Solved

Adjust Coat Scatter Parameters through ZOS-API

  • 11 July 2023
  • 2 replies
  • 55 views

Userlevel 2

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!

icon

Best answer by David.Nguyen 12 July 2023, 12:32

View original

2 replies

Userlevel 7
Badge +2

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

Userlevel 2

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