GDL
About building parametric objects with GDL.
SOLVED!

Limiting 2D Symbol dynamic hotspots to a (Value) Range of output units (mm)

Brendon Reid
Booster

Hi All

 

I have created a label that extracts data from Walls. When placed, it is positioned parallel to the Wall. I have used a Request statement to get the width of the relevant data text to create a 'pill-shaped' frame (incl. fill). This label also has a custom leader that points to the element (Archicad's Pointer is not used). This is all working well. What I would like to do (something I'm struggling with and seeking help on) is to be able to dynamically move the 'pill-shaped' frame to three different fixed positions along a single axis (parallel with the Wall). I have already coded a dynamic hotspot to run along this axis, and the 'pill-shaped' frame runs along with no problem, but it is infinite. I want it to be fixed to three positions. Refer to the attached image for where I would like the positions fixed. From my exploration and testing, I can't get the text width into the Parameter script (where I'm trying to fix these positions with a Value statement). FYI my Value statement looks like VALUES "dynamicOffset1m" RANGE [-0.0015,0.0015] STEP 0, 0.0015. I'd like to replace the '0.0015' with text width calculations. Does anyone know how to achieve this? Thanks in advance!

 


Dynamic_Hotspot.png
Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Brendon,

 

I think I have managed to come up with a solution thanks to Peter's comment. Peter gave me an idea which seemed to have worked. Although I didn't use GLOB_FEEDBACK_MODE, I used a variable in the 2D Script that forces the hotspots to not exceed the beginning of your curve via an if statement. I have attached the file.

 

Cheers,

Shaun.

View solution in original post

18 REPLIES 18
Barry Kelly
Moderator

Just off the top of my head without testing, wouldn't you just use the width value you got from the REQUEST?

i.e the same parameter/value you use to set the text box width.

Assuming the returned parameter is 'box_wid'

Something like ...

 

VALUES "dynamicOffset1m" -box_wid*0.5, 0, box_wid*0.5

 

I wouldn't use STEP, just give the 3 values you want to use.

 

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

Hi Barry

You would think that is the obvious solution! Although, unfortunately you can't get the 'box_wid' value as it is REQUESTed (and transformed with GLOB_SCALE) in the 2D Script. I have tried moving the REQUEST statement to the Parameter Script, but you get a 'Project dependent request' error.

Thanks

Brendon

Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994
Lingwisyer
Guru

Since you are just having it snap to the sides, and each label maybe different, why not just have it be:

VALUES{2} dynamicOffset1mfg -1, Left, 0, None, 1, Right

 Since the positions are set to nodes on the pill, the actual offset is kind of irrelivant to the user. Then in your script you just have a transformation which is  dynamicOffset1mfg * box_wid.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Kevin Lee
Enthusiast

Hi BR, 

 

Yes! I always wanted to use the text string width for moveable hotspots but couldn't work out how.. as a workaround.. I'm using the custom leader to toggle between 3 anchor points.

 

DEFINE STYLE "tzg_marker1" LABEL_FONT_NAME, LABEL_TEXT_SIZE, ANCHOR, LABEL_FONT_STYLE

(Anchor set to 7, 8, or 9)

 

Let me know if you find a way to limit the hotspot points based on return values!

 


Screenshot 2023-05-01 at 2.25.17 pm.png
Kevin Lee | Director of Technology | BIM
TZG Architects
ARCHICAD 27 | GDL | Rhino.GH | Solibri | Twinmotion
Mac Studio-M2 24‑core CPU | 60‑core GPU | 128GB memory
Brendon Reid
Booster

Hi Ling

That is in fact my fall back. But unfortunately this is not so great, as the 'text box width' will vary due to the called Wall data and scale of the View! Maybe I have encountered a limitation!

Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994

Hi Kev!

Yes this is an option too. Maybe it is a limitation! How good would it be to have a fix though!

Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994

Hi Kev

Upon having a closer look, I think there is definitely something in your suggestion worth exploring... I think I can move the frame the required distance no matter how long the length of text using this method. Now if I can only get a dynamic hotspot to link to the 'Anchor'... I'll give this a go and let you know! Thanks!

Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994
Jochen Suehlo
Moderator

I attach an example from a stretchable cabinet.

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

Thanks Joachim - much appreciated. Unfortunately, these fixed points are not tied to an output scale (e.g. 5mm at 1:100, or 15mm at 1:50). What makes my request even more complicated is I'm trying to tie my fixed points to a length that will vary depending on the width of the RICHTEXT block.  

Thanks
Brendon
MacBook Pro (16-inch, 2019), i9, 64GB RAM, macOS Big Sur, Windows 10 (Bootcamp)
Archicad User since 1994

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!