查看编辑的宏

最终的宏如下所示:

// Start of execute0 function
 
Simulation simulation_0 =
  getActiveSimulation();
 
Units units_1 =
  simulation_0
  .getUnitsManager()
  .getPreferredUnits(
    Dimension.Builder().length(1).build())
    )
;
 Scene scene_0 =
  simulation_0
  .getSceneManager()
  .getScene("Scalar Scene 1");
 
FvRepresentation fvRepresentation_0 =
  ((FvRepresentation) simulation_0
  .getRepresentationManager()
  .getObject("Volume Mesh"));
  
Region region_1 =
  simulation_0
  .getRegionManager()
  .getRegion("Fluid");

PartDisplayer partDisplayer_0 =
    scene_0.getDisplayerManager().createPartDisplayer("Probe Surface", -1, 1);
  
double dXDIST = 0.1; // Distance between probes
 
double[] dExtents =
  fvRepresentation_0
  .getRegionExtents(region_0);
 
 
double dXMIN = dExtents[0];
double dXMAX = dExtents[1];
 
double dXLOC = dXMIN + dXDIST;
 
// Start the loop
while(dXLOC < dXMAX) {
  
LinePart linePart_1 = 
      simulation_0.getPartManager().createLinePart(new ArrayList<>(Collections.
<NamedObject>emptyList()),
new DoubleVector(new double[] {0.0, 0.0, 0.0}),
new DoubleVector(new double[] {1.0, 0.0, 0.0}) 
20, null);

LabCoordinateSystem labCoordinateSystem_0 =
  simulation_0.getCoordinateSystemManager().
  getLabCoordinateSystem();


linePart_1.getPoint1Coordinate()
.setCoordinateSystem(labCoordinateSystem_0);
 

linePart_1.getPoint1Coordinate()
.setUnits0(units_1);
linePart_1.getPoint1Coordinate()
.setUnits1(units_1);
linePart_1.getPoint1Coordinate()
.setUnits2(units_1);
linePart_1.getPoint1Coordinate()
.setDefinition("");


linePart_1.getPoint1Coordinate()
.setValue(
  new DoubleVector(
    new double[] {dXLOC, 0.0, 0.0}
  )
);

linePart_1.getPoint1Coordinate
.setCoordinate(
  units_1,
  units_1,
  units_1,
  new DoubleVector(
    new double[] {dXLOC, 0.0, 0.0}
  )
);
linePart_1.getPoint2Coordinate()
.setUnits0(units_1);
linePart_1.getPoint2Coordinate()
.setUnits1(units_1);
linePart_1.getPoint2Coordinate()
.setUnits2(units_1);
linePart_1.getPoint2Coordinate()
.setDefinition("");


linePart_1.getPoint2Coordinate()
.setValue(
  new DoubleVector(
    new double[] {dXLOC, 0.0762, 0.0}
  )
);

linePart_1.getPoint2Coordinate
.setCoordinate(
  units_1,
  units_1,
  units_1,
  new DoubleVector(
    new double[] {dXLOC, 0.0762, 0.0}
  )
);
 
PartDisplayer_0.getVisibleParts().addPart(linePart_1);
partDisplayer_0.getHiddenParts().addParts();

String strPartName =
  String.format("X = %6.4f",dXLOC);
 
linePart_0.setPresentationName(strPartName);
 
// Update dXLOC and end the loop with a closing brace
dXLOC = dXLOC + dXDIST;
} // End of Loop
 
// partDisplayer_2.getParts().setObjects();
 ScalarDisplayer scalarDisplayer_0 =
  ((ScalarDisplayer)
    scene_0
    .getDisplayerManager()
    .getObject("Scalar 1")
  );
 
PartManager partManager_0 =
  simulation_0.getPartManager();
 
Collection<Part> allDerivedParts =
  partManager_0.getObjects();
 
scalarDisplayer_0
.getInputParts()
.setObjects(allDerivedParts);
 
  } // End of execute0()
} // End of createLineProbes