cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Access feature ID

frage12358
6-Contributor

Access feature ID

Hey everybody,

 

is there a way to access the feature ID from a part or assembly programmatically? I know that it is possible to get the feature ID via the selection option but can I archive the same without user input? Is it possible to generate a list of all parts of an assembly which contain said ID?

 

Any help is greatly appreciated!!

2 REPLIES 2

Hello!
Try it like this:

 

Session session = pfcSession.GetCurrentSession ();
Model model = session.GetCurrentModel ();
Solid solid = (Solid)model;
Features Feats = solid.ListFeaturesByType(Boolean.TRUE, FeatureType.FEATTYPE_COMPONENT);
Feats.get(component number in your part or assembly).GetId()

 

Regards! 

Many ways to get there - depends on the language you are using.

 

In CREOSON - you can simply request (from any programming/scripting language):

 

-->> bom : get_paths (paths = true)

This will return all the children of your assembly and will include:

  • file - name of model
  • seq_path - bom structure path
  • path [array of component ids]

from then it is just a matter of filtering the results for what you are looking for and what you want to do with the information.  (a simple filter function or for loop would do the trick)

 

Hope that helps/inspires.

 

Dave

Top Tags