Community
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
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);