vindicate Posted February 6 Posted February 6 (edited) Is there something that can help me extract the location(latitude-longitude) from the position marker? I have maybe 20-30 position marker in every dwg file. Edited February 6 by fuccaro Thread name was "I need help" Quote
fuccaro Posted February 6 Posted February 6 @vindicate Welcome in the forum! Please use relevant names when you start new threads. It will help people with similar problems to find their solution faster. Quote
vindicate Posted February 6 Author Posted February 6 11 minutes ago, fuccaro said: @vindicate Welcome in the forum! Please use relevant names when you start new threads. It will help people with similar problems to find their solution faster. Oh. Sorry. I am new here hehe Quote
vindicate Posted February 6 Author Posted February 6 I attached an example. I put manually the position markers because I need the coordinates(lat-long) on each of the marks. sample.dwg Quote
BIGAL Posted February 6 Posted February 6 You may need to be in CIV3D to export direct Lat Long, or else will export X Y and you need another program to convert to Lat Long, do you understand world zones for lat long conversion. Quote
Danielm103 Posted February 7 Posted February 7 entget ((-1 . <Entity name: 20484b4e3f0>) (0 . "POSITIONMARKER") (330 . <Entity name: 204e6d9e1f0>) (5 . "5B7") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100 . "AcDbGeoPositionMarker") (90 . 0) (10 3584.9 1434.64 0.0) (40 . 5.0) (1 . "") (40 . 2.5) (290 . 0) (280 . 0) (290 . 0)) Quote
vindicate Posted February 7 Author Posted February 7 3 hours ago, BIGAL said: You may need to be in CIV3D to export direct Lat Long, or else will export X Y and you need another program to convert to Lat Long, do you understand world zones for lat long conversion. oh i see. Thanks Quote
vindicate Posted February 7 Author Posted February 7 4 minutes ago, Danielm103 said: entget ((-1 . <Entity name: 20484b4e3f0>) (0 . "POSITIONMARKER") (330 . <Entity name: 204e6d9e1f0>) (5 . "5B7") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100 . "AcDbGeoPositionMarker") (90 . 0) (10 3584.9 1434.64 0.0) (40 . 5.0) (1 . "") (40 . 2.5) (290 . 0) (280 . 0) (290 . 0)) may I know how to use this? thanks Quote
1958 Posted February 7 Posted February 7 (defun c:11 (/) (setq ent (vlax-ename->vla-object (car (entsel))) lat (vla-get-latitude ent) lon (vla-get-longitude ent) ) (alert (strcat "Latitude = " lat "\nLongitude = " lon)) ) 3 Quote
Danielm103 Posted February 7 Posted February 7 21 minutes ago, vindicate said: may I know how to use this? thanks Sorry, I miss read it, ‘58s is a better approach 1 Quote
vindicate Posted February 7 Author Posted February 7 3 minutes ago, 1958 said: (defun c:11 (/) (setq ent (vlax-ename->vla-object (car (entsel))) lat (vla-get-latitude ent) lon (vla-get-longitude ent) ) (alert (strcat "Latitude = " lat "\nLongitude = " lon)) ) It works! Thanks on this. But is there anything that we can extract 2 or more position marker to text file or excel? Quote
mrharris78 Posted February 7 Posted February 7 Something like this: (defun C:POSM-TO-CSV ( / doc fil sel lst hdr ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vla-get-latitude x)(vla-get-longitude x)) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (car x) (cadr x))) lst)) (setq hdr (cons (list "<Latitude>" "<Longitude>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) Requires Lee Mac's WriteCSV 1 1 Quote
vindicate Posted February 7 Author Posted February 7 21 minutes ago, mrharris78 said: Something like this: (defun C:POSM-TO-CSV ( / doc fil sel lst hdr ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vla-get-latitude x)(vla-get-longitude x)) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (car x) (cadr x))) lst)) (setq hdr (cons (list "<Latitude>" "<Longitude>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) Requires Lee Mac's WriteCSV Wow! It works. This will do. Thanks a lot! Quote
BIGAL Posted February 8 Posted February 8 You can also write direct to Excel, how much do you know about lisp. Quote
vindicate Posted February 26 Author Posted February 26 On 2/7/2024 at 1:14 PM, mrharris78 said: Something like this: (defun C:POSM-TO-CSV ( / doc fil sel lst hdr ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vla-get-latitude x)(vla-get-longitude x)) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (car x) (cadr x))) lst)) (setq hdr (cons (list "<Latitude>" "<Longitude>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) Requires Lee Mac's WriteCSV do you have something that can also get the content text on each position marker together with the coordinates? Quote
vindicate Posted February 26 Author Posted February 26 like the numbers on each position marker Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.