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.

Split Command - Number or Text

Anonymous
Not applicable
OK,
have been spending all day setting up a zone stamp that when the zone name gets too long, it separates over multiple text2 commands.
The reason I am doing this is because a paragraph doesn't translate well into AutoCAD (translates as one line)

All was going rosy until I put a number in the zone name, and it went bang.

Looking at the split command again, I realised it is differentiated between numbers and text. Is there a way it can find a variable as a number or a text.

This is my current split command, which only contains words.

znx = split(room_name, "%s %s %s %s %s %s %s", zn1a,zn2a,zn3a,zn4a,zn5a,zn6a,zn7a)

I hope my day of work hasn't been wasted
3 REPLIES 3
Frank Beister
Moderator
You could check the variables by a VARTYPE command and can afterwards return the numbers into chars by STR command.

I would better try it in something like a loop to search by STRSUB for the spaces, check the cumulated width and add it to two new strings - segent by segment.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Frank Beister
Moderator
width=8 ! paragraph length in m
oneline="The quick black architect jumped over the lazy programmer. Lore ipsum!"

! settings
DIM absatz[]
i=1
absatz=""
factorT=GLOB_SCALE/1000
last=0
space=1

DO
	space = STRSTR(STRSUB(oneline,last+1,255)," ")
	IF space THEN GOSUB "addpart"
	last=last+space
	WHILE space

space=STRLEN(oneline)-last
GOSUB "addpart"

LINE2 0,0,width,0

FOR i=1 TO VARDIM1(absatz)
	TEXT2 0,-0.75*i, "'"+absatz+"'"
	NEXT i
END

"addpart":
IF STW(absatz+STRSUB(oneline,last+1,space))*factorT<width THEN
	absatz=absatz+STRSUB(oneline,last+1,space)
	ELSE
	i=i+1
	absatz=""+STRSUB(oneline,last+1,space)
	ENDIF
RETURN
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
wow, didn't expect the whole code.
checking A17 translator, it seems to translate better. But still with problems.
Looking forward to trying this today.
Many Thanks!