Skip to main content
Solved

Adjust Coat Scatter Parameters through ZOS-API


I use a cylinder volume with a scatter model (gaussian) in the front face to implement a generic diffuser.

Among other parameters, the scatter model is adjusted through the sigma value.

Using the following code does not result in the sigma value being updated:

o11 = TheSystem.NCE.GetObjectAt(11)coat_scatter = o11.get_CoatScatterData()coat_scatter.GetFaceData(1).CurrentScatterModelSettings.set_Sigma(1.2)

Alternatively, using the following code also does not update sigma:

coat_scatter_face_1.CurrentScatterModelSettings.Sigma = 1.5

 

Does anyone had a similar experience? How to address this problem?

 

Kind regards!

Best answer by David.Nguyen

Hi Jonasz,

 

I had more success with the following snippet in Python:

# Retrieve object of interest
my_object = TheSystem.NCE.GetObjectAt(1)

# Retrieve scatter data from the relevant face
scatter_data = o11.CoatScatterData.GetFaceData(0)

# Retrieve scatter settings
scatter_settings = scatter_data.CurrentScatterModelSettings._S_Gaussian

# Retrieve sigma parameter
sigma = scatter_settings.Sigma

# Print current sigma
print(sigma)

# Change sigma to a new value
sigma = 1.2345

# Apply new scatter settings
scatter_data.ChangeScatterModelSettings(scatter_settings)

I hope this helps. The main difference is that I used the _S_Gaussian property to sort of cast the settings to the Gaussian scatter model.

Also you need to use the ChangeScatterModelSettings method to actually apply the settings.

Take care,

 

David

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

2 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1097 replies
  • Answer
  • July 12, 2023

Hi Jonasz,

 

I had more success with the following snippet in Python:

# Retrieve object of interest
my_object = TheSystem.NCE.GetObjectAt(1)

# Retrieve scatter data from the relevant face
scatter_data = o11.CoatScatterData.GetFaceData(0)

# Retrieve scatter settings
scatter_settings = scatter_data.CurrentScatterModelSettings._S_Gaussian

# Retrieve sigma parameter
sigma = scatter_settings.Sigma

# Print current sigma
print(sigma)

# Change sigma to a new value
sigma = 1.2345

# Apply new scatter settings
scatter_data.ChangeScatterModelSettings(scatter_settings)

I hope this helps. The main difference is that I used the _S_Gaussian property to sort of cast the settings to the Gaussian scatter model.

Also you need to use the ChangeScatterModelSettings method to actually apply the settings.

Take care,

 

David


  • Author
  • Visible
  • 23 replies
  • July 12, 2023

Thanks David,

Your solution worked perfectly. Thanks for the insight that I had to use the method ChangeScatterModelSettings:

o11 = TheSystem.NCE.GetObjectAt(11)
o11_face1 = o11.CoatScatterData.GetFaceData(1)
o11_face1_model = o11_face1.CurrentScatterModelSettings._S_Gaussian
o11_face1_model.Sigma = 2.2
o11_face1.ChangeScatterModelSettings(o11_face1_model)

Best regards

 


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