<?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: Create Solid from boundingbox in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/11320235#M65572</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="516579196_0-1658825579631.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1096426i169194A101670506/image-size/medium?v=v2&amp;amp;px=400" role="button" title="516579196_0-1658825579631.png" alt="516579196_0-1658825579631.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;namespace SizeAdjustment&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;public class WindowDoorOpening : IExternalCommand&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,&lt;BR /&gt;ref string message, ElementSet elements)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;UIApplication uIApp = commandData.Application;&lt;BR /&gt;Application application = uIApp.Application;&lt;BR /&gt;UIDocument uIDoc = uIApp.ActiveUIDocument;&lt;BR /&gt;Document document = uIDoc.Document;&lt;BR /&gt;Selection selection = uIDoc.Selection;&lt;BR /&gt;View view = uIDoc.ActiveView;&lt;BR /&gt;//【】过滤墙体 用户选择&lt;BR /&gt;IList&amp;lt;Element&amp;gt; faces = uIDoc.Selection.PickElementsByRectangle();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Transaction trans = new Transaction(document, "LS");&lt;BR /&gt;trans.Start();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var solid = solidBoundingBox(view, faces.First());&lt;BR /&gt;var ds7 = DirectShape.CreateElement(document, new ElementId(BuiltInCategory.OST_GenericModel));&lt;BR /&gt;ds7.GetGeneratingElementIds(solid);&lt;BR /&gt;ds7.SetShape(new List&amp;lt;GeometryObject&amp;gt;() { solid });&lt;BR /&gt;trans.Commit();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return Result.Succeeded;&lt;BR /&gt;}&lt;BR /&gt;public static Solid solidBoundingBox(View view,Element inputSolid)&lt;BR /&gt;{&lt;BR /&gt;BoundingBoxXYZ bbox = inputSolid.get_BoundingBox(view);&lt;/P&gt;&lt;P&gt;// corners in BBox coords&lt;BR /&gt;XYZ pt0 = new XYZ(bbox.Min.X, bbox.Min.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt1 = new XYZ(bbox.Max.X, bbox.Min.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt2 = new XYZ(bbox.Max.X, bbox.Max.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt3 = new XYZ(bbox.Min.X, bbox.Max.Y, bbox.Min.Z);&lt;BR /&gt;//edges in BBox coords&lt;BR /&gt;Line edge0 = Line.CreateBound(pt0, pt1);&lt;BR /&gt;Line edge1 = Line.CreateBound(pt1, pt2);&lt;BR /&gt;Line edge2 = Line.CreateBound(pt2, pt3);&lt;BR /&gt;Line edge3 = Line.CreateBound(pt3, pt0);&lt;BR /&gt;//create loop, still in BBox coords&lt;BR /&gt;List&amp;lt;Curve&amp;gt; edges = new List&amp;lt;Curve&amp;gt;();&lt;BR /&gt;edges.Add(edge0);&lt;BR /&gt;edges.Add(edge1);&lt;BR /&gt;edges.Add(edge2);&lt;BR /&gt;edges.Add(edge3);&lt;BR /&gt;Double height = bbox.Max.Z - bbox.Min.Z;&lt;BR /&gt;CurveLoop baseLoop = CurveLoop.Create(edges);&lt;BR /&gt;List&amp;lt;CurveLoop&amp;gt; loopList = new List&amp;lt;CurveLoop&amp;gt;();&lt;BR /&gt;loopList.Add(baseLoop);&lt;BR /&gt;Solid preTransformBox = GeometryCreationUtilities.CreateExtrusionGeometry(loopList, XYZ.BasisZ, height);&lt;/P&gt;&lt;P&gt;Solid transformBox = SolidUtils.CreateTransformed(preTransformBox, bbox.Transform);&lt;/P&gt;&lt;P&gt;return transformBox;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2022 08:54:25 GMT</pubDate>
    <dc:creator>516579196</dc:creator>
    <dc:date>2022-07-26T08:54:25Z</dc:date>
    <item>
      <title>Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6330376#M65560</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a boundingbox and i need to convert in to a solid;&lt;/P&gt;&lt;P&gt;one possible solution is to use&amp;nbsp;CreateExtrusionGeometry using a curveloop from some lines&amp;nbsp;created from&amp;nbsp;this boundingbox,&lt;/P&gt;&lt;P&gt;is there a better solution to accomplish this?&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 14:15:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6330376#M65560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-17T14:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6330583#M65561</link>
      <description>&lt;P&gt;For now i used&amp;nbsp;&lt;SPAN&gt;CreateExtrusionGeometry and its OK, but i would appreciate better solutions if any.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 15:28:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6330583#M65561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-17T15:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6332037#M65562</link>
      <description>&lt;P&gt;Do you want to generate a persistent Revit database element?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, the simplest solution is almost certainly to use a DirectShape element:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.50" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.50&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 07:21:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6332037#M65562</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-05-18T07:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6332078#M65563</link>
      <description>&lt;P&gt;Dear jeremy,&lt;/P&gt;&lt;P&gt;Thank you for your answer and helpful link.&lt;/P&gt;&lt;P&gt;Here, this solid is a temporary one to use with&amp;nbsp;ElementIntersectsSolidFilter.&lt;/P&gt;&lt;P&gt;Since intersecting element is a brace , &amp;nbsp;i couldn't use BoundingBoxIntersectsFilter;&lt;/P&gt;&lt;P&gt;if there were a &amp;nbsp;gradient boundingboxxyz in Revit API that Could&amp;nbsp;be of great use for elements such as braces;&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 07:48:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6332078#M65563</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-18T07:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6579549#M65564</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking for an answer to the very same question, ended up here, and re-created your solution.&amp;nbsp; To save the next person a bit of typing, here's my code.&amp;nbsp; I'd love a more elegant answer but this works for my needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        public static Solid solidBoundingBox(Solid inputSolid)
        {
            BoundingBoxXYZ bbox = inputSolid.GetBoundingBox();

            // corners in BBox coords
            XYZ pt0 = new XYZ(bbox.Min.X, bbox.Min.Y, bbox.Min.Z);
            XYZ pt1 = new XYZ(bbox.Max.X, bbox.Min.Y, bbox.Min.Z);
            XYZ pt2 = new XYZ(bbox.Max.X, bbox.Max.Y, bbox.Min.Z);
            XYZ pt3 = new XYZ(bbox.Min.X, bbox.Max.Y, bbox.Min.Z);
            //edges in BBox coords
            Line edge0 = Line.CreateBound(pt0, pt1);
            Line edge1 = Line.CreateBound(pt1, pt2);
            Line edge2 = Line.CreateBound(pt2, pt3);
            Line edge3 = Line.CreateBound(pt3, pt0);
            //create loop, still in BBox coords
            List&amp;lt;Curve&amp;gt; edges = new List&amp;lt;Curve&amp;gt;();
            edges.Add(edge0);
            edges.Add(edge1);
            edges.Add(edge2);
            edges.Add(edge3);
            Double height = bbox.Max.Z - bbox.Min.Z;
            CurveLoop baseLoop = CurveLoop.Create(edges);
            List&amp;lt;CurveLoop&amp;gt; loopList = new List&amp;lt;CurveLoop&amp;gt;();
            loopList.Add(baseLoop);
            Solid preTransformBox = GeometryCreationUtilities.CreateExtrusionGeometry(loopList, XYZ.BasisZ, height);

            Solid transformBox = SolidUtils.CreateTransformed(preTransformBox, bbox.Transform);

            return transformBox;
            
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 01:24:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6579549#M65564</guid>
      <dc:creator>owenmerrick</dc:creator>
      <dc:date>2016-09-23T01:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6580124#M65565</link>
      <description>&lt;P&gt;Dear Owen,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your nice little sample code snippet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will gladly add it to The Building Coder samples, if I may.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a sample use case to demonstrate it doing something handy&amp;nbsp;in a simple external command?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 10:52:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6580124#M65565</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-23T10:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6581132#M65566</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sampleSplitBoundingBox.jpg" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/275744i4A44867495AB0C9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sampleSplitBoundingBox.jpg" alt="sampleSplitBoundingBox.jpg" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;Upon selecting the planar face of a solid, two new solids are created - the two halves of the bounding box of the original, split by the plane of the selected face.&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;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a simplified version of how I'm using the bounding box code from yesterday. Whether this command meets the definition of "doing something handy" is debatable, but it's at least a functional command. I'm working on solid modeling tools for working with non-parametric masses using somewhat different formal logic than the built-in "form" tools. The step demo'd here is really just one piece of construction geometry on the way to a more complex, yet-unfinished tool, but it illustrates a few useful functions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- from user face selection, retrieve both the face and the solid&lt;BR /&gt;- from solid, generate solid of bounding box&lt;BR /&gt;- insert solid into family context&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This draws _very_ heavily on the sample code provided with the SDK, particularly the FreeFormElement sample and planar face selection filter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the sample code I copied the relevant bits into a fresh addin and zipped the whole thing up. This has the source, working(for me) .dll and sample image and rfa in the "doc" folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Owen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 17:23:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6581132#M65566</guid>
      <dc:creator>owenmerrick</dc:creator>
      <dc:date>2016-09-23T17:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6582446#M65567</link>
      <description>&lt;P&gt;Can you please provide a sample RVT file for your "brace" family because I guess there is a direct way to do your intersection.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 18:04:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6582446#M65567</guid>
      <dc:creator>Mustafa.Salaheldin</dc:creator>
      <dc:date>2016-09-24T18:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6587841#M65568</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;As a use case, we use very similar code to do interference checking within a provided tolerance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Owen,&lt;/P&gt;&lt;P&gt;I think you nailed it and&amp;nbsp;I don't think there is a more elegant solution.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 19:40:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6587841#M65568</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2016-09-27T19:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6594331#M65570</link>
      <description>&lt;P&gt;Wonderful, thank you ever so much for the perfect sample!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I summarised, polished and published this thread on The Building Coder:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2016/09/solid-from-bounding-box-and-forge-webinar-4.html#2" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2016/09/solid-from-bounding-box-and-forge-webinar-4.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 11:55:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6594331#M65570</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-09-30T11:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6595002#M65571</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great, glad it worked out for you.&amp;nbsp; If I get my alternative massing modeling tools working well perhaps I'll post a follow up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bobby,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the kind words.&amp;nbsp; I'm an architect rather than a proper programmer so sometimes I'm not sure if I'm missing an easier or more elegant way of doing things.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 16:09:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/6595002#M65571</guid>
      <dc:creator>owenmerrick</dc:creator>
      <dc:date>2016-09-30T16:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create Solid from boundingbox</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/11320235#M65572</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="516579196_0-1658825579631.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1096426i169194A101670506/image-size/medium?v=v2&amp;amp;px=400" role="button" title="516579196_0-1658825579631.png" alt="516579196_0-1658825579631.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;namespace SizeAdjustment&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;public class WindowDoorOpening : IExternalCommand&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,&lt;BR /&gt;ref string message, ElementSet elements)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;UIApplication uIApp = commandData.Application;&lt;BR /&gt;Application application = uIApp.Application;&lt;BR /&gt;UIDocument uIDoc = uIApp.ActiveUIDocument;&lt;BR /&gt;Document document = uIDoc.Document;&lt;BR /&gt;Selection selection = uIDoc.Selection;&lt;BR /&gt;View view = uIDoc.ActiveView;&lt;BR /&gt;//【】过滤墙体 用户选择&lt;BR /&gt;IList&amp;lt;Element&amp;gt; faces = uIDoc.Selection.PickElementsByRectangle();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Transaction trans = new Transaction(document, "LS");&lt;BR /&gt;trans.Start();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var solid = solidBoundingBox(view, faces.First());&lt;BR /&gt;var ds7 = DirectShape.CreateElement(document, new ElementId(BuiltInCategory.OST_GenericModel));&lt;BR /&gt;ds7.GetGeneratingElementIds(solid);&lt;BR /&gt;ds7.SetShape(new List&amp;lt;GeometryObject&amp;gt;() { solid });&lt;BR /&gt;trans.Commit();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return Result.Succeeded;&lt;BR /&gt;}&lt;BR /&gt;public static Solid solidBoundingBox(View view,Element inputSolid)&lt;BR /&gt;{&lt;BR /&gt;BoundingBoxXYZ bbox = inputSolid.get_BoundingBox(view);&lt;/P&gt;&lt;P&gt;// corners in BBox coords&lt;BR /&gt;XYZ pt0 = new XYZ(bbox.Min.X, bbox.Min.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt1 = new XYZ(bbox.Max.X, bbox.Min.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt2 = new XYZ(bbox.Max.X, bbox.Max.Y, bbox.Min.Z);&lt;BR /&gt;XYZ pt3 = new XYZ(bbox.Min.X, bbox.Max.Y, bbox.Min.Z);&lt;BR /&gt;//edges in BBox coords&lt;BR /&gt;Line edge0 = Line.CreateBound(pt0, pt1);&lt;BR /&gt;Line edge1 = Line.CreateBound(pt1, pt2);&lt;BR /&gt;Line edge2 = Line.CreateBound(pt2, pt3);&lt;BR /&gt;Line edge3 = Line.CreateBound(pt3, pt0);&lt;BR /&gt;//create loop, still in BBox coords&lt;BR /&gt;List&amp;lt;Curve&amp;gt; edges = new List&amp;lt;Curve&amp;gt;();&lt;BR /&gt;edges.Add(edge0);&lt;BR /&gt;edges.Add(edge1);&lt;BR /&gt;edges.Add(edge2);&lt;BR /&gt;edges.Add(edge3);&lt;BR /&gt;Double height = bbox.Max.Z - bbox.Min.Z;&lt;BR /&gt;CurveLoop baseLoop = CurveLoop.Create(edges);&lt;BR /&gt;List&amp;lt;CurveLoop&amp;gt; loopList = new List&amp;lt;CurveLoop&amp;gt;();&lt;BR /&gt;loopList.Add(baseLoop);&lt;BR /&gt;Solid preTransformBox = GeometryCreationUtilities.CreateExtrusionGeometry(loopList, XYZ.BasisZ, height);&lt;/P&gt;&lt;P&gt;Solid transformBox = SolidUtils.CreateTransformed(preTransformBox, bbox.Transform);&lt;/P&gt;&lt;P&gt;return transformBox;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 08:54:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/create-solid-from-boundingbox/m-p/11320235#M65572</guid>
      <dc:creator>516579196</dc:creator>
      <dc:date>2022-07-26T08:54:25Z</dc:date>
    </item>
  </channel>
</rss>

