// 取得所有元件的所有參數 public List <Item> getItems() { List <Item> items = new List <Item>(); Element selectedElement = null; foreach (ElementId elid in _elemids) { List <CusParameter> cups = new List <CusParameter>(); selectedElement = _doc.GetElement(elid); this._componentId = elid.IntegerValue.ToString(); this._componentTypeName = selectedElement.Category.Name; foreach (Parameter parm in selectedElement.Parameters) { ParameterFactory pf = new ParameterFactory(parm, _doc); CusParameter csp = pf.Cusparmeter; if (csp != null) { cups.Add(csp); } } Item newit = new Item(); newit.IID = elid.IntegerValue.ToString(); newit.Name = selectedElement.Category.Name; newit.Floor = getParamByName(cups, "樓層"); if (newit.Floor == "") { newit.Floor = getParamByName(cups, "底部約束"); } if (newit.Floor == "") { newit.Floor = getParamByName(cups, "基準樓層"); } ; if (newit.Floor == "-1") { newit.Floor = getParamByName(cups, "參考樓層"); } newit.Type = getParamByName(cups, "類型"); if (newit.Type == "") { newit.Type = getParamByName(cups, "族群"); } newit.size = getParamByName(cups, "體積"); items.Add(newit); } return(items); }
// 取得每個參數 public List <CusParameter> getElementParameters() { Element selectedElement = null; foreach (ElementId elid in _elemids) { selectedElement = _doc.GetElement(elid); this._componentId = elid.IntegerValue.ToString(); this._componentTypeName = selectedElement.Category.Name; foreach (Parameter parm in selectedElement.Parameters) { ParameterFactory pf = new ParameterFactory(parm, _doc); CusParameter csp = pf.Cusparmeter; if (csp != null) { _cusps.Add(csp); } } break; } return(_cusps); }