GDL
About building parametric objects with GDL.
SOLVED!

Problem with graphical hotspots

Finlay_Moran
Contributor

Hi, everyone!

I'm trying to educate myself with GDL.

 

For the moment I'm trying to figure out how to use graphical hotspot. Generally I understand the idea but I have some issues.

I've made two circles, where the first one is static and the second one is movable.

Issue is that I want the moving point to be exactly at the right side (or right pole) of the second circle. However when I try to move it the cursor goes from right side to the center of the circle.

 

Tried to improve my code with chatGPT but it failed miserably. 

 

The problem as I understand it is with coordinates of the moving point and the second circle itself.

 

Here is a code I made. There are few variables that defined:

 

 

radCircle - circle radius
movX - parameter for hotspots to works with

! First circle
CIRCLE2 0, 0, radCircle
hsID = hsID+1
HOTSPOT2 0, 0, hsID ! Center point of the first circle 
hsID = hsID+1
HOTSPOT2 radCircle, 0, hsID ! Hotspot for the right side of the first circle

! Second circle
CIRCLE2 movX, 0, radCircle
hsID = hsID+1
HOTSPOT2 0, 0, hsID, movX, 1 ! Base point
hsID = hsID+1
HOTSPOT2 movRad, 0, hsID, movX, 2 ! Moving point
hsID = hsID+1
HOTSPOT2 -radCircle, 0, hsID, movX, 3 ! Reference point

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru

You have Circle 1 or radius radCircle, and Circle 2 of radius radCircle which can move along a linear path that runs through Circle 1?

 

 

hsID = 0

CIRCLE2	0,		0,	radCircle
CIRCLE2	movX,	0,	radCircle

HOTSPOT2	radCircle,			0,	hsID,	movX,	1		:	hsID = hsID+1	!Base
HOTSPOT2	movX + radCircle,	0,	hsID,	movX,	2		:	hsID = hsID+1	!Moving
HOTSPOT2	-radCircle,			0,	hsID,	movX,	3		:	hsID = hsID+1	!Ref

 

 

 

 

 

Ling.

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

3 REPLIES 3
Solution
Lingwisyer
Guru

You have Circle 1 or radius radCircle, and Circle 2 of radius radCircle which can move along a linear path that runs through Circle 1?

 

 

hsID = 0

CIRCLE2	0,		0,	radCircle
CIRCLE2	movX,	0,	radCircle

HOTSPOT2	radCircle,			0,	hsID,	movX,	1		:	hsID = hsID+1	!Base
HOTSPOT2	movX + radCircle,	0,	hsID,	movX,	2		:	hsID = hsID+1	!Moving
HOTSPOT2	-radCircle,			0,	hsID,	movX,	3		:	hsID = hsID+1	!Ref

 

 

 

 

 

Ling.

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

Wow! Thank you so much. I didn't expect it to be so easily done.

Just to be clear, the problem was that base point was at the center of coordinates. But why moving the base point made everything as intended?

You had movRad so while you edited movX the node you were actually moving never changed.

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