private static void ExtractHeightElements(List <HeightElements> HeightElements, ProfAlign Profilealign, int i, object CurrentPViPoint) { if (CurrentPViPoint is PVI) { XYZ PVIPoint = ExtractPVIPoint((CurrentPViPoint as PVI).Text); var NextPVIPointLand = Profilealign.Items[i + 1]; (double, double)Range = (0, 0); Range.Item1 = PVIPoint.X; Autodesk.Revit.DB.Line LineElement = GetLineElementForPVI(PVIPoint, NextPVIPointLand, ref Range); HeightElements.Add(new HeightElements(Range, LineElement)); } else if (CurrentPViPoint is CircCurve) { (double, double)ARcRange, LineAfterRange; XYZ ArcPointEnd, NextPviPoint; Arc ARC; GetarcElementPVI(Profilealign, i, CurrentPViPoint, out ARcRange, out ArcPointEnd, out LineAfterRange, out NextPviPoint, out ARC); HeightElements.Add(new HeightElements(ARcRange, ARC)); var LineAfterCurve = Autodesk.Revit.DB.Line.CreateBound(ArcPointEnd, NextPviPoint); HeightElements.Add(new HeightElements(LineAfterRange, LineAfterCurve)); } }
public VertAlignment(Alignment aligment) { NumberFormat(); sectionsList = new List <VerticalEntity>(); ProfAlign profAlign = aligment.Profile.ProfAlign[0]; // Find all the polygonal points List <double> points = new List <double>(); points.Add(Convert.ToDouble(profAlign.PVI[0].Split(' ')[0], _format)); points.Add(Convert.ToDouble(profAlign.PVI[0].Split(' ')[1], _format)); for (int i = 0; i < profAlign.ParaCurve.Count; i++) { ParaCurve paraCurve = profAlign.ParaCurve[i]; points.Add(Convert.ToDouble(paraCurve.Point.Split(' ')[0], _format)); points.Add(Convert.ToDouble(paraCurve.Point.Split(' ')[1], _format)); } points.Add(Convert.ToDouble(profAlign.PVI[1].Split(' ')[0], _format)); points.Add(Convert.ToDouble(profAlign.PVI[1].Split(' ')[1], _format)); // Generates curves List <double> linePoints = new List <double>(); int nVert = profAlign.ParaCurve.Count; for (int i = 1; i < nVert + 1; i++) { ParaCurve paraCurve = profAlign.ParaCurve[i - 1]; double L = Convert.ToDouble(paraCurve.Length, _format); int i1 = i - 1; int i2 = i; int i3 = i + 1; double sta1 = points[2 * i1]; double z1 = points[2 * i1 + 1]; double sta2 = points[2 * i2]; double z2 = points[2 * i2 + 1]; double sta3 = points[2 * i3]; double z3 = points[2 * i3 + 1]; double staP1 = sta2 - L / 2; double staP2 = sta2 + L / 2; double zP1 = z1 + (staP1 - sta1) / (sta2 - sta1) * (z2 - z1); double zP2 = z2 + (staP2 - sta2) / (sta3 - sta2) * (z3 - z2); sectionsList.Add(new VerticalCurve(staP1, zP1, staP2, zP2, sta2, z2, L)); if (i == 1) { linePoints.Add(sta1); linePoints.Add(z1); } linePoints.Add(staP1); linePoints.Add(zP1); linePoints.Add(staP2); linePoints.Add(zP2); if (i == nVert) { linePoints.Add(sta3); linePoints.Add(z3); } } // Generate lines for (int i = 0; i < linePoints.Count / 4; i++) { double staIni = linePoints[4 * i]; double zIni = linePoints[4 * i + 1]; double staFin = linePoints[4 * i + 2]; double zFin = linePoints[4 * i + 3]; sectionsList.Add(new VerticalLine(staIni, zIni, staFin, zFin)); } }
private static void GetarcElementPVI(ProfAlign Profilealign, int i, object CurrentPViPoint, out (double, double) ARcRange, out XYZ ArcPointEnd, out (double, double) LineAfterRange, out XYZ NextPviPoint, out Arc ARC)