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

Text from a numeric value

Aussie John
Newcomer
I want to print a report of a library part ( actually for a door schedule).
I need to insert a dimension value into a text string. Im not sure if this is possible. Any ideas?
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
6 REPLIES 6
Anonymous
Not applicable
I think you want translate a variable from Numeric type to String type. Isn't it?

You can do it with STR() function, see more info in manual.
Aussie John
Newcomer
it must be Friday as i cant see any STR functions that do that
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
David Larrew
Booster
The STR() function will convert a numeric value into a formatted text "string". You will need to decide what kind of formatting you want to have expressed and assign it to the raw value.

This example takes the Object's raw width, "A", and raw height, "B", and formats the measured value into text strings defined as "String_W" and "String_H" formatted into feet and fractional inches with a precision of 1/16":
String_W=str("%0.16ffi", A)
String_H=str("%0.16ffi", B)


The GDL Manual section of the Help file can explain the formatting in depth.
David Larrew, AIA, GDLA, GSRC

Architectural Technology Specialist

a r c h i S O L U T I O N S



WIN7-10/ OSX 10.15.7

AC 5.1-25 USA
Anonymous
Not applicable
Aussie John,

You puzzled me. You said you want to insert a dimension value into a string, did you?
Well, we know the type of a dimension value is numeric and all string function can not deal with numeric type value. So, I think you have to convert the value into a string type first, then you can do what you want.
Aussie John
Newcomer
i have two numerical values say A & B. I want a text string to say "AxBmm". I think David suggestion will work. (I was too tired on friday to make any sense of the manual at that point!!)
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
Anonymous
Not applicable
Try

text_dim = str(a*1000,3,0) + 'x' + str(b*1000,3,0) + 'mm'


if a = 500 and b = 380 you will get

500x380mm

The *1000 is important or you will be 3 decimal places out.

if you want spaces put then in ' x ' and ' mm'

I do this all the time. I have a little subroutine that draws a line with ticks to match my normal dims.