public Model(Point3d anchorPoint, bool reverse, List <double> floorLength, double storeyHeight, int floor, double percision, double initialHeight) { CalculateFloor(anchorPoint, reverse, floorLength, storeyHeight, floor, initialHeight, out PointsA, out PointsB); PointsA.Reverse(); PointsB.Reverse(); PointsMidA = SectionCalculate.Arrange(PointsA); PointsMidB = SectionCalculate.Arrange(PointsB); FloorLines = CalculateLineLength(PointsA, PointsB, out FloorLength); SampleLines = CalculateLineLength(PointsMidA, PointsMidB, out SampleLength); List <Point3d> points = new List <Point3d>(PointsA); List <Point3d> tempPoint = new List <Point3d>(PointsB); tempPoint.Reverse(); points.AddRange(tempPoint); points.Add(points[0]); Polyline = new PolylineCurve(points); SamplePoints = CalculateSamplePoints(SampleLines, Polyline, percision); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Model modelA = null; Model modelB = null; List <Point3d> pointsA = new List <Point3d>(); List <Point3d> pointsB = new List <Point3d>(); if (!DA.GetData(0, ref modelA)) { return; } if (!DA.GetData(1, ref modelB)) { return; } var section = new SectionCalculate(modelA, modelB); DataTree <double> dataTreeA = new DataTree <double>(); dataTreeA.AddRange(section.ElevationAngleA, new GH_Path(0)); dataTreeA.AddRange(section.ProjectAngleA, new GH_Path(1)); DataTree <double> dataTreeB = new DataTree <double>(); dataTreeB.AddRange(section.ElevationAngleB, new GH_Path(0)); dataTreeB.AddRange(section.ProjectAngleB, new GH_Path(1)); DataTree <Line> dataTreeLineA = new DataTree <Line>(); for (int i = 0; i < section.ElevationLineA.Count; i++) { dataTreeLineA.AddRange(section.ElevationLineA[i], new GH_Path(i)); } DataTree <Line> dataTreeLineB = new DataTree <Line>(); for (int i = 0; i < section.ElevationLineB.Count; i++) { dataTreeLineB.AddRange(section.ElevationLineB[i], new GH_Path(i)); } DataTree <double> dataTreeEneryA = new DataTree <double>(); for (int i = 0; i < section.EnergyEachPointA.Count; i++) { dataTreeEneryA.AddRange(section.EnergyEachPointA[i], new GH_Path(i)); } DataTree <double> dataTreeEneryB = new DataTree <double>(); for (int i = 0; i < section.EnergyEachPointB.Count; i++) { dataTreeEneryB.AddRange(section.EnergyEachPointB[i], new GH_Path(i)); } var energyAverage = (section.EnergyAverageA + section.EnergyAverageB) / 2; var standardDeviationTotal = (section.StandardDeviationTotalA + section.StandardDeviationTotalB) / 2; DA.SetDataList(0, section.Curves); DA.SetDataTree(1, dataTreeA); DA.SetDataTree(2, dataTreeB); DA.SetDataTree(3, dataTreeLineA); DA.SetDataTree(4, dataTreeLineB); DA.SetDataTree(5, dataTreeEneryA); DA.SetDataTree(6, dataTreeEneryB); DA.SetData(7, energyAverage); DA.SetData(8, standardDeviationTotal); }