Author Topic: Dynamic block & BlockTableRecord.GetBlockReferenceIds method  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Dynamic block & BlockTableRecord.GetBlockReferenceIds method
« on: October 09, 2011, 11:43:30 AM »
AutoCAD 2009 SP3 Enu.

Hi all.
Fragment of my code:
Code: [Select]
...
//btr - it is BlockTableRecord.
//db - it is Database object.
using (Transaction t = db.TransactionManager.StartTransaction()) {
BlockTable bt = (BlockTable) t.GetObject(db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId brId in btr.GetBlockReferenceIds(directOnly, false)) {
...
Problem code row:
Code: [Select]
btr.GetBlockReferenceIds(directOnly, false)if btr is dynamic block, then it's row can't find block reference ids. Why?

Thank you.

bargool

  • Guest
Re: Dynamic block & BlockTableRecord.GetBlockReferenceIds method
« Reply #1 on: October 09, 2011, 12:01:04 PM »
For DynamicBlock here is GetAnonymousBlockIds

lCine7ic

  • Guest
Re: Dynamic block & BlockTableRecord.GetBlockReferenceIds method
« Reply #2 on: October 11, 2011, 10:47:13 AM »
You're semi correct.

In fact, GetAnonymousBlockIds returns BlockTableRecords, not BlockReferences.  You'd then need to get the .GetBlockReferenceIds of the Anonymous BlockTableRecords to get the Anonymous BlockReferences.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Dynamic block & BlockTableRecord.GetBlockReferenceIds method
« Reply #3 on: October 11, 2011, 12:45:36 PM »
You're semi correct.

In fact, GetAnonymousBlockIds returns BlockTableRecords, not BlockReferences.  You'd then need to get the .GetBlockReferenceIds of the Anonymous BlockTableRecords to get the Anonymous BlockReferences.
I know it. The subject isn't actual for a long time, but all the same thanks for the answer. :)