We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

Rotate 2D hotspots code into 3D?

GDL Enthusiast
Enthusiast

Hi,

 

Is it possible to copy 2D hotspots from the 2D script, paste them into the 3D script and add a ROTx beforehand to bring them into the z-axis?

 

One of my objects is rotated in 3D by 90 degrees but the hotspots remain on the x,y plane when viewed in 3D. My hope is that something like a simple rotate command could apply to 2D hotspots as well? The complexity of HOTSPOT x,y,z is way high! 

 

Many thanks, Matt

3 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
scottjm
Advisor

Unfortunately no. 
Hotspots in 3D have to be coded with HOTSPOT x,y,z. They really just follow the same logic, just with the added z coord. 
You may however be able to do a rotx 90 to rotate your working plane and then just draw your hotspots with a 0 z coord. 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

View solution in original post

Solution
rudl
Contributor

Don't think that that works. Hotspots don't take the transformation stack into account i think.

On the plus side after messing with the 3D hotspots once you automatically get 2D ones aswell.

Here is my code which may make it easier since you only have to pass x,y,z to to the subroutine.

!==========================================================
! creates Hotspots in 3D
!----------------------------------------------------------
!Input paramater: 
!	mypoint[ti][1], mypoint[ti][2],mypoint[ti][3]
!Output parameter : 
!	mypoint[ti][1], mypoint[ti][2],mypoint[ti][3]
!Remark:
!	set ti before calling sub
! 	Hotspots need to work directly on the parameter, variables don't seem to work
!==========================================================

"h_xyz":

!HOTSPOT for points_h[ti]
!HOTSPOT for X:

		id_hs = id_hs+1
	!Vector
	HOTSPOT -1,points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1],3
		id_hs = id_hs+1
	!Base
	HOTSPOT 0,points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1], 1+128 !Invisible
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1], 2
		id_hs = id_hs+1 

!HOTSPOT for Y:

	!Vector
	HOTSPOT points_s[ti][1],-1,points_s[ti][3],
		id_hs,points_s[ti][2],3
		id_hs = id_hs+1
	!Base
	HOTSPOT points_s[ti][1],0,points_s[ti][3],
		id_hs,points_s[ti][2],1+128
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs,points_s[ti][2],2
		id_hs = id_hs+1

!HOTSPOT for Z:

	!Vector
	HOTSPOT points_s[ti][1],points_s[ti][2],-1,
		id_hs,points_s[ti][3],3
		id_hs = id_hs+1
	!Base
	HOTSPOT points_s[ti][1],points_s[ti][2],0,
		id_hs,points_s[ti][3],1+128
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs,points_s[ti][3],2
		id_hs = id_hs+1 

RETURN

 

 

View solution in original post

Solution
Lingwisyer
Guru

The amount if trig I sometimes need because of the transformation stack being ignored is such a pain...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

View solution in original post

7 REPLIES 7
Solution
scottjm
Advisor

Unfortunately no. 
Hotspots in 3D have to be coded with HOTSPOT x,y,z. They really just follow the same logic, just with the added z coord. 
You may however be able to do a rotx 90 to rotate your working plane and then just draw your hotspots with a 0 z coord. 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
Solution
rudl
Contributor

Don't think that that works. Hotspots don't take the transformation stack into account i think.

On the plus side after messing with the 3D hotspots once you automatically get 2D ones aswell.

Here is my code which may make it easier since you only have to pass x,y,z to to the subroutine.

!==========================================================
! creates Hotspots in 3D
!----------------------------------------------------------
!Input paramater: 
!	mypoint[ti][1], mypoint[ti][2],mypoint[ti][3]
!Output parameter : 
!	mypoint[ti][1], mypoint[ti][2],mypoint[ti][3]
!Remark:
!	set ti before calling sub
! 	Hotspots need to work directly on the parameter, variables don't seem to work
!==========================================================

"h_xyz":

!HOTSPOT for points_h[ti]
!HOTSPOT for X:

		id_hs = id_hs+1
	!Vector
	HOTSPOT -1,points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1],3
		id_hs = id_hs+1
	!Base
	HOTSPOT 0,points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1], 1+128 !Invisible
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs, points_s[ti][1], 2
		id_hs = id_hs+1 

!HOTSPOT for Y:

	!Vector
	HOTSPOT points_s[ti][1],-1,points_s[ti][3],
		id_hs,points_s[ti][2],3
		id_hs = id_hs+1
	!Base
	HOTSPOT points_s[ti][1],0,points_s[ti][3],
		id_hs,points_s[ti][2],1+128
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs,points_s[ti][2],2
		id_hs = id_hs+1

!HOTSPOT for Z:

	!Vector
	HOTSPOT points_s[ti][1],points_s[ti][2],-1,
		id_hs,points_s[ti][3],3
		id_hs = id_hs+1
	!Base
	HOTSPOT points_s[ti][1],points_s[ti][2],0,
		id_hs,points_s[ti][3],1+128
		id_hs = id_hs+1 
	!Move
	HOTSPOT points_s[ti][1],points_s[ti][2],points_s[ti][3],
		id_hs,points_s[ti][3],2
		id_hs = id_hs+1 

RETURN

 

 

Solution
Lingwisyer
Guru

The amount if trig I sometimes need because of the transformation stack being ignored is such a pain...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Thank you Scott, that saved me a lot of time! Best regards, Matt

Hi Rudl,

 

Okay that is cool! I didn't know the 3D Hotspots also produce the 2D Hotspots, thank you for that info, two birds, one stone! Best regards, Matt

Soooo complex right!!! 

Peter Baksa
Graphisoft
Graphisoft

Hi, hotspots should work with the transformation stack as long as the axes remain unit length.

 

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest