protected override void SolveInstance(IGH_DataAccess DA) { ///// INPUTS ///// Point3d pt = Point3d.Unset; List <bool> rels = new List <bool>(); Plane pl = Plane.Unset; if (!DA.GetData(0, ref pt)) { return; } if (!DA.GetDataList <bool>(1, rels)) { //Set as unrestrained if no release information is provided for (int i = 0; i < 6; i++) { rels.Add(false); } } if (rels.Count != 6) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Number of bools in input should be 6"); return; } if (!DA.GetData(2, ref pl)) { // If no plane submitted, use global XY plane pl = new Rhino.Geometry.Plane(new Rhino.Geometry.Point3d(0, 0, 0), new Rhino.Geometry.Vector3d(1, 0, 0), new Rhino.Geometry.Vector3d(0, 1, 0)); } ///// SOLVE ///// double factor = Utilities.GetScalingFactorFromRhino(); WR_XYZ wrXYZ = new WR_XYZ(pt.X * factor, pt.Y * factor, pt.Z * factor); WR_Vector wrX = GetUnitizedWR_Vector(pl.XAxis); WR_Vector wrY = GetUnitizedWR_Vector(pl.YAxis); WR_Vector wrZ = GetUnitizedWR_Vector(pl.ZAxis); WR_Plane wrPl = new WR_Plane(wrX, wrY, wrZ, wrXYZ); WR_Restraint rest = new WR_Restraint(wrPl, rels[0], rels[1], rels[2], rels[3], rels[4], rels[5]); WR_INode node = new WR_Node3d(pt.X * factor, pt.Y * factor, pt.Z * factor, rest); ///// OUTPUTS ///// DA.SetData(0, node); }
protected override void SolveInstance(IGH_DataAccess DA) { ///// INPUTS ///// Point3d pt = Point3d.Unset; List<bool> rels = new List<bool>(); Plane pl = Plane.Unset; if (!DA.GetData(0, ref pt)) { return; } if (!DA.GetDataList<bool>(1, rels)) { //Set as unrestrained if no release information is provided for (int i = 0; i < 6; i++) { rels.Add(false); } } if (rels.Count != 6) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Number of bools in input should be 6"); return; } if (!DA.GetData(2, ref pl)) { // If no plane submitted, use global XY plane pl = new Rhino.Geometry.Plane(new Rhino.Geometry.Point3d(0,0,0), new Rhino.Geometry.Vector3d(1,0,0), new Rhino.Geometry.Vector3d(0,1,0)); } ///// SOLVE ///// double factor = Utilities.GetScalingFactorFromRhino(); WR_XYZ wrXYZ = new WR_XYZ(pt.X * factor, pt.Y * factor, pt.Z * factor); WR_Vector wrX = GetUnitizedWR_Vector(pl.XAxis); WR_Vector wrY = GetUnitizedWR_Vector(pl.YAxis); WR_Vector wrZ = GetUnitizedWR_Vector(pl.ZAxis); WR_Plane wrPl = new WR_Plane(wrX, wrY, wrZ, wrXYZ); WR_Restraint rest = new WR_Restraint(wrPl, rels[0], rels[1], rels[2], rels[3], rels[4], rels[5]); WR_INode node = new WR_Node3d(pt.X * factor, pt.Y * factor, pt.Z * factor, rest); ///// OUTPUTS ///// DA.SetData(0, node); }