Author Topic: One object reactor and multiple owners or: Multiple reactors with single owners?  (Read 2745 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
There are apparently two approaches to object reactors:

1.
One object reactor and multiple owners. With data attached to the object (Xdata or Extension dictionary).

2.
Multiple reactors with single owners. With data stored in the reactor.

One obvious disadvantage to method 1. would be the limitations of Xdata. But apart from that:
What are the pros and cons of these two approaches?

BlackBox

  • King Gator
  • Posts: 3770
What are the pros and cons of these two approaches?

That may entirely depend on the inherent nature of the task to be completed. Using your own example, if the desired tasks(s) require XData, then you would obviously prefer one method over the other.

Did you have something specific in mind, or are you asking from a learning standpoint?

If the former, please clarify.
"How we think determines what we do, and what we do determines what we get."

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
a learning standpoint
That is the nature of my question. I am just starting out with reactors.
Is one approach faster than the other?
Is one approach more reliable?
...

Lee Mac

  • Seagull
  • Posts: 12934
  • London, England
I've used both methods in different situations, and sometimes I would use multiple reactors with multiple owners (as in my BoundingBoxReactor example).

That said, I'm not too experienced with XData, so would perhaps try to avoid it (also, its easier to remove the reactors than go scouting for XData).

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Thanks for your view Lee.
Scouting for Xdata is not that hard as you can use it in ssget filters. Example:
Code: [Select]
(ssget "_X" '((-3 ("MyApp"))))

Lee Mac

  • Seagull
  • Posts: 12934
  • London, England
Thanks for your view Lee.
Scouting for Xdata is not that hard as you can use it in ssget filters. Example:
Code: [Select]
(ssget "_X" '((-3 ("MyApp"))))

True, but then I suppose you have to iterate through the set and modify each entity in turn, whereas with reactors you can remove them without modifying drawing entities - maybe safer?

I think 6 of one, half a dozen of the other  :-)

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
maybe safer?
I don't know. But basically the idea is of course to leave the Xdata intact for entities that have not been modified.