コード例 #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            List <FemDesign.Loads.LoadCase> loadCases = new List <FemDesign.Loads.LoadCase>();
            string name = null;

            if (!DA.GetDataList(0, loadCases))
            {
                return;
            }
            if (!DA.GetData(1, ref name))
            {
                return;
            }
            if (loadCases == null || name == null)
            {
                return;
            }

            //
            FemDesign.Loads.LoadCase obj = FemDesign.Loads.LoadCase.LoadCaseFromListByName(loadCases, name);

            // return
            DA.SetData(0, obj);
        }
コード例 #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Curve curve = null;

            if (!DA.GetData(0, ref curve))
            {
                return;
            }

            Vector3d startForce = Vector3d.Zero;

            if (!DA.GetData(1, ref startForce))
            {
                return;
            }

            Vector3d endForce = Vector3d.Zero;

            if (!DA.GetData(2, ref endForce))
            {
                // if no data set endForce to startForce to create a uniform line load.
                endForce = startForce;
            }

            FemDesign.Loads.LoadCase loadCase = null;
            if (!DA.GetData(3, ref loadCase))
            {
                return;
            }

            bool constLoadDir = true;

            DA.GetData(4, ref constLoadDir);

            string comment = null;

            DA.GetData(5, ref comment);

            if (curve == null || startForce == null || endForce == null || loadCase == null)
            {
                return;
            }

            FemDesign.Geometry.Edge       edge        = Convert.FromRhinoLineOrArc1(curve);
            FemDesign.Geometry.FdVector3d _startForce = startForce.FromRhino();
            FemDesign.Geometry.FdVector3d _endForce   = endForce.FromRhino();


            try
            {
                var obj = new FemDesign.Loads.LineLoad(edge, _startForce, _endForce, loadCase, Loads.ForceLoadType.Moment, comment, constLoadDir, false);
                DA.SetData(0, obj);
            }
            catch (ArgumentException e)
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, e.Message);
            }
        }
コード例 #3
0
ファイル: Deconstruct.cs プロジェクト: strusoft/femdesign-api
 public static Dictionary <string, object> LoadCaseDeconstruct(FemDesign.Loads.LoadCase loadCase)
 {
     return(new Dictionary <string, object>
     {
         { "Guid", loadCase.Guid.ToString() },
         { "Name", loadCase.Name },
         { "Type", loadCase.Type.ToString() },
         { "DurationClass", loadCase.DurationClass.ToString() }
     });
 }
コード例 #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Brep     surface   = null;
            Vector3d direction = Vector3d.Zero;
            List <FemDesign.Loads.LoadLocationValue> loads = new List <FemDesign.Loads.LoadLocationValue>();

            FemDesign.Loads.LoadCase loadCase = null;
            string comment = null;

            if (!DA.GetData(0, ref surface))
            {
                return;
            }
            if (!DA.GetData(1, ref direction))
            {
                return;
            }
            if (!DA.GetDataList(2, loads))
            {
                return;
            }
            if (!DA.GetData(3, ref loadCase))
            {
                return;
            }
            if (!DA.GetData(4, ref comment))
            {
                // pass
            }
            if (surface == null || loads == null || loadCase == null)
            {
                return;
            }
            if (loads.Count != 3)
            {
                throw new System.ArgumentException("Load must contain exactly 3 items");
            }

            // transform geometry
            FemDesign.Geometry.Region     region   = surface.FromRhino();
            FemDesign.Geometry.FdVector3d fdVector = direction.FromRhino().Normalize();

            //
            FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loads, loadCase, false, comment);

            // return
            DA.SetData(0, obj);
        }
コード例 #5
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Brep     surface   = null;
            Vector3d direction = Vector3d.Zero;
            List <FemDesign.Loads.LoadLocationValue> loads = new List <FemDesign.Loads.LoadLocationValue>();

            FemDesign.Loads.LoadCase loadCase = null;
            bool   loadProjection             = false;
            string comment = "";

            if (!DA.GetData("Surface", ref surface))
            {
                return;
            }
            if (!DA.GetData("Direction", ref direction))
            {
                return;
            }
            if (!DA.GetDataList("LoadLocationValue", loads))
            {
                return;
            }
            DA.GetData("LoadProjection", ref loadProjection);
            if (!DA.GetData("LoadCase", ref loadCase))
            {
                return;
            }
            DA.GetData("Comment", ref comment);

            if (surface == null || loads == null || loadCase == null)
            {
                return;
            }
            if (loads.Count != 3)
            {
                throw new System.ArgumentException("Load must contain exactly 3 items");
            }

            // Convert geometry
            FemDesign.Geometry.Region     region   = surface.FromRhino();
            FemDesign.Geometry.FdVector3d fdVector = direction.FromRhino().Normalize();

            FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Variable(region, fdVector, loads, loadCase, loadProjection, comment);

            DA.SetData("SurfaceLoad", obj);
        }
コード例 #6
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            FemDesign.Loads.LoadCase obj = null;
            if (!DA.GetData(0, ref obj))
            {
                return;
            }
            if (obj == null)
            {
                return;
            }

            // return
            DA.SetData(0, obj.Guid);
            DA.SetData(1, obj.Name);
            DA.SetData(2, obj.Type.ToString());
            DA.SetData(3, obj.DurationClass.ToString());
        }
コード例 #7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Point3d  point  = Point3d.Origin;
            Vector3d moment = Vector3d.Zero;

            FemDesign.Loads.LoadCase loadCase = null;
            string comment = null;

            if (!DA.GetData(0, ref point))
            {
                return;
            }
            if (!DA.GetData(1, ref moment))
            {
                return;
            }
            if (!DA.GetData(2, ref loadCase))
            {
                return;
            }
            if (!DA.GetData(3, ref comment))
            {
                // pass
            }
            if (moment == null || loadCase == null)
            {
                return;
            }
            ;

            // convert geometry
            FemDesign.Geometry.FdPoint3d  fdPoint = point.FromRhino();
            FemDesign.Geometry.FdVector3d _moment = moment.FromRhino();

            //
            FemDesign.Loads.PointLoad obj = new FemDesign.Loads.PointLoad(fdPoint, _moment, loadCase, comment, Loads.ForceLoadType.Moment);

            // return
            DA.SetData(0, obj);
        }
コード例 #8
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Brep     surface = null;
            Vector3d force   = Vector3d.Zero;

            FemDesign.Loads.LoadCase loadCase = null;
            string comment = "";

            if (!DA.GetData(0, ref surface))
            {
                return;
            }
            if (!DA.GetData(1, ref force))
            {
                return;
            }
            if (!DA.GetData(2, ref loadCase))
            {
                return;
            }
            if (!DA.GetData(3, ref comment))
            {
                // pass
            }
            if (surface == null || force == null || loadCase == null)
            {
                return;
            }

            // transform geometry
            FemDesign.Geometry.Region     region = surface.FromRhino();
            FemDesign.Geometry.FdVector3d _force = force.FromRhino();

            //
            FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Uniform(region, _force, loadCase, false, comment);

            // return
            DA.SetData(0, obj);
        }
コード例 #9
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Brep     surface = null;
            Vector3d force   = Vector3d.Zero;

            FemDesign.Loads.LoadCase loadCase = null;
            bool   loadProjection             = false;
            string comment = "";

            if (!DA.GetData("Surface", ref surface))
            {
                return;
            }
            if (!DA.GetData("Force", ref force))
            {
                return;
            }
            DA.GetData("LoadProjection", ref loadProjection);
            if (!DA.GetData("LoadCase", ref loadCase))
            {
                return;
            }
            DA.GetData("Comment", ref comment);

            if (surface == null || force == null || loadCase == null)
            {
                return;
            }

            // Convert geometry
            FemDesign.Geometry.Region     region = surface.FromRhino();
            FemDesign.Geometry.FdVector3d _force = force.FromRhino();

            FemDesign.Loads.SurfaceLoad obj = FemDesign.Loads.SurfaceLoad.Uniform(region, _force, loadCase, loadProjection, comment);

            DA.SetData("SurfaceLoad", obj);
        }