.NET

.NET

Reply
Valued Contributor
54 Posts
5 Kudos
Registered: ‎09-18-2006
Post 1 of 7
Accepted Solution

link a sheetset view to a block reference

206 Views, 6 Replies
07-27-2014 07:42 AM

I'm trying to write a vb.net addin to link a sheet set view to a callout block or label block reference already in the drawing. I want to be able to select a view from my list of views and link it to selected block references. The view list dialog and block selection parts are done; just cannot figure out how to make the link.

 

Does anyone have some example code to show how a sheetset view is linked to a block reference?

 

Many thanks for any help,

Allen

 

 

Yes, As Jeff mentioned recreating the fields should help.

 

You can get the field using the AttributeReference.GetField method and then change the field code using "SetFieldCode".

To ensure that the field is evaluated based on the new field code, use the "Evaluate" method.

 

The field code will need to be created just as the Field dialog does. To get the Guid of the SheetSet and sheet similar to what is displayed in the Field dialog, you can use “.GetObjectId().GetHandle()” on the SheetSet and Sheet. 

 

Regards,

Balaji

 

 

ADN Support Specialist
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 2 of 7

Re: link a sheetset view to a block reference

07-31-2014 01:42 AM in reply to: Allen_Hart

Hi Allen,

 

From what I understand, such linking will need a Field to be created in the callout block that acts as a hyperlink to the SheetView.

 

I have attached a screenshot to show this option in AutoCAD UI. Is this what you are trying to do through code or some other option in AutoCAD that does such linking already ?  

 

If you can please share screenshots in AutoCAD to do that, I can investigate that further. 

 

Regards,

Balaji

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Valued Contributor
54 Posts
5 Kudos
Registered: ‎09-18-2006
Post 3 of 7

Re: link a sheetset view to a block reference

07-31-2014 11:25 AM in reply to: Balaji_Ram

Hi Balaji,

 

I'm not sure that hyperlink is what I'm looking for. I'm trying to mimic what the SSM does when I place a callout, or a view label, in the drawing. By that I mean I want to repair a broken connection between the SSM and one of its callout block references. For example, sometimes I need to delete a view from one layout (sheet) and place it on another. Doing so causes any callout for that view to display ##### as the field value. So instead of manually deleting the broken callout and placing a new one, I thought I would write an addin to repair it or "relink" it to the SSM view. I can't figure out how to do that. Nor can I figure out how to programmatically replace the broken callout with a new one.

 

The attached screen capture shows my addin running next to the SSM tool palette. In the drawing area there is a broken view label and a broken detail callout because view 01 on sheet 2.01 has been deleted. And for the sake of example, I added the two blocks to act as placeholders in the drawing. I would like to be able to apply the sheetset view to these blocks as well.

 

So is it better to have the addin repair the connection to the selected callout, or to have it delete the selected callout and replace it with a new one? Either way, how do you do it?

 

Thanks

Allen

 

Valued Mentor
341 Posts
53 Kudos
Registered: ‎05-12-2009
Post 4 of 7

Re: link a sheetset view to a block reference

07-31-2014 08:26 PM in reply to: Allen_Hart

SheetSet file is just an XML file here is link with more info

http://www.theswamp.org/index.php?topic=46497.0

 

 

But what it is basiclly doing is adding a field and here is pic of how to do it manully in some text using sample sheet set file that comes with installation

 

Capture.PNG

You can also find your answers @ TheSwamp
ADN Support Specialist
762 Posts
100 Kudos
Registered: ‎03-21-2011
Post 5 of 7

Re: link a sheetset view to a block reference

07-31-2014 09:11 PM in reply to: Allen_Hart

Yes, As Jeff mentioned recreating the fields should help.

 

You can get the field using the AttributeReference.GetField method and then change the field code using "SetFieldCode".

To ensure that the field is evaluated based on the new field code, use the "Evaluate" method.

 

The field code will need to be created just as the Field dialog does. To get the Guid of the SheetSet and sheet similar to what is displayed in the Field dialog, you can use “.GetObjectId().GetHandle()” on the SheetSet and Sheet. 

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Valued Contributor
54 Posts
5 Kudos
Registered: ‎09-18-2006
Post 6 of 7

Re: link a sheetset view to a block reference

08-01-2014 05:15 AM in reply to: Balaji_Ram

Thanks guys,

 

Actually, my first thought was to work on the field code but could not find a API function to create it.  Maybe now I have enough info from you guys to recreate the field code myself.

 

If I get stuck again...I'll be back :smileyhappy:

 

Allen

 

Valued Contributor
54 Posts
5 Kudos
Registered: ‎09-18-2006
Post 7 of 7

Re: link a sheetset view to a block reference

08-03-2014 10:55 AM in reply to: Allen_Hart

Woo Hoo! got it working.  Thanks for all the help.

 

Although, I do wish there was a better way to update the display of the modified block references on screen besides Editor.Regen(), which causes the screen to blink on-and-off each time it is used. Annoying, but it works.  Is there another method I can try?

 

I tried the solution discussed here but could not get it to work for me...

"http://forums.autodesk.com/t5/NET/Redrawing-the-screen-during-execution-of-a-Command-Method/m-p/3740...

 

Thanks,

Allen

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!