GDL
About building parametric objects with GDL.

GDL - 2 hotspots edit 2 mutually connected parameters

Darwuhr
Enthusiast

Hi there, I have just started delving into the world of GDL. I have encountered a problem and would like to ask our experts.

Here is what I want to achieve: 

I have scripted a 2d line (we will call it Main Line) and another 2d line perpendicular to the first one (Perpendicular Line). I want to move the Perpendicular Line along the MAin Line using hotspots. I want to be able to input the position of the Perpendicular Line with 2 methods (parameters) that are mutually connected.

The first parameter is the x position along the Main Line. The second parameter is the % along the Main Line. For example, if Main Line is 10m, and I want to position the Perpendicular Line at 3/4 of the Main Line, I can input in the first parameter 7,5m or in the second parameter 0,75. Either one I choose to change, I want it to automatically update the second one.

 

I have been able to accomplish this in the objects settings dialog, but not through hotspots.

 

The hotspots problem:

 Changing the x coordinate along the Main Line, is done. Changing the % value is challenging and I was not able to make it work. It works if the Main Line is max 1m long; if it is not, the % value will change only if my mouse is between the origin of the Main Line and 1m from it (as I have defined a range of (0.0, 1.0) for the % parameter).

Then comes the problme of applying both these hotspots in the object.

 

Does anybody have any tips?

2 REPLIES 2
DGSketcher
Legend

You need two parameters 1. hotspot distance 2. % length. You then need to have two statements in the parameter script like ...  

IF GLOB_MODPAR_NAME = "Parameter1"  THEN
Parameter2 = Parameter1 !include your conversion calculation for "Parameter1" to percent or distance 
PARAMETERS Parameter2 = Parameter2. !These parameter names are the same
ENDIF

 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
lszatmary
Contributor

If I understand your question well, then you would like to create one purple hotspot, and by moving it it should edit both parameters?

If yes, then I'm afraid it is not possible. Even if you define two moving hotspots on the same route/place then only one of the params can be edited by moving. 

You have to decide which param should be edited and optionally you can place the other param's hotspot at a different location (e.g. one hotspot at the connection of the two lines and the other one at the other end of the perpendicular line).

Also you have to "bind" the two parameters together as DGSketcher wrote above, to be able to react if the other param is edited.

László Szatmáry
Content Developer at Walter AEC
Budapest, Hungary

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!