public bool CreateDependents() { ElementId levelID = this.selectedFloorPlan.get_Parameter(BuiltInParameter.PLAN_VIEW_LEVEL).Id; if (this.selectedFloorPlan != null && this.housingNum != null) { using (Transaction t = new Transaction(m_rvtDoc, "Create dependent views")) { t.Start(); try { for (int i = 0; i < housingNum.Count(); i++) { ElementId viewID = this.selectedFloorPlan.Duplicate(ViewDuplicateOption.AsDependent); ViewPlan plan = m_rvtDoc.GetElement(viewID) as ViewPlan; if (plan == null) { throw new Exception("Can't create dependent views"); } plan.Name = housingNum[i]; // var shape = plan.GetCropRegionShapeManager(); } t.Commit(); return(true); } catch { t.RollBack(); } } } else { TaskDialog.Show("Revit", housingNum.ToString() + selectedFloorPlan.ToString()); } return(false); }