Community
Been scratching my head on this one. I think I have eveything correct but it's not working, see below.
Dim F3D As New Solid3d 'these have been assigned a Solid3D Dim addSolid as New Solid3d 'these have been assigned a Solid3D F3D.BooleanOperation(BooleanOperationType.BoolUnite, addSolid)
If you see anything wrong, please let me know. Thanks.
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
Hi,
I tried the code snippet that Hallex shared in AutoCAD 2014 and it worked fine.
If you continue to have this issue, can you please provide the sample project and the drawing for me to reproduce the behavior ?
Can't find what you're looking for? Ask the community or share your knowledge.