GDL
About building parametric objects with GDL.

Help with dynamic hotspots counter

Mats_Knutsson
Advisor

Hi,

I want to create a simple table like in attach where I can choose numer of internal legs and give them dynamic hotspots so I can move the freely within the table (I will use values from an array after understanding the hotspot creation. I know how dynamic hotspots work but I haven't cracked how they work togehter with the FOR-loop.
I just looked at Erichs Framing object but it was too complex for me right now. I just need the simple example with BLOCK.

Br,

Mats

 

!------ countertop
ADDZ 0.8
BRICK A,B,0.05
DEL 1

!------ first and last leg
GOSUB "LEG"
ADDX A
MULX -1
GOSUB "LEG"

!------ internal legs
IF numberofinternallegs > 0 THEN
FOR i = 1 TO numberofinternallegs
ADDX 0.5
GOSUB "LEG"
NEXT i
ENDIF
END

"LEG":
BLOCK 0.05,B,0.8

RETURN

2022-06-16_22-51-06.png
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
5 REPLIES 5

Hi Mats,

 

If the hotspots are to control the position then they need to be used in the "ADDX" function within the FOR-loop.

The dynamic hotspot definition sits outside the FOR-loop (otherwise it gets messed up by the ADDX function), and then you use the array parameter in your ADDX function in the loop.

If the array parameter contains the X position then you need to add a "DEL 1" after the gosub "Leg" in the loop. However if the array parameter contains the distance between each leg then your current structure without the "DEL 1" is correct.

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Thanks Kristian but I need a simple example. Remember I'm a noob. As usual I don't have the time to learn through trial&error. I looked at the code of the Shelving object you did for us but I need a simpler example with this particular coding isolated. If you can squeeze an hour or so to code this simple example so that I can check it I'd be delighted and you can send the bill using the same contact info as last time.

 

I'd really would like to have the time to sit down and study gdl more but I just don't have that time...

AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
A_ Smith
Expert

Gee thanks. I'll have a look after work is done 🙂

AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.

Sure Mats,

Just send me the object you have created so far and I will make it work. It will only take me 3 or 4 minutes.

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

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!