get pipe size revitapi
UIApplication uiApp = commandData.Application;
UIDocument uiDoc = uiApp.ActiveUIDocument;
Application app = uiApp.Application;
Document doc = uiDoc.Document;
FilteredElementCollector pipeSegments = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PipeSegments);
Dictionary<string,List<string>> pipeSegmentSizes = new Dictionary<string, List<string>>();
Reference pickObject = uiDoc.Selection.PickObject(ObjectType.Element);
Pipe pipe = doc.GetElement(pickObject.ElementId) as Pipe;
string segmentPipeName = pipe.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).AsValueString();
foreach (Segment segment in pipeSegments)
{
string key = segment.Name;
List<string> diameters = new List<string>();
if (!pipeSegmentSizes.ContainsKey(key))
{
foreach(MEPSize ms in segment.GetSizes())
if(ms != null && key == segmentPipeName) diameters.Add(ms.NominalDiameter.ToString());
}
pipeSegmentSizes.Add(key, diameters);
}
return Autodesk.Revit.UI.Result.Succeeded;