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

Real number to String

Red
Advocate
How do you convert a real number to string?

The reason I'm asking is that I'm trying to get the width of the real number so that I can place a fill behind it. But everytime I use "fillw = STW ('pitch') / 1000 * A_" its giving me the width of "pitch" and not the real number. So by converting it to string and/or text I could get the correct width, or is there away to do it with a real number?

Hopefully this made so sense!

Thanks,
Jeremy
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz
5 REPLIES 5
Anonymous
Not applicable
Hello

Try "fillw = STW (pitch) / 1000 * A_"
Red
Advocate
Fmr wrote:
Hello

Try "fillw = STW (pitch) / 1000 * A_"
Sorry I should have mention that before. When trying that I get an error saying "String type expression required".

Thanks for the idea though.
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz
Anonymous
Not applicable
Re

Try this one :
pitch=""
define style "style_pitch" helvetica,c,5,0
set style "style_pitch"
text2 0,0,pitch
fillw = STW (pitch) / 1000 * A_

or look to this 2D Script of a Fc-Cadlink Object who works fine
compteur=""
Request ("ID_of_Main","",compteur)
compteur=pre+compteur+suf
define style "style_compteur" helvetica,c,5,0
set style "style_compteur"
text2 0,0,compteur
haut=0
Request ("Height_of_style","style_compteur",haut)
a=stw(compteur)/1000*A_
Red
Advocate
Nope still no luck.
Thanks,
Red
i7 8700k
ROG Strix Z390-E MoBo
64gb RAM
EVGA GeForce GTX 2080
_______________________
http://www.facebook.com/flatcreekdesignstn
http://www.sraarchitects.biz
Anonymous
Not applicable
I just hope that this one works

You can change the fill "23" just choose for the exemple
This object just show the "a" variable in the middle of a fill, if you want another one just replace it in this "pitch=str("%m",a)"
the "c" variable is the height of the font

  • pitch=""
    pitch=str("%m",a)
    define style "style_pitch" helvetica,c,5,0
    set style "style_pitch"
    text2 0,0,pitch

    Request ("Height_of_style","style_pitch",haut)

    fillw=stw(pitch)/1000*A_
    fillh=haut/1000*A_

    fillw=fillw+dec*2
    fillh=fillh+dec*2

    add2 -fillw/2, -fillh/2
    PEN 1
    SET FILL 23
    POLY2_B{2} 5, 2, 1, 0,
    0, 0, 0,
    0, 0, 1,
    fillw, 0, 1,
    fillw, fillh, 1,
    0, fillh, 1,
    0, 0, -1