Good morning,
I need a solution for the following szenari:
When the user inserts a block to the modelspace I would like to explode it and attach some xData. Inside the block there is always only one entity.
I tried to find a solution with a ObjetAppended reactor.
Within this eventhandler I can read the objects parent database Handle and compare it to the ModelSpace Handle.
Now I know that this object was added to the modelspace.
Next step would be to explode the new object. I tried it with the following code, but it did not work. What is wrong?
=============================================
Private Sub ObjectAppended(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.DatabaseServices.ObjectEventArgs)
If _sModelSpaceHandle = e.DBObject.OwnerId.Handle.ToString Then
Dim trans As Transaction
trans = HostApplicationServices.WorkingDatabase().TransactionManager.StartTransaction()
Dim ent As Entity = trans.GetObject(e.DBObject.ObjectId, OpenMode.ForRead, False)
Dim entset As New Autodesk.AutoCAD.DatabaseServices.DBObjectCollection
ent.Explode(entset)
trans.Commit()
trans.Dispose()
End If
End Sub
=============================================
Regards, Jan