Skip to main content

Attached file shows alternative method to the following code.

ZPL Macro:Fit CAD surface as a sequential surface

 

It uses ZOS-API with Python. The benefit is we will generate the fitting system automatically. 

A document is provided to show a simple example about how to use it.

If you encounter such problem:

AttributeError: module 'clr' has no attribute 'AddReference'

You can try to uninstall the clr and follow the instruction below:

Getting started with Python – Knowledgebase (zemax.com)

 

 


If you are using PythonNET 3.0 and experiencing the error below, you can use the attached file. For more information about the changes in PythonNET 3.0, please refer to the following discussion.

 

System.ArgumentException: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value) in method Boolean ReadNextSegmentFull(Int32 ByRef, Int32 ByRef, Int32 ByRef, Int32 ByRef, Int32 ByRef, ZOSAPI.Tools.RayTrace.RayStatus ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Int32 ByRef, Int32 ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef, Double ByRef) ---> Python.Runtime.PythonException: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value)
   --- End of inner exception stack trace ---<---


Reply