<?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 Re: BRepBuilder fails on very simple example in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9671507#M32832</link>
    <description>&lt;P&gt;I got another workaround using TesselatedShapeBuilder, but it's strange that I can't get the simplest example working with the BREP commands. Also, the error message is not very helpful.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Aug 2020 08:41:51 GMT</pubDate>
    <dc:creator>GFric</dc:creator>
    <dc:date>2020-08-04T08:41:51Z</dc:date>
    <item>
      <title>BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9661432#M32830</link>
      <description>&lt;P&gt;I get "Failure" result on a very simple BRepBuilder example, when I try to build a (4-sided triangle pyramid) Tetrahedron. I know about TessellatedShapeBuilder, but it fails for a quite complex object here, so I hope to bypass this with the BREP.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class Test{

    public Test(){}

    // Keep track of already created edges and their orientation
    struct BrepEdge {
        public BRepBuilderGeometryId id;
        public XYZ p1, p2;
    }
    List&amp;lt;BrepEdge&amp;gt; brep_edges = new List&amp;lt;BrepEdge&amp;gt;();

    // add edge to face loop
    void AddEdgeToBREP( BRepBuilder brep, BRepBuilderGeometryId loop, XYZ a, XYZ b) {
        foreach(var be in brep_edges) {
            // ab is p1-p2
            if(be.p1.DistanceTo(a) &amp;lt; 1e-7 &amp;amp;&amp;amp; be.p2.DistanceTo(b) &amp;lt; 1e-7) { brep.AddCoEdge(loop, be.id, false);return; }
            // ab is p2-p1 (reversed edge)
            if(be.p1.DistanceTo(b) &amp;lt; 1e-7 &amp;amp;&amp;amp; be.p2.DistanceTo(a) &amp;lt; 1e-7) { brep.AddCoEdge(loop, be.id, true); return; }
        }
        // must create a new edge
        BRepBuilderGeometryId edge = brep.AddEdge(BRepBuilderEdgeGeometry.Create(a, b));
        brep.AddCoEdge(loop, edge, false);
        var bed = new BrepEdge();
        bed.p1 = a;
        bed.p2 = b;
        bed.id = edge;
        brep_edges.Add(bed);
    }

    // add triangle face to solid
    private void AddTriangleToBREP( BRepBuilder brep, XYZ a, XYZ b, XYZ c ) {
        Plane plane = Plane.CreateByThreePoints(a, b, c);
        BRepBuilderGeometryId face = brep.AddFace(BRepBuilderSurfaceGeometry.Create(plane, null), true);
        var loop = brep.AddLoop(face);
        AddEdgeToBREP(brep, loop, a, b);
        AddEdgeToBREP(brep, loop, b, c);
        AddEdgeToBREP(brep, loop, c, a);
        brep.FinishLoop(loop);
        brep.FinishFace(face);
    }


    ///////////////////////////////////////////////////////////////////////////
    public void run() {
        BRepBuilder brep = new BRepBuilder(BRepType.Solid);

        var points = new List&amp;lt;XYZ&amp;gt;(4);
        points.Add(new XYZ(0, 0, 0)); // 0 origin
        points.Add(new XYZ(1, 0, 0)); // 1 right
        points.Add(new XYZ(0, 1, 0)); // 2 back
        points.Add(new XYZ(0, 0, 1)); // 3 top

        AddTriangleToBREP(brep, points[2], points[1], points[0]); // bottom face
        AddTriangleToBREP(brep, points[0], points[1], points[3]); // front face
        AddTriangleToBREP(brep, points[1], points[2], points[3]); // diagonal face
        AddTriangleToBREP(brep, points[2], points[0], points[3]); // left face

        var outcome = brep.Finish(); // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; Failure

        // throws: "This BRepBuilder object hasn't completed building data or was unsuccessful building it.
        // Built Geometry is unavailable. In order to access the built Geometry,
        // Finish() must be called first. That will set the state to completed."
        var res = brep.GetResult();
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Jul 2020 07:29:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9661432#M32830</guid>
      <dc:creator>GFric</dc:creator>
      <dc:date>2020-07-29T07:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9663814#M32831</link>
      <description>&lt;P&gt;I cannot say why your code does not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example that does work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2018/02/directshape-from-brepbuilder-and-boolean.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2018/02/directshape-from-brepbuilder-and-boolean.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;BRepBuilder&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;wasn’t really meant for 'manually' constructing geometry. Its interface is very cumbersome for that purpose. It was meant for translating existing geometry into Revit, with rather thorough validation of the input geometry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 10:36:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9663814#M32831</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-07-30T10:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9671507#M32832</link>
      <description>&lt;P&gt;I got another workaround using TesselatedShapeBuilder, but it's strange that I can't get the simplest example working with the BREP commands. Also, the error message is not very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 08:41:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/9671507#M32832</guid>
      <dc:creator>GFric</dc:creator>
      <dc:date>2020-08-04T08:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12013786#M32833</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;, it has been a while since the question was posted, I am wondering if there is any good news or further details on the topic?&lt;/P&gt;&lt;P&gt;I experienced the same error when try to create a simple pyramid shape as a prototype for recreating geometry from linked IFC file. I would like to use some external algorithm the geometry and convert the external data to a mesh and rebuilt the new shape. The API documentation does not provide much of information about why it failed.&lt;/P&gt;&lt;P&gt;Would you have any suggestion for my problem? Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 07:41:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12013786#M32833</guid>
      <dc:creator>longt61</dc:creator>
      <dc:date>2023-06-06T07:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12014403#M32834</link>
      <description>&lt;P&gt;No news, just the same advice as above: try using the&amp;nbsp;&lt;SPAN&gt;TesselatedShapeBuilder instead of the BRepBuilder.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 12:24:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12014403#M32834</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-06-06T12:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12015942#M32835</link>
      <description>&lt;P&gt;It takes a bit of organisation but it does work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It isn't ideal for manual creation since (1) you need to arrange the edges so they are compatible and (2) the edges need to sit on the surface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I organised the above original into the below edge orders and directions and it worked fine. Each co-edge should be reversed on one face and not reversed on the other. Outer loops for a face should be anticlockwise with respect to the face normal (pointing outwards for a solid). So the edge is indicated as reversed on the face if it can't satisfy that e.g. the edge of two adjoining faces needs to be reversed on one of them.&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="230607_A.PNG" style="width: 729px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1224353i690B56973B2A5541/image-size/large?v=v2&amp;amp;px=999" role="button" title="230607_A.PNG" alt="230607_A.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Private Function Obj_230606a(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData,
ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Result
        Dim UIApp As UIApplication = commandData.Application
        Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
        If UIDoc Is Nothing Then Return Result.Cancelled Else
        Dim IntDoc As Document = UIDoc.Document

        'Only needs 6 edges
        'Set on triangle if an edge of that triangle is reversed or not
        'Each edge has two faces the edge should be reversed on one face and not on the other
        'Outer loops should be anticlockwise with respect to normal

        Dim A As New TriangleSide(1, 0)
        Dim B As New TriangleSide(0, 2)
        Dim C As New TriangleSide(2, 1)
        Dim D As New TriangleSide(1, 3)
        Dim E As New TriangleSide(3, 0)
        Dim F As New TriangleSide(3, 2)

        Dim T_ABC As New Triangle(A, B, C, New Boolean(2) {False, False, False})
        Dim T_ADE As New Triangle(A, D, E, New Boolean(2) {True, False, False})
        Dim T_BEF As New Triangle(B, E, F, New Boolean(2) {True, True, False})
        Dim T_CFD As New Triangle(C, F, D, New Boolean(2) {True, True, True})

        Dim Triangles As Triangle() = New Triangle(3) {T_ABC, T_ADE, T_BEF, T_CFD}
        Dim Edges As TriangleSide() = New TriangleSide(5) {A, B, C, D, E, F}

        'The coords
        Dim X As Double = 1
        Dim Y As Double = 1
        Dim Z As Double = 1

        Dim Points As XYZ() = New XYZ(3) {New XYZ(0, 0, 0),
                                          New XYZ(X, 0, 0),
                                          New XYZ(0, Y, 0),
                                          New XYZ(0, 0, Z)}

        Dim BrepB As New BRepBuilder(BRepType.Solid)
        'Faces
        For i = 0 To Triangles.Length - 1
            Dim T As Triangle = Triangles(i)
            Dim P As Plane = T.GetPlane(Points)
            Triangles(i).FaceId = BrepB.AddFace(BRepBuilderSurfaceGeometry.Create(P, Nothing), False)
        Next

        'Edges
        For i = 0 To Edges.Length - 1
            Dim ed As TriangleSide = Edges(i)
            Edges(i).EdgeId = BrepB.AddEdge(BRepBuilderEdgeGeometry.Create(ed.GetXYZ(0, Points), ed.GetXYZ(1, Points)))
        Next

        'Face loops
        For i = 0 To Triangles.Length - 1
            Dim T As Triangle = Triangles(i)
            Triangles(i).LoopId = BrepB.AddLoop(T.FaceId)
        Next

        'co-edges
        For i = 0 To Triangles.Length - 1
            Dim T As Triangle = Triangles(i)

            For ia = 0 To 2
                Dim ed As TriangleSide = T(ia)
                BrepB.AddCoEdge(T.LoopId, ed.EdgeId, T.Sides_Reversed(ia))
            Next
            BrepB.FinishLoop(T.LoopId)
            BrepB.FinishFace(T.FaceId)
        Next

        Dim Outcome As BRepBuilderOutcome = BrepB.Finish

        Using Tx As New Transaction(IntDoc, "DS")
            If Tx.Start = TransactionStatus.Started Then

                Dim DS As DirectShape = DirectShape.CreateElement(IntDoc, New ElementId(BuiltInCategory.OST_GenericModel))
                Dim S As Solid = BrepB.GetResult()
                DS.SetShape(New GeometryObject() {S}.ToList)

                Tx.Commit()
            End If
        End Using

        Return Result.Succeeded
    End Function


    Public Class TriangleSide
        Public Property EdgeId As BRepBuilderGeometryId
        Public ReadOnly Property N1 As Integer
        Public ReadOnly Property N2 As Integer
        Public Function GetXYZ(Idx As Integer, Points As XYZ()) As XYZ
            If Idx = 0 Then
                Return Points(N1)
            ElseIf Idx = 1 Then
                Return Points(N2)
            Else
                Throw New ArgumentOutOfRangeException
            End If
        End Function
        Public Sub New(Node1 As Integer, Node2 As Integer)
            N1 = Node1
            N2 = Node2
        End Sub
    End Class
    Public Class Triangle
        Public Property LoopId As BRepBuilderGeometryId
        Public Property FaceId As BRepBuilderGeometryId
        Public ReadOnly Property Sides_Reversed As Boolean()
        Public ReadOnly Property S1 As TriangleSide
        Public ReadOnly Property S2 As TriangleSide
        Public ReadOnly Property S3 As TriangleSide

        Public Function GetPlane(Points As XYZ()) As Plane

            'The edge ends could be reversed for a triangles so use mid points to ensure points are unique
            'and no colinear
            Dim Mid1 As XYZ = (Points(S1.N1) + Points(S1.N2)) / 2
            Dim Mid2 As XYZ = (Points(S2.N1) + Points(S2.N2)) / 2
            Dim Mid3 As XYZ = (Points(S3.N1) + Points(S3.N2)) / 2

            Return Plane.CreateByThreePoints(Mid1, Mid2, Mid3)
        End Function
        Default Public ReadOnly Property Side(Idx As Integer) As TriangleSide
            Get
                If Idx = 0 Then
                    Return S1
                ElseIf Idx = 1 Then
                    Return S2
                ElseIf Idx = 2 Then
                    Return S3
                Else
                    Throw New ArgumentOutOfRangeException
                End If
            End Get
        End Property
        Public Sub New(Side1 As TriangleSide, Side2 As TriangleSide, Side3 As TriangleSide, Reversed As Boolean())
            S1 = Side1
            S2 = Side2
            S3 = Side3

            If Reversed.Length &amp;lt;&amp;gt; 3 Then
                Throw New ArgumentOutOfRangeException
            End If
            Sides_Reversed = Reversed

        End Sub
    End Class&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 23:56:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12015942#M32835</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2023-06-06T23:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12016897#M32836</link>
      <description>&lt;P&gt;It took me a while to figure out how the edges and faces should be added before the detail explanation and sample code reaches me. Thank you very much for your effort.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 10:16:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12016897#M32836</guid>
      <dc:creator>longt61</dc:creator>
      <dc:date>2023-06-07T10:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12017504#M32837</link>
      <description>&lt;P&gt;That's a really cool image, did you create it or you found in some &lt;STRONG&gt;Revit API&lt;/STRONG&gt; presentation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is kinda missing a &lt;STRONG&gt;&lt;EM&gt;Four-sided dice&lt;/EM&gt;&lt;/STRONG&gt; in that image &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing that is good to mention, is if your &lt;STRONG&gt;BRepType&lt;/STRONG&gt; is &lt;STRONG&gt;Void&lt;/STRONG&gt;, all the face normals must point into the void.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 14:04:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12017504#M32837</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2023-06-07T14:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12017850#M32838</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4176855"&gt;@ricaun&lt;/a&gt;&amp;nbsp;I drew it with AutoCAD after a couple of attempts at what I wanted to get across using pencil, paper and eraser (more eraser than pencil and paper).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll have to check how important it is to set the boundaries of the surfaces. I'm sure I noticed previously and the other day that just specifying null may create a performance issue in Revit after the direct shape exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The best thing about the BRepBuilder in my view is that you can create single face solids. So all those API functions specific to the face class can be used on such.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 16:05:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12017850#M32838</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2023-06-07T16:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12018457#M32839</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I'll have to check how important it is to set the boundaries of the surfaces. I'm sure I noticed previously and the other day that just specifying null may create a performance issue in Revit after the direct shape exists.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In my code, the&amp;nbsp;boundaries&amp;nbsp;of the surfaces are &lt;STRONG&gt;&lt;EM&gt;null&lt;/EM&gt; &lt;/STRONG&gt;as well, never have a problem but the most complex thing I did was create a copy of a &lt;STRONG&gt;Solid&lt;/STRONG&gt; to change the &lt;STRONG&gt;Material&lt;/STRONG&gt;. Works, but reordering and reversing each edge is painful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;The best thing about the BRepBuilder in my view is that you can create single face solids. So all those API functions specific to the face class can be used on such.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;For a simple face is possible to use &lt;STRONG&gt;TessellatedShapeBuilder&lt;/STRONG&gt;, you can create a &lt;STRONG&gt;Solid&lt;/STRONG&gt; or &lt;STRONG&gt;Mesh&lt;/STRONG&gt; is fails.&lt;/P&gt;&lt;P&gt;In this D4 (&lt;EM&gt;tetrahedron&lt;/EM&gt;) is much simpler to use &lt;STRONG&gt;TessellatedFace.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var shapeBuilder = TessellatedShapeCreatorUtils.Create(builder =&amp;gt;
{
    var points = new List&amp;lt;XYZ&amp;gt;(4);
    points.Add(new XYZ(0, 0, 0)); // 0 origin
    points.Add(new XYZ(1, 0, 0)); // 1 right
    points.Add(new XYZ(0, 1, 0)); // 2 back
    points.Add(new XYZ(0, 0, 1)); // 3 top

    var materialId = ElementId.InvalidElementId;
    builder.AddFace(new TessellatedFace(new[] { points[2], points[1], points[0] }, materialId)); // bottom face
    builder.AddFace(new TessellatedFace(new[] { points[0], points[1], points[3] }, materialId)); // front face
    builder.AddFace(new TessellatedFace(new[] { points[1], points[2], points[3] }, materialId)); // diagonal face
    builder.AddFace(new TessellatedFace(new[] { points[2], points[0], points[3] }, materialId)); // left face
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full code: &lt;A href="https://gist.github.com/ricaun/35baa2ed9f33de3487e46e4217b5e8bd" target="_blank" rel="noopener"&gt;https://gist.github.com/ricaun/35baa2ed9f33de3487e46e4217b5e8bd&lt;/A&gt; with the &lt;STRONG&gt;TessellatedShapeCreatorUtils&lt;/STRONG&gt; util.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static class TessellatedShapeCreatorUtils
{
    public static TessellatedShapeBuilderResult Create(Action&amp;lt;TessellatedShapeBuilder&amp;gt; actionBuilder)
    {
        TessellatedShapeBuilder builder = new TessellatedShapeBuilder();
        builder.Target = TessellatedShapeBuilderTarget.AnyGeometry;
        builder.Fallback = TessellatedShapeBuilderFallback.Mesh;
        builder.OpenConnectedFaceSet(true);
        actionBuilder?.Invoke(builder);
        builder.CloseConnectedFaceSet();
        builder.Build();
        TessellatedShapeBuilderResult result = builder.GetBuildResult();
        return result;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are working with a Revit surface &lt;STRONG&gt;BRepBuilder&lt;/STRONG&gt; is the way to go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edited: Add tetrahedron in the D4 text.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 14:18:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12018457#M32839</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2023-06-12T14:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12027851#M32840</link>
      <description>&lt;P&gt;Editing this thread for a blog post, I wonder what you mean by, "In this D4 is much simpler to use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;TessellatedFace&lt;/STRONG&gt;".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 13:57:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12027851#M32840</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-06-12T13:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12027913#M32841</link>
      <description>&lt;P&gt;I mean a tetrahedron, a shape with 4 flat faces, a dice with 4 faces, or a D4 if you are familiar with dice and RPG (role-playing game). &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edited: Add (role-playing game)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 20:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12027913#M32841</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2023-06-13T20:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: BRepBuilder fails on very simple example</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12029876#M32842</link>
      <description>&lt;P&gt;Thank you for the explanation. Now, I don't know what you mean by RPG &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked it out and assume role-playing game?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Still, I edited and published this very illuminating discussion, Richard's organisation explanation and your sample code on the blog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/06/brepbuilder-and-toposurface-interior.html#2" target="_blank" rel="noopener"&gt;https://thebuildingcoder.typepad.com/blog/2023/06/brepbuilder-and-toposurface-interior.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for the great advice!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 10:56:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/brepbuilder-fails-on-very-simple-example/m-p/12029876#M32842</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-06-13T10:56:51Z</dc:date>
    </item>
  </channel>
</rss>

