Solved

ZOS-API Setting Pick Ups

  • 28 September 2022
  • 4 replies
  • 189 views

Badge

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

icon

Best answer by David.Nguyen 29 September 2022, 14:36

View original

4 replies

Userlevel 5
Badge +3

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

 

Userlevel 7
Badge +2

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

Userlevel 5
Badge +3

Many thanks! @David.Nguyen 

Badge

@yuan.chen  @David.Nguyen 

Thank you both for the quick response.

This is exactly the syntax I was looking for.

Reply