Try this code, tested on A2010 only
<CommandMethod("u3")> _
Public Sub UnionTestCommand()
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Dim ename1 As Entity
Dim ename2 As Entity
Dim id1 As ObjectId
Dim id2 As ObjectId
' Select a solids
Dim peo As New PromptEntityOptions(vbLf & "Select a first solid ")
peo.SetRejectMessage(vbLf & "Must be solid3d object...")
peo.AddAllowedClass(GetType(Solid3d), True)
Dim per As PromptEntityResult = ed.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
id1 = per.ObjectId
peo = New PromptEntityOptions(vbLf & "Select second solid ")
per = ed.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
id2 = per.ObjectId
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Using tr
ename1 = TryCast(tr.GetObject(id1, OpenMode.ForRead, False), Entity)
If ename1 Is Nothing Then Return
ename2 = TryCast(tr.GetObject(id2, OpenMode.ForRead, False), Entity)
If ename2 Is Nothing Then Return
Dim sol1 As Solid3d = TryCast(ename1, Solid3d)
Dim sol2 As Solid3d = TryCast(ename2, Solid3d)
sol1.UpgradeOpen()
sol2.UpgradeOpen()
' This will merge the geometry of the input solid sol1
' into the geometry of solids[0] and then erase the geometry of
' the input solid sol2
sol1.BooleanOperation(BooleanOperationType.BoolUnite, sol2)
' We should delete sol2 otherwise we leave a solid with
' degenerate geometry (i.e. zero geometry) in the database
' and that could cause issues
sol2.Erase()
tr.Commit()
End Using
End Sub See this article for more
http://adndevblog.typepad.com/autocad/2012/07/solids-created-with-booleanoper-may-crash-autocad-on-s...
_____________________________________
C6309D9E0751D165D0934D0621DFF27919