.NET

Reply
Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 1 of 9 (235 Views)

Hyperlinks in attribute values and tables

235 Views, 8 Replies
05-15-2012 01:10 PM

Hey guys,

 

I've been going through older posts with not too much luck. Using C# (VS2010, Acad2012) i've created a block, imported it, given it the required attibute tags and values, and then created an array out of this block for a total of "x" identical blocks for our purposes. As these blocks are desigend to represent real-world products, is there any way that one of my attribute values can reflect a hyperlink to the manufacturers datasheet?

 

So essentially

 

Product Info http://www.google.ca/testproduct.pdf

 

 

Also, one of my functions lists all of the blocks in the current drawing and tallys them up and drops them into a table where it reports the block name, details, and quantity. I would also like this block name to be a hyperlink as well...is this doable?

 

Cheers

Vince

 

*** Edted for spelling and code

 

AttributeDefinition attDef15 = new AttributeDefinition(new Point3d(0d, 0d, 0d), productinfo, "Web Link", "", db.Textstyle);
                    attDef12.Invisible = true;

 

ADN Support Specialist
adam.nagy
Posts: 559
Registered: ‎03-26-2007
Message 2 of 9 (215 Views)

Re: Hyperlinks in attribute values and tables

05-15-2012 07:04 PM in reply to: vince1327

Hi,

 

You could add a hyperlink to each block reference. The same that you can achieve in the user interface using the HYPERLINK command. With that you can assign a URL to any entity (inc. a block reference) so that if the user hovers above the entity then information with the URL will come up, and if the user presses Ctrl+Click, then the browser comes up with the given URL.

 

Actually, what you asked should also be possible, i.e. to set an attribute reference's value to a URL, by including a field type called hypertext, e.g. like

%<\AcVar \href "http://www.autodesk.com##www.autodesk.com#0">%

 

There, again, the user could just click on the attribute text and get to the given website.

 

I hope this helps.

 

Adam Nagy

Autodesk Developer Network



Adam Nagy
Developer Technical Services
Autodesk Developer Network
Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 3 of 9 (196 Views)

Re: Hyperlinks in attribute values and tables

05-16-2012 05:20 AM in reply to: adam.nagy

Great thanks adam. I've been trying however no luck though, is my hyperlink a string value?

 

for example:

 

string url = "%<\AcVar \href "http://www.autodesk.com##www.autodesk.com#0">%"

 

or is there another way to do this. The first set of quotes encompassing the link tends to throw things off.

 

Cheers

Vince

Moderator
Alexander.Rivilis
Posts: 1,406
Registered: ‎04-09-2008
Message 4 of 9 (183 Views)

Re: Hyperlinks in attribute values and tables

05-16-2012 09:30 PM in reply to: vince1327

vince1327 wrote:

Great thanks adam. I've been trying however no luck though, is my hyperlink a string value?

 

for example:

 

string url = "%<\AcVar \href "http://www.autodesk.com##www.autodesk.com#0">%"

 

or is there another way to do this. The first set of quotes encompassing the link tends to throw things off.

 

Cheers

Vince


Maybe like this:

string url = "%<\\AcVar \\href \"http://www.autodesk.com##www.autodesk.com#0\">%";

 



Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 5 of 9 (176 Views)

Re: Hyperlinks in attribute values and tables

05-17-2012 05:16 AM in reply to: Alexander.Rivilis

Thanks Alexander. When i do this, the URL shows up in my properties window but is not clickable...is this normal?

 

Cheers

Vince

Moderator
Alexander.Rivilis
Posts: 1,406
Registered: ‎04-09-2008
Message 6 of 9 (174 Views)

Re: Hyperlinks in attribute values and tables

05-17-2012 05:29 AM in reply to: vince1327

What about Ctrl+Left Mouse Button click on attribute in drawing?


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 7 of 9 (171 Views)

Re: Hyperlinks in attribute values and tables

05-17-2012 05:33 AM in reply to: Alexander.Rivilis

That doesn't seem to be working...It seems as though the hyperlink isn't being treated any differently than any other attribute. I can click it, select it, etc....but it doens't behave as a hyperlink, just as a standard attribute. 

Valued Mentor
fieldguy
Posts: 368
Registered: ‎03-31-2005
Message 8 of 9 (163 Views)

Re: Hyperlinks in attribute values and tables

05-17-2012 09:48 AM in reply to: vince1327

Try the attached.  It needs to be inserted into some drawing.

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 9 of 9 (158 Views)

Re: Hyperlinks in attribute values and tables

05-17-2012 09:57 AM in reply to: fieldguy

Thanks fieldguy...so that does work...but i think i'm just explaining this badly...What i'm trying to do is get the attribute value that shows up in the property window to be clickable. I know how to create hyperlinks in the drawing itself, but is it possible to make an attribute value a hyperlink? So that way if i click a filter for instance, the model number, size, etc, all pop up as attributes in the properties window, and then i have a hyperlink there that links directly to the manufacturers datasheet

 

Cheers

Vince

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.