<?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: Creating disconnected Solid with one PlanarFace using BRepBuilder in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031067#M2970</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15732166"&gt;@andhxl&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Check the below workaround code&lt;BR /&gt;&lt;STRONG&gt;Reference Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            PlanarFace planarFace = null;

            foreach (GeometryObject geoObj in geoElement)
            {
                if (geoObj is Solid)
                {
                    Solid solid = geoObj as Solid;

                    if (solid.Volume &amp;gt; 0)
                    {
                        FaceArray faceArray = solid.Faces;

                        foreach (Face face in faceArray)
                        {
                            if (face is PlanarFace)
                            {
                                PlanarFace pFace = face as PlanarFace;

                                if (pFace.FaceNormal.Z == 1)
                                {
                                    planarFace = pFace;
                                    break;
                                }
                            }
                        }
                    }

                }
            }


List&amp;lt;GeometryObject&amp;gt; objects = new List&amp;lt;GeometryObject&amp;gt;();

using (Transaction createGometry = new Transaction(doc, "Create Surface Highlightes"))
{
    createGometry.Start();

    DirectShape directShape = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
    objects.Add(ConvertPlanarFaceToSolid(planarFace));
    directShape.AppendShape(objects);

    createGometry.Commit();
}&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;LI-CODE lang="csharp"&gt; public Solid ConvertPlanarFaceToSolid(PlanarFace planarFace)
 {
     // Get the boundary edges of the planar face
     IList&amp;lt;CurveLoop&amp;gt; curveLoops = planarFace.GetEdgesAsCurveLoops();

     // Get the normal direction of the face
     XYZ normal = planarFace.ComputeNormal(new UV(0.5, 0.5));

     // Set the extrusion height to a very small value, making it a thin BRep
     double extrusionHeight = 0.001;

     // Create a solid by extruding the face along its normal direction
     Solid faceSolid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, normal, extrusionHeight);

     return faceSolid;
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reference Video&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Revit_vxxEXVhNfj.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1411164iB2602E7D6D7657CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Revit_vxxEXVhNfj.gif" alt="Revit_vxxEXVhNfj.gif" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2024 14:48:04 GMT</pubDate>
    <dc:creator>Mohamed_Arshad</dc:creator>
    <dc:date>2024-09-19T14:48:04Z</dc:date>
    <item>
      <title>Creating Solid with one PlanarFace using BRepBuilder based on slab sketch</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030683#M2961</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I&lt;/SPAN&gt; &lt;SPAN class=""&gt;need&lt;/SPAN&gt; to &lt;SPAN class=""&gt;create&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;SPAN&gt;a S&lt;/SPAN&gt;&lt;SPAN class=""&gt;olid&lt;/SPAN&gt; &lt;SPAN class=""&gt;with&lt;/SPAN&gt;&lt;SPAN&gt; a &lt;/SPAN&gt;&lt;SPAN class=""&gt;single&lt;/SPAN&gt; PlanarFace&amp;nbsp;&lt;SPAN class=""&gt;using&amp;nbsp;BRepBuilder.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;A PlanarFace Edges based on a curves from sketch of a slab.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Below is the code of how I do it. I get the error "Autodesk.Revit.Exceptions.InvalidOperationException: 'BRep doesn't have enough faces.'" on brepBuilder.Finish();.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I do not understand how&lt;SPAN&gt; to create&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;disconnected Solid with one PlanarFace&lt;/SPAN&gt;&amp;nbsp;(highlighted&lt;SPAN&gt; in &lt;/SPAN&gt;red&lt;SPAN&gt; in &lt;/SPAN&gt;the screenshot).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andhxl_0-1726748177954.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1411079i83DFE57E6A95013B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andhxl_0-1726748177954.png" alt="andhxl_0-1726748177954.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var brepBuilder = new BRepBuilder(BRepType.Solid);
var surface = BRepBuilderSurfaceGeometry.Create(sketch.SketchPlane.GetPlane(), null);
BRepBuilderGeometryId faceId = brepBuilder.AddFace(surface, false);
foreach (CurveArray ca in sketch.Profile)
{
    BRepBuilderGeometryId loopId = brepBuilder.AddLoop(faceId);
    foreach (Curve c in ca)
    {
        var edge = BRepBuilderEdgeGeometry.Create(c);
        BRepBuilderGeometryId edgeId = brepBuilder.AddEdge(edge);
        brepBuilder.AddCoEdge(loopId, edgeId, false);
    }
    brepBuilder.FinishLoop(loopId);
}
brepBuilder.FinishFace(faceId);
brepBuilder.Finish();

using (var tr = new Transaction(doc, "Create a DirectShape"))
{
    tr.Start();
    DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
    ds.SetShape(brepBuilder);
    tr.Commit();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 19:12:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030683#M2961</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T19:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030812#M2962</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15732166"&gt;@andhxl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Do you need to project curve over the slab top surface ? Can you please explain in detail&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 13:14:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030812#M2962</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-09-19T13:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030825#M2963</link>
      <description>&lt;P&gt;Maybe the &lt;U&gt;&lt;STRONG&gt;BRepBuilderExample&lt;/STRONG&gt;&lt;/U&gt; Revit SDK sample will help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/05/revit-2017-and-2018-sdk-samples.html#4.4" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/05/revit-2017-and-2018-sdk-samples.html#4.4&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 13:19:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030825#M2963</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-19T13:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030832#M2964</link>
      <description>&lt;P&gt;Hi, no, I need to get Solid with one PlanarFace. TessellatedShapeBuilder is not suitable for me, since I need not only Line, but also Arc and so on.&amp;nbsp;Tessellation is not suitable&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 13:22:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030832#M2964</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T13:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030840#M2965</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15732166"&gt;@andhxl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; you need to create solid using one planar face correct ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 13:25:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030840#M2965</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-09-19T13:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030905#M2966</link>
      <description>&lt;P&gt;Need Solid&amp;nbsp;&lt;SPAN class=""&gt;consisting&lt;/SPAN&gt; &lt;SPAN class=""&gt;of one PlanarFace, created by&amp;nbsp;BRepBuilder.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This is how I get it using TessellatedShapeBuilder. I need the same thing, but without tessellation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var tsb = new TessellatedShapeBuilder();
tsb.OpenConnectedFaceSet(true);
var facePoints = new List&amp;lt;IList&amp;lt;XYZ&amp;gt;&amp;gt;();
foreach (CurveArray ca in sketch.Profile)
{
    var points = new List&amp;lt;XYZ&amp;gt;();
    foreach (Curve c in ca)
    {
        if (c is Line)
        {
            points.Add(c.GetEndPoint(0));
        }
        else
        {
            IList&amp;lt;XYZ&amp;gt; curvePoints = c.Tessellate();
            for (int i = 0; i &amp;lt; curvePoints.Count - 1; i++)
            {
                points.Add(curvePoints[i]);
            }
        }
    }
    facePoints.Add(points);
}
tsb.AddFace(new TessellatedFace(facePoints, ElementId.InvalidElementId));
tsb.CloseConnectedFaceSet();
tsb.Build();

using (var tr = new Transaction(doc, "Create a DirectShape"))
{
    tr.Start();
    DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
    ds.SetShape(tsb);
    tr.Commit();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 19:48:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030905#M2966</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T19:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030941#M2967</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15732166"&gt;@andhxl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I understand now, But you have created a TessellatedFace using single planar which a surface not solid. But we can't able to generate solid just using one planar face (Brep). You need thickness for that one. you can do one thing extract complete solid from the slab and and generate feature using DirectShape. Kindy check the below code.&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;foreach (GeometryObject geoObj in geoElement)
{
    if (geoObj is Solid)
    {
       solid = geoObj as Solid;

        if (solid.Volume &amp;gt; 0)
        {
            break;
        }
    }
}

List&amp;lt;GeometryObject&amp;gt; objects = new List&amp;lt;GeometryObject&amp;gt;();
objects.Add(solid);

using (Transaction createGometry = new Transaction(doc, "Create Disconnected Slab"))
{
    createGometry.Start();

    DirectShape directShape = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
    directShape.AppendShape(objects);

    createGometry.Commit();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what we can do, Generating Solid using Face it possible, but you have to define some thickness to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will Helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 14:16:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030941#M2967</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-09-19T14:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030960#M2968</link>
      <description>No, that's not what I need. And we can create a Solid with one PlanarFace, I showed this code above with TessellatedShapeBuilder</description>
      <pubDate>Thu, 19 Sep 2024 14:18:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030960#M2968</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T14:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030969#M2969</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/549406"&gt;@Moustafa_K&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help in solving this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 14:20:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13030969#M2969</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-09-19T14:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031067#M2970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15732166"&gt;@andhxl&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Check the below workaround code&lt;BR /&gt;&lt;STRONG&gt;Reference Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            PlanarFace planarFace = null;

            foreach (GeometryObject geoObj in geoElement)
            {
                if (geoObj is Solid)
                {
                    Solid solid = geoObj as Solid;

                    if (solid.Volume &amp;gt; 0)
                    {
                        FaceArray faceArray = solid.Faces;

                        foreach (Face face in faceArray)
                        {
                            if (face is PlanarFace)
                            {
                                PlanarFace pFace = face as PlanarFace;

                                if (pFace.FaceNormal.Z == 1)
                                {
                                    planarFace = pFace;
                                    break;
                                }
                            }
                        }
                    }

                }
            }


List&amp;lt;GeometryObject&amp;gt; objects = new List&amp;lt;GeometryObject&amp;gt;();

using (Transaction createGometry = new Transaction(doc, "Create Surface Highlightes"))
{
    createGometry.Start();

    DirectShape directShape = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
    objects.Add(ConvertPlanarFaceToSolid(planarFace));
    directShape.AppendShape(objects);

    createGometry.Commit();
}&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;LI-CODE lang="csharp"&gt; public Solid ConvertPlanarFaceToSolid(PlanarFace planarFace)
 {
     // Get the boundary edges of the planar face
     IList&amp;lt;CurveLoop&amp;gt; curveLoops = planarFace.GetEdgesAsCurveLoops();

     // Get the normal direction of the face
     XYZ normal = planarFace.ComputeNormal(new UV(0.5, 0.5));

     // Set the extrusion height to a very small value, making it a thin BRep
     double extrusionHeight = 0.001;

     // Create a solid by extruding the face along its normal direction
     Solid faceSolid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, normal, extrusionHeight);

     return faceSolid;
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reference Video&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Revit_vxxEXVhNfj.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1411164iB2602E7D6D7657CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Revit_vxxEXVhNfj.gif" alt="Revit_vxxEXVhNfj.gif" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 14:48:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031067#M2970</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2024-09-19T14:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031097#M2971</link>
      <description>Need PlanarFace without any thickness(</description>
      <pubDate>Thu, 19 Sep 2024 14:54:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031097#M2971</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T14:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031188#M2972</link>
      <description>&lt;P&gt;Did you look at&amp;nbsp;the &lt;U&gt;&lt;STRONG&gt;BRepBuilderExample&lt;/STRONG&gt;&lt;/U&gt; Revit SDK sample, as suggested above? You didn't say anything about that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/05/revit-2017-and-2018-sdk-samples.html#4.4" target="_blank" rel="nofollow noopener noreferrer"&gt;https://thebuildingcoder.typepad.com/blog/2017/05/revit-2017-and-2018-sdk-samples.html#4.4&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;It includes a creation of a non-planar face, with no solid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please also take a look at the sample code in the documentation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2024/94c1fef4-2933-ce67-9c2d-361cbf8a42b4.htm" target="_blank"&gt;https://www.revitapidocs.com/2024/94c1fef4-2933-ce67-9c2d-361cbf8a42b4.htm&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It demonstrates in detail the creation of faces, edges, coedges, including arcs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additional very helpful background information is provided by The Building Coder discussing&amp;nbsp;BRepBuilder organisation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/06/brepbuilder-and-toposurface-interior.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/06/brepbuilder-and-toposurface-interior.html#2&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 15:25:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031188#M2972</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-19T15:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031307#M2973</link>
      <description>&lt;P&gt;&lt;STRONG&gt;BRepBuilder&lt;/STRONG&gt; can be tricky to work with, in your case you should change the &lt;STRONG&gt;BRepType.Solid&lt;/STRONG&gt; to &lt;STRONG&gt;BRepType.OpenShell&lt;/STRONG&gt;, this basically allow the builder to return a solid without a volume.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes the orientation matter, specially in the &lt;STRONG&gt;BRepType.Solid&lt;/STRONG&gt; and &lt;STRONG&gt;BRepType.Void &lt;/STRONG&gt;that you need to make sure all edges is register in the correct orientation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pretty sure if you change to &lt;STRONG&gt;BRepType.OpenShell&lt;/STRONG&gt; your code gonna work fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a full sample to copy a &lt;STRONG&gt;Face&lt;/STRONG&gt; to &lt;STRONG&gt;Solid&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FaceToSolid - 2024-09-19 12-37-33.gif" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1411216i4CDB6BAF0885F200/image-size/small?v=v2&amp;amp;px=200" role="button" title="FaceToSolid - 2024-09-19 12-37-33.gif" alt="FaceToSolid - 2024-09-19 12-37-33.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;

namespace RevitAddin.Forum.Revit.Commands
{
    [Transaction(TransactionMode.Manual)]
    public class CommandFaceToSolid : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiapp = commandData.Application;
            Document document = uiapp.ActiveUIDocument.Document;

            try
            {
                var faceReference = uiapp.ActiveUIDocument.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Face);
                var element = document.GetElement(faceReference);
                var face = element.GetGeometryObjectFromReference(faceReference) as Face;

                var solid = CreateSolidFromFace(face);
                var normal = face.ComputeNormal(new UV(0.5, 0.5));

                using (Transaction transaction = new Transaction(document))
                {
                    transaction.Start("Create Solid");
                    var ds = DirectShape.CreateElement(document, new ElementId(BuiltInCategory.OST_GenericModel));
                    ds.SetName(ds.Category.Name);
                    ds.SetShape(new[] { solid });
                    ds.Location.Move(normal);
                    transaction.Commit();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return Result.Succeeded;
        }

        private Solid CreateSolidFromFace(Face face)
        {
            var surface = face.GetSurface();
            var brepBuilder = new BRepBuilder(BRepType.OpenShell);
            var faceIsReversed = !face.OrientationMatchesSurfaceOrientation;
            BRepBuilderGeometryId faceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(surface, null), faceIsReversed);
            foreach (CurveLoop curveLoop in face.GetEdgesAsCurveLoops())
            {
                BRepBuilderGeometryId loopId = brepBuilder.AddLoop(faceId);
                foreach (Curve curve in curveLoop)
                {
                    var edge = BRepBuilderEdgeGeometry.Create(curve);
                    BRepBuilderGeometryId edgeId = brepBuilder.AddEdge(edge);
                    brepBuilder.AddCoEdge(loopId, edgeId, false);
                }
                brepBuilder.FinishLoop(loopId);
            }
            brepBuilder.SetFaceMaterialId(faceId, face.MaterialElementId);
            brepBuilder.FinishFace(faceId);
            brepBuilder.Finish();

            return brepBuilder.GetResult();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 16:05:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031307#M2973</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2024-09-19T16:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031513#M2974</link>
      <description>&lt;P&gt;I looked, thanks. It became more clear.&amp;nbsp;It especially helped to understand:&amp;nbsp;&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;</description>
      <pubDate>Thu, 19 Sep 2024 17:38:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031513#M2974</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T17:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating disconnected Solid with one PlanarFace using BRepBuilder</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031540#M2975</link>
      <description>&lt;P&gt;Thanks, I've tried with BRepType.OpenShell and I got an internal error. If you take the curves from Face, then it really works without problems. But if you get the curves from the slab sketch, then you need to determine whether they are reversed or not. The sketch could have been constructed any way. Now it is clear that it is possible to do this and that is the whole problem. It remains to understand how to accurately determine this&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 21:42:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031540#M2975</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-19T21:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Solid with one PlanarFace using BRepBuilder based on slab sketch</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031678#M2976</link>
      <description>&lt;P&gt;Thank you all!&amp;nbsp;&lt;SPAN class=""&gt;In&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class=""&gt;case&lt;/SPAN&gt; &lt;SPAN class=""&gt;of&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class=""&gt;sketch&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;I&lt;/SPAN&gt; &lt;SPAN class=""&gt;found&lt;/SPAN&gt; &lt;SPAN class=""&gt;this&lt;/SPAN&gt;&lt;SPAN&gt; way &lt;/SPAN&gt;&lt;SPAN class=""&gt;out -&amp;nbsp;combine several actions (creating Face and creating Solid based on it), &lt;SPAN class=""&gt;to&lt;/SPAN&gt; &lt;SPAN class=""&gt;not&lt;/SPAN&gt; &lt;SPAN class=""&gt;care&lt;/SPAN&gt; &lt;SPAN class=""&gt;about&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class=""&gt;direction&lt;/SPAN&gt;&lt;SPAN&gt; of the &lt;/SPAN&gt;&lt;SPAN class=""&gt;curves&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class=""&gt;sketch&lt;/SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        var sketch = (Sketch)doc.GetElement(floor.GetSketchId());

        Face face = CreateFaceFromSketch(sketch);
        Solid solid = CreateSolidFromFace(face);

        using (var tr = new Transaction(doc, "Creation DirectShape"))
        {
            tr.Start();
            DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
            ds.SetShape([solid]);
            tr.Commit();
        }
    }

    private static PlanarFace CreateFaceFromSketch(Sketch sketch)
    {
        var curveLoops = new List&amp;lt;CurveLoop&amp;gt;();
        foreach (CurveArray ca in sketch.Profile)
        {
            var cl = new CurveLoop();
            foreach (Curve c in ca)
                cl.Append(c);
            curveLoops.Add(cl);
        }

        XYZ dir = sketch.SketchPlane.GetPlane().Normal;

        Solid tempSolid = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, dir.Negate(), Application.MinimumThickness);

        return tempSolid.Faces
            .OfType&amp;lt;PlanarFace&amp;gt;()
            .First(f =&amp;gt; f.FaceNormal.IsAlmostEqualTo(dir));
    }

    private static Solid CreateSolidFromFace(Face face)
    {
        var brepBuilder = new BRepBuilder(BRepType.OpenShell);

        var surface = BRepBuilderSurfaceGeometry.Create(face.GetSurface(), null);
        bool faceIsReversed = !face.OrientationMatchesSurfaceOrientation;
        BRepBuilderGeometryId faceId = brepBuilder.AddFace(surface, faceIsReversed);

        foreach (CurveLoop cl in face.GetEdgesAsCurveLoops())
        {
            BRepBuilderGeometryId loopId = brepBuilder.AddLoop(faceId);
            foreach (Curve c in cl)
            {
                BRepBuilderGeometryId edgeId = brepBuilder.AddEdge(BRepBuilderEdgeGeometry.Create(c));
                brepBuilder.AddCoEdge(loopId, edgeId, false);
            }
            brepBuilder.FinishLoop(loopId);
        }

        brepBuilder.SetFaceMaterialId(faceId, face.MaterialElementId);
        brepBuilder.FinishFace(faceId);
        brepBuilder.Finish();

        return brepBuilder.GetResult();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Although&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;perhaps&lt;/SPAN&gt; &lt;SPAN class=""&gt;this&lt;/SPAN&gt; &lt;SPAN class=""&gt;can&lt;/SPAN&gt;&lt;SPAN&gt; be &lt;/SPAN&gt;&lt;SPAN class=""&gt;done&lt;/SPAN&gt;&lt;SPAN&gt; by &lt;/SPAN&gt;&lt;SPAN class=""&gt;creating&lt;/SPAN&gt; &lt;SPAN class=""&gt;a&lt;/SPAN&gt;&lt;SPAN&gt; CurveLoop &lt;/SPAN&gt;&lt;SPAN class=""&gt;and&lt;/SPAN&gt; &lt;SPAN class=""&gt;determining&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class=""&gt;direction&lt;/SPAN&gt; &lt;SPAN class=""&gt;using&lt;/SPAN&gt; &lt;SPAN class=""&gt;IsCounterclockwise&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class=""&gt;without&lt;/SPAN&gt; &lt;SPAN class=""&gt;creating&lt;/SPAN&gt;&lt;SPAN&gt; a &lt;/SPAN&gt;&lt;SPAN class=""&gt;temporary&lt;/SPAN&gt; &lt;SPAN class=""&gt;Solid&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 07:13:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-solid-with-one-planarface-using-brepbuilder-based-on/m-p/13031678#M2976</guid>
      <dc:creator>andhxl</dc:creator>
      <dc:date>2024-09-20T07:13:35Z</dc:date>
    </item>
  </channel>
</rss>

