View Full Version : Inserting a block in Paper Space

2004-09-07, 01:34 PM
I've got code that ran beautifully for a long time. After some updating to a different module, I'm getting the following error:

"Class does not support Automation or does not support expected interface."

The line it dumps out on:
Set objCoverBlock = ThisDrawing.PaperSpace.InsertBlock(dblInsertArray, strFileName, _ dblX, dblY, dblZ, dblRotation)

All the variables report good data back. The insert array is 0,0,0, the file name is good, the scale factors are 1,1,1 and rotation is 0.

Right before this line, the program adds a new layout and sets it to be current.

I have a second step that attaches an XREF to the newly created layout and that runs without any problems. Just when I try and insert a block.


2004-09-07, 09:09 PM
Save the Layout object when you create it, then use the Layout object's Block property to insert to instead of the PaperSpace object. The PaperSpace object must be initialized correctly for your code to work, and in reality refers to the active layout, not neccessarily the one just created.

2004-09-08, 07:38 PM
Cool. Didn't think about that. I just delayed releasing the layout object and dropped the block in. Beautiful. Thanks.