link to google map

link to google map

Anonymous
Not applicable
2,171 Views
4 Replies
Message 1 of 5

link to google map

Anonymous
Not applicable

Hello all, I have this problem with this basic autolisp code. I wanted to link the longitude and lattitude of my autocad project with the same location on google map for a quick reference. so i wrote this 

                    (defun C:googleMap ( )


                    (setq googleMap "https://maps.google.com/maps?q=loc:32.746635,-97.319549") 

                     (startapp "explorer" google)                                                                                     
                    )

 

the code works with other urls like "https://maps.google.com" but not with this specific kind of url  

"https://maps.google.com/maps?q=loc:32.746635,-97.319549"

it throws this error message

 

"There is no program associated to perform the requested action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.

 

appreciate any help

 

Solomon Tessema

0 Likes
Accepted solutions (1)
2,172 Views
4 Replies
Replies (4)
Message 2 of 5

rkmcswain
Mentor
Mentor
Accepted solution

Try the following:

 

(defun C:googleMap  ( / filename shell)
  (setq filename "https://maps.google.com/maps?q=loc:32.746635,-97.319549")
  (setq shell
         (vla-getinterfaceobject
           (vlax-get-acad-object)
           "Shell.Application"
           )
        )
  (vlax-invoke-method shell 'Open filename)
  (vlax-release-object shell)
)

 

R.K. McSwain     | CADpanacea | on twitter
Message 3 of 5

Anonymous
Not applicable

It is working like a charm! many thanks

0 Likes
Message 4 of 5

paullimapa
Mentor
Mentor

Or you can change the code to use the SH command placing quotes around the URL:

(defun c:googlemap () (setq googlemap "Explorer \"https://maps.google.com/maps?q=loc:32.746635,-97.319549\"")(command"_SH" googlemap))

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Anonymous
Not applicable

This is great, but shouldn't the code grab the location you select onscreen? I knew AutoLisp years ago but haven't used it recently. I'll keep looking.

0 Likes