how do i create a single text string from three parameters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 01:46 AM
i'm trying to create a single text string made from the values of multiple parameters....
the background: i'm modifying the steel section objects to display their profile sizes adjacent to the placed section. when this is a standard profile designation i can use use the 'Profile' parameter value in a TEXT2 command, so:
TEXT2 0, 0, Profile
the problem: when the section size is set to 'CUSTOM' i would like the TEXT2 command to display the custom section size. this involves creating a string (i think) to combine the three size parameters, each separated by an "x" character:
ws = width of section
ds = depth of section
massm = weight/meter
i need the string to read 'ds x ws x massm' . . . e.g. "406x178x60"
i've tried various separators and quotation marks, but keep getting errors.
additionally, i'd really like the 'massm' value to be rounded up to a whole number . . . i get the impression from the GDL manual that this can be done, but i just don't understand a bloody word of it . . .

thanks in advance!
~/archiben
b f [a t ] p l a n b a r c h i t e c t u r e [d o t] n z
archicad | sketchup! | coffeecup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 04:23 AM
I do not know of a way to make a single TEXT2 statement
containing five strings spaced out so it is readable.
You can do what you want using separate TEXT2 statements.
The following code with, I hope, understandable comments
(the text preceded by exclamation points) may help.
DEFINE STYLE "mystyle" "helvetica", 12,1,0
SET STYLE "mystyle"
!!!ws=ws*3.28084*12 !!conversion to imperial to test script
!!!ds=ds*3.28084*12 !!conversion to imperial to test script
massm=CEIL(massm) !!the CEIL() function rounds up
!!any decimal number
!!to the nearest whole number
!!NOTE: str() is a function that converts a number to a string
wx="x" !!defines the string "x"
wid=stw(wx)/1000*A_ !!wid=width of the string "x"
wid1=stw(str(ws,3,2))/1000*A_ !!wid1=width of the the number ws
!! converted to a string
wid2=stw(str(ds,3,2))/1000*A_ !!wid1=width of the the number ds converted to a string
text2 0,0,str(ws,3,2)
text2 wid1,0,"x"
text2 wid1+wid,0,str(ds,3,2)
text2 wid1+wid+wid2,0,"x"
text2 wid1+wid+wid2+wid,0,str(massm,3,2)
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 05:56 AM
Peter wrote:thanks peter
I do not know of a way to make a single TEXT2 statement containing five strings spaced out so it is readable. You can do what you want using separate TEXT2 statements. The following code with, I hope, understandable comments (the text preceded by exclamation points) may help.
wow! i had in the back of my mind that this could be done by finding the string lengths and multiple text blocks, but i figured that there
i pretty much followed your comments. i'll give it a whirl tonight and hopefully get it working!
thanks again!
ben
b f [a t ] p l a n b a r c h i t e c t u r e [d o t] n z
archicad | sketchup! | coffeecup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 06:10 AM
Yes, complicated for such a simple thing.
There may be a simpler way using TEXTBLOCK2 but
I have not studied this new command.
Let us know how it goes.
Thanks,
Peter Devlin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 06:45 AM
aa=str(ws,3,2)
bb=str(ds,3,2)
cc=str(massm,3,2)
text2 0,0, aa+"x"+bb+"x"+cc
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 03:44 PM
aa = STR("%.0mm",ws) !! whole no. in mm
bb = STR("%.0mm",ds) !! whole no. in mm
cc = STR("%.0",massm) !! whole no.
TEXT2 0, 0, aa + "x" + bb+ "x" + cc + "kg/m"
Win 10, Archicad 19 INT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2006-12-29 09:17 PM
Right you are. I had forgotten that after converting
the numbers to strings you can concatenate the strings
with the plus sign.
Hello LiHigh,
Depending on the form Ben wants,
the second form of the str() works as well.
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-01-04 01:48 AM
Peter - i got your solution working shortly before john posted, but ultimately his solution is cleaner.
LiHigh - as you correctly guessed, i would need to control the rounding on these values. i was able to decipher the GDL manual based on your examples and have been able to work out all of the various rounding requirements i needed for all of the other steel sections, not just universal columns.
the final (universal column) code:
if nz_label then add2 nz_labelPosX, nz_labelPosY rot2 nz_labelRotAng define style nz_labelFontStyle nz_labelFont, nz_labelFontSize, 4, nz_labelFontFaceCode set style nz_labelFontStyle pen nz_labelFontPen if Profile="CUSTOM" then stringDS=str("%.0mm",ds) stringWS=str("%.0mm",ws) stringMassm=str("%.0",massm) text2 0, 0, stringDS + "x" + stringWS + "UC " + stringMassm else text2 0, 0, Profile endif del 2 endifthe next step for me is to turn this into a label object (i actually loathe having textual information display with object itself as there is no control over the display of this text based on the drawing context) . . . but it will do for the next couple of weeks whilst i recharge my GDL batteries and consider how i'm going to tackle that one!


thanks again!
ben
b f [a t ] p l a n b a r c h i t e c t u r e [d o t] n z
archicad | sketchup! | coffeecup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-01-04 03:33 AM
I'm glad you got it working.
Yes, Johns solution is cleaner.
I'm sorry you didn't catch his
post before you started working.
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-01-04 04:21 AM
You said, "i actually loathe having
textual information display with object itself
as there is no control over the display of this text
based on the drawing context".
Could you say a little more about what you mean by this ?
What "drawing context" are you referring to ?
What sort of control of the display do you need ?
Thanks,
Peter Devlin