CAD/CAM discussion forum > CAD > autocad vba explode block entity

autocad vba explode block entity

Rank: 1

venkatesh

Newbie

posts: 0

Registered: 2009-8-5

Message 1 of 1

 autocad vba explode block entity
01-01-1970 08:00 . am | View his/her posts only
Hi, i tried for following code clear the bugs. I want to explode 
block enity after inserting the block. i tried also in C#.net.
but ther also Iam getiing same problem has comming. pleas any body help me.
 
-------------vba zwcad devolper's given code ----------
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
 
 
-------------C#.net code ----------



ZwcadBlockReference
entBlock = SCadDoc.ModelSpace.InsertBlock(var, "bcsteel22.7", 1, 1, 1, 0);



entBlock.Explode(); /// here is going to the exceptions

venkatesh.ch
zwcad programmer
+919701521116
See also