Skip to main content

Dear comunity.

 

What is the syntax to open a shaded model from Wolfram Mathematica?

 

analysis =  TheSystem@Analyses@NewUAnalysisy"ZOSAPI.Analysis.AnalysisIDM.NSCShadedModel"]

 

returns 

 

NET::methodargs: Improper arguments supplied for method named NewUAnalysis.

 

Thanx and BR,

Jozef

Hi Jozef,

The NSC Shaded model is only available if TheSystem is currently a non-sequential system.  By default, new systems are sequential mode.  Can you confirm your system is non-sequential (I don’t use Mathematica so I’m not sure if the code below has the correct @ & double quotes):

TheSystem@Mode == "ZOSAPI.SystemType.NonSequential"

If your system is already non-sequential, then it is something with the ZOSAPI enum you are calling.


Hi Michael,

 

yes my system is non-sequential. For example TheSystem@NCE@InsertNewObjectAtA2] works.

 

TheSystem@Mode returns 

BR,

Jozef


Hi @Jozef.Pulko 

For using a command with an enumerated input within Mathematica, you must first load the enum via the LoadNETType command. For example, the enum for the NSC Shaded Model is “ZOSAPI.Analysis.AnalysisIDM”, so I will enter that as shown below:

 

LoadNETTypeE"ZOSAPI.Analysis.AnalysisIDM"];

 

Once loaded, you can choose the enumerator you wish to use by using the ` operator and the final section of the enum value. (That operator is the key to the left of the “1” and above “Tab” on a typical keyboard.) For example, to select NSC Shaded Model with the ZOSAPI.Analysis.AnalysisIDM enum loaded, we would use this command:

 

theSystem@Analyses@NewUAnalysissAnalysisIDM`NSCShadedModel];

 

As long as the enum is loaded somewhere in the document (and evaluated), you can call any enumerator value from its list using the ` operator. This is exemplified in Sample 3 from within the C:\...\Zemax\ZOS-API Sample Code\Mathematica folder, where we insert optimization operands into the Merit Function Editor using the MeritOperandType enum. 

Let me know if you have any other questions about this!


This works. Thank you!


Reply