If I have say, five more or less identical objects in the NCE, that are in different X,Y positions, and I’m accessing the NCE via an Interactive Extension, is there a way to index the assigned names of the NCE rows somehow?
For example, in the Matlab extension
instead of having to create five unique Objects: Heliostat1, Heliostat2,… Heliostat5, as shown below,
Heliostat1 = TheNCE.GetObjectAt(2);
Heliostat2 = TheNCE.GetObjectAt(3);
Heliostat3 = TheNCE.GetObjectAt(4);
Heliostat4 = TheNCE.GetObjectAt(5);
Heliostat5 = TheNCE.GetObjectAt(6);
is there a way to index the left side variable names so that they can be used in a loop? Such as:
for h = 1:5
Heliostat(1) = TheNCE.GetObjectAt(h+1);
When I try the above, I get something like: “Array formation and indexing are not allowed on .NET objects.” I’m hoping there is some sensible way to do this.
This would be extremely helpful when performing looped calculations to alter the physical properties of each of these objects in the NCE and then wanting to set these properties back inside OpticsStudio before a Ray Trace. Especially with larger numbers of objects.
The 3D Layout visualization in OpticsStudio makes troubleshooting the calculations sooo much easier and I’m not really willing to give that up.
Open to suggestions.
Best answer by David.NguyenView original