Hyperlinks

Hyperlinks

WoHo
Alumni Alumni
700 Views
1 Reply
Message 1 of 2

Hyperlinks

WoHo
Alumni
Alumni

Hi,

 

adding or modifing hyperlinks via 

 

HyperLinkCollection hyperLinkCollectrion = entity.Hyperlinks;

HyperLink hyperLink = new HyperLink();
hyperLink.Name = filename
hyperLink.SubLocation = filename
hyperLinkCollectrion.Add(hyperLink);

 

works fine. But it seems that the file to link must exist. If the file does not exist, I cannot modify a hyperlink. With the command HYPERLINK in AutoCAD the file must not exist.

 

Is my observation true or is it a fault I made?

 

Thanks

Wolfgang

0 Likes
701 Views
1 Reply
Reply (1)
Message 2 of 2

Balaji_Ram
Alumni
Alumni

Hi Wolfgang,

 

Sorry for the delay.

 

I dont think there is any such requirement while adding a hyperlink.

AutoCAD tries to resolve the actual path only when you click on the entity with Ctrl pressed.

 

Using this code, I could add a hyperlink to a file that did not exist and AutoCAD displayed the error message only when the entity was clicked.

 

HyperLink hyperLink = new HyperLink();
hyperLink.Description = "My File";
hyperLink.Name = "..\\..\\..\\..\\..\\..\\..\\..\\Temp\\5.txt";
hyperLink.SubLocation = "";
linkCollection.Add(hyperLink);

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes