Code to be Repeated Multiple Times

You now come to the code to be placed within a loop. Some Java comments have been added to help describe the operations taking place. Items to be replaced by variables are underlined, and sections to be removed are underlined.

// The LinePart object is the Derived Part you want to
// create. The PartManager on the simulation_0 object
// has the method that lets you do this.

LinePart linePart_0 = 
      simulation_0.getPartManager().createLinePart(new NeoObjectVector(new Object[] {}), 
new DoubleVector(new double[] {0.0, 0.0, 0.0}), 
new DoubleVector(new double[] {1.0, 0.0, 0.0}), 
20);
 
// The LinePart object must now be told
// what coordinate system it is using. You retrieve the
// LabCoordinateSystem object from the
// CoordinateSystemManager on the simulation_0 object.
 
LabCoordinateSystem labCoordinateSystem_0 =
  ((LabCoordinateSystem)
    simulation_0
    .getCoordinateSystemManager()
    .getLabCoordinateSystem();
 
// As you now have the labCoordinateSystem_0 object we
// can tell linePart_0 to use it.
 
linePart_0
.setCoordinateSystem(labCoordinateSystem_0);
 
// The next two sections set the units on each axis,
// and the position, of the first Point of linePart_0
 
Coordinate coordinate_0 =
  linePart_0.getPoint1Coordinate();
 
coordinate_0
.setCoordinate(
  units_0,
  units_0,
  units_0,
  new DoubleVector(
    new double[] {0.04, 0.0, 0.0}
  )
);
 
// The next two sections set the units on each axis,
// and the position, of the second Point of linePart_0.
 
Coordinate coordinate_1 =
  linePart_0
  .getPoint2Coordinate();
 
coordinate_1
.setCoordinate(
  units_0,
  units_0,
  units_0,
  new DoubleVector(
    new double[] {0.04, 0.0762, 0.0}
  )
);
 
// The following two sections are updating the visible
// scene and are not required for creating line parts.
// Note: The part number may differ slightly in your
// recording.

PartDisplayer partDisplayer_5 =
     scene_1.getDisplayerManager().createPartDisplayer("Probe Surface", -1, 1);
     partDisplayer_5.initialize();
 
// Change the name of the linePart.
 
linePart_0.setPresentationName("X = 0.04");

This section is pruned to remove the redundant code and placed within a loop. Code shown as underlined is replaced by appropriate variables that are incremented within the loop.

The redundant code shown above is dealing with a PartDisplayer from scene_0, and has nothing to do with actually creating the line part. This can all safely be omitted.