12. Hotspots, graphical editing

 

  Example file for this lesson

The fastest way to quickly edit the size of a GDL object is to use the hotspots: positioning, snapping, resizing, dimensioning, are a lot easier that way, and work in 2D and 3D as well, including section views.
There are 2 basic hotspot types:

  • scripted hotspots (by the developer)
  • in lack of the above, ARCHICAD creates automatic hotspots to form a bounding box around the object

Both can be scripted via the HOTSPOT/HOTSPOT2 commands.
In case the generated automatic hotspots are not fitting into your design, time to script new ones. If there is at least one scripted hotspot in a script, ARCHICAD does not create its own.
The default positioning anchor point of an object is always the first hotspot in the script.

Identification
To support associative dimensioning and annotation, every hotspot must have a unique ID, which is representing its topological information: if a hotspot with a fix ID is placed to one corner of a table, it is going to mean that corner, no matter how the sizes change. ARCHICAD will regard and store this ID when attaching dimensions to that point, so the dimension will follow any movement of the identified “coordinate” automatically.
Example of a simple, but identified hotspot (used for moving or snapping):

! in 3D script
unID = 7
hotspot A/2, B/2, ZZYZX/2, unID

! in 2D script
unID = 23
hotspot2 A/2, B/2, unID

Snapping and highlighting
Sometimes hotspots are not enough when it comes to aligning objects to one another. Status lines and arcs can be created to support the snapping feature (these status lines are invisible unless the mouse is positioned above them). Unique ID is equally important in their cases as well.
HOTLINE commands, very similar to LINE2 and LIN_:

hotline x1, y1, z1, x2, y2, z2, unID
hotline2 x1, y1, x2, y2, unID

HOTARC commands, similar to ARC2 and ARC:

hotarc r, alpha, beta, unID
hotarc2 x, y, r, startangle, endangle, unID

Editing with HOTSPOTS
The function of a scripted hotspot can be extended: a hotspot can have associated parameters (length, angle), so the value of the attached parameter can be edited via the hotspot.
The [optional parameter] section of the command is used in these cases:

hotspot x, y, z [, unID [, paramReference [, flags [, displayParam [, "customDescription"]]]]]
hotspot2 x, y [, unID [, paramReference [, flags [, displayParam [, "customDescription"]]]]]

The optional parameters may vary according to the editing purpose of the hotspot.

Generic Flags
Every hotspot is customized for a function using flags. This function can be the role the hotspot takes on in the editing geometry, or it can be a modifier of a function.
The modifier flags are the following:

  • +128 : the point is hidden from the user (suitable for base and moving hotspots, the reference hotspot is always hidden)
  • +256 : base point can be converted into editable hotspot
  • +512 : change direction for 2D angle hotspot
  • +1024 : use paramReference value as meters in paper space

Displaying custom parameters in tracker
With the displayParam parameter of the commands there is the possibility to represent a parameter ("A" in example) connected to the edited parameter ("halfA" in example) in the Tracker, and adding a customized description to it:

hotspot2 0,	0, _unID, halfA, 1+128	!BASE (hidden)
_unID = _unID + 1
	
hotspot2 -1,	0, _unID, halfA, 3	!REFERENCE
_unID = _unID + 1
	
hotspot2 halfA,	0, _unID, halfA, 2, A, `Size A for reference`	!MOVING hotspot for "halfA", representing "A" with custom description for Tracker
_unID = _unID + 1

Meanwhile, in parameter script you must connect the edited and represented parameters:

if GLOB_MODPAR_NAME = "halfA" then
	A = 2 * halfA
	parameters A = A
else
	halfA = A / 2
	parameters halfA = halfA
endif

Editing length/distance parameters
Linear length editing is like moving along a vector defined by 3 parameters. All 3 are used by hotspot commands, with distinctive identification (flags):

  • 1 – base hotspot: this is point zero, the starting point
  • 2 – moving hotspot: the distance between this and the base hotspot will define the value of the length type parameter attached
  • 3 – reference hotspot: the vector defined by the base and moving hotspot needs a reference point on the same line to set positive and negative directions (always hidden)

GraphEd_hotspotLength

Example:
editing “A” length type parameter in 2D:

unID = 1
hotspot2 0, 0, unID, A, 1+256		!BASE (editable)
unID = unID + 1
hotspot2 -1, 0, unID, A, 3		!REFERENCE
unID = unID + 1
hotspot2 A, 0, unID, A, 2		!MOVING
unID = unID + 1

If 2 length type hotpots have the same moving hotspot, they can be edited the same time with a common hotspot. In the next example, “pointDistX” and “pointDistY” are the coordinates of a moving point in 2D space:

! Top X
hotspot2 0, pointDistY, unID, pointDistX, 1+128		!BASE (hidden)
unID = unID + 1
hotspot2 -1, pointDistY, unID, pointDistX, 3		!REFERENCE
unID = unID + 1
hotspot2 pointDistX, pointDistY, unID, pointDistX, 2	!MOVING
unID = unID + 1

! Top Y
hotspot2 pointDistX, 0, unID, pointDistY, 1+128		!BASE (hidden)
unID = unID + 1
hotspot2 pointDistX, -1, unID, pointDistY, 3		!REFERENCE
unID = unID + 1
hotspot2 pointDistX, pointDistY, unID, pointDistY, 2	!MOVING
unID = unID + 1

For more examples and explanations, visit the Graphical Editing Using Hotspots chapter of the GDL Reference Guide.

Editing angle parameters
To edit an angle parameter in 2D, the circle of possible movement needs to be defined first (center and starting point), then the position of the moving hotspot on the arc segment.
The default direction of the movement is counter-clockwise. This can be changed using the 512 additional flag.

GDL_Basics_HotspotEditing_Angle

Example:
editing “ang” angle type parameter in 2D, “r” is point radius:

! --------------------------------------------------------------------------------
! Center
! --------------------------------------------------------------------------------
hotspot2 0, 0, unID, ang, 6     : unID = unID + 1

! --------------------------------------------------------------------------------
! Base
! --------------------------------------------------------------------------------
hotspot2 r, 0, unID, ang, 4     : unID = unID + 1

! --------------------------------------------------------------------------------
! Moving
! --------------------------------------------------------------------------------
hotspot2 r * COS(ang), r * SIN(ang), unID, ang, 5     : unID = unID + 1

In 3D, an additional reference point is needed to define the axis of the rotation (a vector perpendicular to the plane of the circle, a going through the center of the circle and the reference hotspot).
These functions are set in the commands using the following flags:

  • 4 – base hotspot positioned on the circle
  • 5 – moving hotspot, positioned on the end of the arc starting from the base point
  • 6 – center of the circle (always hidden)
  • 7 – 3D reference point for axis vector (always hidden)

GDL_Basics_HotspotEditing_3DAngle

Example:
editing “ang” angle type parameter in 3D, “r” is point radius:

! --------------------------------------------------------------------------------
! Center
! --------------------------------------------------------------------------------
hotspot 0, 0, 0, unID, ang, 6     : unID = unID + 1

! --------------------------------------------------------------------------------
! Base
! --------------------------------------------------------------------------------
hotspot r, 0, 0, unID, ang, 4     : unID = unID + 1

! --------------------------------------------------------------------------------
! Moving
! --------------------------------------------------------------------------------
hotspot r * COS(ang), r * SIN(ang), 0, unID, ang, 5     : unID = unID + 1

! --------------------------------------------------------------------------------
! Reference
! --------------------------------------------------------------------------------
hotspot 0, 0, 1, unID, ang, 7     : unID = unID + 1