Prompting for a Double-Precision Real Number Entry
You can edit a macro to prompt for a double-precision real number.
Double-precision real numbers are often used for specifying values in Simcenter STAR-CCM+ such as boundary conditions.

For this example, a simple macro was recorded to change the pressure from -3066.82 to -4017.39.

The macro, named doublePrecision.java, contains the following code:
// STAR-CCM+ macro: doublePrecision.java
package macro;
import java.util.*;
import star.common.*;
import star.base.neo.*;
import star.flow.*;
public class doublePrecision extends StarMacro {
public void execute() {
Simulation simulation_0 =
getActiveSimulation();
Region region_0 =
simulation_0.getRegionManager().getRegion("Fluid");
Boundary boundary_0 =
region_0.getBoundaryManager().getBoundary("Free_Stream");
StaticPressureProfile staticPressureProfile_0 =
boundary_0.getValues().get(StaticPressureProfile.class);
((ConstantScalarProfileMethod) staticPressureProfile_0.getMethod()).getQuantity().
setValue(-4017.39);
}
}
This typical macro code contains the value for the static pressure that is entered during recording—it remains constant. However, when the macro contains code for user input, it pauses to activate a dialog in which you can specify that value.

Once you click OK, the macro continues.
The code of doublePrecision.java is modified as follows to make this work:
// STAR-CCM+ macro: doublePrecision.java
package macro;
import java.util.*;
import star.common.*;
import star.base.neo.*;
import star.flow.*;
public class doublePrecision extends StarMacro {
public void execute() {
Simulation simulation_0 =
getActiveSimulation();
Region region_0 =
simulation_0.getRegionManager().getRegion("Fluid");
Boundary boundary_0 =
region_0.getBoundaryManager().getBoundary("Free_Stream");
StaticPressureProfile staticPressureProfile_0 =
boundary_0.getValues().get(StaticPressureProfile.class);
double ret = promptUserForInput("Static Pressure", -3066.82); /* <---NEW CODE */
((ConstantScalarProfileMethod) staticPressureProfile_0.getMethod()).getQuantity().setValue(ret); /* <---- "ret"
* replaces the numeric entry that was recorded automatically */
}
}