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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to use "Desktop::ReadTextFromTrail" in OTK Java

MichelH
13-Aquamarine

How to use "Desktop::ReadTextFromTrail" in OTK Java

Dear community,

does anybody know how to read from the trail file using Desktop.ReadTextFromTrail()?

/otk_java_doc/objecttoolkit_Creo/api/c-uifcDesktop-Desktop.html#ReadTextFromTrail

I cannot get a handle on desktop object.

 

Kind regards

Michael

6 REPLIES 6
sjuraj
15-Moonstone
(To:MichelH)

uifc is part of paid version of java toolkit.

Can you describe what you are trying to achieve ?

MichelH
13-Aquamarine
(To:sjuraj)

When I click a modelitem in the modeltree I get something like:

 

~ Select `main_dlg_cur` `PHTLeft.AssyTree` 1 `node21`

 

which I wanted to use (`node21`) for building a mapkey dynamically...

sjuraj
15-Moonstone
(To:MichelH)

You can programically prompt user to select model (eg. part or assembly) and toolkit return you handler to selected model object.

Selections sels = Session.Select(selOptions, null);
Model model = sels.get(0).GetSelModel();
String fileName = model.GetFileName();
MichelH
13-Aquamarine
(To:sjuraj)

Thank you sjuraj! I am aware of that, but I wanted to create a mapkey for a list of modelitems in the modeltree. And the mapkey needs `node...`. At least in OTK java free I cannot perform a mapkey on each item while iterating over a selection. Mapkey is only executed after CREO gets back the handle (for the paid version there is WSession::ExecuteMacro but not for the free version).

 

But I found another solution: https://community.ptc.com/t5/Customization/DefaultUICommandBracketListener-on-user-created-command/m-p/761233/highlight/true#M10821

 

Anyhow, I am still interessted how to use "Desktop::ReadTextFromTrail". Sounds interessting to read the trailfile. To bad that uifc is the paid license...

sjuraj
15-Moonstone
(To:MichelH)

What are you trying to achieve ? I think you cannot read node value by toolkit. However you can read trail file manually if you know specific line to read and parse node value.

But maybe you can do easy think too complicated. You can select or insert any feature to selection buffer (programically selection).

MichelH
13-Aquamarine
(To:sjuraj)

I wanted to read the trail file and stumbled upon the method "Desktop::ReadTextFromTrail" but couldn't make it work. I solved my problem in another way but I am still curious how to imply invoke ReadTextFromTrail() 😀

Announcements


Top Tags