<?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: Filled Region in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815992#M70757</link>
    <description>&lt;P&gt;Dear Danny,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on getting it to work!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your appreciation for&amp;nbsp;The Building Coder.&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>Mon, 14 Sep 2015 15:59:18 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2015-09-14T15:59:18Z</dc:date>
    <item>
      <title>Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5796463#M70749</link>
      <description>&lt;P&gt;I've deleted a line style which is in a filled region. &amp;nbsp;The filled region now apears to be missing the lines, however the lines are set to thin. &amp;nbsp;If I edit the boundary of the filled region and close it the appear. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is is possible to "Edit Boundary" of a filled region through the API?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2015 19:28:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5796463#M70749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-31T19:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5797140#M70750</link>
      <description>&lt;P&gt;Dear Danny,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same answer as here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/group-array-versus-array-of-group/m-p/5792465" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/group-array-versus-array-of-group/m-p/5792465&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&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>Tue, 01 Sep 2015 08:46:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5797140#M70750</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-01T08:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802371#M70751</link>
      <description>&lt;P&gt;I was able to get the lines back by moving the fill region and then moving it back. &amp;nbsp;The filled region needed to be regeneratated to show the lines again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help. &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        public void editFilledRegion(Document doc, UIDocument uidoc)
        {
            FilteredElementCollector fillRegionTypes = new FilteredElementCollector(doc).OfClass(typeof(FilledRegion));
            FilteredElementIterator itr = fillRegionTypes.GetElementIterator();
            while (itr.MoveNext())
            {
                Element element = (Element)itr.Current;
                FilledRegion filledRegion = doc.GetElement(element.Id) as FilledRegion;

                Transaction tx = new Transaction(doc);
                tx.Start("move");
                XYZ xyznew = new XYZ(1,0,0);
                XYZ xyzOld = new XYZ(-1,0,0);
                ElementTransformUtils.MoveElement(doc, filledRegion.Id, xyznew);
                ElementTransformUtils.MoveElement(doc, filledRegion.Id, xyzOld);
                tx.Commit();
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Sep 2015 19:01:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802371#M70751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-03T19:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802961#M70752</link>
      <description>&lt;P&gt;Dear Danny,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on solving this and thank you for your appreciation and sharing your solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That looks viable to me. I discussed this technique in the past:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2011/07/refresh-element-graphics-display.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2011/07/refresh-element-graphics-display.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As explained there, it might be safer if you move the region by a smaller amount than a full foot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have several other best practivce coding enhancements to suggest, if you don't mind:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 15px;"&gt;Using foreach instead of an explicit iterator saves you a lot of typing.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 15px;"&gt;The best way to handle transactions is to encapsulate them in a 'using&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt; statement.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 15px;"&gt;You can encapsulate all your calls to MoveElement in one single transaction, instead of opening a new one for each call.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 15px;"&gt;You can use the static XYZ.BasisX member instead of explicitly instantiating your own X unit vector.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding the using statement, please refer to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/04/using-using-automagically-disposes-and-rolls-back.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2012/04/using-using-automagically-disposes-and-rolls-back.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That discussion was followed by many more posts on handling transactions and transaction groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The resultting code looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  public void EditFilledRegion( Document doc )
  {
    FilteredElementCollector fillRegions 
      = new FilteredElementCollector( doc )
        .OfClass( typeof( FilledRegion ) );

    using( Transaction tx = new Transaction( doc ) )
    {
      tx.Start( "Move all Filled Regions" );

      foreach( FilledRegion filledRegion in fillRegions )
      {
        XYZ v = XYZ.BasisX;
        ElementTransformUtils.MoveElement( doc, filledRegion.Id, v );
        ElementTransformUtils.MoveElement( doc, filledRegion.Id, -v );
      }
      tx.Commit();
    }
  }&lt;/PRE&gt;
&lt;P&gt;Once you see it like that, it also becomes obvious that it would be more effective to move all the regions at once using the MoveElements method, instead of one by one, leading to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  public void EditFilledRegion( Document doc )
  {
    ICollection&amp;lt;ElementId&amp;gt; fillRegionIds
      = new FilteredElementCollector( doc )
        .OfClass( typeof( FilledRegion ) )
        .ToElementIds();

    using( Transaction tx = new Transaction( doc ) )
    {
      tx.Start( "Move all Filled Regions" );

      XYZ v = XYZ.BasisX;
      ElementTransformUtils.MoveElements( doc, fillRegionIds, v );
      ElementTransformUtils.MoveElements( doc, fillRegionIds, -v );

      tx.Commit();
    }
  }&lt;/PRE&gt;
&lt;P&gt;Would you like to try that out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And reduce the offset a bit, e.g by using something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;XYZ v = 0.01 * XYZ.BasisX;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 05:43:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802961#M70752</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-04T05:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802988#M70753</link>
      <description>&lt;P&gt;In order to compare these steps better, I added them to The Building Coder samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the diffs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/compare/2016.0.120.10...2016.0.120.11" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2016.0.120.10...2016.0.120.11&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/compare/2016.0.120.11...2016.0.120.12" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2016.0.120.11...2016.0.120.12&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, 04 Sep 2015 06:19:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5802988#M70753</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-04T06:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5803007#M70754</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;since a FilledRegion is view depending, it may be that it resides in a section or elevation view.&lt;/P&gt;&lt;P&gt;In this case, the moving vector must not be XYZ.BasisX since it may be that the FilledRegion would be moved out of the view's plane.&lt;/P&gt;&lt;P&gt;Which would result in an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What about view.RightDirection ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rudi&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 06:41:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5803007#M70754</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2015-09-04T06:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815955#M70755</link>
      <description>&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;I got it to work. I had to check the elements one at a time because in the project some elements had been pinned. I unpinned them and then repined them back. I also changed it to move along the Z axis. A comment made by a user had mentioned that it might move off the screen causing some problems. Moving it in the Z axis work enough to refresh the filled region even in a drafting view.&lt;/P&gt;&lt;P&gt;I’m CS student working in architecture and can use all the guidance, with that said I made the changes to my code and it runs nicely. I’ve also been reading and following “The Building Coder” and have found it very helpful. The many examples have helped me understand how Revit’s API works. It’s a very useful and great resource.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Danny.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2015 15:35:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815955#M70755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-14T15:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815987#M70756</link>
      <description>&lt;P&gt;Hi Revitalizer,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, ensuring that it stays in the correct plane definitely makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for noticing and pointing that out!&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>Mon, 14 Sep 2015 15:58:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815987#M70756</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-14T15:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filled Region</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815992#M70757</link>
      <description>&lt;P&gt;Dear Danny,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on getting it to work!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your appreciation for&amp;nbsp;The Building Coder.&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>Mon, 14 Sep 2015 15:59:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/filled-region/m-p/5815992#M70757</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-09-14T15:59:18Z</dc:date>
    </item>
  </channel>
</rss>

