Author Topic: Why dynamic block cannot use Table's SetBlockTableRecordId method?  (Read 1474 times)

0 Members and 1 Guest are viewing this topic.

csharpbird

  • Newt
  • Posts: 64
Table tb=new Table();
......
tb.SetBlockTableRecordId(i, 3, bt["Door"], true);

If "Door" block is normal,the table cell will get the block image.
If "Door" block is dynamic, AutoCAD will throw an exception.
« Last Edit: November 17, 2011, 10:22:51 AM by csharpbird »

kaefer

  • Guest
Re: Why dynamic block cannot use Table's SetBlockTableRecordId method?
« Reply #1 on: November 17, 2011, 10:38:02 AM »
Table tb=new Table();
......
tb.SetBlockTableRecordId(i, 3, bt["Door"], true);

If "Door" block is normal,the table cell will get the block image.
If "Door" block is dynamic, AutoCAD will throw an exception.

What AutoCAD version? What error message? What about a complete code example to reproduce your observation? Did you read Kean's blog and did you try the syntax he uses, as follows?

Code: [Select]
                    // Insert the block as the contents of our cell
 
                    Cell cell = tb.Cells[row, col];
                    cell.Contents.InsertAt(0);
                    cell.Contents[0].BlockTableRecordId =
                       blockId;

csharpbird

  • Newt
  • Posts: 64
Re: Why dynamic block cannot use Table's SetBlockTableRecordId method?
« Reply #2 on: November 17, 2011, 11:58:05 AM »
I'm using AutoCAD 2008.
It seems that your code is not for this version.

kaefer

  • Guest
Re: Why dynamic block cannot use Table's SetBlockTableRecordId method?
« Reply #3 on: November 17, 2011, 12:25:04 PM »
I'm using AutoCAD 2008.
It seems that your code is not for this version.

The Table API underwent a major restructuring with release 2010. I'd wager a guess that the kind of problem you observed might have had something to do with it, even when the dynamic block API had stabilized before that.