Author Topic: Removing xdata when creating wblock.  (Read 2229 times)

0 Members and 1 Guest are viewing this topic.

mr_nick

  • Guest
Removing xdata when creating wblock.
« on: May 28, 2012, 04:44:07 AM »
Is anybody able to offer a method as to how to remove any xdata from a block when it's wblocked? I want a 'silent' method that does this behind the scenes so a reactor would seem to be the perfect method but I'm struggling to find a suitable method. Vlr-Wblock-Reactor events don't seem to be able to offer what I need as there is seemingly no visible record of the blocks passed to the reactor so while I can intercept the command, I can't determine which blocks are selected and thus can do nothing with them to strip off any xdata.

Hopefully I'm not running up a dead-end with this and it's just that I'm not looking the right place.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Removing xdata when creating wblock.
« Reply #1 on: May 28, 2012, 05:04:01 AM »
Is the xdata attached to the block definition / some internal object inside the block / one or more of the block references? Perhaps attach a sample of what you have and how you want it.

Also, perhaps simply redoing the wblock command might be of use. Rolling a dialog/commandline version that looks similar to the wblock command, undefining wblock, then perform the xdata remove and send to the ".wblock" to use the "undefined" command itself, then revert the xdata back inside the current drawing. It might be a bit more work, but you'd be capable of getting at which block / selection is being wblocked.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

mr_nick

  • Guest
Re: Removing xdata when creating wblock.
« Reply #2 on: May 28, 2012, 05:22:58 AM »
Basically we have a bunch of blocks and as part of another routine we may or may not have attached a unique text string to them as xdata. As the string is to be unique, we don't want it replicated by people copying blocks so we have a few reactors which intercept the copying of blocks and also when a drawing is 'saved as' but we are a bit stuck when it comes to dealing with wblocking.

As a very long winded method I could simply intercept the wblock command and then read the xdata of every block into a list and then remove it all, run the wblock command and then replace the xdata back onto the respective blocks but this seems fraught with peril and far from a slick method.

The redefinition idea is a possibility - I've done that in the past so it's not beyond the bounds of possibility. It just seems that the wblock reactor should be the ideal tool for the task but actually offers very little.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Removing xdata when creating wblock.
« Reply #3 on: May 28, 2012, 05:41:51 AM »
What you can attempt is to look at all possible reactors, using something like vlr-trace-reaction to have the arguments listed in the VLIDE's trace window. Then perform a test wblock and see which reaction shows you which block is being saved out. Perhaps there's one:

You could use my old code here (post #22): http://forums.augi.com/showthread.php?115384-SysVar-or-Object-Modified-Reactor-Drawing-Setup-%28Horizontal-Scale%29

Just uncomment the reactions you'd like to test for.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

mr_nick

  • Guest
Re: Removing xdata when creating wblock.
« Reply #4 on: May 28, 2012, 06:32:02 AM »
A very handy bit of code. Looks like there may be options open to me afterall as there are triggers coming from reactions I had thought not relevant.