<?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: Set a view cropbox error in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557240#M33851</link>
    <description>&lt;P&gt;Might be it rejects the bounding box taken from the Element because some other aspect such as transform/BoundsEnabled etc. is invalid for the bounding box required by the view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a ViewPlan try getting bounding box from view and assign to independent variable then set the max/min based on bounding box from Element and then pass entire updated bounding box from variable back to view (rather than just it's properties as was done in first attempt). You may be bypassing hidden setter logic of the View.CropBox property by changing the properties of the bounding box directly (I've never found that to work).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also set CropBox active before applying bounding box.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 11:10:05 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2020-06-03T11:10:05Z</dc:date>
    <item>
      <title>Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9555178#M33847</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to set a cropbox in a view. Here is snippet code&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using (var trans = new Transaction(doc))
            {
                trans.Start("Set CropBox");

                var boundingBoxElement = elem.get_BoundingBox(null);
                newView.CropBoxActive = true;
                newView.CropBox = boundingBoxElement;
           
                trans.Commit();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In debug I can see how the cropBox changes but when transaction is committed the cropBox has suddenly changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is this happening? transaction is committed successfully&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 15:49:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9555178#M33847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-02T15:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9555585#M33848</link>
      <description>&lt;P&gt;From the Revit API documentation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Remarks
Note: the Transform of the input BoundingBoxXYZ is ignored. Only Max and Min members of the input BoundingBoxXYZ are used.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to guess that this is what you're seeing. The min/max members of the input are used, but the view maintains&amp;nbsp; its original transform, but changes its min/max members to match the input values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hard to say w/o being in an active debug environment.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 18:09:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9555585#M33848</guid>
      <dc:creator>bhprest</dc:creator>
      <dc:date>2020-06-02T18:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9556028#M33849</link>
      <description>&lt;P&gt;Also&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8047956"&gt;@bhprest&lt;/a&gt;&amp;nbsp;the defined values can differ per view type. see:&amp;nbsp;&lt;A title="CropBox Property" href="https://www.revitapidocs.com/2020/d6246051-ecfb-7388-0429-6ed65de72638.htm" target="_blank" rel="noopener"&gt;CropBox Property&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So setting the CropBox for a floorplan would normally have the expected result.&lt;/P&gt;&lt;P&gt;But for elevation, sections etc. the result depends on it's orientation and might need some transfroms of the min/max to align/project to the correct plane of the view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@Anonymous&amp;nbsp;, What type of view are you using, and what means "&lt;SPAN&gt;cropBox has suddenly changed" into what?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe post a image before/after?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Michel&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 20:37:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9556028#M33849</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-06-02T20:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557223#M33850</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3633270"&gt;@TripleM-Dev.net&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8047956"&gt;@bhprest&lt;/a&gt;&amp;nbsp; thanks for your answers. But I can not do it well yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, my view is a ViewPlan.&lt;/P&gt;&lt;P&gt;I am trying to set a cropBox in the view to see just a element. That's why I get element.get_BoundingBox(null), then I set view.CropBox with element boundingBox value. As&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8047956"&gt;@bhprest&lt;/a&gt;&amp;nbsp;said "&lt;SPAN&gt;&amp;nbsp;min/max members of the input are used&lt;/SPAN&gt;&amp;nbsp;" I did the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;         newView.CropBox.Min = boundingBoxElement.Min;
         newView.CropBox.Max = boundingBoxElement.Max;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I see it in the debug, neither value has changed. However, if&amp;nbsp; I do&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;      newView.CropBox = boundingBoxElement;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CropBox changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code now is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  using (var trans = new Transaction(doc))
            {
                trans.Start("Set cropview");
                newView.CropBoxActive = false;
                var boundingBoxElement = elem.get_BoundingBox(null);
                

                newView.CropBox = boundingBoxElement;#Part2
                newView.CropBoxActive = true;
                newView.CropBoxVisible = false;

               trans.Commit();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just before starting #Part2&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Both BoundaringBoxXYZ are different.&lt;/P&gt;&lt;P&gt;Once they have been assigned with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        newView.CropBox = boundingBoxElement;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Both boundaringBoxXYZ are equal, except Z&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Part2.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/779210i52E3BE31946B19B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Part2.PNG" alt="Part2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But after committing the transaction the view.CropBox changes and has the previous value again&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="afterTrans.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/779211iCFCBEFF9F7A3E091/image-size/large?v=v2&amp;amp;px=999" role="button" title="afterTrans.PNG" alt="afterTrans.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have checked the transaction and it was committed successfully&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clue?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 10:37:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557223#M33850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-03T10:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557240#M33851</link>
      <description>&lt;P&gt;Might be it rejects the bounding box taken from the Element because some other aspect such as transform/BoundsEnabled etc. is invalid for the bounding box required by the view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a ViewPlan try getting bounding box from view and assign to independent variable then set the max/min based on bounding box from Element and then pass entire updated bounding box from variable back to view (rather than just it's properties as was done in first attempt). You may be bypassing hidden setter logic of the View.CropBox property by changing the properties of the bounding box directly (I've never found that to work).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also set CropBox active before applying bounding box.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:10:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557240#M33851</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-06-03T11:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set a view cropbox error</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557342#M33852</link>
      <description>&lt;P&gt;I've just found the error,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when there is a previous non-rectangular cropBox in the view. First you should remove the shape&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;                var shapeManager = newView.GetCropRegionShapeManager();
                shapeManager.RemoveCropRegionShape();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And then you can set the boundingBox that by default is a rectangle.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:28:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/set-a-view-cropbox-error/m-p/9557342#M33852</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-03T11:28:49Z</dc:date>
    </item>
  </channel>
</rss>

