Skip to main content
Solved

Setup Mie sacttering parameters via ZOSAPI Matlab

  • July 31, 2024
  • 1 reply
  • 71 views

yuan.chen
Zemax Staff
Forum|alt.badge.img+3

Sample code using Interactive Extension:

TheConnection = ZOSAPI.ZOSAPI_Connection();

TheApplication = TheConnection.ConnectAsExtension(21);

TheSystem = TheApplication.PrimarySystem;

Obj2 = TheSystem.NCE.GetObjectAt(2);

Obj2_VolumePhysicsData = Obj2.VolumePhysicsData;

Obj2_VolumePhysicsData.Model = ZOSAPI.Editors.NCE.VolumePhysicsModelType.DLLDefinedScattering;

Obj2_ModelSettings = Obj2_VolumePhysicsData.ModelSettings.S_DLLDefinedScattering_;

Obj2_ModelSettings.DLL = 'Mie.dll';

Obj2_ModelSettings.MeanPath = 5;

Obj2_ModelSettings.SetParameterValue(0, 1.53);

Obj2_ModelSettings.SetParameterValue(1, 0.5);

Obj2_ModelSettings.SetParameterValue(2, 100000000000000000);

Obj2_ModelSettings.SetParameterValue(3, 0.001);

Obj2_ModelSettings.SetParameterValue(4, 1);

 

For newbies, re-requested steps:

  1. The object is set to a volume object 
  2. The interactive extension is activated

More information:

You can find the settings for DLL Defined Scattering in the ZOSAPI.Editors.NCE.IVMPS_DLLDefinedScattering Interface Reference. This is where you will find the properties and public member functions for all DLL Volume Scatter models:
 
?name=Screenshot+2024-04-03+161640.jpg
 
As you can see in the GUI, all DLL models have the common parameters Mean Path and Angle. The rest of the parameters are DLL specific. For this reason, we do not use the full name, but instead we use the parameter number as the reference for these settings. This means that you need to access these parameters using their numbers rather than their names.

Best answer by yuan.chen

Sample file attached for your reference.

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

1 reply

yuan.chen
Zemax Staff
Forum|alt.badge.img+3
  • Author
  • Zemax Staff
  • 275 replies
  • Answer
  • July 31, 2024

Sample file attached for your reference.


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