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

GDL: AutoCAD Block Hotspot

Lingwisyer
Guru
Hi all,

Within the translator settings for imported a dwg/dxf block, there is an option to convert Points to Hotspots. The problem here is that I am wanting to modify the 2D script of the imported block but when I do, I lose the Hotspot created by this Point. There is no Hotspot command in the script created by the translator so I am a bit confused at how it is being generated... Somehow, the 2D script is generating a Hotspot in both 2D and 3D.
!!! Precaution against A == 0 or B == 0
BOXMAX = MAX(ABS(A), ABS(B), ABS(ZZYZX))
AA = A
IF ABS(AA) < 1E-5 THEN
	AA = BOXMAX
ENDIF
BB = B
IF ABS(BB) < 1E-5 THEN
	BB = BOXMAX
ENDIF
AA = AA/0.111238
BB = BB/0.251900
MUL2 AA, BB
det = TR3D_1_1 * TR3D_2_2 + TR3D_1_2 * TR3D_2_1
xs = sqr (TR3D_1_1 * TR3D_1_1 + TR3D_2_1 * TR3D_2_1 + TR3D_3_1 * TR3D_3_1)
ys = sqr (TR3D_1_2 * TR3D_1_2 + TR3D_2_2 * TR3D_2_2 + TR3D_3_2 * TR3D_3_2)
if (det < 0.0) then
	xs = -xs
endif
xr = 0
yr = 0
if abs (xs) > 1e-5 then
	xr = TR3D_1_1 / xs
	yr = TR3D_2_1 / xs
else
	if abs (ys) > 1e-5 then
		xr =  TR3D_2_2 / ys
		yr = -TR3D_1_2 / ys
	else
		xr = 1
		yr = 0
	endif
endif
!!! Calculate atan2 (yr, xr)
if abs (xr) < 1e-5 then
	if yr > 1e-5 then
		angle = 90
	else
		angle = 270
	endif
else
	angle = atn (abs (yr / xr))
	if xr < -1e-5 then
		if yr < -1e-5 then
			angle = angle + 180
		else
			angle = 180 - angle
		endif
	else
		if yr < -1e-5 then
			angle = 360 - angle
		endif
	endif
endif
mul2 xs, ys
rot2 angle
FRAGMENT2 ALL, 0


Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
4 REPLIES 4
Podolsky
Ace
I think conversion of AutoCAD points into hotspots works only when you open you DWG drawing on floor plan (or as embedded drawing). Conversion of DWG into GDL probably uses different settings. It can be two different algorithms involved.
Try to open DWG on the floor plan and after save it as GDL object.
Lingwisyer
Guru
Podolsky, the AutoCAD block was already converted into an object that had a hotspot(s) so the translator has done what it says it would. The script for said object did not contain any Hotspot commands and any modification to it resulted in the hotspot(s) disappearing.



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
Podolsky
Ace
Please upload the file. I want to see the script and DWG file too. It sounds very strange.
Lingwisyer
Guru
Script is in the original post. No idea what file/s it was anymore... even if I knew, wouldn't be able to share anything other than the block anyway...

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