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); }
private void AppendCouplingInformation_SPR_Line(StringBuilder sb, GH_Spring spr) { sb.AppendFormat(" SLNS"); if (spr.GroupId > 0) { sb.AppendFormat(" GRP {0}", spr.GroupId); } sb.AppendFormat(" CA {0}", spr.Axial_stiffness); sb.AppendFormat(" CD {0}", spr.Rotational_stiffness); if (!spr.Direction.IsTiny()) { sb.AppendFormat(" DRX {0} DRY {1} DRZ {2}", spr.Direction.X, spr.Direction.Y, spr.Direction.Z); } sb.AppendLine(); }
public void Setup() { model = new GH_Model(ModelType.Truss2D, new List <GH_Element>(), new List <GH_Load>(), new List <GH_Support>()); 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); }
private void AppendCouplingInformation_SPR_Point(StringBuilder sb, GH_Spring spr) { sb.Append(" SPTS"); //sb.Append(" TYP 'C'"); sb.AppendFormat(" CP {0}", spr.Axial_stiffness); sb.AppendFormat(" CM {0}", spr.Rotational_stiffness); if (!spr.Direction.IsTiny()) { sb.AppendFormat(" DX {0} DY {1} DZ {2}", spr.Direction.X, spr.Direction.Y, spr.Direction.Z); } if (spr.GroupId > 0) { sb.AppendFormat(" GRP {0}", spr.GroupId); } sb.AppendLine(); }