/// <summary> /// get all the door families in the project. /// And store them in two lists separately based on opening parameter. /// </summary> private void PrepareDoorFamilies() { // prepare DoorFamilies FilteredElementIterator familyIter = new FilteredElementCollector(m_app.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator(); while (familyIter.MoveNext()) { Family doorFamily = familyIter.Current as Family; if (null == doorFamily.FamilyCategory) // some family.FamilyCategory is null { continue; } if (doorFamily.FamilyCategory.Name != m_app.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Doors).Name) // FamilyCategory.Name is not 'Doors' { continue; } // create one instance of self class DoorFamily. DoorFamily tempDoorFamily = new DoorFamily(doorFamily, m_app); // store the created DoorFamily instance m_doorFamilies.Add(tempDoorFamily); } }
/// <summary> /// Preview door's geometry when user select one door family in customizeDoorOpeningDataGridView. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void customizeDoorOpeningDataGridView_RowEnter(object sender, DataGridViewCellEventArgs e) { DoorFamily selectedDoorFamily = customizeDoorOpeningDataGridView.Rows[e.RowIndex].DataBoundItem as DoorFamily; m_currentGraphic = selectedDoorFamily.Geometry; // update the dialog box's display. previewPictureBox.Refresh(); }
/// <summary> /// get all the door families in the project. /// And store them in two lists separately based on opening parameter. /// </summary> private void PrepareDoorFamilies() { // prepare DoorFamilies FilteredElementIterator familyIter = new FilteredElementCollector(m_app.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator(); while (familyIter.MoveNext()) { Family doorFamily = familyIter.Current as Family; if (null == doorFamily.FamilyCategory) // some family.FamilyCategory is null { continue; } if (!doorFamily.FamilyCategory.Name.Equals("Doors")) { continue; } // create one instance of self class DoorFamily. DoorFamily tempDoorFamily = new DoorFamily(doorFamily, m_app); // store the created DoorFamily instance m_doorFamilies.Add(tempDoorFamily); } }