Results 1 to 9 of 9

Thread: lisp to view Street views by clicking in dwg file

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2017-01
    Posts
    1
    Login to Give a bone
    0

    Default lisp to view Street views by clicking in dwg file

    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

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    Quote Originally Posted by Belavyas33 View Post
    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
    What do you mean by "street views"? Google Maps? What kind of drawing do you have? You can assign hyperlinks to any drawing object.
    C:> ED WORKING....


    LinkedIn

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    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

  4. #4
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    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

  5. #5
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    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")

  6. #6
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    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

  7. #7
    Member
    Join Date
    2010-09
    Location
    The Nederlands
    Posts
    14
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    Quote Originally Posted by GreyHippo View Post
    ...
    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]: "))

  8. #8
    Member
    Join Date
    2005-12
    Posts
    7
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    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

  9. #9
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: lisp to view Street views by clicking in dwg file

    Look at what I posted but you need lat lang not XY.

Similar Threads

  1. Replies: 7
    Last Post: 2013-11-16, 11:44 PM
  2. I wish I could open a section/drafting view by double clicking on it in the sheet view
    By Wish List System in forum Revit Structure - Wish List
    Replies: 2
    Last Post: 2013-11-02, 11:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •