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.

How do I make Text Stretchy?

kevin b
Contributor
We have an object we have modified. It uses a REQUEST to read the zone name from the zone it is placed into. This is not a Zone Stamp but an object that more or less duplicates the info from a Zone Stamp.

Right now that name is a TEXT2 and it's not stretchy, but if we have a long zone name we'd like to be able to stretch it to break into two lines.

I have found several references to possible needing to use TEXTBLOCK and PARAGRAPH but can't seem to get it to work, seemingly in over my GDL head.
kevin s burns, AIA

massachusetts, usa



AC25 (1413), since AC6

Windows 10

Intel Core i7 -8700 @ 3.2 GHz~ 16 GB ram
2 REPLIES 2
Erich
Booster
You will need to use RICHTEXT2.

I use this code snippet as a building block when I need to do this.

Parameters:
Typical settings for all parameters
===============
Hidden:		N/A
Indent:		N/A
Bold:		N/A
U:			N/A
===============

Variable:	rhtxt
Type:		text
Name:		Text
Value:		abc

Variable:	text_pen
Type:		Pen
Name:		Text pen
Value:		7

Variable:	font_type
Type:		text
Name:		Font style
Value:		Arial

Variable:	txt_size
Type:		Real
Name:		Size (points)
Value:		2

Variable:	wfact
Type:		Real
Name:		Leter width factor
Value:		1.00

Variable:	chfact
Type:		Real
Name:		Text width factor
Value:		1.00

Variable:	bBold
Type:		boolean
Name:		Bold
Value:		Off

Variable:	bItalic
Type:		boolean
Name:		Italic
Value:		Off

Variable:	bUnderline
Type:		boolean
Name:		Underline
Value:		Off

Variable:	bStrike
Type:		Real
Name:		Strike through
Value:		Off

Variable:	widthset
Type:		Length
Name:		Paragraph width
Value:		0'-3"
2D Script:
LINE2 0,0, widthset, 0

GOSUB 10  !! General
GOSUB 100 !! Text
GOSUB 200 !! Hotspots

!! ======================================
				END
!! ======================================

10:  !! General	
	PEN text_pen
	unID = 1
	faceC = 1*bBold+2*bItalic+4*bUnderline+128*bStrike
	txt_sizeC = txt_size*0.3527777 !! (mm to Pt conversion)
	size = widthset*1000/glob_scale	 

	DEFINE STYLE{2} "AC_STYLE_0" font_type, txt_sizeC, faceC
RETURN 


100: !! Text	
	PARAGRAPH "PRG_1" 1, 0, 0, 0, 1
		PEN text_pen
		SET STYLE "AC_STYLE_0"
		"Test text to make the color option work"
	ENDPARAGRAPH
		
	TEXTBLOCK "TEXTBLOCK_1" size,
		1, 0, wfact, chfact, 1, rhtxt 
	
	RICHTEXT2 0, 0, "TEXTBLOCK_1"
RETURN 


200: !! Hotspots		
	! ===== Selection Hotspots
	nul = REQUEST ('TEXTBLOCK_INFO', "TEXTBLOCK_1", wid, hit)
	
	w=wid*glob_scale/1000
	h=hit*glob_scale/1000
	
	HOTSPOT2 w/2, -h/2
	HOTSPOT2 w, -h
	HOTSPOT2 0, -h
	HOTSPOT2 0, 0
	!HOTSPOT2 w, 0
	
	! ===== Width Hotspots
	HOTSPOT2  0,        0, unID, widthset, 1+128 : unID = unID+1 !b
	HOTSPOT2  widthset, 0, unID, widthset, 2     : unID = unID+1 !m
	HOTSPOT2 -1,        0, unID, widthset, 3     : unID = unID+1 !r
RETURN
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Anonymous
Not applicable
Thank you for sharing the code! (Now I can complete our object!)