<?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: Modify CropBox of Elevation View in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3607398#M80493</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is likely that Revit overwrite the cropbox when the transaction is submitted. However not sure, as I didn't test this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This idea just came to my mind.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you use two transactions to do this?&lt;/P&gt;
&lt;P&gt;Start the first transaction to create the section marker and the section view, then commit the transaction.&lt;/P&gt;
&lt;P&gt;Start the second transaction to change the crop box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Sep 2012 07:24:53 GMT</pubDate>
    <dc:creator>Joe.Ye</dc:creator>
    <dc:date>2012-09-05T07:24:53Z</dc:date>
    <item>
      <title>Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3604982#M80492</link>
      <description>&lt;P&gt;I am having difficulty in modifying the cropbox of an elevation view.&amp;nbsp; The extract code below will place an elevation marker in a room and then create an elevation off index 0 of the marker.&amp;nbsp; I then get the existing cropbox and attempt to reduce the height by 3 feet (just as an example).&amp;nbsp; The code runs successfully (within a transaction) but the result is as per the original cropbox, ie, no change.&amp;nbsp; When&amp;nbsp;an elevation marker is placed in a room using the User Interface Revit will automatically find the extents of the room and set the crop box accordingly.&amp;nbsp; I'm wondering if this behavior is overwriting the changes I make via the API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ElevationMarker elevMarker = 
ElevationMarker.CreateElevationMarker(doc, vft.Id, roomCenter, scale);

ViewSection sv = elevMarker.CreateElevation(doc, viewPlan.Id, 0);
doc.Regenerate();

// get the bounding box of the section
BoundingBoxXYZ bb = sv.CropBox;

// by way of example reduce the section height by 3 foot
XYZ max = bb.Max;
max = new XYZ(max.X, max.Y - 3, max.Z);
bb.Max = max;

// set the new bounding box
sv.CropBox = bb;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 11:39:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3604982#M80492</guid>
      <dc:creator>grahamcook</dc:creator>
      <dc:date>2012-09-03T11:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3607398#M80493</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is likely that Revit overwrite the cropbox when the transaction is submitted. However not sure, as I didn't test this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This idea just came to my mind.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you use two transactions to do this?&lt;/P&gt;
&lt;P&gt;Start the first transaction to create the section marker and the section view, then commit the transaction.&lt;/P&gt;
&lt;P&gt;Start the second transaction to change the crop box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 07:24:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3607398#M80493</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2012-09-05T07:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3607628#M80494</link>
      <description>&lt;P&gt;Joe, thanks for your suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the idea of creating a second transaction to carry out the cropbox resize but unfortunately didn’t make any difference.&amp;nbsp; I must clarify though that this issue relates to elevations created using the new 2013 class.&amp;nbsp; I have created the attached graphic to illustrate some weird behaviour though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As we go through the code in the graphic you will see that I set BoundingBoxXYZ bb to equal the cropbox of my testView. (1)&lt;/P&gt;&lt;P&gt;I then modify bb by reducing the height by 3 feet.&lt;/P&gt;&lt;P&gt;I then set the cropBox to equal bb, see 2 and 3 in the image.&amp;nbsp; At this point an unexpected change in the boundingBox values takes place.&amp;nbsp; You will see that even though we set the cropBox to equal bb both of the Z values seem to have reversed in the new cropBox (3).&lt;/P&gt;&lt;P&gt;After regenerating I checked the cropBox value again and you will see that the Y value we reduced by 3 feet has reverted to the original value but the incorrect Z values have remained.&amp;nbsp; This has the effect of the elevation looking back on itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 11:28:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3607628#M80494</guid>
      <dc:creator>grahamcook</dc:creator>
      <dc:date>2012-09-05T11:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3616094#M80495</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Z value of the CropBox Max and Min is not so important. In the elevation view, the Z coordinate is vertical to the elevation view. The X is horizontal to &amp;nbsp;the right, and Y is vertical up. Probably Revit change the CropBox max and min Z value automatically. This doesn't affect the appearance of the elevation view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After assign the bb back to the elevation view, I cannot reproduce the issue you reported. "&lt;SPAN&gt;Y value we reduced by 3 feet has reverted to the original value "&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I also wrote a command like yours. I cannot reproduce the Y value reduced back to the original value issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;here is the code I used.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;public class RevitCommand : IExternalCommand&lt;BR /&gt;{&lt;BR /&gt; public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)&lt;BR /&gt; {&lt;/P&gt;
&lt;P&gt;UIApplication app = commandData.Application;&lt;BR /&gt; Document doc = app.ActiveUIDocument.Document;&lt;BR /&gt; Transaction trans = new Transaction(doc, "ExComm");&lt;BR /&gt; trans.Start();&lt;/P&gt;
&lt;P&gt;FilteredElementCollector collector = new FilteredElementCollector(doc);&lt;BR /&gt; collector.OfClass(typeof(ViewFamilyType));&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; var viewFamilyTypes = from elem in collector &lt;BR /&gt; let type = elem as ViewFamilyType&lt;BR /&gt; where type.ViewFamily == ViewFamily.Elevation&lt;BR /&gt; select type;&lt;/P&gt;
&lt;P&gt;ElementId viewtypeId;&lt;BR /&gt; if (viewFamilyTypes.Count() &amp;gt; 0)&lt;BR /&gt; viewtypeId = viewFamilyTypes.First().Id;&lt;BR /&gt; else&lt;BR /&gt; return Result.Cancelled;&lt;/P&gt;
&lt;P&gt;ElevationMarker marker = ElevationMarker.CreateElevationMarker(doc, viewtypeId, new XYZ(0, 10, 0), 100);&lt;/P&gt;
&lt;P&gt;ViewSection sv = marker.CreateElevation(doc,doc.ActiveView.Id, 1);&lt;/P&gt;
&lt;P&gt;trans.Commit();&lt;/P&gt;
&lt;P&gt;//chang the cropbox.&lt;BR /&gt; Transaction trans2 = new Transaction(doc,"test2");&lt;BR /&gt; trans2.Start();&lt;/P&gt;
&lt;P&gt;doc.Regenerate();&lt;/P&gt;
&lt;P&gt;// get the bounding box of the section&lt;BR /&gt; BoundingBoxXYZ bb = sv.CropBox;&lt;/P&gt;
&lt;P&gt;// by way of example reduce the section height by 3 foot&lt;BR /&gt; XYZ max = bb.Max;&lt;BR /&gt; max = new XYZ(max.X+ 3, max.Y - 3, max.Z);&lt;BR /&gt; bb.Max = max;&lt;/P&gt;
&lt;P&gt;// set the new bounding box&lt;BR /&gt; sv.CropBox = bb;&lt;/P&gt;
&lt;P&gt;trans2.Commit();&lt;/P&gt;
&lt;P&gt;return Result.Succeeded ;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR class="Apple-interchange-newline" /&gt;When debuging, I kept watching &amp;nbsp;the CropBox value, and the bb value. The result is attached.&lt;/P&gt;
&lt;P&gt;Not sure what's the problem in your side.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 08:48:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3616094#M80495</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2012-09-12T08:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3618322#M80496</link>
      <description>&lt;P&gt;Joe&lt;/P&gt;&lt;P&gt;Thanks for trying to reproduce the problem.&amp;nbsp; If you add a doc.regenerate() between sv.CropBox = bb and trans2.Commit() you should see the modified X and Y values revert back.&amp;nbsp; I tested your code on the rac_basic_sample_project.rvt model and was able to reproduce the behaviour (see cropboxProblem_debug.jpg image attched).&amp;nbsp; I also attach an image cropboxProblem2.jpg that shows the effect of the max and min Z values being reversed and you will see it does infact make a significant difference to the resulting view.&lt;/P&gt;&lt;P&gt;I hope you are able to now reproduce the issue as i know this is fundamental in getting these things fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Graham Cook&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 09:27:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3618322#M80496</guid>
      <dc:creator>grahamcook</dc:creator>
      <dc:date>2012-09-13T09:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3627034#M80497</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HI&amp;nbsp;&lt;SPAN&gt;Graham,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, i also reproduce the issue. If calling the regenerate() method, the cropbox value is reversed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This looks wield.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then how about not calling the Regenerate() method.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Since the transaction commit can automatically regenerate the model.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 10:21:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3627034#M80497</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2012-09-20T10:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3627130#M80498</link>
      <description>&lt;P&gt;Hi Joe&lt;/P&gt;&lt;P&gt;Glad you are now able to see the same issue!&lt;/P&gt;&lt;P&gt;Unfortunately, as you say the commit also performs a regenerate behind the scenes and it is at this point that Revit resets any changes to the cropbox back to the original values&amp;nbsp;(and reverses min and max Z).&amp;nbsp; The cropbox can be modified no problem through the user interface so it looks to be a bug with the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also just tested the same code you provided but changed the XYZ location of the elevation marker to 0,0,0.&amp;nbsp; This puts the marker on the outside of the building (if run on the rac_basic_sample_project file).&amp;nbsp; When the elevation is outside and not within a room then the specified X and Y changes work OK.&amp;nbsp; But the Z still gets reversed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could this be logged as a bug with the development team?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Graham&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 11:29:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3627130#M80498</guid>
      <dc:creator>grahamcook</dc:creator>
      <dc:date>2012-09-20T11:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3633146#M80499</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I See, will let the engineering team know this issue soon.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2012 16:00:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/3633146#M80499</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2012-09-25T16:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/4663159#M80500</link>
      <description>&lt;P&gt;has there been any update on this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason I ask is in a command I do this on a Section:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;					var section = (from v in new FilteredElementCollector(uiDoc.Document).OfClass(typeof(ViewSection)).Cast&amp;lt;ViewSection&amp;gt;()
								   where v.Name == viewName
								   select v).First();

					if (section != null)
					{
						var cropbox = section.CropBox;
						section.CropBox = cropbox;
					}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run it once and set a breadkpoint on the section I get:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;+ Max {(39.920867142, 6.000000000, 0.000000000)} Autodesk.Revit.DB.XYZ&lt;BR /&gt;+ Min {(-36.346794904, -6.000000000, -10.000000000)} Autodesk.Revit.DB.XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run it again I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;+ Max {(39.920867142, 6.000000000, 10.000000000)} Autodesk.Revit.DB.XYZ&lt;BR /&gt;+ Min {(-36.346794904, -6.000000000, 0.000000000)} Autodesk.Revit.DB.XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run it a third time, it goes back to what I got the first time, and so forth. It's very puzzling, I was trying to work out how to set the depth of a section, I'm guessing this means I won't be able to do that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2013 08:58:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/4663159#M80500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-01T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/4830873#M80501</link>
      <description>Dear Joe, Recently I'm figure out the same problem when I found this post. I post my problem here and your colleague, Jeremy Tammik, tried to help me. I used the idea of one transaction for adjust the crop box, but not success. I saw in your last reply on this post that you sent the issue to analysis by engineering team. This issue persists in Revit 2014 API. Any suggestions to solve this issue? Regards, Ari Monteiro</description>
      <pubDate>Fri, 21 Feb 2014 17:44:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/4830873#M80501</guid>
      <dc:creator>ari.monteiro</dc:creator>
      <dc:date>2014-02-21T17:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/5631417#M80502</link>
      <description>&lt;P&gt;Updates on this? Seems not resolved on 2016...&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 16:23:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/5631417#M80502</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-05-12T16:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/5651140#M80503</link>
      <description>&lt;P&gt;I'm going to add my voice to this issue.&amp;nbsp; It is, in fact, no small issue that the max/min Z values reverse, the result is that the section mark is now looking the wrong direction and is completely unacceptable.&amp;nbsp; This bug makes it impossible to set the crop box extents as well as revise the orientation of the cropbox/section.&amp;nbsp; There is a workaround for relocating/rotating the section by moving the section mark but resizing the crop box automatically is impossible in the current situation.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As an additional note, a new section created with a new BBXYZ will be created at the proper location.&amp;nbsp; This may be a workaround for typical section views but assembly views can *only* be created by the AssemblyViewUitls class (which I think is too constraining: we should be able to create them normally.&amp;nbsp; If I can create a new one in the assembly view via the UI, then the API should be able to as well: important sections aren't always orthogonal to the assembly origin).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also like to say that, while I understand priorities, three to four releases later isn't really what I would hope for in terms of a bug-fix turn-around.&amp;nbsp; I have filed this as a new case and will try to communicate the need for this fix as best I can.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2015 21:06:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/5651140#M80503</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-25T21:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6241959#M80504</link>
      <description>&lt;P&gt;WOHOOOO!!!.... Finally resolved in 2017 ... Thank you Autodesk team &amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 15:57:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6241959#M80504</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2016-03-30T15:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6241978#M80505</link>
      <description>Nice Job Autodesk! This is absolutely HUGE for us.&lt;BR /&gt;&lt;BR /&gt;Thanks Mostafa for verifying that it works now!</description>
      <pubDate>Wed, 30 Mar 2016 16:04:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6241978#M80505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-30T16:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6411342#M80506</link>
      <description>&lt;P&gt;How do I change the Transform of the crop box of existing view?&lt;/P&gt;&lt;P&gt;Though Transform has set, it does not change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to move and resize an existing elevation view (created using createDetail)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resize works, but not move.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2016 18:50:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6411342#M80506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-29T18:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6412122#M80507</link>
      <description>&lt;P&gt;Can we see your code, please?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 06:55:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6412122#M80507</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2016-06-30T06:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6413822#M80508</link>
      <description>&lt;P&gt;private void CreateElevationView(BoundingBoxXYZ box)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;ElementId viewFamilyTypeId = Document.GetViewFamilyTypeId(ViewFamily.Detail);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;if (EditView == null) //static variable to maintain the same view&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EditView = ViewSection.CreateDetail(Document, viewFamilyTypeId, box);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;EditView.CropBox = box;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;EditView.CropBox.Transform = box.Transform;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the min and max of box gets assigned, but not the transform values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whatever happens in CreateDetail passing the boundingbox, needs to be done to the exisitng ViewSection.&lt;/P&gt;&lt;P&gt;Typically,&amp;nbsp;assigning a new bounding box to the same viewSection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any working code would be helpful.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 21:38:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6413822#M80508</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T21:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6413826#M80509</link>
      <description>&lt;P&gt;private void CreateElevationView(BoundingBoxXYZ box)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;ElementId viewFamilyTypeId = Document.GetViewFamilyTypeId(ViewFamily.Detail);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;if (EditView == null) //static variable to maintain the same view&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EditView = ViewSection.CreateDetail(Document, viewFamilyTypeId, box);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;EditView.CropBox = box;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;EditView.CropBox.Transform = box.Transform;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the min and max of box gets assigned, but not the transform values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whatever happens in CreateDetail passing the boundingbox, needs to be done to the exisitng ViewSection.&lt;/P&gt;&lt;P&gt;Typically,&amp;nbsp;assigning a new bounding box to the same viewSection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any working code would be helpful.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2016 21:40:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6413826#M80509</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-30T21:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6430284#M80510</link>
      <description>&lt;P&gt;Any updates on this??&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 22:47:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6430284#M80510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-11T22:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Modify CropBox of Elevation View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6430422#M80511</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Apologies for my delayed response. i was extremely busy with a submission, you all know how Architecture world is. I have created this class to help you with this.&lt;/P&gt;&lt;P&gt;Please be aware this will work only on &amp;nbsp;Revit 2017&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

namespace A4H_ArchMate
{
    [Transaction(TransactionMode.Manual)]
    class sectionme : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument m_uidoc = uiapp.ActiveUIDocument;
            Document m_doc = m_uidoc.Document;








            BoundingBoxXYZ bbx = new BoundingBoxXYZ();
            PickedBox pbox = m_uidoc.Selection.PickBox(PickBoxStyle.Directional);

            double minx, miny, maxx, maxy, maxz, minz;
            Transform trans = null;

            if (m_doc.ActiveView.ViewType == ViewType.Section || m_doc.ActiveView.ViewType == ViewType.Elevation)
            {

                var vx = m_doc.ActiveView as ViewSection;

                //Section view and Elevation must have Transform Inverse.
                trans = vx.get_BoundingBox(null).Transform.Inverse;

                pbox.Max = trans.OfPoint(pbox.Max);
                pbox.Min = trans.OfPoint(pbox.Min);

                ///we need to make sure that the bounding box initialized correctly
                ///we do not know if the user started clipping from top left to bottom right
                ///or from top right to bottom left
                ///or from bottom left to top right
                ///or from bottom right to top left
                ///all in all bounding box XYZ maximum point mustbe bigger than minimum point other wise you would get bounding box is empty.

                if (pbox.Max.Z &amp;gt; pbox.Min.Z)
                {
                    maxz = pbox.Max.Z;
                    minz = pbox.Min.Z;
                }
                else
                {
                    maxz = pbox.Min.Z;
                    minz = pbox.Max.Z;
                }


                if (Math.Round(pbox.Max.X, 4) == Math.Round(pbox.Min.X, 4))
                {
                    maxx = pbox.Max.X;
                    minx = minz;
                }
                else if (pbox.Max.X &amp;gt; pbox.Min.X)
                {
                    maxx = pbox.Max.X;
                    minx = pbox.Min.X;
                }

                else
                {
                    maxx = pbox.Min.X;
                    minx = pbox.Max.X;
                }

                if (Math.Round(pbox.Max.Y, 4) == Math.Round(pbox.Min.Y, 4))
                {
                    maxy = pbox.Max.Y;
                    miny = minz;
                }
                else if (pbox.Max.Y &amp;gt; pbox.Min.Y)
                {
                    maxy = pbox.Max.Y;
                    miny = pbox.Min.Y;
                }

                else
                {
                    maxy = pbox.Min.Y;
                    miny = pbox.Max.Y;
                }


            }
            else
            {
                if (pbox.Max.X &amp;gt; pbox.Min.X)
                {
                    maxx = pbox.Max.X;
                    minx = pbox.Min.X;
                }
                else
                {
                    maxx = pbox.Min.X;
                    minx = pbox.Max.X;
                }

                if (pbox.Max.Y &amp;gt; pbox.Min.Y)
                {
                    maxy = pbox.Max.Y;
                    miny = pbox.Min.Y;
                }
                else
                {
                    maxy = pbox.Min.Y;
                    miny = pbox.Max.Y;
                }

                if (pbox.Max.Z &amp;gt; pbox.Min.Z)
                {
                    maxz = pbox.Max.Z;
                    minz = pbox.Min.Z;
                }
                else
                {
                    maxz = pbox.Min.Z;
                    minz = pbox.Max.Z;
                }
            }

            bbx = new BoundingBoxXYZ();

            // after every thing is ok now setup the boundingbox
            bbx.Max = new XYZ(maxx, maxy, maxz);
            bbx.Min = new XYZ(minx, miny, minz);


            Transaction t = new Transaction(m_doc, "ArchMate");
            t.Start();


            //make sure scope box is set to none        
            m_doc.ActiveView.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(ElementId.InvalidElementId);

            //make sure FarClipping is set to none or at lease the far clipping distance contains the sectioned elements
            m_doc.ActiveView.get_Parameter(BuiltInParameter.VIEWER_BOUND_FAR_CLIPPING).Set(0);
            
            // set crop region active and visible
            m_doc.ActiveView.CropBoxActive = true;
            m_doc.ActiveView.CropBoxVisible = true;

            //regenerate the view to update data base with the above updates
            m_doc.Regenerate();

            m_doc.ActiveView.CropBox = bbx;

            t.Commit();


            return Result.Succeeded;

        }
    }
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2016 01:27:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/modify-cropbox-of-elevation-view/m-p/6430422#M80511</guid>
      <dc:creator>Moustafa_K</dc:creator>
      <dc:date>2016-07-12T01:27:16Z</dc:date>
    </item>
  </channel>
</rss>

