Author Topic: Link/Sync Block attribute with Dynamic attribute  (Read 1859 times)

0 Members and 1 Guest are viewing this topic.

Bert

  • Guest
Link/Sync Block attribute with Dynamic attribute
« 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 ? 

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Link/Sync Block attribute with Dynamic attribute
« Reply #1 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.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

Bert

  • Guest
Re: Link/Sync Block attribute with Dynamic attribute
« Reply #2 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 ?

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Link/Sync Block attribute with Dynamic attribute
« Reply #3 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 that will basically show you everything you need to do. 
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

BlackBox

  • King Gator
  • Posts: 3770
Re: Link/Sync Block attribute with Dynamic attribute
« Reply #4 on: August 28, 2014, 09:27:14 AM »
See this post by Tony Tanzillo that will basically show you everything you need to do.

1+... Guy's a ******* genius.  :-)
"How we think determines what we do, and what we do determines what we get."