Solved

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

  • 24 January 2022
  • 1 reply
  • 22 views

Userlevel 3
Badge +2

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

 

icon

Best answer by yuan.chen 24 January 2022, 07:39

View original

1 reply

Userlevel 3
Badge +2

混合模式的非序列表面可以直接用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