Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I created a function that retrieves Latitude and Longitude from Drawing Properties. Now, I need them converted to X and Y coordinates, but I cannot think of any efficient way to do this without creating an object then having to delete it. I have assigned a coordinate system to my drawing. Any ideas?! (Running AutoCAD 2016, NOT Civil3D).
Any help is appreciated.
Best,
~DD
(defun c:TEST ( / Lat Lon tmpCnt tmpStr1 tmpStr2 cord) (vl-load-com) (setq acadObject (vlax-get-acad-object)) (setq acadDocument (vla-get-ActiveDocument acadObject)) (setq dProps (vla-get-SummaryInfo acadDocument)) (setq tmpCnt 0) (repeat (vla-numcustominfo dProps) (vla-getcustombyindex dProps tmpCnt 'tmpStr1 'tmpStr2) (cond ((eq tmpStr1 "Latitude") (setq Lat tmpStr2)) ((eq tmpStr1 "Longitude") (setq Lon tmpStr2)) );cond (setq tmpCnt (1+ tmpCnt)) );repeat (if (and Lat Lon) (setq cord (XYfrom Lat Lon)) (prompt "\nLatitude or Longitude Missing.")) (vlax-release-object acadObject) (vlax-release-object acadDocument) (vlax-release-object dProps) (princ) );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;vvvvvvvvvvvvvvvv;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun XYfrom (Lat Lon / ) ;;Need help here! To convert to X Y coordinates (convert lat) / (convert Lon) does not exist lol (setq xy (list (convert Lat) (convert Lon))) (princ xy)
);defun
Solved! Go to Solution.