Cancel
Showing results for 
Search instead for 
Did you mean: 

Extract Model history Steps using NX

Creator
Creator

I am trying to find model history data of a part model in nx using NXOpen python but I am having trouble finding this data

I have attached a screenshot of what I want to extract . [I want to extract the names - sketch(1), extrude(2), sketch(3)] Please help me out this...

screenshoot.png

6 REPLIES 6

Re: Extract Model history Steps using NX

Legend
Legend

@Ravi_Kumar 

 

That is Timestamp of those features.

 

Collect all features based on the ascending feature timestamp.

 

 

伊尔凡

Re: Extract Model history Steps using NX

Creator
Creator

@Irfan23 

 

How do you extract it using NXopen code ?

Highlighted

Re: Extract Model history Steps using NX

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Try the following:

 

import NXOpen
import NXOpen.UF

theSession = NXOpen.Session.GetSession()
theLw = theSession.ListingWindow
theUfSession = NXOpen.UF.UFSession.GetUFSession()    
    
def main(): 

    workPart = theSession.Parts.Work
    
    markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "feature info")
    theLw.Open()    
    
    theLw.WriteLine("*** All features ***")
    
    for tempFeat in theSession.Parts.Work.Features:
        theLw.WriteLine(".GetFeatureName: " + tempFeat.GetFeatureName())
        theLw.WriteLine(".Name: " + tempFeat.Name)
        theLw.WriteLine(".IsInternal: " + str(tempFeat.IsInternal))
        theLw.WriteLine(".FeatureType: " + tempFeat.FeatureType)
        theLw.WriteLine("Type: " + str(type(tempFeat)))
        theLw.WriteLine(".Timestamp: " + str(tempFeat.Timestamp))
        theLw.WriteLine(".Suppressed: " + str(tempFeat.Suppressed))
                
        theLw.WriteLine("")
    
    theLw.Close()
    
    
if __name__ == '__main__':
    main()

Re: Extract Model history Steps using NX

Creator
Creator

Thanks a lot...This is exactly What  I was looking for

Re: Extract Model history Steps using NX

Creator
Creator
Thank you for such a great work which you have done. I need to ask you if the same thing is possible for parts present in assembly ?? Do we get the same values as that of the parts ?

Re: Extract Model history Steps using NX

Pioneer
Pioneer

Here's something in C#, but you could convert it to another language pretty easily.

 

One thing nobody has mentioned is ufs.Modl.IsBrowseableFeature which will help you get a more accurate representation of the part navigator. Some features exist in the part file but are not listed in the part navigator.

 

private static Session session = Session.GetSession();
private static UFSession ufs = UFSession.GetUFSession();
private static UI ui = UI.GetUI();

public static void Main(string[] args)
{
  var workPart = session.Parts.Work;
  var ui = UI.GetUI();
  var lw = session.ListingWindow;
  lw.Open();
  foreach (var feature in workPart.Features.ToArray())
  {
    ufs.Modl.IsBrowseableFeature(feature.Tag, true, true, out var isBrowseable);
    if(isBrowseable)
    {
      lw.WriteLine(feature.GetFeatureName());
    }
  }
}