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.

Real types - precision problems

Anonymous
Not applicable
I searched the forum for some help, but not being a GDL guru, I was unable to decipher if there was any useful information that could help me out.

I am trying to add text to an object so that when the width of the object is changed the text changes automatically. i.e., a 16' marker board is labeled "MB16", and when changed to 12' the label changes to "MB12".

My first thought was to add the "MB" to the expression in the text2 "text2 D*0.5, (-A), ("MB" + D)", but I quickly realized that this expression is not a compatible type, so I added IF THEN statements to handle this (see attachment). This works perfectly when the object is open (in the 2d Full View), but when placed in the project, returns "0" whenever the width is changed.

I thought I had read that the "use of real types...precision problems" warning did not result in any actual problems (must have been wrong).

Any help is greatly appreciated.
4 REPLIES 4
Anonymous
Not applicable
Hello,

Basically you need to convert the width (A) to string before putting it together
with the phrase "MB".

In addition it is useful to convert the width on-the-fly so no need to know every
possible situation beforehand.

Here is a simple code for such. The imperial measurement caused a little extra
lines here, you surely can make it shorter by investigating the GDL Reference Guide 12
pages 206-208.

!--all this can be put in the master script
values "a" 1', range[1', ] step 1', 1'!--step by 1 foot
values "b" 0.2'

hotspot2 0, 0
hotspot2 a, 0
hotline2 0, 0, a, 0
hotline2 0, b, a, b

rect2 0, 0, a, b

define style "textstyle" "Arial", 2, 2, 0
style "textstyle"

wid= str("%fi", a/12)
len= strlen(wid)
wid= strsub(wid,1,len-1)

text2 a/2, 0, "W"+ wid

Regards, Juha
Anonymous
Not applicable
These feet and fractional inches really are a funny way to measure...I just wonder why the volume unit is a gallon and not 'head'


--
Juha
Anonymous
Not applicable
Juha,

Worked perfectly!

Thank you so much! I would have never figured that out (even though I had read those pg's several times today)
Anonymous
Not applicable
Juha wrote:"These feet and fractional inches really are a funny way to measure.."
Actually quite easy if you learn to measure with your toes.
And in Texas, they do wear ten gallon hats:-))
lec