GDL
About building parametric objects with GDL.
SOLVED!

How to make certain point of Poly2_B shape movable

ArchiMind
Advocate

Hello all,

 

Recently I started investing my time in learning GDL scripting. So I apologize if my question is silly. I will probably have many of them in the future, so thank you upfront for understanding.

 

My first question is regarding the graphical hotspots department.

 

I am trying to make it so that certain spots from POLY2_B shape can be moved freely,

Also, I struggle in figuring out how to make code structure regarding the offset of the diagonal shape with the ability to have a parameter for thickness.

 

Cheers.

Stefan Veselinović

Parking spot -handicap.pngClick to expand Click to expand Collaborate category Click to collapse Collaborate category

 

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Two problems I see are:

  1. You have locked the value of DX1 with the "DX1 = A+0.504"
  2. Either LDX needs to control DX1 or you should just use LDX instead of DX1 if it is your parameter.
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

View solution in original post

7 REPLIES 7
Jorge_Arreguin
Booster

you need to create a hotspot that modify the C dimension when you move it, to made this is necesary define a group of hotspot working together , Base hotspot, reference hotspot and moving hotspot , the base hotspot will be in the start of C dimension and rererence hotspot indicate de direction where the spot will move and the move hotspot will be the one you move and will be and the end of dimension C

ArchiMind
Advocate

Hello @Jorge_Arreguin ,

 

Thank you for replying.

I understand the basic concept of how hotspot works, and I already made Variable C work. What confuses me is, is there a way to create an independent code structure to move that one point independently, inside my C distance (DX1 distance as shown in the picture)?

 

I tried following code structure:

!LDX parameter for DX1 distance

HOTSPOT2 A,      St, hsid+1,     LDX, 1+128: hsid=hsid+1   !base (hidden)
HOTSPOT2 -1,      St, hsid+1,     LDX, 3: hsid=hsid+1          !referece
HOTSPOT2 DX1,  St, hsid+1,     LDX, 2: hsid=hsid+1          !moving

 

With this code, I am able to create a hotspot, but without luck in changing DX1 length

 

 

shape hotspot.png



Cheers,

Stefan

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11

Full code structure

 

code structure.png

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11
Solution

Two problems I see are:

  1. You have locked the value of DX1 with the "DX1 = A+0.504"
  2. Either LDX needs to control DX1 or you should just use LDX instead of DX1 if it is your parameter.
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
ArchiMind
Advocate

@Kristian Bursell  Thank you very much for help,

 

Such a dumb thing to not notice :D.

 

While I have your attention, could you help me also with how to structure the code to have a diagonal shape thickness as a parameter?

 

ArchiMind_0-1664225702624.png

 

Cheers,

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11

Use the same hotspot definition method you have been (x direction) then simply do a "ROT2" 2d transformation to rotate the hotspot relative to the diagonal angle.

You will obviously have to do basic math to position the hotspot reference just remember you DON'T have to put these position values in the hotspot coordinates but instead can put them in the 2d transformations such as "ADD2" and "ROT2" before the hotspot code. It's just easier to read the logic this way and keeps the hotspot definition simple.

 

would look like this:

 

add2 x, y             !you do the maths 😉

rot2 45

        hotspot code

del 2

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

Thank you again for this advice. 🙂

 

Cheers 🙂

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11