//method to make choice based on availability of parallel trays with no intersection/ parallel with intersecting trays //or no parallel trays private void InterParallel(List <XYZ> placementPoints, Element leastWidth) { try { ICollection <ElementId> parallels = ducttray.ParallelElements(doc, leastWidth); List <Element> interParallel = new List <Element>(); foreach (XYZ point in placementPoints) { if (parallels == null || parallels.Count == 0) { AdjustInstance.height = Intersectors.StructureHeight(point, doc) + DuctsAndTrays.TrayDuctHeight(leastWidth); CreateAdjustElement(leastWidth, point, point, DuctsAndTrays.GetWidth(leastWidth), true, 0.0); continue; } else { interParallel = Intersectors.ParallelElements(point, doc, parallels); Element maxWidth = null, lowest = null; XYZ widthProject = null, lowestProject; if (interParallel.Count != 0) { interParallel.Add(leastWidth); maxWidth = DuctsAndTrays.MaxWidthElement(interParallel); lowest = DuctsAndTrays.LowestElement(interParallel); lowestProject = Intersectors.Projectpoint(point, ((LocationCurve)maxWidth.Location).Curve as Line); AdjustInstance.height = Intersectors.StructureHeight(lowestProject, doc) + DuctsAndTrays.TrayDuctHeight(lowest); widthProject = Intersectors.Projectpoint(point, ((LocationCurve)maxWidth.Location).Curve as Line); PlaceOnParallel(interParallel, widthProject, DuctsAndTrays.GetWidth(maxWidth), true, null, 0.0); } else { AdjustInstance.height = Intersectors.StructureHeight(point, doc) + DuctsAndTrays.TrayDuctHeight(leastWidth); CreateAdjustElement(leastWidth, point, point, DuctsAndTrays.GetWidth(leastWidth), true, 0.0); continue; } } } } catch { throw new Exception(); } }
//method to compute rod heights private static void ComputeRodHeights() { try { ReferPoints points = new ReferPoints(); points = Points.FindRodPoints(instancePoint, hostElement); rodLeft = Intersectors.StructureHeight(points.left, doc); rodRight = Intersectors.StructureHeight(points.right, doc); } catch { throw new Exception(); } }