Displaying the New Parts
The remaining change is to display all of the line probes in the scalar scene. This is achieved by obtaining all of the derived parts from the
PartManager
and setting them on the appropriate displayer of object
scene_0
obtained previously. Delete the redundant line of code which is underlined below:
// 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
This completes modification of the recorded macro.
- Save the macro in your editor.