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
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
uifc is part of paid version of java toolkit.
Can you describe what you are trying to achieve ?
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...
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();
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...
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).
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() 😀