Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

ID of a Komponent

magic_halli

New member
Hi,



i read out the components (there feature regeneration number) of an assembly.

Code:
Session curSession = pfcGlobal.GetProESession();
Model model = curSession.GetCurrentModel();
Assembly asm = (Assembly)model;

ComponentFeat component;
Features m_items = asm.ListFeaturesByType(Boolean.FALSE, FeatureType.FEATTYPE_COMPONENT);
      for (int i = 0; i < m_items.getarraysize(); i++){
        component = (ComponentFeat)m_items.get(i);	
        String num = component.GetNumber().toString();
        stringseq seq = stringseq.create();
        seq.append(num);

     
curSession.UIDisplayMessage("message.txt", "Info: %0s", seq);
   

}



But how can i:

1. get the ID of these components, instead of the feature regeneration number???

2. open a found component in new window???

(3. get the name of each component???)



It would be nice, if question 1 or 2 could be answered at least.



Thanks a lot...
 
Hi,


you are on the right way
smiley1.gif
. With the feature component you can get the information of the ID and the name of the component.


To get the ID: int compID = component.GetId();


To get the name: String name = component.GetFullName(); // returns the name without extension.


To open the found component you need to get the ModelDescriptor of the component (ModelDescriptor md = component.GetModelDescr();) and then open the model (Model loadModel = curSession.RetrieveModel(proeModelDescriptor);) and create a new Window with the model (curSession.CreateModelWindow(loadModel);)


Michael
 

Sponsor

Articles From 3DCAD World

Back
Top