Block Hyperlinks

Block Hyperlinks

crawfordscott
Enthusiast Enthusiast
670 Views
12 Replies
Message 1 of 13

Block Hyperlinks

crawfordscott
Enthusiast
Enthusiast

All,

 

I have a series of identical blocks representing Street Lighting Columns.

 

I would like to add a hyperlink to these blocks which would take me, via Google Street View, to the Column.

 

When setting up the original block I can, of course, set up a hyperlink.

But obviously this link is going to stay the same every time I copy the block.

 

So, is there anyway of copying these blocks and changing the Hyperlink individually.

Or would I have to make a series of blocks, each with a different name and individual

hyperlink.

 

I think I know what the answer's going to be but you never know.....

 

Thanks in anticipation.

 

Crawford

 

 

0 Likes
671 Views
12 Replies
Replies (12)
Message 2 of 13

Brock_Olly
Collaborator
Collaborator

Found a LISP on cadtutor that can help you.
https://www.cadtutor.net/forum/topic/25128-hyperlinks-in-block-attributes/

 

Create a block with an attribute called 'HYPERLINK'
Then you have to paste your URL in that attribute.
When you run the lisp 'A2H' and select your blocks, it transforms that block into a hyperlink using the link inside that value.

 

(defun c:a2h ( / ss ) (vl-load-com)
 ;; © JM 2010

 (if (ssget '((0 . "INSERT") (66 . 1)))
   (progn
     (vlax-for obj
       (setq ss
         (vla-get-ActiveSelectionSet
           (vla-get-ActiveDocument (vlax-get-acad-object))
         )
       )
       (mapcar
         (function
           (lambda ( x )
             (if (eq "HYPERLINK" (strcase (vla-get-TagString x)))
               (vla-Add (vla-get-Hyperlinks obj) (vla-get-Textstring x))
             )
           )
         )
         (vlax-invoke obj 'GetAttributes)
       )
     )
     (vla-delete ss)
   )
 )

 (princ)
)

 

 

 

0 Likes
Message 3 of 13

crawfordscott
Enthusiast
Enthusiast
Thanks for that.
I had found this link just after I posted.
Will let you know if it works.
Thanks again
Crawford
0 Likes
Message 4 of 13

crawfordscott
Enthusiast
Enthusiast

Hi Olly,

 

This lisp "A2H" works up to a point.

 

1. When I type in the Road Name in Google Maps, Google will zoom to that street as we know.

 

2. I then drop the yellow "observer" next to the Column in question so I can get a close up.

 

3. This URL is entered into the attribute hyperlink.

 

When I control + click on the block I get taken to step 1,  the overview of the street

Any idea why its not accepting the "close up" URL and is defaulting to the aerial view URL

even though its not the URL I entered in attributes.

 

Thanks

 

Crawford

0 Likes
Message 5 of 13

Brock_Olly
Collaborator
Collaborator

Might be because the link is too long? (255 char max)
Click the share icon top right instead of copying the URL, this creates a shorter link.
This worked for me using street view of big ben:

https://maps.app.goo.gl/4xBFUG9yHBuxvRiKA

Brock_Olly_0-1742826457960.png

 

0 Likes
Message 6 of 13

CodeDing
Advisor
Advisor

@crawfordscott ,

 

It seems cumbersome to make them hyperlinks, when you could run a custom command at any point and open up Street View for any light pole (assuming you're using Geo-Location).

 

Are you using Google Earth Desktop? If so, I would recommend a command that looks like this:

- create & call command "S2S" (Street light 2 Street view)

- User selects Street Light(s)

- If ONE light selected,

--- get Lat/Long of street light, create URL to street view, open in browser

- If MULTIPLE lights selected,

--- get lats/longs of street lights, create temporary KML file, open KML file in Google Earth Desktop for user

 

Best,

~DD

Message 7 of 13

crawfordscott
Enthusiast
Enthusiast

Hi Olly,

 

Tried that but its still defaulting to the initial search request ie road name and overview

 

I have found a work around though.

 

I thought that if its defaulting to the initial search request then I'll change the initial request. 

So, I went into Google Maps, dropped the observer near a lighting column copied the URL.

I then closed and reopened a new session of Google Maps and entered this URL. (in other words dispensing with the initial

street name search.

 

It works.

 

For some reason it seems to use the initial search criteria. ???????

 

Anyway, thanks again.

 

Crawford

0 Likes
Message 8 of 13

crawfordscott
Enthusiast
Enthusiast

Thanks DD,

 

I'm not too experienced with GEO Location in Autocad.

and not experienced with Google Earth.

 

Your solution seems to have merit so I will discuss with my colleagues

to see if we can work out how to do this.

 

Thanks again.

 

Crawford

0 Likes
Message 9 of 13

crawfordscott
Enthusiast
Enthusiast

Hi All.  

 

Thanks to Olly and DD for replies.

 

I have come across the easiest way to do what I want.

On the ribbon there is a button called "Hyperlink".

I had never investigated or used this before believing it was associated with

the hyperlink you set up when constructing a block.

 

Well, you can use this button to add different hyperlinks to similar blocks. Simple.

 

Crawford

0 Likes
Message 10 of 13

CodeDing
Advisor
Advisor

@crawfordscott ,

 

You CAN do it that way. But it sounds painful.

Can I ask a few more questions:

 

1) How are you creating the Street View hyperlink?

2) Roughly, on average how many poles will you be hyperlinking per drawing?

3) Do you use GEOLOCATION within your drawings? 

4) Are you using vanilla AutoCAD? Or a vertical like Map 3D, Civil 3D, etc?

5) Why are you trying to have a street view of these poles? What information do you hope to gain by being able to see it in street view?

 

... if you could post a sample DWG file for us to look at, that would be great.

 

Best,

~DD

0 Likes
Message 11 of 13

crawfordscott
Enthusiast
Enthusiast

Hi DD,

 

Apologies for the tardy reply. Out of the country for a few days.

 

1. Originally I set up a Hyperlink Attribute, which wouldn't work (see previous). Then  I discovered the Hyperlink on the ribbon. which works fine.

2. Could be up to 50 Lighting Columns.

3. No we don't use Geo Location

4.  Were using Autocad 2024

5. Why? Well, for example, we might be relighting a complete road ie New Lanterns and Columns.

    We zoom into every existing column that we were replacing to see if we are going to encounter any problems. eg are there any trees in the vicinity

    whose roots might cause a problem when planting new column. Are there any services access chambers (Scottish Power, BT etc) next to the column.

    We can check if it looks like the footway has recently been resurfaced. (There are time restrictions on doing work on recent footway resurfacing. 

     

    Has anybody erected illegal signs on the columns? (Of course, only up to the date that Google last mapped. In Edinburgh usually every 18months)

    In a scheme where we are only replacing Lanterns, we can have a look a the columns to see if they look structurally suspect. Again, like above , we can only        look at these columns at the date of the last Google date. But it can give us a good idea.

 

    Most of the above is available, in some format, within the organisations records but to find it all is time consuming. This is the easiest way.

 

    Hope that explains everything.

 

    Thanks

 

    Crawford 

0 Likes
Message 12 of 13

CodeDing
Advisor
Advisor

@crawfordscott ,

 


@crawfordscott wrote:

This is the easiest way.


I very seriously doubt that.

But I've been proven wrong before.

 

For example,

1) when someone was browsing Street View for the pole locations, they could have saved the URL in a way that makes it easier to add into AutoCAD.

2) OR, when someone told that someone WHERE to browse in street view, they could have created/saved that information in a way that could benefit AutoCAD.

3) OR when someone gave that someone, who told that someone, a file that has the locations of the poles, that file might be useful in benefitting AutoCAD.

 

The hard part is understanding your bigger process and bigger picture. THAT is where you will save time within this process. There is nothing 'easy' about manually hyperlinking up to 50 poles in a drawing.

 

How are the street view links obtained? Do they get saved to a hyperlink in a project folder first? or go straight into AutoCAD? If they're in a project folder, are they organized? (maybe you could read them from Lisp and find an easier way to add them) If they go straight into AutoCAD then I might ask that you consider GeoLocation if it's not gonna hurt your process any. It could be easy to assign geolocation then retrieve Lat/Long and generate a Street View URL link on the fly.

 

We have options. Just depends on if you want to invest in the process. But if this is one of the easier tasks... then may the AutoCAD gods have mercy on the rest of your process

 

Best,

~DD

0 Likes
Message 13 of 13

Sea-Haven
Mentor
Mentor

When in google earth etc it displays a lat and long so can use that in your hyperlink. This is an example of using lisp not a hyper link.

(command "browser" "https://www.google.com.au/maps/@-33.8567844,151.213108,17z")

Try "https://www.google.com.au/maps/@-33.8567844,151.213108,17z" as link.

 

0 Likes