protected override void SolveInstance(IGH_DataAccess DA) { // Declare a variable for the input Line line = new Line(); double springConstant = 0; // Use the DA object to retrieve the data inside the first input parameter. // If the retieval fails (for example if there is no data) we need to abort. if (!DA.GetData(0, ref line )) { return; } if (!DA.GetData(1, ref springConstant)) { return; } // if (!DA.GetDataList<GHBarRelease>(2, releases)) { return; } // if (!DA.GetDataList<GHBarGroup>(2, groups)) { return; } GH_Spring spring = new GH_Spring(line.From, line.To, springConstant); DA.SetData(0, spring); }
public void Setup() { model = new GH_Model(ModelType.Truss2D); springConstant = 10; force = new Vector3d(0,0,10); moment = new Vector3d(0,0,0); point1 = new Point3d(0,0,0); point2 = new Point3d(0,0,10); point3 = new Point3d(0,0,20); spring1 = new GH_Spring(point1, point2, springConstant); spring2 = new GH_Spring(point2, point3, springConstant); nodalLoad1 = new GH_NodalLoad(point2, force, moment); nodalLoad2 = new GH_NodalLoad(point3, force, moment); nodeSupport1 = new GH_NodeSupport(point1, true, true, true, true, true, true); nodeSupport2 = new GH_NodeSupport(point2, true, true, false, true, true, true); }