Пример #1
0
        protected override void SolveInstance(IGH_DataAccess da)
        {
            List <IGH_GeometricGoo> a_list       = da.GetDataList <IGH_GeometricGoo>(0);
            List <int>      groups               = da.GetDataList <int>(1);
            List <double>   axial_stiffness      = da.GetDataList <double>(2);
            List <double>   rotational_stiffness = da.GetDataList <double>(3);
            List <Vector3d> direction            = da.GetDataList <Vector3d>(4);

            List <GH_Spring> out_list = new List <GH_Spring>();

            for (int i = 0; i < a_list.Count; i++)
            {
                IGH_GeometricGoo a_goo = a_list[i];

                GH_Spring spr = new GH_Spring();
                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.SetInput(a_goo, true);
                if (state.Equals(GH_CouplingStruc.State.OK))
                {
                    out_list.Add(spr);
                }
                else
                {
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Input param: only (structural)points/lines allowed");
                }
            }

            da.SetDataList(0, out_list);
        }
Пример #2
0
        public override IGH_GeometricGoo DuplicateGeometry()
        {
            GH_Spring nc = new GH_Spring();

            nc.Value = new GH_CouplingStruc();
            if (!(Value.Reference_A is null))
            {
                nc.Value.Reference_A = Value.Reference_A;
            }

            if (Value.IsACurve)
            {
                nc.Value.SetA(Value.CurveA.DuplicateCurve());
            }
            else
            {
                nc.Value.SetA(new Point(Value.PointA.Location));
            }

            nc.GroupId              = GroupId;
            nc.Axial_stiffness      = Axial_stiffness;
            nc.Rotational_stiffness = Rotational_stiffness;
            nc.Direction            = Direction;
            return(nc);
        }
Пример #3
0
        public override IGH_GeometricGoo Morph(SpaceMorph xmorph)
        {
            GH_Spring nc = this.DuplicateGeometry() as GH_Spring;

            if (nc.Value.IsACurve)
            {
                xmorph.Morph(nc.Value.CurveA);
            }
            else
            {
                xmorph.Morph(nc.Value.PointA);
            }
            return(nc);
        }
Пример #4
0
        public override IGH_GeometricGoo Transform(Transform xform)
        {
            GH_Spring nc = this.DuplicateGeometry() as GH_Spring;

            if (nc.Value.IsACurve)
            {
                nc.Value.CurveA.Transform(xform);
            }
            else
            {
                nc.Value.PointA.Transform(xform);
            }
            return(nc);
        }