public void Excute(Document doc, AssemblyInstance assemblyInstance) { FamilyInstance Skin = FIlterstructuralframming(assemblyInstance); List <FamilyInstance> Frames = FIlterFrame(assemblyInstance); List <FamilyInstance> Connecions = FIlterConnections(assemblyInstance); var symbol = Get3dsymbol(doc); XYZ Center1; double Volumns1; GetCenterPoinSkintSolids(Solidhelper.AllSolids(Skin), out Center1, out Volumns1); XYZ Center2; double Volumns2; CaculatorSolidFrame(Frames, out Center2, out Volumns2); XYZ Center3; double Volumns3; CaculatorSolidConnections(Connecions, out Center3, out Volumns3); double x = 0; double y = 0; double z = 0; x = ((Center1.X) * Volumns1 * 150 + (Center2.X) * Volumns2 * 490 + (Center3.X) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490); y = ((Center1.Y) * Volumns1 * 150 + (Center2.Y) * Volumns2 * 490 + (Center3.Y) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490); z = ((Center1.Z) * Volumns1 * 150 + (Center2.Z) * Volumns2 * 490 + (Center3.Z) * Volumns3 * 490) / (Volumns1 * 150 + Volumns2 * 490 + Volumns3 * 490); var ft = new XYZ(x, y, z); PlaceSymbol(doc, symbol, ft, Skin); }
public void CaculatorSolidConnections(List <FamilyInstance> familyInstances, out XYZ Center, out double Volumn) { Dictionary <XYZ, double> dic = new Dictionary <XYZ, double>(); double Volumncount = 0; double x = 0; double y = 0; double z = 0; foreach (var item in familyInstances) { double volumn; XYZ center; var solids = Solidhelper.AllSolids(item); GetCenterPointFrameSolids(solids, out center, out volumn); dic.Add(center, volumn); } foreach (var item in dic.Values.ToList()) { Volumncount = Volumncount + Math.Abs(item); } for (int i = 0; i < dic.Keys.Count; i++) { if (dic.Keys.ToList()[i] != null) { x = x + dic.Keys.ToList()[i].X * Math.Abs(dic.Values.ToList()[i]) / Volumncount; y = y + dic.Keys.ToList()[i].Y * Math.Abs(dic.Values.ToList()[i]) / Volumncount; z = z + dic.Keys.ToList()[i].Z * Math.Abs(dic.Values.ToList()[i]) / Volumncount; } } Center = new XYZ(x, y, z); Volumn = Volumncount; }
public void ExcuteForStructuralFramming(Document doc, AssemblyInstance assemblyInstance) { List <FamilyInstance> familyInstances = FIlterAllstructuralFramming(assemblyInstance); var symbol = Get3dsymbol(doc); XYZ tong = XYZ.Zero; for (int i = 0; i < familyInstances.Count; i++) { var value = familyInstances[i]; XYZ Center1; double Volumns1; GetCenterPoinSkintSolids(Solidhelper.AllSolids(value), out Center1, out Volumns1); tong = tong + Center1; } XYZ Center = tong / familyInstances.Count; if (symbol != null) { PlaceSymbol(doc, symbol, Center, familyInstances.First()); } else { DrawingModelline(doc, Center); } }
public List <FamilyInstance> FindProductVoidcut(Document doc, List <FamilyInstance> Voids) { List <FamilyInstance> list = new List <FamilyInstance>(); foreach (var item in Voids) { var solids = Solidhelper.AllSolids(item); foreach (var solid in solids) { ICollection <ElementId> col = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).WherePasses(new ElementIntersectsSolidFilter(solid)).ToElementIds(); } } return(list); }
public void ExcuteForStructuralFrammingSelect(Document doc, FamilyInstance familyInstance) { var symbol = Get3dsymbol(doc); XYZ Center1; double Volumns1; GetCenterPoinSkintSolids(Solidhelper.AllSolids(familyInstance), out Center1, out Volumns1); if (symbol != null) { PlaceSymbol(doc, symbol, Center1, familyInstance); } else { DrawingModelline(doc, Center1); } }