<?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 Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12995500#M3275</link>
    <description>&lt;P&gt;After getting BoundingBox from Soild How I Transform its Values to comply with 3d view because as mentioned in revit API docs "&lt;SPAN&gt;The bounding box information is stored as bounds in local coordinates and a transform. So the transform is to be taken in to account when using the bounds. This is different from the bounding box returned by Element.BoundingBox in that the bounding box returned by that routine stores the bounds in modeling coordinates with an identity transform.&lt;/SPAN&gt;" all I need is to&amp;nbsp;C transform bounding box got from solid geometry to bounding box I can use in 3dview&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2024 11:04:52 GMT</pubDate>
    <dc:creator>ahmed.elhawary73</dc:creator>
    <dc:date>2024-09-02T11:04:52Z</dc:date>
    <item>
      <title>Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12995500#M3275</link>
      <description>&lt;P&gt;After getting BoundingBox from Soild How I Transform its Values to comply with 3d view because as mentioned in revit API docs "&lt;SPAN&gt;The bounding box information is stored as bounds in local coordinates and a transform. So the transform is to be taken in to account when using the bounds. This is different from the bounding box returned by Element.BoundingBox in that the bounding box returned by that routine stores the bounds in modeling coordinates with an identity transform.&lt;/SPAN&gt;" all I need is to&amp;nbsp;C transform bounding box got from solid geometry to bounding box I can use in 3dview&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 11:04:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12995500#M3275</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-02T11:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12996245#M3276</link>
      <description>&lt;P&gt;It depends on your element. For a wall, for instance, the transform is identity. For a family instance, the local coordinate system depends on the family definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 18:35:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12996245#M3276</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-02T18:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12996926#M3277</link>
      <description>&lt;P&gt;Hello Dear, let's take an example to explain what I mean if I get a solid of a specific element and get the bounding box from this solid through solid.GetBoundingBox(); then used this bounding box to set the 3dview section box I'm getting a section box that does not include my element.&amp;nbsp;&lt;BR /&gt;After Searching within Revit API Docs I got this remarks:&lt;/P&gt;&lt;P&gt;Remarks&lt;/P&gt;&lt;DIV class=""&gt;"The bounding box information is stored as bounds in local coordinates and a transform. So the transform is to be taken in to account when using the bounds. This is different from the bounding box returned by Element.BoundingBox in that the bounding box returned by that routine stores the bounds in modeling coordinates with an identity transform."&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;So I want an example of converting a Solid bounding box so it can be used to get a section box in the 3d view to just include my solid bounds.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Sep 2024 06:00:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12996926#M3277</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-03T06:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12997090#M3278</link>
      <description>&lt;P&gt;I searched this forum for&amp;nbsp;"transform element coordinates to model" for you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&amp;amp;allow_punctuation=false&amp;amp;filter=location&amp;amp;location=forum-board:160&amp;amp;q=transform%20element%20coordinates%20to%20model" target="_blank"&gt;https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&amp;amp;allow_punctuation=false&amp;amp;filter=location&amp;amp;location=forum-board:160&amp;amp;q=transform%20element%20coordinates%20to%20model&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the first hits is this that looks likely to answer your question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Convert local family instance coordinate of selected Edge to project coordinates&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/convert-local-family-instance-coordinate-of-selected-edge-to/m-p/6282821" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/convert-local-family-instance-coordinate-of-selected-edge-to/m-p/6282821&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 07:27:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/12997090#M3278</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-03T07:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004396#M3279</link>
      <description>&lt;P&gt;Dear Jeremey, I've browsed the mentioned posts. Now I can get all the bounding boxes I need from solids, for example, if I set the 3d view section box to one of them directly it works well,&amp;nbsp; but here is a new problem when I try to combine all the bounding boxes by getting min &amp;amp; max points (x,y,z) and create a new bounding box to include all wanted solids then I miss the transform of each bounding box how can I combine bounding box without losing transform?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void SetSectionBox()
		{
			UIDocument uidoc = Application.ActiveUIDocument;
			Document doc = Application.ActiveUIDocument.Document;
			var myview = uidoc.ActiveView as View3D;
			
			//pick elements
			var refs = uidoc.Selection.PickObjects(ObjectType.Element);
			var elements = refs.Select(x =&amp;gt; doc.GetElement(x.ElementId)).ToList();
//get all solids it worked
			var solids = getallsolids(elements,myview);
			var bbs = solids.Select(x=&amp;gt;x.GetBoundingBox()).ToList();
			

			BoundingBoxXYZ bb =  OuterBox(bbs);
			
					
			 Transaction trn = new Transaction(doc, "sd");
             trn.Start();
             myview.SetSectionBox(bb);
             trn.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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public BoundingBoxXYZ OuterBox(List&amp;lt;BoundingBoxXYZ&amp;gt; bbs)
		{
			var x1 = bbs.Select(x=&amp;gt;x.Min.X).Min();
			var y1 = bbs.Select(x=&amp;gt;x.Min.Y).Min();
			var z1 = bbs.Select(x=&amp;gt;x.Min.Z).Min();
			
			var x2 = bbs.Select(x=&amp;gt;x.Max.X).Max();
			var y2 = bbs.Select(x=&amp;gt;x.Max.Y).Max();
			var z2 = bbs.Select(x=&amp;gt;x.Max.Z).Max();
			
			var min = new XYZ(x1,y1,z1);
			var max = new XYZ(x2,y2,z2);
			
			var bb = new BoundingBoxXYZ(){Min=min,Max=max};
			
			return bb;
			
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then I need to set a transform to the new bounding box so it'll show all selected elements in the view section box&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 08:24:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004396#M3279</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-06T08:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004456#M3280</link>
      <description>&lt;P&gt;Congratulations on your good progress. I suggest you apply the transform individually to each bounding box first, retrieve the resulting min and max corners of each in the global coordinate system, and then unify the GPS corners into one single new GPS bounding box. Here are some methods from The Building Coder samples to expand a bounding box to contain new points:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;    public static class JtBoundingBoxXyzExtensionMethods
    {
        /// &amp;lt;summary&amp;gt;
        ///     Make this bounding box empty by setting the
        ///     Min value to plus infinity and Max to minus.
        /// &amp;lt;/summary&amp;gt;
        public static void Clear(
            this BoundingBoxXYZ bb)
        {
            var infinity = double.MaxValue;
            bb.Min = new XYZ(infinity, infinity, infinity);
            bb.Max = -bb.Min;
        }

        /// &amp;lt;summary&amp;gt;
        ///     Expand the given bounding box to include
        ///     and contain the given point.
        /// &amp;lt;/summary&amp;gt;
        public static void ExpandToContain(
            this BoundingBoxXYZ bb,
            XYZ p)
        {
            bb.Min = new XYZ(Math.Min(bb.Min.X, p.X),
                Math.Min(bb.Min.Y, p.Y),
                Math.Min(bb.Min.Z, p.Z));

            bb.Max = new XYZ(Math.Max(bb.Max.X, p.X),
                Math.Max(bb.Max.Y, p.Y),
                Math.Max(bb.Max.Z, p.Z));
        }

        /// &amp;lt;summary&amp;gt;
        ///     Expand the given bounding box to include
        ///     and contain the given points.
        /// &amp;lt;/summary&amp;gt;
        public static void ExpandToContain(
            this BoundingBoxXYZ bb,
            IEnumerable&amp;lt;XYZ&amp;gt; pts)
        {
            bb.ExpandToContain(new XYZ(
                pts.Min&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.X),
                pts.Min&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.Y),
                pts.Min&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.Z)));

            bb.ExpandToContain(new XYZ(
                pts.Max&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.X),
                pts.Max&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.Y),
                pts.Max&amp;lt;XYZ, double&amp;gt;(p =&amp;gt; p.Z)));
        }

        /// &amp;lt;summary&amp;gt;
        ///     Expand the given bounding box to include
        ///     and contain the given other one.
        /// &amp;lt;/summary&amp;gt;
        public static void ExpandToContain(
            this BoundingBoxXYZ bb,
            BoundingBoxXYZ other)
        {
            bb.ExpandToContain(other.Min);
            bb.ExpandToContain(other.Max);
        }
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 08:46:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004456#M3280</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-06T08:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004532#M3281</link>
      <description>Dear Jeremy, Thanks for your support as usual, I didn't understand how I could apply the transform individually to each bounding box first, from which object I can get the transform to apply for all bounding boxes, excuse me but not understanding.</description>
      <pubDate>Fri, 06 Sep 2024 09:42:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004532#M3281</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-06T09:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004568#M3282</link>
      <description>&lt;P&gt;Given two bounding boxes B1 and B2 with transforms T1 and T2 and min and max points Mn1, Mx1, Mn2 and Mx2, I suggest creating a new bounding box B in GPS coordinates by setting B.min = Min(T1 x Mn1, T2 x Mn2) and B.max = Max( T1 x Mx1, T2 x Mx2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 10:00:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004568#M3282</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-06T10:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004601#M3283</link>
      <description>B.min = Min(T1 x Mn1, T2 x Mn2) &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; what do you mean by x between T1 and Mn1</description>
      <pubDate>Fri, 06 Sep 2024 10:20:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004601#M3283</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-06T10:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004611#M3284</link>
      <description>&lt;P&gt;The standalone 'x' with spaces around it means 'apply the transform'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 10:23:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004611#M3284</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-09-06T10:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004684#M3285</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ahmedelhawary73_0-1725621098378.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1406371i85B6D400CBD48516/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ahmedelhawary73_0-1725621098378.png" alt="ahmedelhawary73_0-1725621098378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid expression&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 11:11:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13004684#M3285</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-06T11:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Solid.GetBoundingBox() is different from Element.get_BoundingBox(View myview) how to convert solid bounding box?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13005216#M3286</link>
      <description>&lt;P&gt;Dear Jeremy, Finally I got it I have to use Transform.Ofpoint(XYZ) method when adding min and max points of the bounding Box.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much Thanks for help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;	var solids = getallsolids(elements,myview);
			var bbs = solids.Select(x=&amp;gt;x.GetBoundingBox()).ToList();
			BoundingBoxXYZ bb = new BoundingBoxXYZ();
			Clear(bb);
			foreach (var B in bbs) 
			{
				var newbb = new BoundingBoxXYZ();
				var min = B.Min;
				var max = B.Max;
				var trans = B.Transform;
				
				ExpandToContain(bb,new BoundingBoxXYZ(){Min=trans.OfPoint( B.Min) , Max = trans.OfPoint( B.Max ) });
			}&lt;/LI-CODE&gt;&lt;P&gt;Much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 15:44:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/solid-getboundingbox-is-different-from-element-get-boundingbox/m-p/13005216#M3286</guid>
      <dc:creator>ahmed.elhawary73</dc:creator>
      <dc:date>2024-09-06T15:44:59Z</dc:date>
    </item>
  </channel>
</rss>

