TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: schueler8 on November 19, 2020, 02:08:34 PM
-
Not even sure if this is something that can be done, but what im looking for is a lsp routine that i can set in a tool palette that will set the coordinate system in your drawing settings. we use 3 or 4 different coordinate systems and i would like the user to just click on a tool in the palette that will set this for them, without them having to do it manually.
Thanks in advance.
-
This is a sample of what I use to get this to work. I hope this helps.
(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) "1500000" "ZOOM" "EXTENTS" "_.ERASE" (ssget "x" '((0 . "CIRCLE"))) "" "_GEOMAP" "HYBRID")
(princ)
)
-
Here's a small lisp that can do this.
(defun setcoordsys
(cs
/ C3D C3DDOC SETTINGS
) (if vlax
-user
-product
-key
(vlax-user-product-key)
)
)
C3D
(vl
-registry
-read C3D
"Release") 1
"."
C3D
)
)
(strcat "AeccXUiLand.AeccApplication." C3D
) )
)
'unitzonesettings
)
'coordinatesystem
)
)
)
Make sure t gets loaded at drawing startup. Add as many calls to it on a palette as needed, for instance this will set the Coordinate System to "California Zone II, US FT (or use HARN/CA.CA-IIF)": (setcoordsys "CAHP-IIF")
-
Thanks for sharing Jeff!