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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

ComponentPath to Root

MichelH
13-Aquamarine

ComponentPath to Root

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

      

 

 

 

6 REPLIES 6
RPN
17-Peridot
17-Peridot
(To:MichelH)

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.

MichelH
13-Aquamarine
(To:RPN)

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 

MichelH
13-Aquamarine
(To:MichelH)

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

RPN
17-Peridot
17-Peridot
(To:MichelH)

I'm not the VB guy, I use Tcl, but I would try to specify the Feat ID only, because this is how Toolkit is working.

 

extern ProError ProOutputFileWrite ( ProMdl      model,
                                     ProFileName name,
                                     ProImportExportFile   file_type,
                                     ProAppData  arg1,
                                     ProAppData  arg2,
                                     ProAppData  arg3,
                                     ProAppData  arg4 );

 

...

If file_type is PRO_IGES_3D_FILE, PRO_STEP_FILE,
                  PRO_VDA_FILE, PRO_FIAT_FILE,
                  PRO_CATIA_DIRECT_FILE or PRO_ACIS_FILE arg2 is a 
                 int* pointing to the number.

 

...

 

In Tcl if an assembly or part  with a csys at feature 1 is the current model:

  ps_export iges_3d -csys 1 iges_out.igs

 

Specify the assembly:

  ps_export iges_3d -model my_assy.asm -csys 1 iges_out.igs

MichelH
13-Aquamarine
(To:RPN)

Even getting a hold on the root CSYS by its ID doesn't work:

ComponentPath rootpath = pfcAssembly.CreateComponentPath(rootAsm, intseq.create());
int rootCsysId = ((Solid) rootAsm).ListItems(ModelItemType.ITEM_COORD_SYS).get(0).GetId();
ModelItem rootCsys_geom = ((Solid) rootAsm).GetItemById(ModelItemType.ITEM_COORD_SYS, rootCsysId);
Selection selrootCsys = pfcSelect.CreateModelItemSelection(rootCsys_geom, rootpath);
igesInstrs.SetReferenceSystem(selrootCsys);
instrs = igesInstrs;
String outputPath = Integer.toString(counter++) + "_" + model.GetInstanceName().toLowerCase() + ".igs";
model.Export(outputPath, instrs);

 

RPN
17-Peridot
17-Peridot
(To:MichelH)

 You could try to invoke a selection, and check the export by this manual select. If it is working dump the selection information, maybe like the other thread you have to use the geom id. So you may not specify a modelitem, you may specify like in Toolkit only an integer value.

 

 

Announcements


Top Tags