<?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 Creating Revit View Set from Scope Boxes in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790208#M5133</link>
    <description>&lt;P&gt;I need to create view sets of multiple areas in a model each with a plan, 2 sections and a section box 3D view. I intend to do this using scope boxes placed/copied manually, and do the rest with Revit API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first hurdle I've run into is that when I use the CreateSection on the boundingbox retrieved from the Scope Box, it points upward from below.&lt;SPAN&gt;&amp;nbsp;I'm not sure why this is happening&lt;/SPAN&gt;&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="hammad_haroon_0-1716386012302.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365841iBD060AE2893F8574/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_0-1716386012302.png" alt="hammad_haroon_0-1716386012302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code snippet I've used to create this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void CreateSection()
		{
			FilteredElementCollector scopeBoxes = new FilteredElementCollector(Document).OfCategory(BuiltInCategory.OST_VolumeOfInterest);
			var scopeBoxList = scopeBoxes.ToList();
			
			ViewFamilyType vft
      = new FilteredElementCollector(Document)
        .OfClass( typeof( ViewFamilyType ) )
        .Cast&amp;lt;ViewFamilyType&amp;gt;()
        .FirstOrDefault&amp;lt;ViewFamilyType&amp;gt;( x =&amp;gt;
          ViewFamily.Section == x.ViewFamily );
			
			using (Transaction tx = new Transaction(Document)) {
				tx.Start("Create Section");
				foreach (Element e in scopeBoxList) 
				{
					BoundingBoxXYZ bbox = e.get_BoundingBox(null);

					ViewSection section1 = ViewSection.CreateSection(Document, vft.Id, bbox);
					
					
				}
				tx.Commit();
			}
						
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried creating a new bounding box, and assigning a new maximum and minimum point, intending to change the orientation while maintaining the dimensions, as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void CreateSection()
		{
			FilteredElementCollector scopeBoxes = new FilteredElementCollector(Document).OfCategory(BuiltInCategory.OST_VolumeOfInterest);
			var scopeBoxList = scopeBoxes.ToList();
			
			ViewFamilyType vft
      = new FilteredElementCollector(Document)
        .OfClass( typeof( ViewFamilyType ) )
        .Cast&amp;lt;ViewFamilyType&amp;gt;()
        .FirstOrDefault&amp;lt;ViewFamilyType&amp;gt;( x =&amp;gt;
          ViewFamily.Section == x.ViewFamily );
			
			using (Transaction tx = new Transaction(Document)) {
				tx.Start("Create Section");
				foreach (Element e in scopeBoxList) 
				{
					BoundingBoxXYZ bbox = e.get_BoundingBox(null);

					/*ViewSection section1 = ViewSection.CreateSection(Document, vft.Id, bbox);*/
					
					XYZ max1 = bbox.Max;
					XYZ min1 = bbox.Min;					
					
					XYZ max2 = new XYZ(max1.X, max1.Y, min1.Z);
					XYZ min2 = new XYZ(min1.X, min1.Y, max1.Z);
					
					XYZ mid = bbox.Max.Add(bbox.Min)/2;
				
					BoundingBoxXYZ ebbox = new BoundingBoxXYZ();
					
					ebbox.Enabled = true;
					ebbox.Max = max2;
					ebbox.Min = min2;
					
					ViewSection section2 = ViewSection.CreateSection(Document, vft.Id, ebbox);
				}
				tx.Commit();
			}	
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I get this error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hammad_haroon_1-1716386717196.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365855iD2521223468950E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_1-1716386717196.png" alt="hammad_haroon_1-1716386717196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 14:07:21 GMT</pubDate>
    <dc:creator>hammad_haroon</dc:creator>
    <dc:date>2024-05-22T14:07:21Z</dc:date>
    <item>
      <title>Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790208#M5133</link>
      <description>&lt;P&gt;I need to create view sets of multiple areas in a model each with a plan, 2 sections and a section box 3D view. I intend to do this using scope boxes placed/copied manually, and do the rest with Revit API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first hurdle I've run into is that when I use the CreateSection on the boundingbox retrieved from the Scope Box, it points upward from below.&lt;SPAN&gt;&amp;nbsp;I'm not sure why this is happening&lt;/SPAN&gt;&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="hammad_haroon_0-1716386012302.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365841iBD060AE2893F8574/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_0-1716386012302.png" alt="hammad_haroon_0-1716386012302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code snippet I've used to create this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void CreateSection()
		{
			FilteredElementCollector scopeBoxes = new FilteredElementCollector(Document).OfCategory(BuiltInCategory.OST_VolumeOfInterest);
			var scopeBoxList = scopeBoxes.ToList();
			
			ViewFamilyType vft
      = new FilteredElementCollector(Document)
        .OfClass( typeof( ViewFamilyType ) )
        .Cast&amp;lt;ViewFamilyType&amp;gt;()
        .FirstOrDefault&amp;lt;ViewFamilyType&amp;gt;( x =&amp;gt;
          ViewFamily.Section == x.ViewFamily );
			
			using (Transaction tx = new Transaction(Document)) {
				tx.Start("Create Section");
				foreach (Element e in scopeBoxList) 
				{
					BoundingBoxXYZ bbox = e.get_BoundingBox(null);

					ViewSection section1 = ViewSection.CreateSection(Document, vft.Id, bbox);
					
					
				}
				tx.Commit();
			}
						
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried creating a new bounding box, and assigning a new maximum and minimum point, intending to change the orientation while maintaining the dimensions, as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public void CreateSection()
		{
			FilteredElementCollector scopeBoxes = new FilteredElementCollector(Document).OfCategory(BuiltInCategory.OST_VolumeOfInterest);
			var scopeBoxList = scopeBoxes.ToList();
			
			ViewFamilyType vft
      = new FilteredElementCollector(Document)
        .OfClass( typeof( ViewFamilyType ) )
        .Cast&amp;lt;ViewFamilyType&amp;gt;()
        .FirstOrDefault&amp;lt;ViewFamilyType&amp;gt;( x =&amp;gt;
          ViewFamily.Section == x.ViewFamily );
			
			using (Transaction tx = new Transaction(Document)) {
				tx.Start("Create Section");
				foreach (Element e in scopeBoxList) 
				{
					BoundingBoxXYZ bbox = e.get_BoundingBox(null);

					/*ViewSection section1 = ViewSection.CreateSection(Document, vft.Id, bbox);*/
					
					XYZ max1 = bbox.Max;
					XYZ min1 = bbox.Min;					
					
					XYZ max2 = new XYZ(max1.X, max1.Y, min1.Z);
					XYZ min2 = new XYZ(min1.X, min1.Y, max1.Z);
					
					XYZ mid = bbox.Max.Add(bbox.Min)/2;
				
					BoundingBoxXYZ ebbox = new BoundingBoxXYZ();
					
					ebbox.Enabled = true;
					ebbox.Max = max2;
					ebbox.Min = min2;
					
					ViewSection section2 = ViewSection.CreateSection(Document, vft.Id, ebbox);
				}
				tx.Commit();
			}	
		}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I get this error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hammad_haroon_1-1716386717196.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1365855iD2521223468950E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_1-1716386717196.png" alt="hammad_haroon_1-1716386717196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 14:07:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790208#M5133</guid>
      <dc:creator>hammad_haroon</dc:creator>
      <dc:date>2024-05-22T14:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790668#M5134</link>
      <description>&lt;P&gt;One important factor you might have overlooked is the orientation of the scope boxes. If the bounding box direction points toward the world XY plane (toward the earth), you'll end up with a section that appears as a plan view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To achieve the desired section view, you need to transform the bounding box that is extracted from the scope box, to get an aligned version with the section direction you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, let's assume you have a scope box oriented along the +Z axis, but you want to create a section that looks in the direction of the X axis. In this case, you would need to rotate the Z vector around the Y axis to align it with the X vector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the steps to accomplish this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Define the vector direction for your section view.&lt;/LI&gt;&lt;LI&gt;Create a rotation transform based on this direction.&lt;/LI&gt;&lt;LI&gt;Apply this rotation transform to the bounding box.&lt;/LI&gt;&lt;LI&gt;Construct your section based on the transformed bounding box.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;To translate this into code, consider the following example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;BoundingBoxXYZ bbox = e.get_BoundingBox(null);
var centerPoint = (bbox.Max+bbox.Min)/2;
var rotateTrans= Transform.CreateRotation(XYZ.BasisY, Math.PI / 2);
bbox.Transform = rotateTrans * bbox.Transform;
ViewSection section1 = ViewSection.CreateSection(Doc, vft.Id, bbox);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this simple briefed explanation fits.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:00:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790668#M5134</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2024-05-22T17:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790678#M5135</link>
      <description>&lt;P&gt;Thanks Moustafa, I tried that solution as well. The issue I ran into was that bounding box isn't a cube, it may be tall with a smaller square base, so when it's rotated, the section isn't the correct size, its short in heigh t&amp;amp; width but looks further than it needs to. I was hoping to have the same dimensions of the bounding box but only change the orientation.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:07:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790678#M5135</guid>
      <dc:creator>hammad_haroon</dc:creator>
      <dc:date>2024-05-22T17:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790719#M5136</link>
      <description>&lt;P&gt;one possible solution is to create the bounding since now you confirmed you know the orientation, and you already have the scope box, then you can extract the width and height and assign it a new boundingbox with a rotation and translation vector&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see this &lt;SPAN class=""&gt;Pseudo&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;code sample:&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;BoundingBoxXYZ bbox = e.get_BoundingBox(null);
var rotatedBbx = new BoundingBoxXYZ();
rotatedBbx.Max = new XYZ( bbox.Width(), bbox.Height(), bbox.Length());

var rotaTrans = Transform.CreateRotation(XYZ.BasisY, Math.PI / 2);
var transla = Transform.CreateTranslation(bbox.Transform.Origin);
rotatedBbx.Transform = rotaTrans .Multiply(transla);&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;</description>
      <pubDate>Wed, 22 May 2024 17:25:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12790719#M5136</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2024-05-22T17:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12793888#M5137</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14217297"&gt;@hammad_haroon&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html" target="_blank" rel="noopener"&gt;http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sample helpt me a lot with creating a addin that can use any scopebox to create 2 section in it's center in X and Y direction.&lt;/P&gt;&lt;P&gt;You need to create a new "BoundingBoxXYZ" with the correct transform value that matches the section you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance see this piece below. The values of origin and right depends on the position and direction of the section needed.&lt;/P&gt;&lt;P&gt;See the full post in the link above on how to calculate them.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Transform transform = Transform.Identity;
  transform.Origin = origin;
  transform.BasisX = right;
  transform.BasisY = up;
  transform.BasisZ = viewdir;
 
  BoundingBoxXYZ sectionBox = new BoundingBoxXYZ();
  sectionBox.Transform = transform;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Michel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 19:45:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12793888#M5137</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2024-05-23T19:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12808350#M5138</link>
      <description>&lt;P&gt;Thank you! I managed to make it work exactly as needed in an empty test file, with the sections intersecting at the center of the scope box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when I applied the same macro to the file (File B) i wanted to use it in, the sections are out of the scope box. The scope boxes are the same sizes in both files but in File B, the sections appear like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hammad_haroon_0-1717097619887.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1369767iA8B081862829637F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_0-1717097619887.png" alt="hammad_haroon_0-1717097619887.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;// get current selected scope box and bounding box
			UIDocument uidoc = this; 
        	Reference myRef = uidoc.Selection.PickObject(ObjectType.Element);
        	Element scopeBox = Document.GetElement(myRef);
        	string scopeBoxName = scopeBox.Name;
			BoundingBoxXYZ bbox = scopeBox.get_BoundingBox(null);
			
			XYZ max1 = bbox.Max;
			XYZ min1 = bbox.Min;	
			XYZ centerpoint = (bbox.Max + bbox.Min)/2;
			
			//Creates section box in center looking east
			Transform transformv = Transform.Identity;
			transformv.Origin = centerpoint;
			transformv.BasisX = XYZ.BasisY;
			transformv.BasisY = XYZ.BasisZ;
			transformv.BasisZ = XYZ.BasisX;			

			BoundingBoxXYZ sectionBoxv = new BoundingBoxXYZ();
			sectionBoxv.Transform = transformv;
			sectionBoxv.Min = min1;
			sectionBoxv.Max = max1;
			
			//Creates section box in center looking north
			Transform transformh = Transform.Identity;
			transformh.Origin = centerpoint;
			transformh.BasisX = XYZ.BasisX.Negate();
			transformh.BasisY = XYZ.BasisZ;
			transformh.BasisZ = XYZ.BasisY;
			
			BoundingBoxXYZ sectionBoxh = new BoundingBoxXYZ();
			sectionBoxh.Transform = transformh;
			sectionBoxh.Min = min1;
			sectionBoxh.Max = max1;
			
				
			using (Transaction tx = new Transaction(Document)) {	
				tx.Start("Create Section");
				
				//Create Plan by duplicating current view and assigning scope box
				View plan = Document.GetElement(ActiveView.Duplicate(ViewDuplicateOption.Duplicate)) as View;
				plan.Name = scopeBoxName + " Plan";
				plan.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				plan.ViewTemplateId = viewTemplatePlanId;
				
				//Create vertical section
				ViewSection sectionv = ViewSection.CreateSection(Document, vft.Id, sectionBoxv);
				sectionv.Name = scopeBox.Name + " Section N-S";
				sectionv.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				sectionv.ViewTemplateId = viewTemplateSection.Id;
				
				//Create horizontal section
				ViewSection sectionh = ViewSection.CreateSection(Document, vft.Id, sectionBoxh);
				sectionh.Name = scopeBox.Name + " Section E-W";
				sectionh.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				sectionh.ViewTemplateId = viewTemplateSection.Id;
				
				tx.Commit();
				}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 19:34:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12808350#M5138</guid>
      <dc:creator>hammad_haroon</dc:creator>
      <dc:date>2024-05-30T19:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12808353#M5139</link>
      <description>&lt;P&gt;Thank you! I managed to make it work exactly as needed in an empty test file, with the sections intersecting at the center of the scope box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when I applied the same macro to the file (File B) i wanted to use it in, the sections are out of the scope box. The scope boxes are the same sizes in both files but in File B, the sections appear like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hammad_haroon_0-1717097619887.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1369767iA8B081862829637F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hammad_haroon_0-1717097619887.png" alt="hammad_haroon_0-1717097619887.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;LI-CODE lang="general"&gt;// get current selected scope box and bounding box
			UIDocument uidoc = this; 
        	Reference myRef = uidoc.Selection.PickObject(ObjectType.Element);
        	Element scopeBox = Document.GetElement(myRef);
        	string scopeBoxName = scopeBox.Name;
			BoundingBoxXYZ bbox = scopeBox.get_BoundingBox(null);
			
			XYZ max1 = bbox.Max;
			XYZ min1 = bbox.Min;	
			XYZ centerpoint = (bbox.Max + bbox.Min)/2;
			
			//Creates section box in center looking east
			Transform transformv = Transform.Identity;
			transformv.Origin = centerpoint;
			transformv.BasisX = XYZ.BasisY;
			transformv.BasisY = XYZ.BasisZ;
			transformv.BasisZ = XYZ.BasisX;			

			BoundingBoxXYZ sectionBoxv = new BoundingBoxXYZ();
			sectionBoxv.Transform = transformv;
			sectionBoxv.Min = min1;
			sectionBoxv.Max = max1;
			
			//Creates section box in center looking north
			Transform transformh = Transform.Identity;
			transformh.Origin = centerpoint;
			transformh.BasisX = XYZ.BasisX.Negate();
			transformh.BasisY = XYZ.BasisZ;
			transformh.BasisZ = XYZ.BasisY;
			
			BoundingBoxXYZ sectionBoxh = new BoundingBoxXYZ();
			sectionBoxh.Transform = transformh;
			sectionBoxh.Min = min1;
			sectionBoxh.Max = max1;
			
				
			using (Transaction tx = new Transaction(Document)) {	
				tx.Start("Create Section");
				
				//Create Plan by duplicating current view and assigning scope box
				View plan = Document.GetElement(ActiveView.Duplicate(ViewDuplicateOption.Duplicate)) as View;
				plan.Name = scopeBoxName + " Plan";
				plan.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				plan.ViewTemplateId = viewTemplatePlanId;
				
				//Create vertical section
				ViewSection sectionv = ViewSection.CreateSection(Document, vft.Id, sectionBoxv);
				sectionv.Name = scopeBox.Name + " Section N-S";
				sectionv.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				sectionv.ViewTemplateId = viewTemplateSection.Id;
				
				//Create horizontal section
				ViewSection sectionh = ViewSection.CreateSection(Document, vft.Id, sectionBoxh);
				sectionh.Name = scopeBox.Name + " Section E-W";
				sectionh.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopeBox.Id);
				sectionh.ViewTemplateId = viewTemplateSection.Id;
				
				tx.Commit();
				}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 19:35:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12808353#M5139</guid>
      <dc:creator>hammad_haroon</dc:creator>
      <dc:date>2024-05-30T19:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Revit View Set from Scope Boxes</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12811851#M5140</link>
      <description>&lt;P&gt;In File B, are the internal origin and the project base point both in 0,0,0 ?&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 13:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-revit-view-set-from-scope-boxes/m-p/12811851#M5140</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2024-06-01T13:14:48Z</dc:date>
    </item>
  </channel>
</rss>

