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

Graphic Toggling with Hotpsots

Anonymous
Not applicable
I am trying to create a graphic toggle switch with Hotspots. Basically, I would like to drag a hotspot away from it's original position, release it, make changes to the object based on the dimensions of where it was released, and then return the hotspot to its original position. Is this possible?

Screen Shot 2016-05-23 at 10.07.22 AM.png
4 REPLIES 4
If GLOB_MODPAR_NAME = "hotspot_param" then
if hotspot_param > .0001 then final_dist = hotspot_param
parameters final_dist=final_dist
if hotspot_param > .0001 then hotspot_param = 0
parameters hotspot_param = hotspot_param
endif


that should work in the master script.
Anonymous
Not applicable
I´m using this (based on one object made by Heimo Mooslechner):

A. PARAMETER SCRIPT:
VALUES "fig" "None", "Circle", "Ellipse 2:1", "Box", "Rectangle 2:1"
VALUES "fig_Switch" 0.00, 0.05, 0.10, 0.15, 0.20
IF fig_Switch = 0.00 THEN fig = "None"
IF fig_Switch = 0.05 THEN fig = "Circle"
IF fig_Switch = 0.10 THEN fig = "Ellipse 2:1"
IF fig_Switch = 0.15 THEN fig = "Box"
IF fig_Switch = 0.20 THEN fig = "Rectangle 2:1"

B. 2D SCRIPT:
!!******* BORDER STYLE *******
!! for Hotspot position coordinates
h41x = 0
h41y = -dif*2.75

HOTSPOT2 h41x, h41y, Uid, fig_Switch, 1+128 : Uid = Uid+1 ! x base
HOTSPOT2 h41x, h41y, Uid, fig_Switch, 2 : Uid = Uid+1 ! x move
HOTSPOT2 -1, h41y, Uid, fig_Switch, 3 : Uid = Uid+10 ! x ref

!! for Hotspot associated TEXT position
ADD2 h41x+tp_x/2, h41y+tp_x/2
STYLE InterfaceText
PEN Pen_Text
IF help_UI_Switch THEN TEXT2 0, 0, "BORDER Style (None/Circle/Ellipse 2:1/Box/Rectangle 2:1)= " + fig
IF fig_Switch = 0.00 THEN fig = "None"
IF fig_Switch >0+EPS AND fig_Switch <= 0.05 THEN fig = "Circle"
IF fig_Switch >=0.06 AND fig_Switch <= 0.10 THEN fig = "Ellipse 2:1"
IF fig_Switch >=0.11 AND fig_Switch <= 0.15 THEN fig = "Box"
IF fig_Switch >=0.16 AND fig_Switch <= 0.20 THEN fig = "Rectangle 2:1"
DEL 1
!!******* BORDER STYLE *******
Anonymous
Not applicable
Thank you both for your reply.

Seneca - what you are proposing seems like a winner, but I can't get it to work.

Andro - I can get your method to work beautifully in one axis. However, ideally, I would like to get it to function on both the x and y axis simultaneously.

I have attached 3 different objects, TESTER, TESTER 01 and TESTER 02.

TESTER roughly works as I would like it, except for one vital piece. It does not return the hotspot back to the origin.

TESTER 01 is built off of Andro's method, and works in the X axis only.

TESTER 02 is attempting to use Seneca's method, but doesn't work.

I can post the code snippets if that works better.
After seeing what you were trying to do I just had to modify the code a little.

master script:


UnIDtest = 1


If GLOB_MODPAR_NAME = "cornerLX1" or GLOB_MODPAR_NAME = "cornerLY1" then 
	cornerLX1 = cornerLX1
	cornerLY1 = cornerLY1
else
	if cornerLX1 > .0001 or cornerLX1 < -.0001 then 
		cornerLX1 = 0
		parameters cornerLX1 = cornerLX1 
	endif
	if cornerLY1 > .0001 or cornerLY1 < -.0001 then 
		cornerLY1 = 0
		parameters cornerLY1 = cornerLY1 
	endif
endif 



	if cornerLX1 > .0001 then 
		IF cornerLX1 <= 2 THEN figx = 1
		IF cornerLX1 >2 THEN figX = 2
		IF cornerLX1 >5 THEN figX = 3
		IF cornerLX1 >8 THEN figX = 4
		IF cornerLX1 >11 THEN figX = 5
		parameters figx = figx
	endif



	if CornerLY1 > .0001 then 
		IF cornerLY1 <= 1 THEN figy = 1
		IF cornerLY1 > 1 THEN figy = 2
		IF cornerLY1 > 3 THEN figy = 3
		IF cornerLY1 > 5 THEN figy = 4
		IF cornerLY1 > 7 THEN figy = 5
		parameters figy = figy 
	endif

2d script:

!!******* HOTSPOT CONTROL ******* 


		!! X Dimension hotspots
		HOTSPOT2 0, cornerLY1, UnIDtest, cornerLX1, 1+128 : UnIDtest = UnIDtest + 1
		HOTSPOT2 -1, cornerLY1, UnIDtest, cornerLX1, 3 : UnIDtest = UnIDtest + 1
		HOTSPOT2 cornerLX1, cornerLY1, UnIDtest, cornerLX1, 2 : UnIDtest = UnIDtest + 1

		!! Y dimension hotspots
		HOTSPOT2 cornerLX1, 0, UnIDtest, cornerLY1, 1+128 : UnIDtest = UnIDtest + 1
		HOTSPOT2 cornerLX1, -1, UnIDtest, cornerLY1, 3 : UnIDtest = UnIDtest + 1
		HOTSPOT2 cornerLX1, cornerLY1, UnIDtest, cornerLY1, 2 : UnIDtest = UnIDtest + 1




!!******* HOTSPOT CONTROL ******* 

	
pen     penAttribute_1
fill fillAttribute_1

for j = 1 to figy
	for i = 1 to figX

	poly2_b{5}       5,      3,      1,      3, penAttribute_1, penAttribute_2, 
			  0, 0, 1, 0, 0, 1, 0, 
			  0, 0,     33, 
			  0, 1,     33, 
			  2, 1,     33, 
			  2, 0,     33, 
			  0, 0,     33
	
	add2 3,0
	next i
del figx
add2 0, 2
next j

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!