static internal IList <BeamTypesInfo> GetBeamTypesInfo() { IList <ElementId> allUsedBeamTypesIDs = new List <ElementId>(); IList <BeamTypesInfo> AllUsedBeamTypesInfo = new List <BeamTypesInfo>(); IList <Element> allBeamgInstances = new FilteredElementCollector(uidoc.Document).OfCategory(BuiltInCategory.OST_StructuralFraming).OfClass(typeof(FamilyInstance)) .WhereElementIsNotElementType().ToList(); foreach (Element currentElement in allBeamgInstances) { if (!allUsedBeamTypesIDs.Contains(currentElement.GetTypeId())) { int typeID = currentElement.GetTypeId().IntegerValue; string typeName = currentElement.Name; BeamTypesInfo currentBeamInfo = new BeamTypesInfo() { TypeName = typeName, TypeId = typeID, WillBeNumbered = true, TypePrefix = "" }; allUsedBeamTypesIDs.Add(currentElement.GetTypeId()); AllUsedBeamTypesInfo.Add(currentBeamInfo); } } return(AllUsedBeamTypesInfo); }
private void RenumberListOfBeams(IList <Element> targetBeams, ref int currentCounter, string prefix, int decimalPlaces) { foreach (Element currentBeamElem in targetBeams) { BeamTypesInfo beamInfo = ONBOXApplication.storedBeamTypesInfo.Where(b => b.TypeId == currentBeamElem.GetTypeId().IntegerValue).First(); if (beamInfo.WillBeNumbered == false) { continue; } string typePrefix = beamInfo.TypePrefix; currentCounter++; string currentName = prefix + typePrefix + InsertZeros(currentCounter, decimalPlaces) + currentCounter; currentBeamElem.get_Parameter(BuiltInParameter.DOOR_NUMBER).Set((currentName).ToString()); } }