The information in this article applies to:
I would like to use the RoomVolume text macro in my room labels, but it displays four decimal points. How can I make it display fewer decimal places?
By default, many text macros are setup to simply display the raw, unrounded results of the calculation they perform, but you can easily modify the macro to round down to the nearest value of your choosing.
To use a macro in a room label
- In this example we will start from a New Plan and draw a 15' by 15' structure.
- Select the room and click Open Object .
- Under the General panel, uncheck Use Room Type and Display in Uppercase.
- Enter the label of your choice and the name of the macro you want to use. In this case we are using the RoomVolume macro.
You now know how to apply a macro to a room label so that it displays the volume of the room. And as you can see, the results are pretty long. This is the actual output from the calculation. If we change the dimensions of our room to 20'x20' for example, the results would contain a single decimal place.
Next, let's look at controlling the output of our macro.
Rounding a macro to a specified number of decimal places
- From the menu, select CAD> Text> Text Macro Management .
- Select the RoomVolume macro and click the Copy button.
- Rename the macro to RoomVolumeRounded and modify the code to:
vol = internal_area * (ceiling_elevation - floor_elevation) / 12
- To break this down we are creating an object named vol and setting it equal to the volume of the room.
- On the next line we are calling the round function with an argument of 2. This tells the program to round the value of vol down to two decimal places.
- Click OK then Done.
- Select our room again and click Open Object .
- Change the macro name to %RoomVolumeRounded% and click OK.
Our room label now stops at the nearest hundredth rather than calculating out to the hundred thousand's place.
You can apply these concepts to other macros or objects that result in a long string of numbers as the room volume macro tends to do.
The language Chief Architect uses for it's text macros is called Ruby, you can learn more about the different Ruby functions by visiting this online guide: