Skip to main content
1-Visitor
December 4, 2018
Question

ComponentPath to Root

  • December 4, 2018
  • 1 reply
  • 3083 views

Hello,

using JLink I am trying to acces the coordinate system of the root assembly while I am on a sub-level part. I am using the method CreateModelItemSelection (ModelItem SelItem, /*optional*/ ComponentPath Path). I am not sure what to use for ComponentPath since I want to access the root assembly.

Neither of the following three approaches succeeded:

"null":
ComponentPath(rootAsm, null)
-> coordinate system of sub-level part is selected
empty intseq:
ComponentPath(rootAsm, intseq.create());
-> coordinate system of sub-level part is selected
providing (0) as intseq:
intseq idsroot = intseq.create();
idsroot.insert(0, 0);
ComponentPath(rootAsm, idsroot); -> pfcExceptions$XToolkitGeneralError

 

I don't know if I am missing something here. I appreciate any help and ideas on how to access the top coordinat system!

 

Thank you and kind regards

Michael

      

 

 

 

1 reply

RPN
18-Opal
December 4, 2018

Hi,

the CompPath with RootAsm and NULL should be valid, the Modelitem is CSYS is not the Feature ID! It's the geom ID, owner is the RootAsm as well.

 

Try it the other way round, select and dump the result.

MichelH1-VisitorAuthor
1-Visitor
December 4, 2018

Hi RPN,

thank you for your quick reply!

Is ist correct to select the CSYS by using ModelItem?

If I do:

ModelItem rootCsys_geom;
rootCsys_geom = rootAsm.ListItems(ModelItemType.ITEM_COORD_SYS).get(0);
Selection selCsys = pfcSelect.CreateModelItemSelection(rootCsys_geom, null);
igesInstrs.SetReferenceSystem(selCsys);

I still do not get the root CSYS.

 

 

Kind regards

Michael 

MichelH1-VisitorAuthor
1-Visitor
December 5, 2018

Hi,

I changed the code so that there is a ComponentPath instance but only an empty intseq:

ComponentPath rootpath = pfcAssembly.CreateComponentPath(rootAsm, intseq.create());
ModelItem rootCsys_geom = rootAsm.ListItems(ModelItemType.ITEM_COORD_SYS).get(0);
Selection selCsys = pfcSelect.CreateModelItemSelection(rootCsys_geom, rootpath);
igesInstrs.SetReferenceSystem(selCsys);

The root CSYS is still not selected. Is there a different way to select the geometry of the CSYS?

 

Kind regards

Michael