//Output bending plane and moment between two consecutive line segments. Moment in [kNm] and stress in [MPa] public override object Output(List <KangarooSolver.Particle> p) { Point3d P0 = p[PIndex[0]].Position; Point3d P1 = p[PIndex[1]].Position; Point3d P2 = p[PIndex[2]].Position; Point3d P3 = p[PIndex[3]].Position; Vector3d V01 = P1 - P0; Vector3d V23 = P3 - P2; Vector3d n = Vector3d.CrossProduct(-V01, V23); //Calculate moment and bending stress double moment = Move[0].Length * Weighting[0] * V01.Length * 1e3; //Units: [Nmm] double bendingStress = (moment * zDist) / inertia; //Calculate bending plane Vector3d planeYAxis = -(Move[1] + Move[2]) / 2.0; Vector3d planeXAxis = Vector3d.CrossProduct(planeYAxis, n); planeYAxis.Unitize(); planeXAxis.Unitize(); Plane pl = new Plane(P1, planeXAxis, planeYAxis); //Create rod data object to store output information DataTypes.RodData rodData = new DataTypes.RodData(pl, moment * 1e-6, bendingStress); return(rodData); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { //Input DataTypes.RodData rodData = new DataTypes.RodData(); DA.GetData(0, ref rodData); //Extract properties Plane pl = rodData.BendingPlane; double moment = rodData.Moment; double stress = rodData.BendingStress; //Output DA.SetData(0, pl); DA.SetData(1, Math.Round(moment, 9)); DA.SetData(2, Math.Round(stress, 3)); }