/// <summary> /// DrawInsulation /// </summary> public double drawInsulation(List<ElementId> grp, Document doc, Curve lower, double distance, Curve upper, ref bool leftwing, List<Interruption> Breaks, bool zigzag) { double dist = distance / lower.Length; if (dist > 1) return 100; XYZ P1 = lower.Evaluate(dist, true); IntersectionResultArray result = new IntersectionResultArray(); XYZ normal = lower.GetCurveTangentToEndPoint(P1); SetComparisonResult scr = Line.CreateUnbound(P1, normal).Intersect(upper, out result); if (result == null || result.Size == 0) { if (dist > 0.5) return 100; else { upper = upper.Clone(); upper.MakeUnbound(); scr = Line.CreateUnbound(P1, normal).Intersect(upper, out result); } } XYZ P3 = result.get_Item(0).XYZPoint; double height = P1.DistanceTo(P3); double r = height / 4; double distr = (distance + r) / lower.Length; if (distr > 1) return 100; foreach (Interruption interrupt in Breaks) { if (distr > lower.ComputeNormalizedParameter(interrupt.from) && distr < lower.ComputeNormalizedParameter(interrupt.to)) return r; } XYZ P2 = (distr < 1) ? lower.Evaluate(distr, true) : P1; double disth = (distance + height) / lower.Length; SetComparisonResult scr2 = Line.CreateUnbound(P2, lower.GetCurveTangentToEndPoint(P2)).Intersect(upper, out result); if (result == null || result.Size == 0) return 100; XYZ P4 = (P1 != P2) ? result.get_Item(0).XYZPoint : upper.GetEndPoint(1); if (zigzag) drawZigZag(grp, doc, P1, P2, P3, P4, leftwing); else drawSoftLoop(grp, doc, P1, P2, P3, P4, leftwing); if (leftwing) leftwing = false; else leftwing = true; return r; }