‎2022-06-16 11:10 PM - last edited on ‎2022-06-17 03:49 PM by Laszlo Nagy
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-17 02:17 AM
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.
‎2022-06-17 08:34 AM - edited ‎2022-06-17 08:37 AM
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...
‎2022-06-17 11:34 AM
This should do the job
https://drive.google.com/file/d/1CtGvo-7gJXO4xsVvZeReAWXMLVRlVE4G/view?usp=drivesdk
‎2022-06-17 02:44 PM
Gee thanks. I'll have a look after work is done 🙂
‎2022-06-20 12:23 AM
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.