vindicate Posted February 6 Share 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 Link to comment Share on other sites More sharing options...
hosneyalaa Posted February 6 Share Posted February 6 Can you attached example drawing Quote Link to comment Share on other sites More sharing options...
fuccaro Posted February 6 Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 6 Author Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 6 Author Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted February 6 Share 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 Link to comment Share on other sites More sharing options...
Danielm103 Posted February 7 Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 7 Author Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 7 Author Share 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 Link to comment Share on other sites More sharing options...
1958 Posted February 7 Share 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 Link to comment Share on other sites More sharing options...
Danielm103 Posted February 7 Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 7 Author Share 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 Link to comment Share on other sites More sharing options...
mrharris78 Posted February 7 Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 7 Author Share 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 Link to comment Share on other sites More sharing options...
BIGAL Posted February 8 Share Posted February 8 You can also write direct to Excel, how much do you know about lisp. Quote Link to comment Share on other sites More sharing options...
vindicate Posted February 26 Author Share 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 Link to comment Share on other sites More sharing options...
vindicate Posted February 26 Author Share Posted February 26 like the numbers on each position marker Quote Link to comment Share on other sites More sharing options...
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.