venkatesh
unread,Aug 5, 2009, 8:47:48 AM8/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ZWCad Users
Hi dear,
any body knows following code has been getting error, this code for
inserting blocks and explode it. here Inserting blocks is ok, then
after exploding has getting error.
I tried also in c#.net also, but same problem were i getting..
Sub Ch10_ExplodingABlock()
' Defien a block
Dim blockObj As ZwcadBlock
Dim insertionPnt As New ZwcadPoint
insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0
Set blockObj = ThisDocument.Blocks.Add _
(insertionPnt, "CircleBlock")
' Add a circle into the block
Dim circleObj As ZwcadCircle
Dim center As New ZwcadPoint
Dim radius As Double
center(0) = 0
center(1) = 0
center(2) = 0
radius = 1
Set circleObj = blockObj.AddCircle(center, radius)
' Insert a block
Dim blockRefObj As ZwcadBlockReference
insertionPnt(0) = 2
insertionPnt(1) = 2
insertionPnt(2) = 0
Set blockRefObj = ThisDocument.ModelSpace.InsertBlock _
(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
ZoomAll
MsgBox "The circle belongs to " & blockRefObj.EntityName
' Explode block reference
Dim explodedObjects As ZwcadSelectionSet
Set explodedObjects = blockRefObj.Explode
' Loop through the exploded objects
Dim I As Integer
For I = 0 To explodedObjects.Count - 1
explodedObjects(I).Color = zcRed
explodedObjects(I).Update
MsgBox "Exploded Object " & I & ": " _
& explodedObjects(I).EntityName
explodedObjects(I).Color = zcByLayer
explodedObjects(I).Update
Next
End Sub