Design forum
cancel
Showing results for 
Search instead for 
Did you mean: 

GDL: AutoCAD Block Hotspot

Lingwisyer
Virtuoso
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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Win10 | R5 2600 | 16GB | GTX1660
4 REPLIES 4

Podolsky
Mentor
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
Virtuoso
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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Win10 | R5 2600 | 16GB | GTX1660

Podolsky
Mentor
Please upload the file. I want to see the script and DWG file too. It sounds very strange.

Lingwisyer
Virtuoso
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...
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Win10 | R5 2600 | 16GB | GTX1660

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!