cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Scripting text with intelligent lines

Anonymous
Not applicable
Is there a way to determine the physical length of a string of text. I'd like the lines to start a certain distance away from the beginning, and end of the text. I thought about just using a line at length A, centering the text on the line then placing a fill between the two. The Problem is that the fill would have to be able to change with the length of text as well. (See attached image) Or maybe I'm going about it the wrong way??

Any thoughts would be appreciated.

Doug

Phisical length of text string.PNG
4 REPLIES 4
Anonymous
Not applicable
Hello, this might help.




!2D-code-----------------------------------------------

txt="Lorem ipsum"

define style "style01" "Arial", (2.5/A_)*A_, 5, 0
set style "style01"
length_txt=STW(txt)/1000*A_

text2 0, 0, txt
line2 -a/2, 0, -length_txt/2, 0
line2 a/2, 0, length_txt/2, 0

hotspot2 0, 0
hotspot2 -a/2, 0
hotspot2 a/2, 0

!-------------------------------------------------------











--
Regards, Juha
Anonymous
Not applicable
Thanks Juha,
I'm headed out for dinner but I will try it out as soon as I get home.

Doug
Anonymous
Not applicable
This is close to what I'm looking for. I'm in the process of tweaking it and I'll show you what I come up with when it's done. One other question that has arisen......Is it possible to suppress zero inches in the script? I'm using ffi to show a length. What I get is (eg. 10'-0"). What I'd like to see in this case is 10'. Any thoughts?

Thanks

Doug
David Maudlin
Rockstar
Doug:

When formatting the string, try:
txt=str("%0.0df", your_parameter)

More information about formatting can be found on pages 203-205 of the AC11 GDL Reference Guide.

HTH

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14