Skip to main content
Solved

混合模式系统中有多个non-sequential components时怎么使用ZOSAPI进行物体的增减和参数修改

  • January 24, 2022
  • 1 reply
  • 96 views

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

如图,系统的表面1和3都是非序列表面。应该怎么对于这两个components进行修改?

 

Best answer by yuan.chen

混合模式的非序列表面可以直接用NCE打开。对于一个系统中有多个非序列components的情况,要用SetActiveSurface进行选定。下面提供一段代码作为参考。

TheNCE = TheSystem.NCE
%set surface 3 active
TheNCE.SetActiveSurface(3)
TheNCE.InsertNewObjectAt(2);
TheNCE.InsertNewObjectAt(3);
% Set 3th object as Standard Lens
Object_3 = TheNCE.GetObjectAt(3);
Typeset_StandardLens = Object_3.GetObjectTypeSettings(ZOSAPI.Editors.NCE.ObjectType.StandardLens);
Object_3.ChangeType(Typeset_StandardLens);
% Set positions
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.ZPosition).DoubleValue = 0.9;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par3).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par4).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par5).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par6).DoubleValue = -1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par8).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par9).DoubleValue = 1.2;
%set surface 1 active
TheNCE.SetActiveSurface(1)
TheNCE.InsertNewObjectAt(2);
Object_2 = TheNCE.GetObjectAt(2);
Typeset_DP = Object_2.GetObjectTypeSettings(ZOSAPI.Editors.NCE.ObjectType.DetectorPolar);
Object_2.ChangeType(Typeset_DP);
TheSystem.Save()

此外,注意混合模式中的探测器实际上不起作用。

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
  • January 24, 2022

混合模式的非序列表面可以直接用NCE打开。对于一个系统中有多个非序列components的情况,要用SetActiveSurface进行选定。下面提供一段代码作为参考。

TheNCE = TheSystem.NCE
%set surface 3 active
TheNCE.SetActiveSurface(3)
TheNCE.InsertNewObjectAt(2);
TheNCE.InsertNewObjectAt(3);
% Set 3th object as Standard Lens
Object_3 = TheNCE.GetObjectAt(3);
Typeset_StandardLens = Object_3.GetObjectTypeSettings(ZOSAPI.Editors.NCE.ObjectType.StandardLens);
Object_3.ChangeType(Typeset_StandardLens);
% Set positions
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.ZPosition).DoubleValue = 0.9;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par3).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par4).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par5).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par6).DoubleValue = -1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par8).DoubleValue = 1.2;
Object_3.GetObjectCell(ZOSAPI.Editors.NCE.ObjectColumn.Par9).DoubleValue = 1.2;
%set surface 1 active
TheNCE.SetActiveSurface(1)
TheNCE.InsertNewObjectAt(2);
Object_2 = TheNCE.GetObjectAt(2);
Typeset_DP = Object_2.GetObjectTypeSettings(ZOSAPI.Editors.NCE.ObjectType.DetectorPolar);
Object_2.ChangeType(Typeset_DP);
TheSystem.Save()

此外,注意混合模式中的探测器实际上不起作用。


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