TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MSTG007 on July 13, 2020, 07:53:30 AM
-
I am having a hard time trying to create a basic macro or routine that can zoom to a center of a georeferenced point.
How can I get the location of the georeferenced point? I would like to be able to set the coordinate zone then zoom to the center of it.
(vl-load-com)
(defun c:test ()
(setq p (getPositionMarkerCoords))
(command "zoom" "center" (getPositionMarkerCoords) "200000")
(princ)
)
(defun getPositionMarkerCoords ( / ad s ds ts rp le ln p)
(setq ad (_GetAeccDocument))
(setq s (vlax-get-property ad 'Settings))
(setq ds (vlax-get-property s 'DrawingSettings))
(setq ts (vlax-get-property ds 'TransformationSettings))
(setq rp (vlax-get-property ts 'ReferencePoint))
(setq le (vlax-get-property rp 'LocalEasting))
(setq ln (vlax-get-property rp 'LocalNorthing))
(setq p (list le ln))
)
-
Your getPositionMarkerCoords function works, just replace:
(command "zoom" "center" (getPositionMarkerCoords) "200000")
with
(vla-zoomcenter (vlax-get-acad-object) (vlax-3d-point p) 20000)
in your c:test.
-
Thanks for the input, so visual lisp was the key for the zoom function. lol Not sure, what I did now, I can't get it to work lol. Ill hopefully figure it out.
Again, thanks
-
You're welcome. Good luck & just come back with an error message in case you're still stuck.
-
My wonderful error.
test ; error: no function definition: _GETAECCDOCUMENT
-
Ok. I think I got it figured out. Thought I would share. I could not get the zoom function to work so I improvised with a circle.
(vl-load-com)
(defun _GetAeccDocument ()
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
C3D (vl-registry-read C3D "Release")
C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1)))
C3D (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D)))
(vlax-get-property C3D 'ActiveDocument)
)
(defun getPositionMarkerCoords ( / ad s ds ts rp le ln p)
(setq ad (_GetAeccDocument))
(setq s (vlax-get-property ad 'Settings))
(setq ds (vlax-get-property s 'DrawingSettings))
(setq ts (vlax-get-property ds 'TransformationSettings))
(setq rp (vlax-get-property ts 'ReferencePoint))
(setq le (vlax-get-property rp 'LocalEasting))
(setq ln (vlax-get-property rp 'LocalNorthing))
(setq p (list le ln))
)
(defun c:zoomtogeolocation ()
(setq p (getPositionMarkerCoords))
(command "_.CIRCLE" (getPositionMarkerCoords) "2000000" "ZOOM" "EXTENTS" "_.ERASE" (ssget "x" '((0 . "CIRCLE"))) "" "_GEOMAP" "HYBRID")
(princ)
)