/// <summary> /// When the roof was edited, then the data of the RoofItem should be updated synchronously. /// </summary> /// <returns>Update successfully return true, otherwise return false.</returns> public bool Update() { try { this.SubItems[1].Text = m_roof.Name; if (m_roof is Autodesk.Revit.DB.FootPrintRoof) { Parameter para = m_roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_BASE_LEVEL_PARAM); this.SubItems[2].Text = LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name; } else if (m_roof is Autodesk.Revit.DB.ExtrusionRoof) { Parameter para = m_roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM); this.SubItems[2].Text = LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name; } this.SubItems[3].Text = m_roof.RoofType.Name; } catch { return(false); } return(true); }
/// <summary> /// The construct of the RoofItem class. /// </summary> /// <param name="roof"></param> public RoofItem(Autodesk.Revit.DB.RoofBase roof) : base(roof.Id.IntegerValue.ToString()) { m_roof = roof; this.SubItems.Add(roof.Name); if (m_roof is Autodesk.Revit.DB.FootPrintRoof) { Parameter para = roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_BASE_LEVEL_PARAM); this.SubItems.Add(LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name); } else if (m_roof is Autodesk.Revit.DB.ExtrusionRoof) { Parameter para = roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM); this.SubItems.Add(LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name); } this.SubItems.Add(roof.RoofType.Name); }