DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Run new drawing macro from a macro

Started by Pearlitic, December 28, 2016, 06:25:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pearlitic

>RunX
{
   <Filename "<filepath>\filename.bat"
}

Instead of ending a macro I would like to open and run the next macro in a file or a specific file.

E:\CAD Macros

filename.D3M

Can I use >RunX? 

Can I do this?

Thank you.

Pearlitic

DrollTroll

Have a look at the CALL and CHAIN statements.

Do you want control to return to the original macro after the second macro is done, or do you want to transfer control completely to the second macro?

For the first case (say you want to run two macros in a row and return to the starting macro)
newmacro1$ = "E:\CAD Macros\filename.d3m"
newmacro2$ = "E:\CAD Macros\filename2.d3m"

MESSAGE "About to switch to filename.d3m"
CALL newmacro1$

MESSAGE "Back from filename.d3m; about to call filename2.d3m"
CALL  newmacro2$

MESSAGE "And we're back again"
END



For the second case (say your current macro is completely finished, and you now want to transfer control to a different macro)
NewMacro$ = "E:\CAD Macros\filename.d3m"
CHAIN NewMacro$


From the Help:
Differences between CALL and CHAIN:


A macro that was started by the CHAIN statement always begins at the first line in the new macro. This makes it impossible to return directly to the next line by CHAINing back to the original macro. A macro started by the CHAIN statement has access to the same variables as the macro that was CHAINed from.


A macro begun by the CALL statement has a separate memory stack for variables. Variable data can only be transferred between the CALLed macro and the CALLing macro through the use of the SysEx functions and the SysEx$ functions.
25 years with DesignCAD

Pearlitic

I wanted the second case.  Thank you.  Looks great.

Best regards,

Pearlitic

Pearlitic

I am doing case No. 2.  This works wonderfully.

Thanks again.

Pearlitic