Author Topic: Clearing Xrecord from Copied Block  (Read 2338 times)

0 Members and 1 Guest are viewing this topic.

kwarmington

  • Guest
Clearing Xrecord from Copied Block
« on: August 31, 2009, 09:19:58 PM »
If one of more blocks are copied, I want to be able to clear all Xrecord data in the copied blocks. Can anyone shed some light on where I should start?

I have looked at the CommandWillStart Event Handler to monitor for the Paste Command, but haven't been able to figure out how to access the blocks that have been pasted? I have also looked at the ObjectAppended Database Event Handler but haven't had any luck in accessing the block.

Can anyone point me in the right direction?

Thanks,

Kate



Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Clearing Xrecord from Copied Block
« Reply #1 on: August 31, 2009, 10:17:19 PM »

Quote
but haven't been able to figure out how to access the blocks that have been pasted?

How about the 'Previous selection ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

kwarmington

  • Guest
Re: Clearing Xrecord from Copied Block
« Reply #2 on: August 31, 2009, 10:30:13 PM »
Wouldn't that give me the original blocks I copied not the new blocks? Correct me if im horribly wrong - I am really new to this.


MickD

  • King Gator
  • Posts: 3639
  • (x-in)->[process]->(y-out) ... simples!
Re: Clearing Xrecord from Copied Block
« Reply #3 on: August 31, 2009, 10:56:41 PM »
A work around may be to create a special copy command to copy your blocks but I know that's not what you would really want.

What about the 'BeginInsert' event, although you are copying you are actually inserting a block ref.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Clearing Xrecord from Copied Block
« Reply #4 on: August 31, 2009, 10:58:47 PM »

Ahhh, I didn't read the problem correctly, sorry.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

kwarmington

  • Guest
Re: Clearing Xrecord from Copied Block
« Reply #5 on: September 01, 2009, 02:42:09 AM »
NathTay on the Autodesk discussion groups came up with the steps below. I followed them and it all seems to be working now. Thanks for everyones help :)

These are the steps I use.

1. Create global variable as ObjectIdCollection
2. In CommandWillStart Event Handler if command name is a command that can result in copies being produced instantiate the global variable.
3. In ObjectAppended Event Handler check "CMDNAMES" system variable if command is same as checked for in Step 2 add objects to global variable.
4. In CommandCancelled or CommandEnded Event Handlers if it is the relevant command process the global variable and then set it to nothing.

vnsharifi

  • Guest
Re: Clearing Xrecord from Copied Block
« Reply #6 on: June 06, 2011, 11:54:01 PM »
NathTay on the Autodesk discussion groups came up with the steps below. I followed them and it all seems to be working now. Thanks for everyones help :)

These are the steps I use.

1. Create global variable as ObjectIdCollection
2. In CommandWillStart Event Handler if command name is a command that can result in copies being produced instantiate the global variable.
3. In ObjectAppended Event Handler check "CMDNAMES" system variable if command is same as checked for in Step 2 add objects to global variable.
4. In CommandCancelled or CommandEnded Event Handlers if it is the relevant command process the global variable and then set it to nothing.


Hello There, I have is it possible to post your code here. I have the same issue . Thanks.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Clearing Xrecord from Copied Block
« Reply #7 on: June 07, 2011, 09:57:20 AM »
Depending on your situation this might work
If you are creating a dictionary and adding it to the ExtensionDictionary
then set
DBDictionary.TreatElementsAsHard = false

This does not work using the AutoCAD 'Copy' command, but
will work for Ctrl+C--Ctrl+V method.
So any object 'pasted' in same or different drawing the xrecord will be empty.
****Edit***
Xrecord will not get copied instead of empty
« Last Edit: June 07, 2011, 10:05:36 AM by Jeff H »