Author Topic: Auto Block Counter Reactor  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Auto Block Counter Reactor
« on: May 11, 2006, 01:53:14 PM »
I am looking to write an AutoBlock counter using reactors, but I don't quite have the concept yet.
So I was wondering how other people would approach this topic?

My pseudo code:

Code: [Select]
1. Select block to count
2. Find all occurrences of block in drawing
3. Insert text showing the count
4. Attach handle of text to reactor for block name
5. Expand insert command to include a callback that checks blockname, If its the block name specified in reactor add to count.
6. Store reactor in drawing to eliminate need to load reactor manually while in drawing

That is what I have so far.
I am having problems with the concept of the reactor checking the block name, and having the reactor react automatically, so that i don't have to load the reactor manually.

I am using the following example as a guide somewhat…
http://www.theswamp.org/index.php?topic=7308.0

Is the pseudo possible?

Any help would be appreciated....  :mrgreen:
« Last Edit: May 11, 2006, 07:02:54 PM by CAB »

Crank

  • Water Moccasin
  • Posts: 1503
Re: Auto Block Counter Reactor
« Reply #1 on: May 13, 2006, 02:35:29 AM »
[...]
So I was wondering how other people would approach this topic?
[...]
It depends on your skills and time you want to spend, but you can make a big project of this.
To keep thinks simple I shouldn't bother for the visibility states of dynamic blocks. That can be done in your next release ;) .

This is how I should do this:
  • Place the blocks and data in a table. The table has XDATA attached to it so the reactor can find it.
  • When blocks are added or removed from the drawing the reactor should start.
  • The reactor then looks for the numbers of the blocks that are placed in the table and updates the number in the table.
This code of Luis might be a good start/example.
Vault Professional 2023     +     AEC Collection

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Auto Block Counter Reactor
« Reply #2 on: May 13, 2006, 10:11:56 AM »
Or you could wait for the next release of AutoCAD as this functionality is already part of 2006.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Joe Burke

  • Guest
Re: Auto Block Counter Reactor
« Reply #3 on: May 13, 2006, 12:55:49 PM »
Also keep in mind nested blocks. For instance, ET BCOUNT does not count them.