Skip to main content
Solved

_S_MaterialModel in Mathematica


Dear all,

 

in Wolfram Matheamtica how can one set Nd for material.

 

LoadNETType["ZOSAPI.Editors.SolveType"]

 

layer = theNCE@GetObjectAt[5]
solver = layer@MaterialCell@CreateSolveType[SolveType`MaterialModel]
solver@USUMaterialModel@IndexNd = 1.6
layer@MaterialCell@SetSolveData[solver]

 

USUMaterialModel derived from "ZOSAPI.Editors.ISolveMaterialModel" _S _MaterialModel seems to be a problem?

 

Thanx for support and BR,

Jozef

Best answer by Allie

Hi @Jozef.Pulko!

This is a great question. I didn’t realize this is not exemplified in any of the samples I wrote. 

It appears we do not need to go through the intermediate “_S_MaterialModel” property when applying a solve in Mathematica. I’m not sure if this is universal to all solve types, but at least for a material solve, we can simply use this code:

solver@IndexNd = 1.6;

To be honest, I’m not entirely sure why this is the case for Mathematica. Ultimately, it seems the ISolveData properties are a bit arbitrary based on language. For example, in Matlab, the property is called with this syntax instead: S_SurfacePickup_ It may just be a quirk based on how .NET is implemented in Mathematica.

By the way - a great way to investigate the capabilities of the API objects is by using the NETTypeInfo command within Mathematica. It provides you with a list of properties and methods for a given object, such as your solver variable. I’m attaching my Interactive Extension code so you can see it in action. 

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

2 replies

Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 337 replies
  • Answer
  • April 26, 2022

Hi @Jozef.Pulko!

This is a great question. I didn’t realize this is not exemplified in any of the samples I wrote. 

It appears we do not need to go through the intermediate “_S_MaterialModel” property when applying a solve in Mathematica. I’m not sure if this is universal to all solve types, but at least for a material solve, we can simply use this code:

solver@IndexNd = 1.6;

To be honest, I’m not entirely sure why this is the case for Mathematica. Ultimately, it seems the ISolveData properties are a bit arbitrary based on language. For example, in Matlab, the property is called with this syntax instead: S_SurfacePickup_ It may just be a quirk based on how .NET is implemented in Mathematica.

By the way - a great way to investigate the capabilities of the API objects is by using the NETTypeInfo command within Mathematica. It provides you with a list of properties and methods for a given object, such as your solver variable. I’m attaching my Interactive Extension code so you can see it in action. 


  • Author
  • Infrared
  • 5 replies
  • May 4, 2022

Excellent explanation. Thanks!


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