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

GDL
About building parametric objects with GDL.

Modifying Zone marker - scale offset and rotation

Mathias Jonathan
Advocate

Hi!

 

I would like to modify the OOTB zone marker. I really like the possibility to have different position for the marker when using the 1/500, 1/100 or 1/200 scale whith the x and y offset.

 

The problem is that this offset is relative to the rotation of the view and not to an actual displacement in space:

If I offset the mark in my part to the right, and create a second view with a 90° rotation, the mark will end up at the top (or bottom) of the part.

I'd like the position to be fixed.

I've created a simple object (a square + text with positioning managed by a hot spot) that has the desired behavior.

I tried to modify the zone marker. The marker itself has the desired behavior, but the hot spot doesn't really work anymore... Can you help me?

 

 

Capture d’écran 2023-07-28 à 11.20.08.png

 

Capture d’écran 2023-07-28 à 11.19.13.png

What I tried:

 

	r = request ("View_Rotangle", "", _angleViewRot)

	hypothenuse=SQR((offsetX^2)+(offsetY^2))
	IF hypothenuse THEN 
		TEST2=(offsetX/hypothenuse)
	ELSE
		TEST2=0
	ENDIF

	IF posy>0 THEN
		alpha=ACS(TEST2)+_angleViewRot
	ELSE
		alpha=-ACS(TEST2)+_angleViewRot
	ENDIF
	
	offsetX =(cos(alpha)*hypothenuse)
	offsetY =(sin(alpha)*hypothenuse)

	ROT2 _angleViewRot

	
	hotspot2  0, 		offsetY,	unIDoffset, "offsetX_50", 1+128				:	unIDoffset = unIDoffset + 1
	hotspot2 -1, 		offsetY,	unIDoffset, "offsetX_50", 3					:	unIDoffset = unIDoffset + 1
	hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetX_50", 2					:	unIDoffset = unIDoffset + 1
	hotspot2 offsetX,  	0, 			unIDoffset, "offsetY_50", 1+128				:	unIDoffset = unIDoffset + 1
	hotspot2 offsetX, 	-1, 		unIDoffset, "offsetY_50", 3					:	unIDoffset = unIDoffset + 1
	hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetY_50", 2					:	unIDoffset = unIDoffset + 1


	DEL 1

 

What was before:

	if GLOB_SCALE < 100 then

		offsetX					= offsetX_50
		offsetY					= offsetY_50

		hotspot2  0, 		offsetY,	unIDoffset, "offsetX_50", 1+128				:	unIDoffset = unIDoffset + 1
		hotspot2 -1, 		offsetY,	unIDoffset, "offsetX_50", 3					:	unIDoffset = unIDoffset + 1
		hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetX_50", 2					:	unIDoffset = unIDoffset + 1
		hotspot2 offsetX,  	0, 			unIDoffset, "offsetY_50", 1+128				:	unIDoffset = unIDoffset + 1
		hotspot2 offsetX, 	-1, 		unIDoffset, "offsetY_50", 3					:	unIDoffset = unIDoffset + 1
		hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetY_50", 2					:	unIDoffset = unIDoffset + 1
1 REPLY 1
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

there is an option for zone stamps to rotate with the model:

PeterBaksa_0-1690963121853.png

If that doesn't solve your problem:

hotspots work in the transformed coordinate system, you don't need to recalculate their positions.

! show model x, y, axes
line2 0,0,1,0
line2 0,0,0,1

r = request ("View_Rotangle", "", _angleViewRot)

! undo view rotation
ROT2 -_angleViewRot

! define hotspots in rotated coordinate system
offsetX					= offsetX_50
offsetY					= offsetY_50
unIDoffset				= 1

hotspot2  0, 		offsetY,	unIDoffset, "offsetX_50", 1+128				:	unIDoffset = unIDoffset + 1
hotspot2 -1, 		offsetY,	unIDoffset, "offsetX_50", 3					:	unIDoffset = unIDoffset + 1
hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetX_50", 2					:	unIDoffset = unIDoffset + 1
hotspot2 offsetX,  	0, 			unIDoffset, "offsetY_50", 1+128				:	unIDoffset = unIDoffset + 1
hotspot2 offsetX, 	-1, 		unIDoffset, "offsetY_50", 3					:	unIDoffset = unIDoffset + 1
hotspot2 offsetX, 	offsetY,	unIDoffset, "offsetY_50", 2					:	unIDoffset = unIDoffset + 1

! draw in same coordinate system
line2 0,0, offsetX, offsetY

 

 Zone stamp positioning information is not available for GDL, you can't achieve a solution which works with all possible combination of settings.

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

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!