BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Piece of Cake? Hotspot2 for Angle & Radius of Arc

Anonymous
Not applicable
Hi All!
This forum is proving to be incredibly helpful,
so here I go once again...

As my Trigonometry is close to non-existent, I need some help
with finishing off this attached Slice-of-Cake object.
I'm sure it actually is a piece of cake... 🙂

1. I need to create a SINGLE HOTSPOT2 that will control both
the RADIUS & the ANGLE of the given ARC2.
In the current object I only have control of the Angle,
as the key code was pretty much copy-pasted from Fabrizio Diodati's
reply in this post:
http://archicad-talk.graphisoft.com/viewtopic.php?p=2533&highlight=hotspots+angle#2533

2. Also, due to the pasted source code, I need to rotate the
start angle of the functions & ARC2 back to 0 degrees.
They currently are set to start at 90 degrees which is NOT what I need.



Here is a the 2D script code for quick reference:

!******************* READ THE PARAMETER SCRIPT FIRST **********************!

PEN mpcol
SET LINE_TYPE ltm


!******************* DEFINE ANGLE (angl) BY HOTSPOTS **********************!

HOTSPOT2 0, 0, 1, angl, 6 ! This is the CENTER
HOTSPOT2 0, rad, 2, angl, 4 ! This is the REFRNC
HOTSPOT2 rad*COS(angl+90), rad*SIN(angl+90), 3, angl, 5 ! This is the MOVING


!******************** DRAW CENTER HS, LINES & ARC ***********************!

HOTSPOT2 0, 0 !
LINE2 0, 0, rad*COS(angl+90), rad*SIN(angl+90)!
LINE2 0, 0, 0 , rad !
ARC2 0, 0, rad, alpha, beta !


! NOTES ON DEFINING THE ANGLE BY FABRIZIO DIODATI !
! -------------------------------------------------------------------------!
! The first hotspot (type 6) must describe the coordinates of the center. !
! The second one (type 4) is the reference(*), that means the point !
! from which the values start (you are looking for a reference !
! that lies on 90° that means it has X=0 and Y=radius). !
! The last one, the moving hotspot (type 5) must run around the circle !
! (which radius is indicated by the parameter R in my example) !
! so you have to use COS & SIN to describe its position. !
! In your case (you are looking for a reference that lies on 90°) !
! you have to add 90° to the angle value). !
! !
! * Is HOTSPOT 4 a "BASE" or "REFERENCE"? One of these must be wrong! !
! !
! !
! NOTES ON HOSTPOT2 FLAGS FOR LENGTH & ANGLE !
! (From GDL Reference Manual page 165) !
! -------------------------------------------------------------------------!
! 1: length type editing, base hotspot !
! 2: length type editing, moving hotspot !
! 3: length type editing, reference hotspot (always hidden) !
! !
! 4: angle type editing, base hotspot !
! 5: angle type editing, moving hotspot !
! 6: angle type editing, center of angle (always hidden) !
! 7: angle type editing, reference hotspot (always hidden) !
! !
! attribute can be a combination of the following values or zero: !
! 128: hide hotspot (meaningful for types: 1,2,4,5) !
! 256: editable base hotspot (for types: 1,4) !
! 512: reverse the angle in 2D (for type 6) !

Thanks -
Gil
(PS-Object added in next post)

Slice of Cake.jpg
3 REPLIES 3
Anonymous
Not applicable
And the half baked object...
Anonymous
Not applicable
You can not mix length and angle for a same hotspot.
In result, only the first hotspot (declared in tab parameters) will be active.

You could achieve this with x, y coords of the hotspot. I would avoid this (trigonometric calculations needed).
Better to script two hotspots, with distinct locations.
uid = 1    ! first unique identifier

!!! ---------- radius ----------
hotspot2  0             ,  0             , uid, rad, 1 : uid = uid+1    ! base (anchor)         
hotspot2 -rad*cos(ang/2), -rad*sin(ang/2), uid, rad, 3 : uid = uid+1    ! ref 
hotspot2  rad*cos(ang/2),  rad*sin(ang/2), uid, rad, 2 : uid = uid+1    ! moving

!!! ---------- angle ---------- 
hotspot2 0           , 0           , uid, ang, 6     : uid = uid+1     ! centre
hotspot2 rad         , 0           , uid, ang, 4+256 : uid = uid+1     ! base (editable)    
hotspot2 rad*cos(ang), rad*sin(ang), uid, ang, 5     : uid = uid+1     ! moving
Anonymous
Not applicable
ThanX!
I pretty much ended up doing something very similar.
🙂
Gil
Learn and get certified!