Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have a J-Link program which recursively searches and retrieves all components in an assembly. I have problems to execute a mapkey on each component after its retrieval. It appears the mapkey runs multiple times but only on the LAST component found and not for each component. I've tried creating the mapkey on-the-fly and then executing it with RunMacro(), but to no avail (see below). Could the problem be that the mapkey loaded with Session.RunMacro() gets executed when control is first returned to Pro/ENGINEER?
try {
String macrostring = "mapkey aw @MAPKEY_LABELActivate Workspace";+
curSession.RunMacro(macrostring);
}
m.Save( );
Regards
David Rodriguez
You are correct.
You are only loading the mapkeys (macros) which are executed only after your J-link app exits and returns control to Pro/E.
Pro/Toolkit has this same limitation.
Gerry
In Reply to David Rodriguez:
I have a J-Link program which recursively searches and retrieves all components in an assembly. I have problems to execute a mapkey on each component after its retrieval. It appears the mapkey runs multiple times but only on the LAST component found and not for each component. I've tried creating the mapkey on-the-fly and then executing it with RunMacro(), but to no avail (see below). Could the problem be that the mapkey loaded with Session.RunMacro() gets executed when control is first returned to Pro/ENGINEER?
try {
String macrostring = "mapkey aw @MAPKEY_LABELActivate Workspace";+
curSession.RunMacro(macrostring);
}
m.Save( );
Hi Jerry
Thanks for your feedback. I was afraid that this would be the case with synchronous programs that mapkeys are only executed after the J-link app exits and returns control to Pro/E. Do you have any other ideas or know a workaround to this problem?
Regards
David
In Reply to Gerry Champoux:
You are correct.
You are only loading the mapkeys (macros) which are executed only after your J-link app exits and returns control to Pro/E.
Pro/Toolkit has this same limitation.
Gerry
In Reply to David Rodriguez:
I have a J-Link program which recursively searches and retrieves all components in an assembly. I have problems to execute a mapkey on each component after its retrieval. It appears the mapkey runs multiple times but only on the LAST component found and not for each component. I've tried creating the mapkey on-the-fly and then executing it with RunMacro(), but to no avail (see below). Could the problem be that the mapkey loaded with Session.RunMacro() gets executed when control is first returned to Pro/ENGINEER?
try {
String macrostring = "mapkey aw @MAPKEY_LABELActivate Workspace";+
curSession.RunMacro(macrostring);
}
m.Save( );
I use a async J-Link app and it works like a charm. I can run mapkeys and wait until they finished her work.
So in async Tools everything seems to be alright.
Best regards,
Eike
Hi Eike
Great to hear that in Async mode the mapkeys wait until they finish their work. Do you know if an Aync program works with objects residing in PDMLink workspaces? My problem is that the user is logged in to PDMLink and needs to open a model from the workspace with ProE and then run the JLink program. Can one do this with an Asynchronous program and how do you which model to open from the workspace?
Regards
David
In Reply to Eike Petersen:
I use a async J-Link app and it works like a charm. I can run mapkeys and wait until they finished her work.
So in async Tools everything seems to be alright.
Best regards,
Eike
Hi David,
wait one second : ) I never mean that mapkeys wait until they finished. This you must program yourself. But its a simple workaroud. If your mapkey is finished his work you write a parameter or something in a file what you can read with your program. So you see when it is finished his work.
You can load and save files from a PDMLink workspace with J-Link programs. You can also checkout and checkin files if the PDMLink structures are simple enough. (You can get problems with wtparts and so on with basic JLink API). To open a file you only need to use its name because the workspace are in the searchpath from Creo / ProE and so it gets your file and open it.
Best regards,
Eike