We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

convert inches to a whole number

Anonymous
Not applicable
Hi All,
I know this is a very basic GDL question but I can not find it in all of my searches.

I have a dimension in an object that is in feet/inches, I would like to convert this to a text (without the ")
Example:
(Length) A = 0'-6"
Convert to (abc value) 6


Sounds easy enough but I cant figure it out.
This is what I tried...
PARAMETERS Width = STR ("%fi", A)
This will give me a value of 6" NOT 6

any input wold be great!
Thanks again
1 REPLY 1
Podolsky
Ace
It depends on what you want to achieve. As I know ArchiCAD is using meters inside if the system. So every time when you are using feet and inches - it converts them into meters.
If you want to convert your A into feet and inches and show only inches without " symbol as a string, then first question - what would you like to get, if A has feet too - let say it's 1'-6"? Will %fi - fractional inches - not show feet? Also, if it's fractional inches - what will happen when you have let say 1/6"?
All these questions necessary to ask that script wouldn't collapse when A is changing.

Width = STR ("%fi", A) 

will give you 6" - as a string. You can use SPLIT to separate 6 from "

n=SPLIT(Width, '%n"', widthNum, string)
widthNum will be equal 6 (number)

but if it will be 1/6" then maybe better to cut " from the end:

len = STRLEN(Width)
WidthNum  = STRSUB(Width, 1, len-1)

So, first, we are getting the length of the word (1/6") - i.e. 4 symbols.
Then we are showing from the first symbol until len-1 symbol (i.e. 3).

WidthNum = '1/6' (string)