Skip to main content
Solved

ZOS-API Setting Pick Ups

  • September 28, 2022
  • 4 replies
  • 313 views

Forum|alt.badge.img

Does anyone have an example of setting pickups via the ZOS api in NSC mode?

for i in obj_list:
    obj = NCE.GetObjectAt(i)
    obj.Xposition.SetPickupfromObject(1) ??? something like this

 

I have over 100 lines in the editor I’d like to set to pickup a position off of an existing object, and manually clicking all of them is tedious.

 

Thank you,

Jason

Best answer by David.Nguyen

Hi Jason,

 

To complement @yuan.chen‘s answer, here is a more specific code:

# This is your non-sequential object
obj = TheSystem.NCE.GetObjectAt(2)

# Create a pick-up solve type from this object
pickup_solve = obj.XPositionCell.CreateSolveType(ZOSAPI.Editors.SolveType.ObjectPickup)

# Adjust the solve settings
pickup_solve.Object = 1 # This is the object to pick-up from
pickup_solve.ScaleFactor = 2.0
pickup_solve.Offset = 3.0
pickup_solve.Column = ZOSAPI.Editors.NCE.ObjectColumn.XPosition

# Apply the solve
obj.XPositionCell.SetSolveData(pickup_solve)

You can pick-up from other columns, and you’ll find the available ones in the Syntax Help File:

Comment   
RefObject   
InsideOf   
XPosition   
YPosition   
ZPosition   
TiltX   
TiltY   
TiltZ   
Material   
Par1   
Par2   
...

 

Let me know if this helps. Take care,

 

David

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

4 replies

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

Hi Jason,

Sorry for my short reply. I have to do many clean-ups before I go for vacation.

Here is a sample code for sequential mode. You can find something similar in non-sequential.

surf3 = TheSystem.LDE.GetSurfaceAt(3)

surf6 = TheSystem.LDE.GetSurfaceAt(6)

ParameterPickup = surf6.GetCellAt(12).CreateSolveType(ZOSAPI.Editors.SolveType.SurfacePickup)

ParameterPickup._S_SurfacePickup.Surface = 3

ParameterPickup._S_SurfacePickup.ScaleFactor = -1

ParameterPickup._S_SurfacePickup.MakePickupFromCurrentColumn()

The code is part of sample code 7

 


David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1089 replies
  • Answer
  • September 29, 2022

Hi Jason,

 

To complement @yuan.chen‘s answer, here is a more specific code:

# This is your non-sequential object
obj = TheSystem.NCE.GetObjectAt(2)

# Create a pick-up solve type from this object
pickup_solve = obj.XPositionCell.CreateSolveType(ZOSAPI.Editors.SolveType.ObjectPickup)

# Adjust the solve settings
pickup_solve.Object = 1 # This is the object to pick-up from
pickup_solve.ScaleFactor = 2.0
pickup_solve.Offset = 3.0
pickup_solve.Column = ZOSAPI.Editors.NCE.ObjectColumn.XPosition

# Apply the solve
obj.XPositionCell.SetSolveData(pickup_solve)

You can pick-up from other columns, and you’ll find the available ones in the Syntax Help File:

Comment   
RefObject   
InsideOf   
XPosition   
YPosition   
ZPosition   
TiltX   
TiltY   
TiltZ   
Material   
Par1   
Par2   
...

 

Let me know if this helps. Take care,

 

David


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

Many thanks! @David.Nguyen 


Forum|alt.badge.img

@yuan.chen  @David.Nguyen 

Thank you both for the quick response.

This is exactly the syntax I was looking for.


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