cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The 2025 Technology Preview Program is now live. Join today!

GDL
About building parametric objects with GDL.
SOLVED!

Parametric text in stretchable 2D object

Kaspars
Booster

Hello!

I'm trying to script a 2D object with parametric text.

Problem is, when object is stretched smaller than text size - there is no possible to regain stretching option in plan view, because bounding box hotspots are outside object itself hotspots.

 

Here is the 2D code for example object -

============================================

RECT2 0, 0, A, B

! Hotspots for stretching
HOTSPOT 0, 0, 1
HOTSPOT A, 0, 2
HOTSPOT A, B, 3
HOTSPOT 0, B, 4

! Text style
DEFINE STYLE "NoStretch" "Arial", 1, 5, 0
SET STYLE "NoStretch"

! Text placement
TEXT2 A/2, B/2, label
==========================================
Is there a way to make text appear outside object and preserve functionality of object stretching, even if it is smaller than text?
 
Kaspars_0-1753359331259.png

 

 

Thank You in advance,
Kaspars Kalniņš

 

Operating system used: Windows

 
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru

We're in the wrong sub...

 

By the sounds of it, the text is the annotation, not the frame, for the shape, so custom hotspots would be the way to go. Toggling edittable base hotspots will allow you to use a single set of hotspots (edittable hotspots require 3 actual hotspots) to control the axis of two adjactent corners. Or you could just script two sets for say the top right corner and have that as your size adjustment. Also, you should be using HOTSPOT2, hence why you are getting bounding box hotspots instread of the ones you are scripting.

 

 

Ling.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

View solution in original post

5 REPLIES 5
Laszlo Nagy
Community Admin
Community Admin

I have not done this in GDL before but I think you can use the following request the get the exact width of a Text Block:

 

n = REQUEST ("TEXTBLOCK_INFO", textblock_name, width, height)


Returns in the given variables the sizes in x and y direction of a text block previously defined via the TEXTBLOCK command.
The sizes are in mm or in m in model space depending on the fixed_height parameter value of TEXTBLOCK
(millimeters if 1, meters in model space if 0 ). If width was 0, the request returns the calculated width and height,
if width was specified in the text block definition, returns the calculated height corresponding to that width.
Expression returns 0 and contains dummy return values (emtpy string or 0) if used in parameter script, causing additional warning.

 

If you know the width of the Text Block then my guess is that after each change, you can make sure that the bounding box of the Library Part is always the same size as the Text Block?

Someone please correct me if I am wrong about this.

Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Barry Kelly
Moderator

You will need to script adjustable or 'graphical editing' hospots for the corners of the box.

Have a look in the GDL manual for 'graphical editing using hotspots'.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Solution
Lingwisyer
Guru

We're in the wrong sub...

 

By the sounds of it, the text is the annotation, not the frame, for the shape, so custom hotspots would be the way to go. Toggling edittable base hotspots will allow you to use a single set of hotspots (edittable hotspots require 3 actual hotspots) to control the axis of two adjactent corners. Or you could just script two sets for say the top right corner and have that as your size adjustment. Also, you should be using HOTSPOT2, hence why you are getting bounding box hotspots instread of the ones you are scripting.

 

 

Ling.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

Hi!

Thank's, Ling!

Problem was so obvious and simple! I just forgot to use HOTSPOT2 instead of HOTSPOT, haaha.

 

Now it is possible to stretch my rectangle even if it is smaller than annotation text.

 

PS

I'm still curious how to use TEXTBLOCK , PARAGRAPH and RICHTEXT,  commands. Have not seen working simple example code on net so far .

 

Kaspars.

You can use TEXTBLOCK , PARAGRAPH and RICHTEXT to get Texts with linebreaks, while you are strechting the textbox.
See download for a simple example object.
On the Graphisoft GDL Website you can find other examples: https://gdl.graphisoft.com/tips-and-tricks/

Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de

Setup info provided by author

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!