Subscribe Topic

Rank: 1



posts: 0

Registered: 2012-1-14

Message 1 of 1

23-06-2011 03:02 . am   |   View his/her posts only

Daniel problem with exploding inserted object after "Bind Method" ,please check this:
Public Sub Let_Bind()
Dim mio_obj As ZwcadEntity
Dim insertedBlock As ZwcadExternalReference
For Each mio_obj In ThisDocument.ModelSpace
If mio_obj.EntityType = zcExternalReference Then
Set insertedBlock = mio_obj

ThisDocument.Blocks.Item(insertedBlock.Name).Bind False

End If
Call now_explode
End Sub

Private Sub now_explode()

Dim mio_blocco As ZwcadBlockReference <---- This line is referenced in the following comment.
Dim explodedObjects As Variant
For Each EntObj In ThisDocument.ModelSpace
If EntObj.EntityType = zcBlockInsert Then
Set mio_blocco = EntObj <--- Got problem here
Set explodedObjects = mio_blocco.Explode

End If
MsgBox "Done."
End Sub

Seems that VBA doesn't fully update the inserted external reference as insert.
I can say this because the watch windows tells that the object entity type is zcInsert (correct)
but if I change the code line
Dim mio_blocco As ZwcadBlockReference
Dim mio_blocco As ZwcadExternalReference
the problem disappear .To better confirm my impression I get the "object doesn't support this method..." in the next line (Set explodedObjects = mio_blocco.Explode)
because one external reference can't be exploded.
Another note :if I copy/paste the inserted reference in one new drawing it works,seems that with the copy/paste operation the proprieties gets fully update.
Best regards.

See also