Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Constrain the move of a hotspot2 along a line ?

Anonymous
Not applicable
HI

With something like this, I can move a point C (editable hotspot2) on all directions :
!x
HOTSPOT2 Cx, 0, ID, Cy, 1+128 : ID=ID+1
HOTSPOT2 Cx, -1, ID, Cy, 3 : ID=ID+1
HOTSPOT2 Cx, Cy, ID, Cy, 2 : ID=ID+1
!y
HOTSPOT2 0, Cy, ID, Cx, 1+128 : ID=ID+1
HOTSPOT2 -1, Cy, ID, Cx, 3 : ID=ID+1
HOTSPOT2 Cx, Cy, ID, Cx, 2 : ID=ID+1



How can I force the displacement of the point C along the line D ?
C is halfway between A and B.

Thanks

hotspot2_01.jpg
10 REPLIES 10
Erich
Booster
There are a number of ways to accomplish this. What are your known variables? delta_x? delta_y? The angle of line "D"?

Basically, you write a group of three hotspot2 commands to get a single moving hotspot constrained to a line. You just need to know the equation for your particular line.

You could also look at simplifying things depending on the know variables, or by writing your hotspot for a simple case (ie. vertical or horizontal lines) and then rotate your coordinate system.

HTH
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Anonymous
Not applicable
Erich wrote:
There are a number of ways to accomplish this. What are your known variables? delta_x? delta_y? The angle of line "D"?

Basically, you write a group of three hotspot2 commands to get a single moving hotspot constrained to a line. You just need to know the equation for your particular line.

You could also look at simplifying things depending on the know variables, or by writing your hotspot for a simple case (ie. vertical or horizontal lines) and then rotate your coordinate system.

HTH
Merci Erich.

All my known variables are in the drawing (A, B, C, O and a point (E) between A and B).
So I have 2 points O and E on the D line.
I can get the D line equation.
How can I use it in the hotspot2 ?

Thanks
Anonymous
Not applicable
Hello,

Try in the master or value script;

parameters b= (-a)

HTH, Juha
Anonymous
Not applicable
You could also have just one moving hotspot
and rotate it before declaring;

rot2 -45
hotspot2 xxx-direction...
hotspot2 xxx-direction...
hotspot2 xxx-direction...
del 1

Regards, Juha
Erich
Booster
I would try using my last method. The same as Juha says.

Start by determining your angle for the line AB. Assume that the origin passes through your point E. Then your angle is ATN (Ay/Ax). You many need a special case for when your angle is 90 or 270 degrees as the tangent blows up there.

Next, write your hotspots in only the vertical direction with an angle transformation before it. You would have something like this:
IF Ax<>0 THEN
   ang = ATN(Ay/Ax)
  ELSE
   ang = 90  !! it could also be ang = 270 
ENDIF

ROT2 ang
 HOTSPOT2  0,   Cy, ID, Cx, 1+128 : ID=ID+1 
 HOTSPOT2 -1,   Cy, ID, Cx, 3 : ID=ID+1  
 HOTSPOT2  Cx,  Cy, ID, Cx, 2 : ID=ID+1 
DEL 1 
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Anonymous
Not applicable
All points (...A,B,C...) are in a matrix parameter " points [40][x,y] "
If I use the solution :
ROT2 angle
DEL 1
all points are in a wrong place, because I don't use a local coordinate system with ADD2 x,y for each point.

I'd rather another way, perhaps using the D line equation ?
With E (between A and B), and O (center of circle), I have two points on the line D.
with line equation : y = ax + b
I have :
a = (Ey - Oy) / (Ex - Ox)
b = Oy - aOx

What can I do after ?

Juha wrote:
parameters b= (-a)
I don't understand

Best regards
Anonymous
Not applicable
You need some trigo to find centre and radius of the arc, according to any location of your points.
See attached example.
Anonymous
Not applicable
Olivier wrote:
You need some trigo to find centre and radius of the arc, according to any location of your points.
See attached example.
Thanks you for your example. I have understood how you do. But I'd like understand how works the editable hotspot. No french documentation for GDL, except the documentation AC 7.0, but without editable hotspot ! And the english documentation seem sketchy !
Is there another way without ROT2 angle ?

Merci
Anonymous
Not applicable
Thierry wrote:
Thanks you for your example. I have understood how you do. But I'd like understand how works the editable hotspot. No french documentation for GDL, except the documentation AC 7.0, but without editable hotspot ! And the english documentation seem sketchy !
Graphical Hotspots are fully documented in each version since AC8. Goto Menu > Help > GDL Reference Guide> Graphical Editing,
or Online Help
Thierry wrote:
Is there another way without ROT2 angle ?
I don't see the problem, you delete the transformation once done.
There are other ways to achieve the same result without using rot2, but calculations are more complicated.