TheSwamp

Code Red => .NET => Topic started by: Bert on August 26, 2014, 05:50:19 AM

Title: Link/Sync Block attribute with Dynamic attribute
Post by: Bert on August 26, 2014, 05:50:19 AM
Hello fella's,

We've got some Dynamic blocks getting scaled/streched by (width/height) dynamic attributes.
The user changes these manually whenever needed.

Next we have a tool that reads out the dwg in order to build up a "bill of materials" (- a list of needed items).
This tool works by reading out a specified set of block attributes found in the blockreferences in the modelspace.
Problem is that here, the width and height are duplicated.
They both exsist as a dynamic attribute (to drive the visual size of the block) as well as a block attribute (so the BOM-tool can "read" the desired size).

I'm not too keen on coding in exceptions in the BOM-tool to make it look in the Dynamic attributes of 'certain blockreferences' to find the correct width/height.

Is there an event I can pick into that would sync these values back and forth when the user edits either of these attributes ? 
Title: Re: Link/Sync Block attribute with Dynamic attribute
Post by: Keith Brown on August 26, 2014, 10:11:17 AM
Hi Bert,


You might try overriding the close event of the object and sync the attributes there.  This way will insure that the object will always have synchronized attributes.
Title: Re: Link/Sync Block attribute with Dynamic attribute
Post by: Bert on August 27, 2014, 02:27:31 AM
Right on, could do that.

But is there a way to do this without having to add an eventhandler on each blockreference ?
Title: Re: Link/Sync Block attribute with Dynamic attribute
Post by: Keith Brown on August 27, 2014, 09:55:57 AM
Sorry I probably did not use the best terminology.  You should override the close method of the object and not the close event.


See this post by Tony Tanzillo (http://www.theswamp.org/index.php?topic=43356.msg486228#msg486228) that will basically show you everything you need to do. 
Title: Re: Link/Sync Block attribute with Dynamic attribute
Post by: BlackBox on August 28, 2014, 09:27:14 AM
See this post by Tony Tanzillo (http://www.theswamp.org/index.php?topic=43356.msg486228#msg486228) that will basically show you everything you need to do.

1+... Guy's a ******* genius.  :-)