显示新零部件

余下的更改是显示标题场景的所有线探测。 这可通过从 PartManager 获取所有衍生零部件,并在先前获取的适当对象 scene_0 显示器上进行设置来实现。 删除下列标有下划线的冗余代码行:

// Following line is redundant: comment it out as shown
// or else delete it.

// scalarDisplayer_0.getInputParts().setObjects(linePart_0);
 
// Following section should remain unchanged; it is
// retrieving the relevant displayer from scene_0
 
ScalarDisplayer scalarDisplayer_0 =
  ((ScalarDisplayer)
    scene_0
    .getDisplayerManager()
    .getDisplayer("Scalar 1")
  );
 
// Add more code to retrieve all Derived Parts
// For more information on the Java technology, see
// the Java documentation for Collections and Generics
 
PartManager partManager_0 =
  simulation_0.getPartManager();
 
Collection<Part> allDerivedParts =
  partManager_0.getObjects();
 
scalarDisplayer_0
.getParts()
.setObjects(allDerivedParts);
 
} // End of execute0()
} // End of createLineProbes

这就完成了录制宏的修改。

  • 将该宏保存在您的编辑器中。