.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hyperlilnk adds drawing file path.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Keith.Brown
459 Views, 3 Replies

Hyperlilnk adds drawing file path.

I am trying to automatically add some hyperlinks to entities in my drawings but I am encountering an issue that I do not know how to readily solve.  After adding the hyperlink, the drawing path is added to the beginning of the hyperlink which is what I do not want.  Here is my code to get the hyperlink.

 

Private Sub AddHyperLinkToEntity(entity As Entity, pidData As PidXData)
	Dim linkCollection As HyperLinkCollection = entity.Hyperlinks
	linkCollection.Add(CreateHyperlink(pidData))
End Sub

Private Function CreateHyperlink(data As PidXData) As HyperLink
	Dim hyperLink As HyperLink = new HyperLink()
	hyperLink.Description = "blahblahblah"
	hyperLink.Name =  $"http//www.blahblahblah.com/pdf?programcode='{data.ProgramCode}'?idcount='{data.IdCount}'"
	hyperLink.SubLocation = string.Empty
	Return hyperLink
End Function

It is pretty standard code with nothing special in it.  However, when i print to pdf or look at the link in the properties, the link has been appended to the drawing location.

 

C:\Demo - Files\02b_PID\http//www.blahblahblah.com/pdf?programcode='301'?idcount='100738'

Is there a way in code to get the link to not add the current drawing path?

 

3 REPLIES 3
Message 2 of 4

I'm pretty sure that the value of the HYPERLINKBASE system variable is prefixed to the name when the hyperlink is created.

 

 


@Keith.Brown wrote:

I am trying to automatically add some hyperlinks to entities in my drawings but I am encountering an issue that I do not know how to readily solve.  After adding the hyperlink, the drawing path is added to the beginning of the hyperlink which is what I do not want.  Here is my code to get the hyperlink.

 

Private Sub AddHyperLinkToEntity(entity As Entity, pidData As PidXData)
	Dim linkCollection As HyperLinkCollection = entity.Hyperlinks
	linkCollection.Add(CreateHyperlink(pidData))
End Sub

Private Function CreateHyperlink(data As PidXData) As HyperLink
	Dim hyperLink As HyperLink = new HyperLink()
	hyperLink.Description = "blahblahblah"
	hyperLink.Name =  $"http//www.blahblahblah.com/pdf?programcode='{data.ProgramCode}'?idcount='{data.IdCount}'"
	hyperLink.SubLocation = string.Empty
	Return hyperLink
End Function

It is pretty standard code with nothing special in it.  However, when i print to pdf or look at the link in the properties, the link has been appended to the drawing location.

 

C:\Demo - Files\02b_PID\http//www.blahblahblah.com/pdf?programcode='301'?idcount='100738'

Is there a way in code to get the link to not add the current drawing path?

 


 

Message 3 of 4

That was my believe also but the value is nothing when i checked the parameter.  I guess i can try setting the value to nothing again immediately before trying to set the hyperlink.

Message 4 of 4
Keith.Brown
in reply to: Keith.Brown

Ok, i found the issue.  The problem was with my hyperlink.  I was missing the colon after the http so autocad rightfully determined that this was not a valid url and decided that it was instead a bookmark in the current file.  Dumb mistake that cost me a couple of hours.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost