Skip to main content

Python fit object face (ex. for CAD)

  • October 24, 2022
  • 2 replies
  • 587 views

Michael Cheng
Zemax Staff
Forum|alt.badge.img+2

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.

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

2 replies

yuan.chen
Zemax Staff
Forum|alt.badge.img+3
  • Zemax Staff
  • 275 replies
  • October 24, 2022

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)

 

 


Julia
Fully Spectral
Forum|alt.badge.img+2
  • Fully Spectral
  • 51 replies
  • October 9, 2023

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


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