Solved

Missing description of some old macros

  • 28 November 2023
  • 7 replies
  • 88 views

Hi!

Working with a task where an old ZPL macro should be converted to a standalone application in C++ (using ZOS-API). I have encountered several macro commands that I cannot find any description for in manual/help.


Is there anyone here that have the knowledge of what the corresponding calls with ZOS-API would be?

Object_distance_orig = THIC(0)

number_of_surfaces_orig = NSUR()
IMA_SURF_NUM = NSUR()

Lens_Configuration_orig = CONF()
number_of_configurations = NCON()

 

Thanks in advance!

icon

Best answer by David.Nguyen 29 November 2023, 13:48

View original

7 replies

Userlevel 7
Badge +3

Hi Henrik,

Anything with a () is a function, not a keyword. Check the manual for ZPL functions.

Also, we added SetSystemProperty and SetSurfaceProperty some years back and deprecated the old functions. They still work, but are not recommended for use in new macros.

  • Mark

Hi Mark,

Thanks for your reply. I understand that the macro calls are functions when used with (). I have looked and the ZPL manual and read it. 

The problem is that I don’t understand how I can access the same functionality when using ZOS-API (what class and function to access).

Example: Where can I for example find the lense data/configuration in ZOS-API?

// Henrik

Userlevel 7
Badge +2

Hi @Henrik A,

 

I’m assuming:

THIC(0)

returns the thickness at Surface 0, because this is not even documented in the Help File anymore (as pointed out by @Mark.Nicholson). Also note that the image surface number is the number of surfaces minus one because surfaces start at zero. The equivalent in a C++ standalone application would be:

double objectThickness = TheSystem->LDE->GetSurfaceAt(0)->Thickness;

int numberOfSurfaces = TheSystem->LDE->NumberOfSurfaces;
int imageSurfaceIndex = numberOfSurfaces - 1;

int currentConfiguration = TheSystem->MCE->CurrentConfiguration;
int numberOfConfigurations = TheSystem->MCE->NumberOfConfigurations;

I suggest looking at the Programming..ZOS-API Help..Syntax Help and browse the examples which are in all four langages including C++.

One more recommendation, I usually use C# and I strongly advise to do so if you can. I think the ZOS-API itself is C# based and it is easier to manipulate it with C# imo.

Hope this helps and take care,

 

David

Thanks David, 

Userlevel 7
Badge +3

Hey guys,

THIC() is documented in the manual, but in the section on ZPL functions, not keywords. Look at The Programming Tab > About the ZPL > Numeric Functions  for details:

You’ll find NCON(), NSUR() etc all there too 😁

I think you’ll get the ZOS-API equivalents in the section on ISystemData TheSystemData, like so:

There are equivalent .NumberOfWavelengths, .NumberOfConfigurations etc under the relevant objects

  • Mark
Userlevel 7
Badge +2

Thank you @Mark.Nicholson, I somehow wasn’t awake when I checked the Help File… Sorry for the oversight.

Userlevel 7
Badge +3

Don’t let it happen again! 😎

The Help File is huge though. 

Reply