Skip to content

Commit

Permalink
added original EditFilledRegion to show code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Tammik committed Sep 4, 2015
1 parent db3f33e commit e0c2ff1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
25 changes: 25 additions & 0 deletions BuildingCoder/BuildingCoder/CmdFilledRegionCoords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ namespace BuildingCoder
[Transaction( TransactionMode.ReadOnly )]
class CmdFilledRegionCoords : IExternalCommand
{
/// <summary>
/// Edit filled region by moving it back and forth
/// to make its boundary lines reappear after
/// deleting the line style. From:
/// http://forums.autodesk.com/t5/revit-api/filled-region/td-p/5796463
/// </summary>
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();
}
}

List<XYZ> GetBoundaryCorners( FilledRegion region )
{
List<XYZ> result = new List<XYZ>();
Expand Down
5 changes: 3 additions & 2 deletions BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
// 2015-08-18 2016.0.120.7 removed obsolete API usage in CmdCollectorPerformance, CmdCreateSlopedSlab, CmdNewTextNote, CmdRoomNeighbours, CmdRoomWallAdjacency, and CmdSpaceAdjacency
// 2015-08-18 2016.0.120.8 replaced obsolete PlanarFace.Normal property by PlanarFace.FaceNormal
// 2015-08-18 2016.0.120.9 eliminated obsolete API calls to ElementTransformUtils.MirrorElements by adding bool mirrorCopies argument
// 2015-09-04 2016.0.120.10 added original EditFilledRegion to show code improvements
//
[assembly: AssemblyVersion( "2016.0.120.9" )]
[assembly: AssemblyFileVersion( "2016.0.120.9" )]
[assembly: AssemblyVersion( "2016.0.120.10" )]
[assembly: AssemblyFileVersion( "2016.0.120.10" )]

0 comments on commit e0c2ff1

Please sign in to comment.