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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to identify the CSYS used in the Model thru J-Link

ptc-5221610
1-Visitor

How to identify the CSYS used in the Model thru J-Link

Hi,

 

I'm able to successfully list all the CSYS available in the Model using the J-Link API "Model.ListItems(ModelItemType.ITEM_COORD_SYS)".

 

But I'm unable to identify the CSYS used in the Model thru J-Link. Any leads on this is greatly appreciated.

 

Regards

Murari

7 REPLIES 7

Murari,

One way to do it is through interactive selection. Here is a section copied from the API wizard.

/*--------------------------------------------------------------------*\

Select a coordinate system. This defines the model (the top one

in that view), and the common attachments for the dimensions

\*--------------------------------------------------------------------*/

Session session = pfcGlobal.GetProESession ();

SelectionOptions selOptions =

pfcSelect.SelectionOptions_Create("csys");

selOptions.SetMaxNumSels (new Integer (1));

Selections selections = session.Select (selOptions, null);

if (selections == null || selections.getarraysize() == 0)

return;

/*--------------------------------------------------------------------*\

Extract the csys handle, and assembly path, and view handle.

\*--------------------------------------------------------------------*/

Selection csysSel = selections.get (0);

ModelItem selItem = csysSel.GetSelItem();

ComponentPath selPath = csysSel.GetPath();

View2D selView = csysSel.GetSelView2D();

Point3D selPos = csysSel.GetPoint();

if (selView == null)

throw new RuntimeException ("Must select coordinate system from a

drawing view.");

Model2D drawing = (Model2D)selView.GetDBParent();

Regards,

Jim

Hello Jim,

Thanks for responding. Unfortunately, the requirement is to run this utility non-interactively on the 3D Model.

Please let me know if there are any work-around's to achieve this. I did not come across the relevant API but not sure if I'm missing anything here.

Regards

Murari

Murari,

Actually, I have this exact same issue facing me at the moment. I am kind of hoping someone can help us out. If I find a solution, I will post it.

Regards,

Jim

Will wait for updates on this post. Thanks.

Regards

Murari

Manoj
1-Visitor
(To:JimRidge)

Well..

If you know name of csys then use SolidModel.GetFeatureByName("CSYS0")

Better practice:

if(model.GetFeatureByName("CSYS0")==null){ JOptionPane.showMessageDialog(null,"Error: CoSys CSY missing");return false;}

Note: it will be a feature and not ModelItem and will come from Solid and not Model.

Thanks Manoj for your suggestion.

Hope I could go with a static name 😞 Unfortunately, the CSYS name is not static but is expected to be different.

Regards

Murari

For dynamic one you either have to know FeatID , Name or the position in tree.

You have a lot of option out there...

I have done that alot

Announcements


Top Tags