Пример #1
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);
            }
        }
Пример #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Brep brep = null;
            List <FemDesign.Bars.Bar>    bars  = new List <FemDesign.Bars.Bar>();
            List <FemDesign.Shells.Slab> slabs = new List <FemDesign.Shells.Slab>();
            Vector3d vector     = Vector3d.XAxis;
            string   identifier = "CO";

            if (!DA.GetData(0, ref brep))
            {
                return;
            }
            if (!DA.GetDataList(1, bars))
            {
                // pass
            }
            if (!DA.GetDataList(2, slabs))
            {
                // pass
            }
            if (!DA.GetData(3, ref vector))
            {
                // pass
            }
            if (!DA.GetData(4, ref identifier))
            {
                // pass
            }
            if (brep == null || bars == null || slabs == null || vector == null || identifier == null)
            {
                return;
            }

            // create list of supporting structures
            List <object> structures = new List <object>();

            foreach (FemDesign.Bars.Bar bar in bars)
            {
                structures.Add(bar);
            }
            foreach (FemDesign.Shells.Slab slab in slabs)
            {
                structures.Add(slab);
            }

            // convert geometry
            FemDesign.Geometry.Region     region     = brep.FromRhino();
            FemDesign.Geometry.FdVector3d fdVector3d = vector.FromRhino().Normalize();

            //
            FemDesign.Cover obj = FemDesign.Cover.OneWayCover(region, structures, fdVector3d, identifier);

            // return
            DA.SetData(0, obj);
        }
        /// <summary>
        /// The method has been created for returning the value for Grasshopper and Dynamo.
        /// The method can still be use for C# users.
        /// </summary>
        public static Dictionary <string, object> DeconstructLineSupportReaction(List <FemDesign.Results.LineSupportGroupReaction> Result, string LoadCase)
        {
            var lineSupportReactions = Result.Cast <FemDesign.Results.LineSupportGroupReaction>();

            // Return the unique load case - load combination
            var uniqueLoadCases = lineSupportReactions.Select(n => n.CaseIdentifier).Distinct().ToList();

            // Select the Nodal Reactions for the selected Load Case - Load Combination
            if (uniqueLoadCases.Contains(LoadCase, StringComparer.OrdinalIgnoreCase))
            {
                lineSupportReactions = lineSupportReactions.Where(n => String.Equals(n.CaseIdentifier, LoadCase, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                var warning = $"Load Case '{LoadCase}' does not exist";
                throw new ArgumentException(warning);
            }

            // Parse Results from the object
            var identifier      = lineSupportReactions.Select(n => n.Id).ToList();
            var elementId       = lineSupportReactions.Select(n => n.ElementId).ToList();
            var nodeId          = lineSupportReactions.Select(n => n.NodeId).ToList();
            var loadCases       = lineSupportReactions.Select(n => n.CaseIdentifier).Distinct().ToList();
            var forceResultant  = lineSupportReactions.Select(n => n.Fr).ToList();
            var momentResultant = lineSupportReactions.Select(n => n.Mr).ToList();

            // Create a Fd Vector/Point for Visualising the Reaction Forces
            var reactionForceVector  = new List <FemDesign.Geometry.FdVector3d>();
            var reactionMomentVector = new List <FemDesign.Geometry.FdVector3d>();


            foreach (var reaction in lineSupportReactions)
            {
                var forceVector  = new FemDesign.Geometry.FdVector3d(reaction.Fx, reaction.Fy, reaction.Fz);
                var momentVector = new FemDesign.Geometry.FdVector3d(reaction.Mx, reaction.My, reaction.Mz);

                reactionForceVector.Add(forceVector);
                reactionMomentVector.Add(momentVector);
            }


            return(new Dictionary <string, dynamic>
            {
                { "CaseIdentifier", loadCases },
                { "Identifier", identifier },
                { "ElementId", elementId },
                { "NodeId", nodeId },
                { "ReactionForce", reactionForceVector },
                { "ReactionMoment", reactionMomentVector },
                { "ForceResultant", forceResultant },
                { "MomentResultant", momentResultant }
            });
        }
Пример #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Brep     surface = null;
            Vector3d direction = Vector3d.Zero;
            LoadCase loadCase = null;
            double   z0 = 0, q0 = 0, qh = 0;
            string   comment = null;

            if (!DA.GetData(0, ref surface))
            {
                return;
            }
            if (!DA.GetData(1, ref direction))
            {
                return;
            }
            if (!DA.GetData(2, ref loadCase))
            {
                return;
            }
            if (!DA.GetData(3, ref z0))
            {
                return;
            }
            if (!DA.GetData(4, ref q0))
            {
                return;
            }
            if (!DA.GetData(5, ref qh))
            {
                return;
            }
            if (!DA.GetData(6, ref comment))
            {
                // pass
            }
            if (surface == null || loadCase == null)
            {
                return;
            }

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

            PressureLoad obj = new PressureLoad(region, loadDirection, z0, q0, qh, loadCase, comment, false, ForceLoadType.Force);

            // return
            DA.SetData(0, obj);
        }
Пример #5
0
        /// <summary>
        /// The method has been created for returning the value for Grasshopper and Dynamo.
        /// The method can still be use for C# users.
        /// </summary>
        public static Dictionary <string, object> DeconstructBarDisplacements(List <FemDesign.Results.BarDisplacement> Result, string LoadCase)
        {
            var barDisplacements = Result.Cast <FemDesign.Results.BarDisplacement>();

            // Return the unique load case - load combination
            var uniqueLoadCases = barDisplacements.Select(n => n.CaseIdentifier).Distinct().ToList();

            // Select the Nodal Displacement for the selected Load Case - Load Combination
            if (uniqueLoadCases.Contains(LoadCase, StringComparer.OrdinalIgnoreCase))
            {
                barDisplacements = barDisplacements.Where(n => String.Equals(n.CaseIdentifier, LoadCase, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                var warning = $"Load Case '{LoadCase}' does not exist";
                throw new ArgumentException(warning);
            }

            // Parse Results from the object
            var elementId     = barDisplacements.Select(n => n.Id).ToList();
            var loadCases     = barDisplacements.Select(n => n.CaseIdentifier).Distinct().ToList();
            var localPosition = barDisplacements.Select(n => n.Pos).ToList();

            // Create a Rhino Vector for Displacement and Rotation
            var translation = new List <FemDesign.Geometry.FdVector3d>();
            var rotation    = new List <FemDesign.Geometry.FdVector3d>();

            foreach (var nodeDisp in barDisplacements)
            {
                var transVector = new FemDesign.Geometry.FdVector3d(nodeDisp.Ex, nodeDisp.Ey, nodeDisp.Ez);
                translation.Add(transVector);

                var rotVector = new FemDesign.Geometry.FdVector3d(nodeDisp.Fix, nodeDisp.Fiy, nodeDisp.Fiz);
                rotation.Add(rotVector);
            }

            var CaseIdentifier = loadCases;
            var ElementId      = elementId;
            var PositionResult = localPosition;
            var Translation    = translation;
            var Rotation       = rotation;

            return(new Dictionary <string, dynamic>
            {
                { "CaseIdentifier", CaseIdentifier },
                { "ElementId", ElementId },
                { "PositionResult", PositionResult },
                { "Translation", Translation },
                { "Rotation", Rotation },
            });
        }
Пример #6
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);
        }
Пример #7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            string name = null;

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

            Rhino.Geometry.Point3d origo = Rhino.Geometry.Point3d.Origin;
            if (!DA.GetData(1, ref origo))
            {
                return;
            }

            Rhino.Geometry.Vector3d direction = Rhino.Geometry.Vector3d.XAxis;
            if (!DA.GetData(2, ref direction))
            {
                // pass
            }

            double dimX = 50;

            if (!DA.GetData(3, ref dimX))
            {
                // pass
            }

            double dimY = 30;

            if (!DA.GetData(4, ref dimY))
            {
                // pass
            }

            if (name == null)
            {
                return;
            }

            // convert geometry
            FemDesign.Geometry.FdPoint3d  p = origo.FromRhino();
            FemDesign.Geometry.FdVector3d v = direction.FromRhino();

            // return
            FemDesign.StructureGrid.Storey obj = new FemDesign.StructureGrid.Storey(p, v, dimX, dimY, name);
            DA.SetData(0, obj);
        }
Пример #8
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);
        }
Пример #9
0
        /// <summary>
        /// The method has been created for returning the value for Grasshopper and Dynamo.
        /// The method can still be use for C# users.
        /// </summary>
        public static Dictionary <string, object> DeconstructNodalVibration(List <FemDesign.Results.NodalVibration> Result, string ModeShapeId)
        {
            var nodalDisplacements = Result.Cast <FemDesign.Results.NodalVibration>();

            // Return the unique load cases - load combinations
            var uniqueShapeId = nodalDisplacements.Select(n => n.ShapeId.ToString()).Distinct().ToList();

            // Select the Nodal Displacement for the selected Load Case - Load Combination
            if (uniqueShapeId.Contains(ModeShapeId, StringComparer.OrdinalIgnoreCase))
            {
                nodalDisplacements = nodalDisplacements.Where(n => String.Equals(n.ShapeId.ToString(), ModeShapeId, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                var warning = $"Shape Mode '{ModeShapeId}' does not exist";
                throw new ArgumentException(warning);
            }

            // Parse Results from the object
            var identifier = nodalDisplacements.Select(n => n.Id).ToList();
            var nodeId     = nodalDisplacements.Select(n => n.NodeId).ToList();
            var shapeIds   = nodalDisplacements.Select(n => n.ShapeId).Distinct().ToList();

            // Create a Rhino Vector for Displacement and Rotation
            var translation = new List <FemDesign.Geometry.FdVector3d>();
            var rotation    = new List <FemDesign.Geometry.FdVector3d>();

            foreach (var nodeDisp in nodalDisplacements)
            {
                var transVector = new FemDesign.Geometry.FdVector3d(nodeDisp.Ex, nodeDisp.Ey, nodeDisp.Ez);
                translation.Add(transVector);

                var rotVector = new FemDesign.Geometry.FdVector3d(nodeDisp.Fix, nodeDisp.Fiy, nodeDisp.Fiz);
                rotation.Add(rotVector);
            }


            return(new Dictionary <string, dynamic>
            {
                { "ShapeId", shapeIds },
                { "Id", identifier },
                { "NodeId", nodeId },
                { "Translation", translation },
                { "Rotation", rotation },
            });
        }
Пример #10
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);
        }
        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);
        }
Пример #12
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);
        }
Пример #13
0
        /// <summary>
        /// The method has been created for returning the value for Grasshopper and Dynamo.
        /// The method can still be use for C# users.
        /// </summary>
        public static Dictionary <string, object> DeconstructPointSupportReaction(List <FemDesign.Results.PointSupportReaction> Result, string LoadCase)
        {
            var pointReactions = Result.Cast <FemDesign.Results.PointSupportReaction>();

            // Return the unique load case - load combination
            var uniqueLoadCases = pointReactions.Select(n => n.CaseIdentifier).Distinct().ToList();

            // Select the Nodal Reactions for the selected Load Case - Load Combination
            if (uniqueLoadCases.Contains(LoadCase, StringComparer.OrdinalIgnoreCase))
            {
                pointReactions = pointReactions.Where(n => String.Equals(n.CaseIdentifier, LoadCase, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                var warning = $"Load Case '{LoadCase}' does not exist";
                throw new ArgumentException(warning);
            }

            // Parse Results from the object
            var identifier      = pointReactions.Select(n => n.Id).ToList();
            var nodeId          = pointReactions.Select(n => n.NodeId).ToList();
            var loadCases       = pointReactions.Select(n => n.CaseIdentifier).Distinct().ToList();
            var forceResultant  = pointReactions.Select(n => n.Fr).ToList();
            var momentResultant = pointReactions.Select(n => n.Mr).ToList();

            // Create a Fd Vector/Point for Visualising the Reaction Forces
            var reactionForceVector  = new List <FemDesign.Geometry.FdVector3d>();
            var reactionMomentVector = new List <FemDesign.Geometry.FdVector3d>();

            var position = new List <FemDesign.Geometry.FdPoint3d>();

            foreach (var reaction in pointReactions)
            {
                var forceVector  = new FemDesign.Geometry.FdVector3d(reaction.Fx, reaction.Fy, reaction.Fz);
                var momentVector = new FemDesign.Geometry.FdVector3d(reaction.Mx, reaction.My, reaction.Mz);
                var pos          = new FemDesign.Geometry.FdPoint3d(reaction.X, reaction.Y, reaction.Z);

                reactionForceVector.Add(forceVector);
                reactionMomentVector.Add(momentVector);
                position.Add(pos);
            }

            var CaseIdentifier  = loadCases;
            var Identifier      = identifier;
            var NodeId          = nodeId;
            var Position        = position;
            var ReactionForce   = reactionForceVector;
            var ReactionMoment  = reactionMomentVector;
            var ForceResultant  = forceResultant;
            var MomentResultant = momentResultant;

            return(new Dictionary <string, dynamic>
            {
                { "CaseIdentifier", CaseIdentifier },
                { "Identifier", Identifier },
                { "NodeId", NodeId },
                { "Position", Position },
                { "ReactionForce", ReactionForce },
                { "ReactionMoment", ReactionMoment },
                { "ForceResultant", ForceResultant },
                { "MomentResultant", MomentResultant }
            });
        }