Beispiel #1
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);
        }
        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);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            FemDesign.Loads.SurfaceLoad obj = null;
            if (!DA.GetData(0, ref obj))
            {
                return;
            }
            if (obj == null)
            {
                return;
            }

            // return
            DA.SetData(0, obj.Guid);
            DA.SetData(1, obj.LoadType);
            DA.SetData(2, obj.GetRhinoGeometry());
            DA.SetData(3, obj.Direction.ToRhino());
            DA.SetData(4, obj.Loads[0].Value);

            // if uniform
            if (obj.Loads.Count == 1)
            {
                DA.SetData(5, obj.Loads[0].Value);
                DA.SetData(6, obj.Loads[0].Value);
            }

            // if variable
            else if (obj.Loads.Count == 3)
            {
                DA.SetData(5, obj.Loads[1].Value);
                DA.SetData(6, obj.Loads[2].Value);
            }

            // else
            else
            {
                throw new System.ArgumentException("Length of load should be 1 or 3.");
            }

            DA.SetData(7, obj.LoadCase);
            DA.SetData(8, obj.Comment);
        }
        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);
        }
        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);
        }
Beispiel #6
0
 public static Dictionary <string, object> SurfaceLoadDeconstruct(FemDesign.Loads.SurfaceLoad surfaceLoad)
 {
     if (surfaceLoad.Loads.Count == 1)
     {
         return(new Dictionary <string, object>
         {
             { "Guid", surfaceLoad.Guid },
             { "Type", surfaceLoad.LoadType },
             { "Surface", surfaceLoad.Region.ToDynamoSurface() },
             { "Direction", surfaceLoad.Direction.ToDynamo() },
             { "q1", surfaceLoad.Loads[0].Value },
             { "q2", surfaceLoad.Loads[0].Value },
             { "q3", surfaceLoad.Loads[0].Value },
             { "LoadCaseGuid", surfaceLoad.LoadCase },
             { "Comment", surfaceLoad.Comment }
         });
     }
     else if (surfaceLoad.Loads.Count == 3)
     {
         return(new Dictionary <string, object>
         {
             { "Guid", surfaceLoad.Guid },
             { "Type", surfaceLoad.LoadType },
             { "Surface", surfaceLoad.Region.ToDynamoSurface() },
             { "Direction", surfaceLoad.Direction.ToDynamo() },
             { "q1", surfaceLoad.Loads[0].Value },
             { "q2", surfaceLoad.Loads[1].Value },
             { "q3", surfaceLoad.Loads[2].Value },
             { "LoadCaseGuid", surfaceLoad.LoadCase },
             { "Comment", surfaceLoad.Comment }
         });
     }
     else
     {
         throw new System.ArgumentException("Length of load must be 1 or 3.");
     }
 }