cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

GDL
About building parametric objects with GDL.
SOLVED!

hotspot editing won't work in 2 directions at once

danielk
Booster

Hi,

 

I am having an issue in GDL. I wanted to set up some 2D hotspots that would allow me to stretch a corner of a rectangle in both the X and Y directions at the same time. I have done this a lot of times before, and it was working fine, but in this specific case it doesn't seem to be working, and I don't know why.

 

In the attached test GDL object you can see that I am using A and B to define a rectangle at an angle in 3D (the rotation axis is the X axis).

rotx angle
addx -A_half
rect A, B

In 2D, I wanted to set up some hotspots for the stretching. A is the same projected as it is in 3D, so I used A for the X direction (or actually A/2, because my origin is in the center of the A edge), but B is in an angle, so when it is projected, it shortens. Thus, I set up a parameter for the projected length of B (B_projected), and in the parameter script I set up a connection between B and B_projected (as well as between A and A_half).

if GLOB_MODPAR_NAME = "A_half" then
parameters a = 2 * A_half
else
parameters A_half = a / 2
endif

if GLOB_MODPAR_NAME = "B_projected" then
parameters b = B_projected / cos(angle)
else
parameters B_projected = b * cos(angle)
endif

Now, if I set up the X-direction hotspots and comment out the Y direction hotspots, the stretching works. If I do the opposite, and have the Y-direction hotspots only, the stretching also works. If I comment out the B - B_projected connection in the parameter script, then the stretching works in both directions. but with everything there, the stretching will only work in the X/A direction, and not the Y/B direction.

rect2 -A_half, 0, A_half, B_projected

! -------------------------------
! --- 2D hotspots for editing ---
! -------------------------------

_unID = 0

! --- horizontal ---

! bottom right

hotspot2 0, 0, _unID, A_half, 1 + 128, a: _unID = _unID + 1 ! Base
hotspot2 A_half, 0, _unID, A_half, 2, a: _unID = _unID + 1 ! Moving
hotspot2 -A_half, 0, _unID, A_half, 3, a: _unID = _unID + 1 ! Reference

! bottom left

hotspot2 0, 0, _unID, A_half, 1 + 128, a: _unID = _unID + 1 ! Base
hotspot2 -A_half, 0, _unID, A_half, 2, a: _unID = _unID + 1 ! Moving
hotspot2 A_half, 0, _unID, A_half, 3, a: _unID = _unID + 1 ! Reference

! top right

hotspot2 0, B_projected, _unID, A_half, 1 + 128, a: _unID = _unID + 1 ! Base
hotspot2 A_half, B_projected, _unID, A_half, 2, a: _unID = _unID + 1 ! Moving
hotspot2 -A_half, B_projected, _unID, A_half, 3, a: _unID = _unID + 1 ! Reference

! top left

hotspot2 0, B_projected, _unID, A_half, 1 + 128, a: _unID = _unID + 1 ! Base
hotspot2 -A_half, B_projected, _unID, A_half, 2, a: _unID = _unID + 1 ! Moving
hotspot2 A_half, B_projected, _unID, A_half, 3, a: _unID = _unID + 1 ! Reference

! --- vertical ---

! right

hotspot2 A_half, 0, _unID, B_projected, 1 + 256, b: _unID = _unID + 1 ! Base
hotspot2 A_half, B_projected, _unID, B_projected, 2, b: _unID = _unID + 1 ! Moving
hotspot2 A_half, -B_projected, _unID, B_projected, 3, b: _unID = _unID + 1 ! Reference

! left

hotspot2 -A_half, 0, _unID, B_projected, 1 + 256, b: _unID = _unID + 1 ! Base
hotspot2 -A_half, B_projected, _unID, B_projected, 2, b: _unID = _unID + 1 ! Moving
hotspot2 -A_half, -B_projected, _unID, B_projected, 3, b: _unID = _unID + 1 ! Reference

Weirdly enough, you can still see the B value in the tracker, but it just simply won't work.

danielk_0-1707411293077.png

 

Can someone shed a light on why this specific arrangement won't work for me? What am I doing wrong?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru

My guess would be your false GLOB_MODPAR_NAME? In your code, as soon as you start modifying A, your second statement fixes B, and viceversa.

 

IF GLOB_MODPAR_NAME = "A_half" THEN
parameters A = 2 * A_half
endIF
IF GLOB_MODPAR_NAME = "A" then
parameters A_half = A / 2
endif

IF GLOB_MODPAR_NAME = "B_projected" THEN
parameters B = B_projected / cos(angle)
endIF
IF GLOB_MODPAR_NAME = "B" | GLOB_MODPAR_NAME = "angle" THEN
parameters B_projected = B * cos(angle)
endif

 

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

View solution in original post

2 REPLIES 2
Solution
Lingwisyer
Guru

My guess would be your false GLOB_MODPAR_NAME? In your code, as soon as you start modifying A, your second statement fixes B, and viceversa.

 

IF GLOB_MODPAR_NAME = "A_half" THEN
parameters A = 2 * A_half
endIF
IF GLOB_MODPAR_NAME = "A" then
parameters A_half = A / 2
endif

IF GLOB_MODPAR_NAME = "B_projected" THEN
parameters B = B_projected / cos(angle)
endIF
IF GLOB_MODPAR_NAME = "B" | GLOB_MODPAR_NAME = "angle" THEN
parameters B_projected = B * cos(angle)
endif

 

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
danielk
Booster

Hi,

 

Yep, that was it. I didn't consider that they would be interpreted like that (running the param script for one modified parameter at a time), but it makes perfect sense.

 

Thanks a lot!

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!