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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

session.RunMacro

T_F
16-Pearl
16-Pearl

session.RunMacro

I'm building a Jlink app.

I need that, the Jlink app run a specific macro in the middle of my code. First I need to select a part to show a layer of the selected part. It's working fine!

Then I need to run a macro, doing the session.RunMacro function. And it also works, then after this, i need to continue my code, and do some other actions. But don't understand why, but all of the jlink actions are running in sequence, the session.RunMacro is ignored, and executed, only at the end of my code! I would need this to be executed when I need to be executed.

 

Any idea?

2 REPLIES 2
MartinHanak
24-Ruby II
(To:T_F)


@T_F wrote:

I'm building a Jlink app.

I need that, the Jlink app run a specific macro in the middle of my code. First I need to select a part to show a layer of the selected part. It's working fine!

Then I need to run a macro, doing the session.RunMacro function. And it also works, then after this, i need to continue my code, and do some other actions. But don't understand why, but all of the jlink actions are running in sequence, the session.RunMacro is ignored, and executed, only at the end of my code! I would need this to be executed when I need to be executed.

 

Any idea?


Hi,

please read https://community.ptc.com/t5/Customization/JLink-Question/td-p/84229 discussion.


Martin Hanák
sjuraj
13-Aquamarine
(To:T_F)

RunMacro() is always run at the and of command. You can alternativly use ExecuteMacro() but it is limited only to WSession object which is part of paid java object toolkit. But, you can split your command into 2 separate command and then you can run your seccond command from macro. So:

 

your actual code:

Command 1 class

code

RunMacro()

code

 

new code:

Command 1 class

code

code RunMacro("~  Command your_second_command_name ;")

 

Command 2 class

rest of code

 

Note that command name is string name of your command when creating command on session object. You will also need to find good solution how to share data between your 2 commands. I suggest to create one object which will be added to your command class in constructor.

Top Tags