Author Topic: BlockTableRecord IsErased  (Read 5530 times)

0 Members and 1 Guest are viewing this topic.

Nathan Taylor

  • Guest
BlockTableRecord IsErased
« on: August 23, 2006, 03:29:30 AM »
I would like to purge a BlockTableRecord from the Database that has the IsErased property = True so I can create a new BlockTableRecord with the same name. Is it possible?

I may also have the same requirement with layers.

Regards - Nathan

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: BlockTableRecord IsErased
« Reply #1 on: August 23, 2006, 06:46:21 AM »
You could try a 'save' as it wont write out the erased objects to the saved file and I think it reloads the current memory with that version. This is how the db handles objects (I think), it flags them as erased and at filing time it only files out what is not erased, I'm sure it also helps with the undo feature as well.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Nathan Taylor

  • Guest
Re: BlockTableRecord IsErased
« Reply #2 on: August 23, 2006, 07:10:04 PM »
You could try a 'save' as it wont write out the erased objects to the saved file and I think it reloads the current memory with that version. This is how the db handles objects (I think), it flags them as erased and at filing time it only files out what is not erased, I'm sure it also helps with the undo feature as well.

Thanks Mick, I will give it shot although I would prefer another way.

Regards - Nathan

Nathan Taylor

  • Guest
Re: BlockTableRecord IsErased
« Reply #3 on: August 23, 2006, 08:32:42 PM »
You could try a 'save' as it wont write out the erased objects to the saved file and I think it reloads the current memory with that version. This is how the db handles objects (I think), it flags them as erased and at filing time it only files out what is not erased, I'm sure it also helps with the undo feature as well.

Thanks Mick, I will give it shot although I would prefer another way.

Regards - Nathan
I ended up just taking the easy option. As the block is only a temporary item I am just adding the current time and date to the blockname.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: BlockTableRecord IsErased
« Reply #4 on: August 23, 2006, 08:46:03 PM »
no prob's, Glenn's pretty good with blocks, xref's etc. he may have some ideas or come across this problem before.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Glenn R

  • Guest
Re: BlockTableRecord IsErased
« Reply #5 on: August 23, 2006, 11:46:12 PM »
You should just be able to add the block again, as once something is erased, it's purgeable in this context. Have you thought of deleting everything from INSIDE the block table record as you recreating it anyway?

When you use the purge function, you pass it a list of objectids and the returned list is the ones you can safely erase...

Cheers,
Glenn.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: BlockTableRecord IsErased
« Reply #6 on: August 24, 2006, 12:11:08 AM »
told ya! :D
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Glenn R

  • Guest
Re: BlockTableRecord IsErased
« Reply #7 on: August 24, 2006, 08:09:25 AM »
Actually, what I suggested probably won't work - I've come across this in symbol tables before and it has to do with the .NET implementaton.
I'll run some tests tomorrow to confirm.

Nathan Taylor

  • Guest
Re: BlockTableRecord IsErased
« Reply #8 on: August 24, 2006, 06:43:59 PM »
You should just be able to add the block again, as once something is erased, it's purgeable in this context. Have you thought of deleting everything from INSIDE the block table record as you recreating it anyway?

When you use the purge function, you pass it a list of objectids and the returned list is the ones you can safely erase...

Cheers,
Glenn.

Thanks. I tried just adding it again but that does not work. Yes deleting everthing from inside the BTR is an option. The BTR IsErased property is set before I try to work on it.
I have a similar problem with layer table records and am just working around it by using the ActiveX API to add my layers. I will probably be about to hit the same problem with Textstyles so will probably use the same work around for that.

I am not too worried about resorting to using the ActiveX API as long I am still getting other benefits of the .NET API such as jigging.

Regards - Nathan

Glenn R

  • Guest
Re: BlockTableRecord IsErased
« Reply #9 on: August 24, 2006, 09:41:46 PM »
It has to do with the default indexer for symboltables.

Lets say you had this: LayerTable lt;
Now if you tried something like this: lt["SomeLayerName"] it will return the object even if it's erased.

In ARX it's like this: AcDbSymbolTable::getAt(string, bool) from memory. The bool flag is true to return erased records, false for not.
Unfortunately, the default indexer is using the version of "getAt" and passing true.

Autodesk should have built the default indexer for symboltables to take 2 arguments to match the 'getAt' function.

Nathan Taylor

  • Guest
Re: BlockTableRecord IsErased
« Reply #10 on: September 05, 2006, 08:35:07 PM »
It has to do with the default indexer for symboltables.

Lets say you had this: LayerTable lt;
Now if you tried something like this: lt["SomeLayerName"] it will return the object even if it's erased.

In ARX it's like this: AcDbSymbolTable::getAt(string, bool) from memory. The bool flag is true to return erased records, false for not.
Unfortunately, the default indexer is using the version of "getAt" and passing true.

Autodesk should have built the default indexer for symboltables to take 2 arguments to match the 'getAt' function.

Thanks Glenn, I have revisited it and using Tony T's method of getting the non-erased record has resolved it.

Regards - Nathan