MarkW
2004-06-19 15:19:04 UTC
Can anyone tell me why this code inserts the block twice and explodes only once?
All the code should do is insert a one block, explode the block and zoom Extents.
I can insert and explode this block manually and it works like it should.
CODE --------------
Option Explicit
'This code inserts the Title/Border block "DMR-OFRAME".
Public Sub InsertOframe()
Dim BlockReference As AcadBlockReference 'Declares a variable named "BlockReference".
Dim ExplodedObjects As Variant 'Declares a variable named "ExplodedObjects".
'Declares an array for insert point coordinates for title block.
Dim InputPoint(0 To 2) As Double 'Declares a variable named "InputPoint"
InputPoint(0) = 0 'X
InputPoint(1) = 0 'Y
InputPoint(2) = 0 'Z
'The [NAME] of the block should include the path with the ".dwg" extension on the end.
Set BlockReference = ThisDrawing.ModelSpace.InsertBlock(InputPoint, "C:\DRAWINGS\Designer DMR-UPU\Rev 6\DMR-OFRAME.dwg", 1#, 1#, 1#, 0#)
'Calls the "Update" method of the "BlockReference" to ensure that the block was drawn in Model Space.
BlockReference.Update
'Explodes the title block -
ExplodedObjects = BlockReference.Explode
'Zooms to extents of drawing
ZoomExtents
End Sub
All the code should do is insert a one block, explode the block and zoom Extents.
I can insert and explode this block manually and it works like it should.
CODE --------------
Option Explicit
'This code inserts the Title/Border block "DMR-OFRAME".
Public Sub InsertOframe()
Dim BlockReference As AcadBlockReference 'Declares a variable named "BlockReference".
Dim ExplodedObjects As Variant 'Declares a variable named "ExplodedObjects".
'Declares an array for insert point coordinates for title block.
Dim InputPoint(0 To 2) As Double 'Declares a variable named "InputPoint"
InputPoint(0) = 0 'X
InputPoint(1) = 0 'Y
InputPoint(2) = 0 'Z
'The [NAME] of the block should include the path with the ".dwg" extension on the end.
Set BlockReference = ThisDrawing.ModelSpace.InsertBlock(InputPoint, "C:\DRAWINGS\Designer DMR-UPU\Rev 6\DMR-OFRAME.dwg", 1#, 1#, 1#, 0#)
'Calls the "Update" method of the "BlockReference" to ensure that the block was drawn in Model Space.
BlockReference.Update
'Explodes the title block -
ExplodedObjects = BlockReference.Explode
'Zooms to extents of drawing
ZoomExtents
End Sub