Skip to main content
Solved

How to get the column number calling a ZPL macro?

  • November 30, 2021
  • 2 replies
  • 193 views

Hi,

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.

Regards,

Hans

Best answer by David.Nguyen

Hi Hans,

 

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.

Take care,

 

David

View original
Did this topic help you find an answer to your question?

2 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1112 replies
  • Answer
  • November 30, 2021

Hi Hans,

 

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.

Take care,

 

David


Thanks a lot, David!

Yes, that solved my problem.

Regards,

Hans


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings