In a ZPL macro one can get the object number that’s calling the macro as solve with SOSO(1), but how do I get which column that’s calling the ZPL macro?
I want to use the same macro for solving both the Z and the Y position of an object so I don’t need maintain two separate macros.
Best answer by David.NguyenView original
That’s an interesting question. I don’t think a numeric function is readily available for that.
However, you could use the mechanism described in the Help File as Calling a Macro from within a Macro (The Programming Tab > About the ZPL > Calling a Macro from within a Macro).
What I would do is have a common “child” macro, which setups a return value depending on the “parent” macro. I’ve illustrated the concept in my screenshot below:
The “parent” macros are MyMacros_SolveA and MyMacros_SolveB, they both call the “child” macro MyMacros_CommonProcessing. Depending which “parent” macro is called a number 0 or 1 is buffered. The “child” macro reads that buffered number and buffers a different number 1.23 or 4.56 that is finally set as the SOLVERETURN by the “parent” macro. I’ve put SolveA on the Mechanical Semi-Diameter, and SolveB on the Conic. Now, whatever I change in CommonProcessing it will apply to both “parent” macros.
Let me know if this isn’t clear and/or if it helps you.
Thanks a lot, David!
Yes, that solved my problem.