Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rhino:faq:formuals-in-dimension [2026/02/04]
dale [Answer:]
rhino:faq:formuals-in-dimension [2026/02/05] (current)
maryfugier [Try these:]
Line 18: Line 18:
  
  
-Try these:+==== Try these: ====
 ^ Operation ^ Example ^ Description ^ ^ Operation ^ Example ^ Description ^
 |Addition |<nowiki>%<(<>+2)>%</nowiki>|Adds <> and n| |Addition |<nowiki>%<(<>+2)>%</nowiki>|Adds <> and n|
Line 24: Line 24:
 |Multiplication|<nowiki>%<(<>*2)>%</nowiki>|Multiplies <> by n| |Multiplication|<nowiki>%<(<>*2)>%</nowiki>|Multiplies <> by n|
 |Division (Float) |<nowiki>%<(<>/2)>%</nowiki>|Divides <> by n| |Division (Float) |<nowiki>%<(<>/2)>%</nowiki>|Divides <> by n|
-|Division (Integer)|<nowiki>%<(<>//2)>%</nowiki>|Divides <> by n|+|Division (Floor)|<nowiki>%<(<>//2)>%</nowiki>|Divides <> by n, rounds down to nearest integer| 
 +|Division (Ceiling)|<nowiki>%<(-(<>//-2))>%</nowiki>|Divides <> by n, rounds up to nearest integer|
 |Modulus|<nowiki>%<(<>%2)>%</nowiki>|Divides <> by n, returns remainder| |Modulus|<nowiki>%<(<>%2)>%</nowiki>|Divides <> by n, returns remainder|
 |Power|<nowiki>%<(<>**3)>%</nowiki>|Raises <> to the nth power| |Power|<nowiki>%<(<>**3)>%</nowiki>|Raises <> to the nth power|
 |Square|<nowiki>%<(<>**2)>%</nowiki>|Computes the square of <>| |Square|<nowiki>%<(<>**2)>%</nowiki>|Computes the square of <>|
 |Square Root|<nowiki>%<(<>**0.5)>%</nowiki>|Computes the square root of <>| |Square Root|<nowiki>%<(<>**0.5)>%</nowiki>|Computes the square root of <>|
 +|DimText + TextField|<nowiki>%<'{:.3f}'.format( <> * float(DetailScale("GUID","Noformatting")) )>%</nowiki>|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.
 +     * <nowiki>%<'{:.3f}'.format( <> * float(DetailScale("GUID","Noformatting")) )>%</nowiki>
 +
 +     * 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.1770237541.txt.gz · Last modified: 2026/02/04 by dale