Page 1 of 1

BoundaryRepresentation

Posted: Sat Jun 27, 2026 11:04 am
by DenisSilveira
Is there any dll to Brep class and so on ?

Code: Select all


Imports System.Windows.Forms.VisualStyles
Imports Teigha.BoundaryRepresentation
Imports Teigha.DatabaseServices
Imports Teigha.Geometry

Public Class FEMBrepFace
    Public Property Id As Integer
    Public Property Normal As Vector3d
    Public Property Pontos As New List(Of Point3d)
    Public Property Arestas As New List(Of FEMBrepAresta)
End Class

Public Class FEMBrepAresta
    Public Property Inicio As Point3d
    Public Property Fim As Point3d
End Class

Public Class FEMBrepSolido
    Public Property ObjectId As ObjectId
    Public Property Faces As New List(Of FEMBrepFace)
End Class

Public Class FEMExtratorBrep3D

    Public Shared Function ExtrairSolido(
        tr As Transaction,
        idSolido As ObjectId) As FEMBrepSolido

        Dim ent As Entity =
            CType(tr.GetObject(idSolido, OpenMode.ForRead), Entity)

        Dim solido As Solid3d = TryCast(ent, Solid3d)

        If solido Is Nothing Then
            Throw New System.Exception("Objeto selecionado não é Solid3d.")
        End If

        Dim resultado As New FEMBrepSolido With {
            .ObjectId = idSolido
        }

        Using brep As New Brep(solido)

            Dim indiceFace As Integer = 0

            For Each face As Face In brep.Faces

                Dim f As New FEMBrepFace With {
                    .Id = indiceFace
                }

                For Each loopFace As Loop In face.Loops

                    For Each edge As Edge In loopFace.Edges

                        Dim curva As Curve3d = edge.Curve

                        Dim p0 As Point3d = curva.StartPoint
                        Dim p1 As Point3d = curva.EndPoint

                        f.Arestas.Add(New FEMBrepAresta With {
                            .Inicio = p0,
                            .Fim = p1
                        })

                        f.Pontos.Add(p0)
                        f.Pontos.Add(p1)

                    Next

                Next

                resultado.Faces.Add(f)
                indiceFace += 1

            Next

        End Using

        Return resultado

    End Function

End Class


Re: BoundaryRepresentation

Posted: Sun Jun 28, 2026 12:03 am
by QuanNguyen
DenisSilveira wrote:
Sat Jun 27, 2026 11:04 am
Is there any dll to Brep class and so on ?
Yes, there're 2 dll files : TD_MgdBrep_25.12_17.dll and TD_MgdBrep_Net8_25.12_17.dll (NET 8 )

Re: BoundaryRepresentation

Posted: Sun Jun 28, 2026 6:12 pm
by QuanNguyen
DenisSilveira wrote:
Sat Jun 27, 2026 11:04 am
Is there any dll to Brep class and so on ?

Code: Select all

                For Each loopFace As Loop In face.Loops
             ...
                Next
And replace Loop by BoundaryLoop.

For Each loopFace As BoundaryLoop In face.Loops