public void Mathvalue2(Document doc, DoubleTee doubleTee, List <DoubleTee> listdt) { ProgressbarWPF progressbarWPF = new ProgressbarWPF(listdt.Count, "Loading..."); progressbarWPF.Show(); foreach (var item in listdt) { progressbarWPF.Giatri(); if (progressbarWPF.iscontinue == false) { break; } using (Transaction tran = new Transaction(doc, "Math Value")) { tran.Start(); item.Length_of_Drop.Set(doubleTee.Length_of_Drop.AsDouble()); item.High_Point_Elevation.Set(doubleTee.High_Point_Elevation.AsDouble()); item.Low_Point_Elevation.Set(doubleTee.Low_Point_Elevation.AsDouble()); item.CL_DT.Set(doubleTee.CL_DT.AsDouble()); item.Manual_Mark_End_Offset.Set(doubleTee.Manual_Mark_End_Offset.AsDouble()); item.Manual_Mark_End_Warp_Angle.Set(doubleTee.Manual_Mark_End_Warp_Angle.AsDouble()); item.Manual_Opp_End_Offset.Set(doubleTee.Manual_Opp_End_Offset.AsDouble()); item.Manual_Opp_End_Warp_Angle.Set(doubleTee.Manual_Opp_End_Warp_Angle.AsDouble()); tran.Commit(); } } progressbarWPF.Close(); }
public void Excute(Document doc, Selection sel) { DoubleTee doubleTee = Resource(doc, sel); var list = ListMath(doc, sel); Mathvalue2(doc, doubleTee, list); }
public DoubleTee Resource(Document doc, Selection sel) { Reference reference = sel.PickObject(ObjectType.Element, new Filterstructuralframing(), "Select double tee"); FamilyInstance familyInstance = doc.GetElement(reference) as FamilyInstance; DoubleTee doubleTee = new DoubleTee(familyInstance); return(doubleTee); }
public List <DoubleTee> ListMath(Document doc, Selection sel) { List <DoubleTee> list = new List <DoubleTee>(); IList <Reference> references = sel.PickObjects(ObjectType.Element, new FilterDoubletee(), "Select Double Tee"); foreach (var item in references) { FamilyInstance familyInstance = doc.GetElement(item) as FamilyInstance; DoubleTee doubleTee = new DoubleTee(familyInstance); list.Add(doubleTee); } return(list); }
public DoubleTee Getdtnearly(DoubleTee familyInstance, List <DoubleTee> listinstance) { DoubleTee flag = null; foreach (var item in listinstance) { if (Math.Round(item.Location.X, 0) == Math.Round(familyInstance.Location.X, 0) && Math.Round(item.Location.Y, 0) == Math.Round(familyInstance.Location.Y, 0)) { flag = item; } } return(flag); }
public void MathValue(Document doc, List <DoubleTee> list1, Dictionary <string, List <DoubleTee> > dic) { ProgressbarWPF progressbarWPF = new ProgressbarWPF(list1.Count, "Loading..."); progressbarWPF.Show(); foreach (var item in list1) { progressbarWPF.Giatri(); if (progressbarWPF.iscontinue == false) { break; } using (Transaction tran = new Transaction(doc, "Math Dt")) { tran.Start(); foreach (var item2 in dic.Keys.ToList()) { var list2 = dic[item2].ToList(); DoubleTee flag = Getdtnearly(item, list2); if (flag != null) { flag.Length_of_Drop.Set(item.Length_of_Drop.AsDouble()); flag.High_Point_Elevation.Set(item.High_Point_Elevation.AsDouble()); flag.Low_Point_Elevation.Set(item.Low_Point_Elevation.AsDouble()); flag.CL_DT.Set(item.CL_DT.AsDouble()); flag.Manual_Mark_End_Offset.Set(item.Manual_Mark_End_Offset.AsDouble()); flag.Manual_Mark_End_Warp_Angle.Set(item.Manual_Mark_End_Warp_Angle.AsDouble()); flag.Manual_Opp_End_Offset.Set(item.Manual_Opp_End_Offset.AsDouble()); flag.Manual_Opp_End_Warp_Angle.Set(item.Manual_Opp_End_Warp_Angle.AsDouble()); } else { continue; } } tran.Commit(); } } progressbarWPF.Close(); }