To create a macro to count parts, regions, boundaries and interfaces follow below steps,
We are going to use collection class for our case.
Collection<GeometryPart> colParts = simulation_0.getGeometryPartManager().getLeafParts() - To collect geometry parts
Collection<Region> regionpart=simulation_0.getRegionManager().getRegions() - To collect regions
Collection<Boundary> bound=reg1.getBoundaryManager().getBoundaries() - To collect boundaries
Collection<Interface> inter=simulation_0.getInterfaceManager().getObjects() - To collect interfaces
There are two options available in this macro to view the count.
1. View the part count in STAR-CCM+ output window
2. Write the count into in a text file by specifying the file path.
In order to use the first or second method the following info need to be updated in the macro file,
Set the savetype as 0 to view the count in STAR-CCM+ output window
Set the savetype as 1 to save the count to a text file
Also for second option update the filepath as shown in below image,
Step-1:
Collect the parts for geometry using the command
Collection<GeometryPart> colParts = simulation_0.getGeometryPartManager().getLeafParts()
Step-2:
Create a for loop to count the number of parts one by one using the following command
Here we have initialized a int variable to store the number of parts count. This procedure can be repeated for others as well.
Step-3;
To write the count info in a text file. This can be done using try catch method
Find attached sim file and java file for reference