public static Dictionary <string, object> DuctCollector(Boolean refresh = false) { List <Revit.Elements.Element> elList = new List <Revit.Elements.Element>(); List <ElementId> elIdList = new List <ElementId>(); List <string> elNameList = new List <string>(); List <double> elLengthList = new List <double>(); List <double> elOffsetList = new List <double>(); List <string> elCalcSizeList = new List <string>(); List <string> elLevelList = new List <string>(); List <double> elArea = new List <double>(); if (refresh) { Document doc = DocumentManager.Instance.CurrentDBDocument; //UIApplication uiapp = DocumentManager.Instance.CurrentUIApplication; //Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; //UIDocument uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; FilteredElementCollector collector = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_DuctCurves); foreach (Autodesk.Revit.DB.Element e in collector) { DynaFunctions f = new DynaFunctions(); elIdList.Add(e.Id); elNameList.Add(e.Name); elLengthList.Add(f.feetToMillimeter(f.paramAsDouble(e, BuiltInParameter.CURVE_ELEM_LENGTH))); elList.Add(doc.GetElement(e.Id).ToDSType(true)); elOffsetList.Add(f.feetToMillimeter(f.paramAsDouble(e, BuiltInParameter.RBS_OFFSET_PARAM))); elCalcSizeList.Add(f.paramAsString(e, BuiltInParameter.RBS_CALCULATED_SIZE)); elLevelList.Add(f.paramAsValueString(e, BuiltInParameter.RBS_START_LEVEL_PARAM)); elArea.Add(f.sqfToSqm(f.paramAsDouble(e, BuiltInParameter.RBS_CURVE_SURFACE_AREA))); } } return(new Dictionary <string, object> { { "Elements", elList }, { "Id", elIdList }, { "Name", elNameList }, { "Length", elLengthList }, { "Area", elArea }, { "Offset", elOffsetList }, { "Size", elCalcSizeList }, { "Level", elLevelList }, }); }
public static Dictionary <string, object> getRebarCover(List <Revit.Elements.Element> elements) { string message = ""; Document doc = DocumentManager.Instance.CurrentDBDocument; DynaFunctions f = new DynaFunctions(); //UIApplication uiapp = DocumentManager.Instance.CurrentUIApplication; //Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; //UIDocument uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; List <double> topExterior = new List <double>(); List <double> bottomInterior = new List <double>(); List <double> others = new List <double>(); Autodesk.Revit.DB.Element el; List <BuiltInParameter> covers = new List <BuiltInParameter> { BuiltInParameter.CLEAR_COVER_EXTERIOR, BuiltInParameter.CLEAR_COVER_TOP, BuiltInParameter.CLEAR_COVER_INTERIOR, BuiltInParameter.CLEAR_COVER_BOTTOM, BuiltInParameter.CLEAR_COVER_OTHER, BuiltInParameter.CLEAR_COVER }; foreach (Revit.Elements.Element e in elements) { el = doc.GetElement(e.UniqueId.ToString()); List <double> coverValue = new List <double>(); foreach (BuiltInParameter c in covers) { try { ElementId rctId = el.get_Parameter(c).AsElementId(); RebarCoverType rct = doc.GetElement(rctId) as RebarCoverType; double cv = f.feetToMillimeter(rct.get_Parameter(BuiltInParameter.COVER_TYPE_LENGTH).AsDouble()); coverValue.Add(cv); } catch (Exception ex) { message = ex.Message; } } topExterior.Add(coverValue[0]); bottomInterior.Add(coverValue[1]); others.Add(coverValue[2]); } return(new Dictionary <string, object> { { "topExterior", topExterior }, { "bottomInterior", bottomInterior }, { "others", others }, //{ "Message", message }, }); }
public static Dictionary <string, object> getRebarDiameter(List <Revit.Elements.Element> rebarBarType) { string message = ""; Document doc = DocumentManager.Instance.CurrentDBDocument; DynaFunctions f = new DynaFunctions(); //UIApplication uiapp = DocumentManager.Instance.CurrentUIApplication; //Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; //UIDocument uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; List <double> rDiameters = new List <double>(); foreach (Revit.Elements.Element rt in rebarBarType) { Autodesk.Revit.DB.Element el = doc.GetElement(rt.UniqueId.ToString()); rDiameters.Add(f.feetToMillimeter(el.get_Parameter(BuiltInParameter.REBAR_BAR_DIAMETER).AsDouble())); } return(new Dictionary <string, object> { { "rebarDiameter", rDiameters }, //{ "Message", message }, }); }