Hello,
What's the easiest rule/function for converting the value from a number rule to a string?
For example, I have...
Rule DoorWidth As Number = 21
What I would like end up with is an additional rule like this, based off of the DoorWidth value:
Rule DoorWidthString As String = "21"
I'm just trying to convert a numerical value, evaluated from a rule, to a string. I know this can be done with :Name rules, by using the MakeString function, but I'm not sure how to change the value of a numerical rule to a string.
I imagine I'm missing something obvious.
Thanks!
Joe
Solved! Go to Solution.
Solved by rsimington. Go to Solution.
You can also use format(%d,expression) or format(%g,expression). %d will round a number to an integer, whereas %g will keep it a decimal.
Hi,
Be aware that stringvalue is not intended to reliably format the output.
For that you use the format function which uses C like notation, such as
Intent >format("my number is %g",2.301)
--> "my number is 2.301"
Intent >format("my number is %3.2g",2.301)
--> "my number is 2.3"
--
Autodesk
Elly Bachrach
Manager
Manufacturing Consulting Services - ETO
Direct +1 (847) 676-2880