protected override void SolveInstance(IGH_DataAccess da) { List <IGH_GeometricGoo> a_list = da.GetDataList <IGH_GeometricGoo>(0); List <IGH_GeometricGoo> b_list = da.GetDataList <IGH_GeometricGoo>(1); List <int> groups = da.GetDataList <int>(2); List <double> axial_stiffness = da.GetDataList <double>(3); List <double> rotational_stiffness = da.GetDataList <double>(4); List <Vector3d> direction = da.GetDataList <Vector3d>(5); List <GH_Elastic_Coupling> out_list = new List <GH_Elastic_Coupling>(); int count = Math.Min(a_list.Count, b_list.Count); for (int i = 0; i < count; i++) { IGH_GeometricGoo a_goo = a_list[i]; IGH_GeometricGoo b_goo = b_list[i]; GH_Elastic_Coupling spr = new GH_Elastic_Coupling(); spr.Value = new GH_CouplingStruc(); spr.GroupId = groups.GetItemOrLast(i); spr.Axial_stiffness = axial_stiffness.GetItemOrLast(i); spr.Rotational_stiffness = rotational_stiffness.GetItemOrLast(i); spr.Direction = direction.GetItemOrLast(i); Enum state = spr.Value.SetInputs(a_goo, b_goo); if (state.Equals(GH_CouplingStruc.State.OK)) { out_list.Add(spr); } else if (state.Equals(GH_CouplingStruc.State.InvalidA)) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input param A: only (structural)points/lines allowed"); } else if (state.Equals(GH_CouplingStruc.State.InvalidB)) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input param B: only (structural)points/lines allowed"); } else if (state.Equals(GH_CouplingStruc.State.Modified)) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Input parameters swapped, only Elastic Couplings from Lines to Points are supported"); out_list.Add(spr); } } da.SetDataList(0, out_list); }
public override IGH_GeometricGoo Transform(Transform xform) { GH_Elastic_Coupling nc = this.DuplicateGeometry() as GH_Elastic_Coupling; if (nc.Value.IsACurve) { nc.Value.CurveA.Transform(xform); } else { nc.Value.PointA.Transform(xform); } if (nc.Value.IsBCurve) { nc.Value.CurveB.Transform(xform); } else { nc.Value.PointB.Transform(xform); } return(nc); }
public override IGH_GeometricGoo Morph(SpaceMorph xmorph) { GH_Elastic_Coupling nc = this.DuplicateGeometry() as GH_Elastic_Coupling; if (nc.Value.IsACurve) { xmorph.Morph(nc.Value.CurveA); } else { xmorph.Morph(nc.Value.PointA); } if (nc.Value.IsBCurve) { xmorph.Morph(nc.Value.CurveB); } else { xmorph.Morph(nc.Value.PointB); } return(nc); }
public override IGH_GeometricGoo DuplicateGeometry() { GH_Elastic_Coupling nc = new GH_Elastic_Coupling(); nc.Value = new GH_CouplingStruc(); if (!(Value.Reference_A is null)) { nc.Value.Reference_A = Value.Reference_A; } if (!(Value.Reference_B is null)) { nc.Value.Reference_B = Value.Reference_B; } if (Value.IsACurve) { nc.Value.SetA(Value.CurveA.DuplicateCurve()); } else { nc.Value.SetA(new Point(Value.PointA.Location)); } if (Value.IsBCurve) { nc.Value.SetB(Value.CurveB.DuplicateCurve()); } else { nc.Value.SetB(new Point(Value.PointB.Location)); } nc.GroupId = GroupId; nc.Axial_stiffness = Axial_stiffness; nc.Rotational_stiffness = Rotational_stiffness; nc.Direction = Direction; return(nc); }