protected override void SolveInstance(IGH_DataAccess DA) { double x = 0; double y = 0; double z = 0; double xx = 0; double yy = 0; double zz = 0; GH_Number ghSprX = new GH_Number(); if (DA.GetData(0, ref ghSprX)) { GH_Convert.ToDouble(ghSprX, out x, GH_Conversion.Both); } GH_Number ghSprY = new GH_Number(); if (DA.GetData(1, ref ghSprY)) { GH_Convert.ToDouble(ghSprY, out y, GH_Conversion.Both); } GH_Number ghSprZ = new GH_Number(); if (DA.GetData(2, ref ghSprZ)) { GH_Convert.ToDouble(ghSprZ, out z, GH_Conversion.Both); } GH_Number ghSprXX = new GH_Number(); if (DA.GetData(3, ref ghSprXX)) { GH_Convert.ToDouble(ghSprXX, out xx, GH_Conversion.Both); } GH_Number ghSprYY = new GH_Number(); if (DA.GetData(4, ref ghSprYY)) { GH_Convert.ToDouble(ghSprYY, out yy, GH_Conversion.Both); } GH_Number ghSprZZ = new GH_Number(); if (DA.GetData(5, ref ghSprZZ)) { GH_Convert.ToDouble(ghSprZZ, out zz, GH_Conversion.Both); } GsaSpring Spring = new GsaSpring { X = x, Y = y, Z = z, XX = xx, YY = yy, ZZ = zz }; DA.SetData(0, new GsaSpringGoo(Spring.Duplicate())); }
protected override void SolveInstance(IGH_DataAccess DA) { GsaSpring spring = new GsaSpring(); GsaSpring gsaspring = new GsaSpring(); if (DA.GetData(0, ref gsaspring)) { spring = gsaspring.Duplicate(); } if (spring != null) { //inputs double x = 0; if (DA.GetData(1, ref x)) { spring.X = x; } double y = 0; if (DA.GetData(2, ref y)) { spring.Y = y; } double z = 0; if (DA.GetData(3, ref z)) { spring.Z = z; } double xx = 0; if (DA.GetData(4, ref xx)) { spring.XX = xx; } double yy = 0; if (DA.GetData(5, ref yy)) { spring.YY = yy; } double zz = 0; if (DA.GetData(6, ref zz)) { spring.ZZ = zz; } //outputs DA.SetData(0, new GsaSpringGoo(spring)); DA.SetData(1, spring.X); DA.SetData(2, spring.Y); DA.SetData(3, spring.Z); DA.SetData(4, spring.XX); DA.SetData(5, spring.YY); DA.SetData(6, spring.ZZ); } }
protected override void SolveInstance(IGH_DataAccess DA) { GH_Point ghpt = new GH_Point(); if (DA.GetData(0, ref ghpt)) { Point3d pt = new Point3d(); if (GH_Convert.ToPoint3d(ghpt, ref pt, GH_Conversion.Both)) { GH_Plane gH_Plane = new GH_Plane(); Plane localAxis = Plane.WorldXY; if (DA.GetData(1, ref gH_Plane)) { GH_Convert.ToPlane(gH_Plane, ref localAxis, GH_Conversion.Both); } GsaNode node = new GsaNode(pt); GsaBool6 bool6 = new GsaBool6(); if (DA.GetData(2, ref bool6)) { x = bool6.X; y = bool6.Y; z = bool6.Z; xx = bool6.XX; yy = bool6.YY; zz = bool6.ZZ; } GsaSpring spring = new GsaSpring(); if (DA.GetData(3, ref spring)) { node.Spring = spring; } node.LocalAxis = localAxis; node.Node.Restraint.X = x; node.Node.Restraint.Y = y; node.Node.Restraint.Z = z; node.Node.Restraint.XX = xx; node.Node.Restraint.YY = yy; node.Node.Restraint.ZZ = zz; DA.SetData(0, new GsaNodeGoo(node.Duplicate())); } } }
protected override void SolveInstance(IGH_DataAccess DA) { GH_ObjectWrapper gh_typ = new GH_ObjectWrapper(); if (DA.GetData(0, ref gh_typ)) { GsaNode gsaNode = new GsaNode(); Point3d tempPt = new Point3d(); if (gh_typ.Value is GsaNodeGoo) { gh_typ.CastTo(ref gsaNode); if (gsaNode == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Node input is null"); } if (gsaNode.Node == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Node input is null"); } } else if (GH_Convert.ToPoint3d(gh_typ.Value, ref tempPt, GH_Conversion.Both)) { gsaNode = new GsaNode(tempPt); } else { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Unable to convert input to Node"); return; } GsaNode node = gsaNode.Duplicate(); // #### inputs #### // 1 ID GH_Integer ghInt = new GH_Integer(); if (DA.GetData(1, ref ghInt)) { if (GH_Convert.ToInt32(ghInt, out int id, GH_Conversion.Both)) { node.ID = id; } } // 2 Point GH_Point ghPt = new GH_Point(); if (DA.GetData(2, ref ghPt)) { Point3d pt = new Point3d(); if (GH_Convert.ToPoint3d(ghPt, ref pt, GH_Conversion.Both)) { node.Point = pt; node.Node.Position.X = pt.X; node.Node.Position.Y = pt.Y; node.Node.Position.Z = pt.Z; } } // 3 plane GH_Plane ghPln = new GH_Plane(); if (DA.GetData(3, ref ghPln)) { Plane pln = new Plane(); if (GH_Convert.ToPlane(ghPln, ref pln, GH_Conversion.Both)) { pln.Origin = node.Point; node.LocalAxis = pln; } } // 4 Restraint GsaBool6 restraint = new GsaBool6(); if (DA.GetData(4, ref restraint)) { node.Node.Restraint.X = restraint.X; node.Node.Restraint.Y = restraint.Y; node.Node.Restraint.Z = restraint.Z; node.Node.Restraint.XX = restraint.XX; node.Node.Restraint.YY = restraint.YY; node.Node.Restraint.ZZ = restraint.ZZ; } // 5 Spring GsaSpring spring = new GsaSpring(); if (DA.GetData(5, ref spring)) { if (spring != null) { node.Spring = spring; } } // 6 Name GH_String ghStr = new GH_String(); if (DA.GetData(6, ref ghStr)) { if (GH_Convert.ToString(ghStr, out string name, GH_Conversion.Both)) { node.Node.Name = name; } } // 7 Colour GH_Colour ghcol = new GH_Colour(); if (DA.GetData(7, ref ghcol)) { if (GH_Convert.ToColor(ghcol, out System.Drawing.Color col, GH_Conversion.Both)) { node.Colour = col; } } // #### outputs #### DA.SetData(0, new GsaNodeGoo(node)); DA.SetData(1, node.ID); DA.SetData(2, node.Point); DA.SetData(3, node.LocalAxis); GsaBool6 restraint1 = new GsaBool6 { X = node.Node.Restraint.X, Y = node.Node.Restraint.Y, Z = node.Node.Restraint.Z, XX = node.Node.Restraint.XX, YY = node.Node.Restraint.YY, ZZ = node.Node.Restraint.ZZ }; DA.SetData(4, restraint1); GsaSpring spring1 = new GsaSpring(); if (node.Spring != null) { spring1 = node.Spring.Duplicate(); } DA.SetData(5, new GsaSpringGoo(spring1)); DA.SetData(6, node.Node.Name); DA.SetData(7, node.Colour); try { DA.SetDataList(8, node.Node.ConnectedElements); } catch (Exception) { } try { DA.SetDataList(9, node.Node.ConnectedMembers); } catch (Exception) { } } }
protected override void SolveInstance(IGH_DataAccess DA) { GsaNode gsaNode = new GsaNode(); if (!DA.GetData(0, ref gsaNode)) { gsaNode = new GsaNode(new Point3d(0, 0, 0)); } if (gsaNode != null) { // #### inputs #### GH_Integer ghInt = new GH_Integer(); if (DA.GetData(1, ref ghInt)) { if (GH_Convert.ToInt32(ghInt, out int id, GH_Conversion.Both)) { gsaNode.ID = id; } } GH_String ghStr = new GH_String(); if (DA.GetData(2, ref ghStr)) { if (GH_Convert.ToString(ghStr, out string name, GH_Conversion.Both)) { gsaNode.Node.Name = name; } } GH_Point ghPt = new GH_Point(); if (DA.GetData(3, ref ghPt)) { Point3d pt = new Point3d(); if (GH_Convert.ToPoint3d(ghPt, ref pt, GH_Conversion.Both)) { gsaNode.Point = pt; gsaNode.Node.Position.X = pt.X; gsaNode.Node.Position.Y = pt.Y; gsaNode.Node.Position.Z = pt.Z; } } GH_Plane ghPln = new GH_Plane(); if (DA.GetData(4, ref ghPln)) { Plane pln = new Plane(); if (GH_Convert.ToPlane(ghPln, ref pln, GH_Conversion.Both)) { pln.Origin = gsaNode.Point; gsaNode.LocalAxis = pln; } } GsaBool6 restraint = new GsaBool6(); if (DA.GetData(5, ref restraint)) { restraint.X = gsaNode.Node.Restraint.X; restraint.Y = gsaNode.Node.Restraint.Y; restraint.Z = gsaNode.Node.Restraint.Z; restraint.XX = gsaNode.Node.Restraint.XX; restraint.YY = gsaNode.Node.Restraint.YY; restraint.ZZ = gsaNode.Node.Restraint.ZZ; } GsaSpring spring = new GsaSpring(); if (DA.GetData(6, ref spring)) { if (gsaNode.Spring != null) { gsaNode.Spring = spring; } } // #### outputs #### DA.SetData(0, new GsaNodeGoo(gsaNode)); DA.SetData(1, gsaNode.ID); DA.SetData(2, gsaNode.Node.Name); DA.SetData(3, gsaNode.Point); DA.SetData(4, gsaNode.LocalAxis); GsaBool6 restraint1 = new GsaBool6 { X = gsaNode.Node.Restraint.X, Y = gsaNode.Node.Restraint.Y, Z = gsaNode.Node.Restraint.Z, XX = gsaNode.Node.Restraint.XX, YY = gsaNode.Node.Restraint.YY, ZZ = gsaNode.Node.Restraint.ZZ }; DA.SetData(5, restraint1); GsaSpring spring1 = new GsaSpring(); if (gsaNode.Spring != null) { spring1 = gsaNode.Spring.Duplicate(); } DA.SetData(6, new GsaSpringGoo(spring1)); try { DA.SetDataList(7, gsaNode.Node.ConnectedElements); } catch (Exception) { } try { DA.SetDataList(8, gsaNode.Node.ConnectedMembers); } catch (Exception) { } } }