Skip to main content
4-Participant
September 27, 2022
Question

Weblink redifine coordinate system origin

  • September 27, 2022
  • 1 reply
  • 755 views

I am using Creo Parametric Release 6.0 and Datecode6.0.6.0

Has any Weblink api to redifine coordinate system's origin?

If not, how to use macro command to process. Here is a problem that I can't change selectonbuffer after once RunMacro. And then cant't select the new reference for coordinate by code.

Code:
let selection1;
let selection2;
...

let selBuffer = session.CurrentSelectionBuffer;
selBuffer.Clear();
selBuffer.AddSelection(selection1);
session.RunMacro('~ Command `ProCmdReroute` ');

selBuffer.Clear(); <-thorws pfc error
selBuffer.AddSelection(selection2);
session.RunMacro('~ Activate `Odui_Dlg_00` `stdbtn_1`');

1 reply

20-Turquoise
September 30, 2022

I notice you have a session.RunMacro() in the "middle" of your code. The session.RunMacro()'s will not run until the end of your code. Running multiple session.RunMacro()'s will give suprising results...

Weblink and jlink session.RunMacro() only runs when control is returned to Creo Parametric. From the weblink api docs:


void RunMacro (string Macro)

Runs the specified macro.

Macros may only run when control is returned to Creo Parametric. If control is maintained by a J-Link program, the macro will be stored for later running.
Parameters:
Macro
The macro to run

 

See also these discussions:

https://community.ptc.com/t5/Customization/session-RunMacro/td-p/691176?art_lang=en&posno=11&q=jlink%20runmacro&source=search

 

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