<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Seperating AutoCAD surfaces with two seperate entities in one object in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/seperating-autocad-surfaces-with-two-seperate-entities-in-one/m-p/11353490#M12071</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a .net project related to slicing surfaces based on several boundaries. However, i've encountered a problem with this challenge. The problem occurs when a autocad surface is sliced in the middle, and a new surface with two or more seperate bodies is created, as seen in the image below.&amp;nbsp; Slicing this outside surface then results in an eNoIntersections error. Hence, it is needed to seperate the outside surface into two seperate entities . Then only the surface that intersects with the boundary can be selected an no error should occur.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sbouwens_0-1660219253985.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1102805iD1DE22AA7824D81F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sbouwens_0-1660219253985.png" alt="sbouwens_0-1660219253985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code snippet (VB.NET) that currently performs the task of slicing the surface is attached below:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;   Dim surfaceInsideBounds = DirectCast(sliceObject, Autodesk.AutoCAD.DatabaseServices.Surface)
                                        Dim sliceResults As SurfaceSliceResults = surfaceInsideBounds.SliceBySurface(SweptSurface)
                                        Dim surfaceOutsideBounds As Autodesk.AutoCAD.DatabaseServices.Surface = sliceResults.NegativeHalfSurface
                                        surfaceOutsideBounds.SetDatabaseDefaults()
                                        surfaceOutsideBounds.Layer = sliceObject.Layer
                                        surfaceOutsideBounds.Color = sliceObject.Color
                                        btr.AppendEntity(surfaceOutsideBounds)
                                        trans2.AddNewlyCreatedDBObject(surfaceOutsideBounds, True)&lt;/LI-CODE&gt;&lt;P&gt;The surface inside the boundary and outside the boundary needs to be preserved in this process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a similar method as described in&amp;nbsp;&lt;A href="https://adndevblog.typepad.com/autocad/2020/06/separate-solid-complexes-into-separate-solids.html" target="_blank"&gt;Separate Solid Complexes into Separate Solids - AutoCAD DevBlog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;with&amp;nbsp;solid.SeparateBody(), but then for AutoCAD Surfaces. Can anyone provide some help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Stan Bouwens&lt;/P&gt;</description>
    <pubDate>Thu, 11 Aug 2022 12:13:33 GMT</pubDate>
    <dc:creator>sbouwens</dc:creator>
    <dc:date>2022-08-11T12:13:33Z</dc:date>
    <item>
      <title>Seperating AutoCAD surfaces with two seperate entities in one object</title>
      <link>https://forums.autodesk.com/t5/net-forum/seperating-autocad-surfaces-with-two-seperate-entities-in-one/m-p/11353490#M12071</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a .net project related to slicing surfaces based on several boundaries. However, i've encountered a problem with this challenge. The problem occurs when a autocad surface is sliced in the middle, and a new surface with two or more seperate bodies is created, as seen in the image below.&amp;nbsp; Slicing this outside surface then results in an eNoIntersections error. Hence, it is needed to seperate the outside surface into two seperate entities . Then only the surface that intersects with the boundary can be selected an no error should occur.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sbouwens_0-1660219253985.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1102805iD1DE22AA7824D81F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sbouwens_0-1660219253985.png" alt="sbouwens_0-1660219253985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code snippet (VB.NET) that currently performs the task of slicing the surface is attached below:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;   Dim surfaceInsideBounds = DirectCast(sliceObject, Autodesk.AutoCAD.DatabaseServices.Surface)
                                        Dim sliceResults As SurfaceSliceResults = surfaceInsideBounds.SliceBySurface(SweptSurface)
                                        Dim surfaceOutsideBounds As Autodesk.AutoCAD.DatabaseServices.Surface = sliceResults.NegativeHalfSurface
                                        surfaceOutsideBounds.SetDatabaseDefaults()
                                        surfaceOutsideBounds.Layer = sliceObject.Layer
                                        surfaceOutsideBounds.Color = sliceObject.Color
                                        btr.AppendEntity(surfaceOutsideBounds)
                                        trans2.AddNewlyCreatedDBObject(surfaceOutsideBounds, True)&lt;/LI-CODE&gt;&lt;P&gt;The surface inside the boundary and outside the boundary needs to be preserved in this process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a similar method as described in&amp;nbsp;&lt;A href="https://adndevblog.typepad.com/autocad/2020/06/separate-solid-complexes-into-separate-solids.html" target="_blank"&gt;Separate Solid Complexes into Separate Solids - AutoCAD DevBlog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;with&amp;nbsp;solid.SeparateBody(), but then for AutoCAD Surfaces. Can anyone provide some help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Stan Bouwens&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 12:13:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/seperating-autocad-surfaces-with-two-seperate-entities-in-one/m-p/11353490#M12071</guid>
      <dc:creator>sbouwens</dc:creator>
      <dc:date>2022-08-11T12:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Seperating AutoCAD surfaces with two seperate entities in one object</title>
      <link>https://forums.autodesk.com/t5/net-forum/seperating-autocad-surfaces-with-two-seperate-entities-in-one/m-p/11377610#M12072</link>
      <description>&lt;P&gt;I'm currently stuck with the idea of exploding the surface with seperate bodies, and then unioning the parts that intersect with each other. Somewhere between lines 20-31 it somehow goes wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;       For Each oid In userSelectionIds
            Dim surfaceToSplit As Autodesk.AutoCAD.DatabaseServices.Surface = TryCast(acTrans.GetObject(oid, OpenMode.ForWrite), Autodesk.AutoCAD.DatabaseServices.Surface)
            Dim surfDBOBJColl As New DBObjectCollection
            Using acDBObjColl As New DBObjectCollection()
                surfaceToSplit.Explode(acDBObjColl)
                For Each DBObject In acDBObjColl
                    If DBObject.GetType() = GetType(Autodesk.AutoCAD.DatabaseServices.Surface) Then
                        surfDBOBJColl.Add(DirectCast(DBObject, Autodesk.AutoCAD.DatabaseServices.Surface))
                    ElseIf DBObject.GetType() = GetType(Autodesk.AutoCAD.DatabaseServices.Region) Then
                        Dim surface As New Autodesk.AutoCAD.DatabaseServices.Surface()
                        surface.SetDatabaseDefaults()
                        surface = Autodesk.AutoCAD.DatabaseServices.Surface.CreateFrom(DirectCast(DBObject, Autodesk.AutoCAD.DatabaseServices.Region))
                        surfDBOBJColl.Add(surface)
                    Else
                        ed.WriteMessage(vbLf &amp;amp; "Exploded entity is not a Surface or a Region")
                    End If
                Next
            End Using

            For Each motherSurface In surfDBOBJColl
ResetJoin:
                For Each toJoinSurface In surfDBOBJColl
                    If toJoinSurface = motherSurface Then Continue For
                    Dim intersectEntity As Entity() = motherSurface.BooleanIntersect(toJoinSurface)
                    If intersectEntity IsNot Nothing Then
                        motherSurface.BooleanUnion(toJoinSurface)
                        surfDBOBJColl.Remove(toJoinSurface)
                        GoTo ResetJoin
                    End If
                Next
            Next

            For Each joinedSurface In surfDBOBJColl
                joinedSurface.Layer = surfaceToSplit.Layer
                joinedSurface.Color = surfaceToSplit.Color
                btr.AppendEntity(joinedSurface)
                acTrans.AddNewlyCreatedDBObject(joinedSurface, True)
            Next

            surfaceToSplit.Erase()
        Next

        acTrans.Commit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone provide me some guidance on joining surfaces together that overlap?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 09:17:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/seperating-autocad-surfaces-with-two-seperate-entities-in-one/m-p/11377610#M12072</guid>
      <dc:creator>sbouwens</dc:creator>
      <dc:date>2022-08-24T09:17:24Z</dc:date>
    </item>
  </channel>
</rss>

