Site Tools


Formulas in Dimensions

Question:

I’m using the default “automatic” dimension value feature (eg “<>”) when I annotate 2D objects I want to create a detail view of a piece of a 2D object - while preserving the original dimensions.

At present, I make a copy of the 2D object, scale it as desired, and then replace the “<>” dimension properties with a hand coded dimension value. This is tedious and prone to error.

So my question is this…is there way to add a calculation to operated on the the automatic value (i.e. “<>”) of the dimension?

Answer:

If the text begins with a % and ends in a %, then python function parser considers it a parsable function or calculation. There my be additional operators in python that you can try, but here are the most common.

You can use the Properties → Text properties page or the TextEdit command to edit the Dimension Text with the following operations or calculations.

Try these:

Operation Example Description
Addition %<(<>+2)>%Adds <> and n
Subtraction %<(<>-2)>%Subtracts <> by n
Multiplication%<(<>*2)>%Multiplies <> by n
Division (Float) %<(<>/2)>%Divides <> by n
Division (Floor)%<(<>//2)>%Divides <> by n, rounds down to nearest integer
Division (Ceiling)%<(-(<>//-2))>%Divides <> by n, rounds up to nearest integer
Modulus%<(<>%2)>%Divides <> by n, returns remainder
Power%<(<>**3)>%Raises <> to the nth power
Square%<(<>**2)>%Computes the square of <>
Square Root%<(<>**0.5)>%Computes the square root of <>
DimText + TextField%<'{:.3f}'.format( <> * float(DetailScale("GUID","Noformatting")) )>%Computes the value with DimText and a TextField

Notes

  • The entire formula needs to be wrapped in %< >% to be computed as a function. Otherwise it's just text string.
  • Detail scale returns a mix of numbers and text so we need to convert it to a decimal number first. “float” tells python to convert the text into a floating point number. Once that happens you can use math functions on it.
    • %<'{:.3f}'.format( <> * float(DetailScale("GUID","Noformatting")) )>%
  • If you dont care about formatting the number of places after the decimal point then you can drop the '{:.3f}'.format .
  • The “Noformatting” isn't parsed, so it's the same as just putting “”
    • %< <> * float(DetailScale(“GUID”,“”)) >%
rhino/faq/formuals-in-dimension.txt · Last modified: 2026/02/05 by maryfugier