I was ill for a few days last week, with a fever and a virus.
I also made a quick trip to Moscow, where we held the final event in this year's sequence of DevDays conferences.
For the first time in my life, I gave my presentations in a woolly hat :-)
I also rented my first airbnb flat ever, on Arbat street in the centre of town, and was pretty happy with that.
I returned back to Switzerland on Friday, and back to health during the weekend.
During last week, I also preformed quite a bit of cleanup on the Revit API code samples on GitHub, continuing the on-going task of eliminating all deprecated API usage before the methods and properties become obsolete and are completely removed.
Another enhancement was the addition of a new external command CmdListPipeSizes prompted by Drew's suggestion on how to obtain a list of all pipe sizes being used in a project, based on a code snippet provided in the Revit API help file RevitAPI.chm description of the Segment class.
It retrieves all pipe segments in the project and lists their nominal, outer and inner diameter to a text file:
const string _filename = "C:/pipesizes.txt"; string FootToMmString( double a ) { return Util.FootToMm( a ) .ToString( "0.##" ) .PadLeft( 8 ); } /// <summary> /// List all the pipe segment sizes in the given document. /// </summary> /// <param name="doc"></param> void GetPipeSegmentSizes( Document doc ) { FilteredElementCollector segments = new FilteredElementCollector( doc ) .OfClass( typeof( Segment ) ); using( StreamWriter file = new StreamWriter( _filename, true ) ) { foreach( Segment segment in segments ) { file.WriteLine( segment.Name ); foreach( MEPSize size in segment.GetSizes() ) { file.WriteLine( string.Format( " {0} {1} {2}", FootToMmString( size.NominalDiameter ), FootToMmString( size.InnerDiameter ), FootToMmString( size.OuterDiameter ) ) ); } } } }
Running it in the Autodesk Waltham office MEP sample model Autodesk Waltham - MEP.rvt generates this pipesizes.txt output file.
As always, The Building Coder samples GitHub repository hosts the most up-to-date version, including:
- release 2015.0.116.8 – updated copyright year to 2015
- release 2015.0.116.9 – eliminated obsolete API usage, 15 warnings left
- release 2015.0.117.0 – implemented CmdListPipeSizes