Esempio n. 1
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> DeconstructFeaNode(List <FemDesign.Results.FeaNode> Result)
        {
            var feaNodes = Result.Cast <FemDesign.Results.FeaNode>();


            // Parse Results from the object
            var nodeId = feaNodes.Select(n => n.NodeId).ToList();


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

            foreach (var node in feaNodes)
            {
                var pos = new FemDesign.Geometry.FdPoint3d(node.X, node.Y, node.Z);
                feaNodePoint.Add(pos);
            }


            return(new Dictionary <string, dynamic>
            {
                { "NodeId", nodeId },
                { "Position", feaNodePoint },
            });
        }
Esempio n. 2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Point3d point = Point3d.Origin;
            double  val   = 0;

            if (!DA.GetData(0, ref point))
            {
                return;
            }
            if (!DA.GetData(1, ref val))
            {
                return;
            }
            if (point == null)
            {
                return;
            }

            //  transform geometry
            FemDesign.Geometry.FdPoint3d fdPoint = point.FromRhino();

            //
            FemDesign.Loads.LoadLocationValue obj = new FemDesign.Loads.LoadLocationValue(fdPoint, val);

            // return
            DA.SetData(0, obj);
        }
Esempio n. 3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //
            Point3d point = Point3d.Origin;

            if (!DA.GetData(0, ref point))
            {
                return;
            }
            string identifier = "S";

            if (!DA.GetData(1, ref identifier))
            {
                // pass
            }
            if (point == null || identifier == null)
            {
                return;
            }

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

            var obj = FemDesign.Supports.PointSupport.Hinged(fdPoint, identifier);

            // return
            DA.SetData(0, obj);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Rhino.Geometry.Curve line = null;
            if (!DA.GetData(0, ref line))
            {
                return;
            }
            string prefix = "";

            if (!DA.GetData(1, ref prefix))
            {
                // pass
            }
            int id = 0;

            if (!DA.GetData(2, ref id))
            {
                return;
            }
            bool idIsLetter = false;

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

            // test nullable input
            if (prefix == null)
            {
                return;
            }

            // convert geometry
            if (line.GetType() != typeof(Rhino.Geometry.LineCurve))
            {
                throw new System.ArgumentException("Curve must be a LineCurve");
            }
            FemDesign.Geometry.FdPoint3d p0 = Convert.FromRhino(line.PointAtStart);
            FemDesign.Geometry.FdPoint3d p1 = Convert.FromRhino(line.PointAtEnd);

            //
            FemDesign.StructureGrid.Axis obj = new StructureGrid.Axis(p0, p1, prefix, id, idIsLetter);
            DA.SetData(0, obj);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //
            Point3d point = Point3d.Origin;
            double  val   = 0;

            if (!DA.GetData(0, ref point))
            {
                return;
            }
            if (!DA.GetData(1, ref val))
            {
                return;
            }

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

            //
            FemDesign.Shells.Thickness obj = new FemDesign.Shells.Thickness(fdPoint, val);

            // return
            DA.SetData(0, obj);
        }
Esempio n. 8
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 }
            });
        }