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

Hotspot editing length and angle at the same time

Matt Balaam
Advocate
Hi,
I am making a custom label (single label object with multiple labels within it to use with the Label Elements option) and am having trouble trying to edit both the length and angle of a line at the same time using hotspots. I can edit the angle fine or the length fine individually but as soon as I include both hotspots at the same time only the length can be edited. Is it possible to edit both at the same time or is this a limitation?
! Length of line
hotspot2	0, 0, UnID, arrowDistance, 1 + 128 :UnID = UnID + 1
hotspot2	arrowDistance * cos(arrowAngle), arrowDistance * sin(arrowAngle), UnID, arrowDistance, 2 :UnID = UnID + 1
hotspot2	-1, 0, UnID, arrowDistance, 3 :UnID = UnID + 1

! Angle of line
hotspot2	arrowDistance, 0, UnID, arrowAngle, 4 + 128 :UnID = UnID + 1
hotspot2	arrowDistance * cos(arrowAngle), arrowDistance * sin(arrowAngle), UnID, arrowAngle, 5 :UnID = UnID + 1
hotspot2	0, 0, UnID, arrowAngle, 6 :UnID = UnID + 1
This is basically the way a standard label behaves and I would like to mimic its behaviour as closely as possible for a more intuitive user experience. I can revert back to using pure X and Y coordinates for the label head and elbow but I would rather this way if it's possible.

Has anyone got this to work?
AC24 (7000 AUS FULL)| Windows 10 Pro | Intel Core i7-12700 @ 2.1GHz | 32GB RAM | NVidia T1000
7 REPLIES 7
Anonymous
Not applicable
You need to place 2 Hotspots to obtain a freely movable Hotspot at their point of intersection:

HOTSPOT2 0, y, unID+1, x, 1+128 !x base
HOTSPOT2 x, y, unID+2, x, 2 !x move
HOTSPOT2 -1, y, unID+3, x, 3 : unID=unID+10 !x ref

HOTSPOT2 x, 0, unID+1, y, 1+128 !y base
HOTSPOT2 x, y, unID+2, y, 2 !y move
HOTSPOT2 x, -1, unID+3, y, 3 : unID=unID+10 !y ref
Matt Balaam
Advocate
Thanks for the reply andro55 however that only gives me movement using X and Y coordinates. This means for the user to make the second point at an angle of 45° to the first point (common for label leaders) they have to know that the X and Y coordinates need to match. Good luck then trying to do an angle like 30°.

What I am trying to achieve is movement that uses an angle and a line length like the built-in label tool.
AC24 (7000 AUS FULL)| Windows 10 Pro | Intel Core i7-12700 @ 2.1GHz | 32GB RAM | NVidia T1000
Barry Kelly
Moderator
mcjh_matt wrote:
What I am trying to achieve is movement that uses an angle and a line length like the built-in label tool.
I don't think you can link angle and length type hotspots.
You will have to have 2 separate ones.
An angle one with a fixed radius and then one for the length that uses the angle (SIN & COS as you did before).

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Matt Balaam
Advocate
Barry wrote:
I don't think you can link angle and length type hotspots.
I had a feeling that was going to be the answer Barry.

Shame it can't be done as it would be good to mimic the behaviour of the built-in tools.

Having two separate hotspots would be quite clunky for the user so I've used X and Y coordinates and created 'sticky' hotspots that 'snap' to horizontal, vertical and 45°. This gives behaviour that is very similar to the built-in label.
AC24 (7000 AUS FULL)| Windows 10 Pro | Intel Core i7-12700 @ 2.1GHz | 32GB RAM | NVidia T1000
Barry Kelly
Moderator
With the label tool I am not sure that you are adjusting parameters for the line nodes.
it is more like adjusting the nodes of a polyline so you have the tracker with distance/angle or horizontal/vertical depending on what you prefer.

If you set up x & y hotspots then you can use guidelines to snap to the angles you need.

There may be a way of using x & y but showing angle and distance because a hotspot can show the value of another parameter rather than the value of itself.
I will try it when I get a moment and get back to you.

A hotspot has an optional 'Display parameter'.

HOTSPOT2 x, y [, unID [, paramReference, flags] [, displayParam]]

Maybe this could be the calculated angle for the x hotspot and the calculated distance for the y hotspot.
I am not sure that you can use these to type in a value but you can certainly still stretch them so this may not be of use.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Barry Kelly
Moderator
I just tried with a stretchy x & y hotspot and you can indeed get it to show the optional parameters for distance and angle.
However as I thought you can not type values into the tracker to change them as they are only a display..

The following will allow you to have an angle hotspot and a length hotspot but they can not be used at the same time.

Comment one out and the other works.

!angle stretchy hotspot
HSID=HSID+1 !increase ID for next hotspot
HOTSPOT2 0,0,HSID,act_ang,6 !centre !!512 flag for clockwise rotation
HSID=HSID+1 !increase ID for next hotspot
HOTSPOT2 act_dist*COS(act_ang),0,HSID,act_ang,4+128 !base
HSID=HSID+1 !increase ID for next hotspot
HOTSPOT2 act_dist*COS(act_ang),act_dist*SIN(act_ang),HSID,act_ang,5 !stretchy hotspot

ROT2 act_ang

!length stretchy hotspot
hsid=hsid+1 !increase ID for next hotspot !increase ID for next hotspot
HOTSPOT2 0,0,hsid,act_dist,1+128 !base
hsid=hsid+1 !increase ID for next hotspot
HOTSPOT2 act_dist,0,hsid,act_dist,2!, act_dist !moving
hsid=hsid+1 !increase ID for next hotspot
HOTSPOT2 -0.0001,0,hsid,act_dist,3 !reference

DEL 1


Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Matt Balaam
Advocate
Thanks for putting some time into it Barry, that is basically the system I had tried where commenting one hotspot out would let the other work and vice versa. The only thing I had done differently was using sin and cos rather than rotating the coordinate system for the distance hotspot however this still doesn't allow you to use both at the same time.

Guidelines aren't of much use when moving the elbow of a label leader as the guidelines appear relative to the original position of the elbow when you actually need them relative to the arrow head. Rather than guidelines I've used the following code in the parameter script to make the hotspots 'snap' to the correct angles.
! Sticky hotspots, only check when editing
stickyTol = 0.05
if GLOB_CONTEXT >= 22 and GLOB_CONTEXT <= 28 then
	for i = 1 to maxLabels
		! Snap to vertical axis
		if elbowX < stickyTol and elbowX > -stickyTol then
			parameters elbowX = 0
		endif
		! Snap to horizontal axis
		if elbowY < stickyTol and elbowY > -stickyTol then
			parameters elbowY = 0
		endif
		! Snap to 45°
		if elbowX < elbowY + stickyTol and elbowX > elbowY - stickyTol then
			parameters elbowX = elbowY
		endif
	next i
endif
AC24 (7000 AUS FULL)| Windows 10 Pro | Intel Core i7-12700 @ 2.1GHz | 32GB RAM | NVidia T1000