Hi all,
I would like to have a lisp for street views by clicking on a point in a Autocad Dwg file. Please help. Thanks in advance.
Bela
|
Hi all,
I would like to have a lisp for street views by clicking on a point in a Autocad Dwg file. Please help. Thanks in advance.
Bela
Yes can be done but need like CIV3d as want co-ordinates lat/long of a point, it is possible to open a google maps and zoom to a spot, I have a working example somewhere will try to find.
Google open internet page autocad
See code below. It takes a picked point in a drawing and converts it to latitude and longitude and launches google map in a Chrome browser and takes you to the picked point in google maps. It doesn't go to Street View but once you are in google maps you can easily get the street view.
This only works with Civil 3d or Map not plain AutoCAD. If you need something for plain AutoCAD maybe the drawing coordinates can be converted to latitude and longitude.
Code:;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/label-lat-long/td-p/3039742 (defun c:go2googlemap (/ as_cor pkpt ll lat lon desc app urlg2 ) ;(initerr) (setq as_cor (ade_projgetwscode)) (if (/= "" as_cor) ;checks for an assigned coordinate system (progn (ade_projsetsrc as_cor) (ade_projsetdest "LL84") ; uses lat/lon with no datum change as needed (while (not (setq pkpt (getpoint "\nPick Desired Point: ")))) (progn (setq ll (ade_projptforward pkpt)) (setq lat (car ll)) (setq lon (car (cdr ll))) (setq desc (ade_projgetinfo "LL84" "description")) (print (strcat "Lat: " (rtos lat 2 6) "\n Long:"(rtos lon 2 6) "\n Converted from: "as_cor "\n Converted to: " desc);strcat );print (princ) );progn );progn (alert "NO COORDINATE SYSTEM ASSIGNED TO THIS DRAWNING") ;(asg_coor) );if (setq app "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe") (setq url (strcat "\"https://www.google.com/maps/@" (rtos lon 2 6) "," (rtos lat 2 6) "," "20z" "\"")) (startapp app url) ;(reset) (princ) );defun (defun asg_coor (/ req ) (initget "Yes No" ) (setq req (getkword "No Coordinates Assigned to this MAP, Do you want to Assign them now? No: ")) (if (= nil req) (setq req "Yes")) (if (= req "Yes") (progn (command "ADESETCRDSYS") (if (/= "" (ade_projgetwscode)) (C:get_ll) (Alert "\nFailed to Assign Coordinates") );if );progn (princ "\nGood Bye") );if (princ) );defun
Last edited by GreyHippo; 2021-08-31 at 03:16 PM. Reason: removed local error functions
GreyHippo has given the full version here is a simple one a landmark for AUS.
(command "browser" "https://www.google.com.au/maps/@-33.8567844,151.213108,17z")
The pervious version had Chrome specified, I revised it so it will now work with the default browser
Code:;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/label-lat-long/td-p/3039742 (defun c:go2googlemap (/ as_cor pkpt ll lat lon desc app urlg2 ) ;(initerr) (setq as_cor (ade_projgetwscode)) (if (/= "" as_cor) ;checks for an assigned coordinate system (progn (ade_projsetsrc as_cor) (ade_projsetdest "LL84") ; uses lat/lon with no datum change as needed (while (not (setq pkpt (getpoint "\nPick Desired Point: ")))) (progn (setq ll (ade_projptforward pkpt)) (setq lat (car ll)) (setq lon (car (cdr ll))) (setq desc (ade_projgetinfo "LL84" "description")) (print (strcat "Lat: " (rtos lat 2 6) "\n Long:"(rtos lon 2 6) "\n Converted from: "as_cor "\n Converted to: " desc);strcat );print (princ) );progn );progn (alert "NO COORDINATE SYSTEM ASSIGNED TO THIS DRAWNING") ;(asg_coor) );if ;(setq app "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe") (setq app "browser") ;(command "browser" "https://www.google.com.au/maps/@-33.8567844,151.213108,17z") (setq url (strcat "\"https://www.google.com/maps/@" (rtos lon 2 6) "," (rtos lat 2 6) "," "20z" "\"")) (command app url) ;(startapp app url) ;(reset) (princ) );defun (defun asg_coor (/ req ) (initget "Yes No" ) (setq req (getkword "No Coordinates Assigned to this MAP, Do you want to Assign them now? No: ")) (if (= nil req) (setq req "Yes")) (if (= req "Yes") (progn (command "ADESETCRDSYS") (if (/= "" (ade_projgetwscode)) (C:get_ll) (Alert "\nFailed to Assign Coordinates") );if );progn (princ "\nGood Bye") );if (princ) );defun
Hey thnx for your code! Realy like it.
But it seems to miss the folowing:
Code:(defun C:get_ll () ... )
Maybe some inprovements:
Code:(setq desc (ade_projgetinfo "LL84" "description")) (setq x (rtos lon 2 6)) (setq y (rtos lat 2 6)) (princ (strcat "Long:"(rtos lon 2 6) "\nLat: " (rtos lat 2 6) ) ) (princ(setq webadress (strcat "https://www.google.nl/maps/@" x "," y ",120m/data=!5m1!1e1?authuser=0"))) (princ) (command "_browser" webadress) (princ)Code:(setq req (getkword "No Coordinates Assigned to this MAP, Do you want to Assign them now? [Yes/No]: "))
I wrote code for this recently and just found this on Augi. See my blog for instructions: https://c3dk.com/2022/04/21/cad-google-street-view/
Here is the code:
Code:; Written by Brian Strandberg, c3dk.com ; email: hello@c3dk.com ; Transforms coordinates from the X & Y in your drawing ; to Lattitude & Longitude ; then opens google street view at that point. ; code is not fully debugged ; requires a coordinate zone is assigned to your drawing. (defun c:gsv (/) (command "UCS" "World") (if (not (getvar "CGOECS"))()(alert "fail - set coordinate zone first")) (setq pkpt (getpoint "Select Point to see in Street View")) (ade_projsetsrc (getvar "CGEOCS")) (ade_projsetdest "LL84") (setq cvp (list (car pkpt) (cadr pkpt))) (setq result (ade_projptforward CVP)) (if (null result) (alert "\nError in Transformation ")) (setq gsv (strcat "http://maps.google.com/maps?q=&layer=c&cbll=" (rtos (cadr result) 2 8) "," (rtos (car result) 2 8))) (command "UCS" "P") (command "browser" gsv) ); close defun
Last edited by Ed Jobe; 2022-05-10 at 07:26 PM. Reason: Added code tags
Look at what I posted but you need lat lang not XY.