Message 1 of 5
Exploding block
Not applicable
07-23-2003
07:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi NG,
I'm having problems with exploding a block. I got this far:
Sub Define_point()
Dim minExt As Variant
Dim maxExt As Variant
For Each ent In ActiveDocument.ModelSpace
With ent
If .ObjectName = "LGDBBORDER" Then
ent.GetBoundingBox minExt, maxExt
'MsgBox minExt(0) & "," & minExt(1) & " en " & maxExt(0) &
"," & maxExt(1)
If minExt(0) > insExtMin(0) Then
insExtMin(0) = minExt(0)
insExtMin(1) = minExt(1)
insExtMin(2) = 0
insExtMax(0) = maxExt(0)
insExtMax(1) = maxExt(1)
insExtMax(2) = 0
End If
End If
End With
Next ent
End Sub
Sub Erase_border()
Dim sstest As AcadSelectionSet
Set sstest = ThisDrawing.PickfirstSelectionSet
sstest.Clear
sstest.Select acSelectionSetCrossing, insExtMin(), insExtMax()
sstest.Erase
End Sub
Sub Insert()
Dim blockname As String
blockname = UserForm1.TextBox1.Value
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insExtMin,
blockname, 1#, 1#, 1#, 0)
End Sub
Sub Test()
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
With ThisDrawing
.Define_point
.Erase_border
.Insert
End With
Unload UserForm1
End Sub
In the textbox the user types the path name of the block. This works fine,
but when I add the line:
blockRefObj.Explode to the sub Insert I get an automation error.
I think I know the cause of the error, the block, which has to be exploded,
is not yet visible when the macro reached the point where it has to explode
the block.
But I could be wrong, so if I'm wrong can somebody tell me what is the cause
and the solution for the problem?
And if I'm right: can somebody tell me how to solve this?
Frank
I'm having problems with exploding a block. I got this far:
Sub Define_point()
Dim minExt As Variant
Dim maxExt As Variant
For Each ent In ActiveDocument.ModelSpace
With ent
If .ObjectName = "LGDBBORDER" Then
ent.GetBoundingBox minExt, maxExt
'MsgBox minExt(0) & "," & minExt(1) & " en " & maxExt(0) &
"," & maxExt(1)
If minExt(0) > insExtMin(0) Then
insExtMin(0) = minExt(0)
insExtMin(1) = minExt(1)
insExtMin(2) = 0
insExtMax(0) = maxExt(0)
insExtMax(1) = maxExt(1)
insExtMax(2) = 0
End If
End If
End With
Next ent
End Sub
Sub Erase_border()
Dim sstest As AcadSelectionSet
Set sstest = ThisDrawing.PickfirstSelectionSet
sstest.Clear
sstest.Select acSelectionSetCrossing, insExtMin(), insExtMax()
sstest.Erase
End Sub
Sub Insert()
Dim blockname As String
blockname = UserForm1.TextBox1.Value
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insExtMin,
blockname, 1#, 1#, 1#, 0)
End Sub
Sub Test()
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
With ThisDrawing
.Define_point
.Erase_border
.Insert
End With
Unload UserForm1
End Sub
In the textbox the user types the path name of the block. This works fine,
but when I add the line:
blockRefObj.Explode to the sub Insert I get an automation error.
I think I know the cause of the error, the block, which has to be exploded,
is not yet visible when the macro reached the point where it has to explode
the block.
But I could be wrong, so if I'm wrong can somebody tell me what is the cause
and the solution for the problem?
And if I'm right: can somebody tell me how to solve this?
Frank