Пример #1
0
        public static Bar TrussLimitedCapacity(Autodesk.DesignScript.Geometry.Line line, Materials.Material material, Sections.Section section, double maxCompression, double maxTension, bool compressionPlasticity, bool tensionPlasticity, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, string identifier = "T")
        {
            // convert class
            Geometry.Edge edge = Geometry.Edge.FromDynamoLine(line);

            // create bar
            var type = BarType.Truss;
            Bar bar  = new Bar(edge, type, material, section, identifier);

            bar.MaxCompression        = maxCompression;
            bar.MaxTension            = maxTension;
            bar.CompressionPlasticity = compressionPlasticity;
            bar.TensionPlasticity     = tensionPlasticity;

            // set local y-axis
            if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                bar.BarPart.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY);
            }

            // else orient coordinate system to GCS
            else
            {
                if (orientLCS)
                {
                    bar.BarPart.OrientCoordinateSystemToGCS();
                }
            }

            // return
            return(bar);
        }
Пример #2
0
        public static Bar Column(Autodesk.DesignScript.Geometry.Line line, Materials.Material material, Sections.Section[] section, [DefaultArgument("Connectivity.Default()")] Connectivity[] connectivity, [DefaultArgument("Eccentricity.Default()")] Eccentricity[] eccentricity, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, string identifier = "C")
        {
            // convert class
            Geometry.Edge edge = Geometry.Edge.FromDynamoLine(line);

            // create bar
            var type = BarType.Column;
            Bar bar  = new Bar(edge, type, material, section, eccentricity, connectivity, identifier);

            // set local y-axis
            if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                bar.BarPart.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY);
            }

            // else orient coordinate system to GCS
            else
            {
                if (orientLCS)
                {
                    bar.BarPart.OrientCoordinateSystemToGCS();
                }
            }

            // return
            return(bar);
        }
Пример #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve                  curve                 = null;
            Motions                motions               = null;
            Rotations              rotations             = null;
            MotionsPlasticLimits   motionsPlasticLimit   = null;
            RotationsPlasticLimits rotationsPlasticLimit = null;
            bool movingLocal = false;

            if (!DA.GetData(0, ref curve))
            {
                return;
            }
            if (!DA.GetData(1, ref motions))
            {
                return;
            }
            if (!DA.GetData(2, ref rotations))
            {
                return;
            }
            DA.GetData(3, ref motionsPlasticLimit);
            DA.GetData(4, ref rotationsPlasticLimit);
            DA.GetData(5, ref movingLocal);
            Vector3d v = Vector3d.Zero;

            DA.GetData(6, ref v);

            bool orientLCS = true;

            DA.GetData(7, ref orientLCS);

            string identifier = "S";

            DA.GetData(8, ref identifier);

            if (curve == null || identifier == null)
            {
                return;
            }

            Geometry.Edge edge = Convert.FromRhinoLineOrArc1(curve);
            var           obj  = new Supports.LineSupport(edge, motions, motionsPlasticLimit, rotations, rotationsPlasticLimit, movingLocal, identifier);

            // Set local y-axis
            if (!v.Equals(Vector3d.Zero))
            {
                obj.Group.LocalY = v.FromRhino();
            }
            else // Orient coordinate system to GCS
            {
                if (orientLCS)
                {
                    obj.Group.OrientCoordinateSystemToGCS();
                }
            }

            DA.SetData(0, obj);
        }
Пример #4
0
        public static LineLoad Moment(Autodesk.DesignScript.Geometry.Curve curve, Autodesk.DesignScript.Geometry.Vector startForce, Autodesk.DesignScript.Geometry.Vector endForce, LoadCase loadCase, [DefaultArgument("true")] bool constLoadDir, string comment = "")
        {
            // convert geometry
            Geometry.Edge       edge        = Geometry.Edge.FromDynamoLineOrArc1(curve);
            Geometry.FdVector3d _startForce = Geometry.FdVector3d.FromDynamo(startForce);
            Geometry.FdVector3d _endForce   = Geometry.FdVector3d.FromDynamo(endForce);

            return(new LineLoad(edge, _startForce, _endForce, loadCase, ForceLoadType.Moment, comment, constLoadDir, loadProjection: false));
        }
Пример #5
0
        public static LineTemperatureLoad Define(Autodesk.DesignScript.Geometry.Curve curve, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,1)")] Autodesk.DesignScript.Geometry.Vector direction, List <TopBotLocationValue> topBottomLocationValues, LoadCase loadCase, string comments = "")
        {
            // convert geometry
            Geometry.Edge       edge = Geometry.Edge.FromDynamoLineOrArc1(curve);
            Geometry.FdVector3d v    = Geometry.FdVector3d.FromDynamo(direction);

            // return
            return(new LineTemperatureLoad(edge, v, topBottomLocationValues, loadCase, comments));
        }
Пример #6
0
 /// <summary>
 /// Construct a uniform or variable line stress load
 /// </summary>
 /// <param name="edge">Underlying edge of line load. Line or Arc.</param>
 /// <param name="direction">Direction of load.</param>
 /// <param name="topBotLocVal">List of 2 top bottom location values</param>
 public LineStressLoad(Geometry.Edge edge, Geometry.FdVector3d direction, List <TopBotLocationValue> topBotLocVals, LoadCase loadCase, string comment)
 {
     this.EntityCreated();
     this.Edge         = edge;
     this.Direction    = direction;
     this.TopBotLocVal = topBotLocVals;
     this.LoadCase     = loadCase.Guid;
     this.Comment      = comment;
 }
Пример #7
0
 public LineLoad(Geometry.Edge edge, Geometry.FdVector3d constantForce, LoadCase loadCase, ForceLoadType loadType, string comment = "", bool constLoadDir = true, bool loadProjection = false)
 {
     this.EntityCreated();
     this.LoadCase = loadCase.Guid;
     this.Comment  = comment;
     this.ConstantLoadDirection = constLoadDir;
     this.LoadProjection        = loadProjection;
     this.LoadType = loadType;
     this.Edge     = edge;
     this.Normal   = edge.CoordinateSystem.LocalZ; // Note that LineLoad normal and Edge normal are not necessarily the same.
     this.SetStartAndEndForces(constantForce, constantForce);
 }
Пример #8
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get data
            Curve crv = null;

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

            Vector3d dir = Vector3d.ZAxis;

            if (!DA.GetData(1, ref dir))
            {
                // pass
            }

            List <Loads.TopBotLocationValue> vals = new List <Loads.TopBotLocationValue>();

            if (!DA.GetDataList(2, vals))
            {
                return;
            }

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

            string comment = null;

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

            if (crv == null || vals == null || lc == null)
            {
                return;
            }

            // convert geometry
            Geometry.Edge       edge = crv.FromRhinoLineOrArc1();
            Geometry.FdVector3d v    = dir.FromRhino();

            // create obj
            Loads.LineTemperatureLoad obj = new Loads.LineTemperatureLoad(edge, v, vals, lc, comment);


            // return
            DA.SetData(0, obj);
        }
Пример #9
0
        /// <summary>
        /// Construct beam or column with non-uniform section and different start/end conditions
        /// </summary>
        /// <param name="edge"></param>
        /// <param name="type"></param>
        /// <param name="material"></param>
        /// <param name="sections">List of sections, 2 or more items.</param>
        /// <param name="positions">List of parametric (0-1) section positions, 2 or more items.</param>
        /// <param name="eccentricities">List of analytical eccentricities, 2 or more items.</param>
        /// <param name="startConnectivity">Start connectivity</param>
        /// <param name="endConnectivity">End connectivity</param>
        /// <param name="identifier">Identifier</param>
        public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section[] sections, double[] positions, Eccentricity[] eccentricities, Connectivity startConnectivity, Connectivity endConnectivity, string identifier)
        {
            if (type == BarType.Truss)
            {
                throw new System.Exception("Truss is not a valid type");
            }

            this.EntityCreated();
            this.Type       = type;
            this.Identifier = identifier;
            this.BarPart    = new BarPart(edge, this.Type, material, sections, positions, eccentricities, startConnectivity, endConnectivity, this.Identifier);
        }
Пример #10
0
 /// <summary>
 /// Create Dynamo Arc from Edge (Arc).
 /// </summary>
 public static Autodesk.DesignScript.Geometry.Arc ToDynamoArc(Geometry.Edge obj)
 {
     if (obj.Points.Count == 3)
     {
         return(Autodesk.DesignScript.Geometry.Arc.ByThreePoints(obj.Points[0].ToDynamo(), obj.Points[1].ToDynamo(), obj.Points[2].ToDynamo()));
     }
     else
     {
         Autodesk.DesignScript.Geometry.Point p0 = obj.Points[0].Translate(obj.XAxis.Scale(obj.Radius)).ToDynamo();
         return(Autodesk.DesignScript.Geometry.Arc.ByCenterPointStartPointSweepAngle(obj.Points[0].ToDynamo(), p0, Degree.FromRadians(obj.EndAngle - obj.StartAngle), obj.Normal.ToDynamo()));
     }
 }
Пример #11
0
        /// <summary>
        /// Construct a truss element. BarType must be specified as Truss.
        /// </summary>
        /// <param name="edge"></param>
        /// <param name="type"></param>
        /// <param name="material"></param>
        /// <param name="section"></param>
        /// <param name="identifier"></param>
        /// <exception cref="System.Exception"></exception>
        public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section section, string identifier)
        {
            if (type != BarType.Truss)
            {
                throw new System.Exception("Truss is not a valid type");
            }

            this.EntityCreated();
            this.Type       = type;
            this.Identifier = identifier;
            this.BarPart    = new BarPart(edge, this.Type, material, section, this.Identifier);
        }
Пример #12
0
 /// <summary>
 /// Internal constructor.
 /// </summary>
 public FictitiousBar(Geometry.Edge edge, Geometry.FdVector3d localY, Bars.Connectivity startConnectivity, Bars.Connectivity endConnectivity, string name, double ae, double itg, double i1e, double i2e)
 {
     this.EntityCreated();
     this.Edge              = edge;
     this.LocalY            = localY;
     this.StartConnectivity = startConnectivity;
     this.EndConnectivity   = endConnectivity;
     this.Name              = name;
     this.AE  = ae;
     this.ItG = itg;
     this.I1E = i1e;
     this.I2E = i2e;
 }
Пример #13
0
        public static LineLoad MomentUniform(Autodesk.DesignScript.Geometry.Curve curve, Autodesk.DesignScript.Geometry.Vector force, LoadCase loadCase, [DefaultArgument("true")] bool constLoadDir, string comment = "")
        {
            // convert geometry
            Geometry.Edge       edge        = Geometry.Edge.FromDynamoLineOrArc1(curve);
            Geometry.FdVector3d _startForce = Geometry.FdVector3d.FromDynamo(force);
            Geometry.FdVector3d _endForce   = _startForce;

            // check zero vector
            if (_startForce.IsZero())
            {
                throw new System.ArgumentException($"Force is zero.");
            }

            return(new LineLoad(edge, _startForce, _endForce, loadCase, ForceLoadType.Moment, comment, constLoadDir, loadProjection: false));
        }
Пример #14
0
        /// <summary>
        /// Create Rhino open ArcCurve from Edge(Arc).
        /// </summary>
        public static Rhino.Geometry.ArcCurve ToRhinoArcCurve(Geometry.Edge obj)
        {
            if (obj.Points.Count == 3)
            {
                Rhino.Geometry.Arc arc = new Rhino.Geometry.Arc(obj.Points[0].ToRhino(), obj.Points[1].ToRhino(), obj.Points[2].ToRhino());
                return(new Rhino.Geometry.ArcCurve(arc));
            }

            else
            {
                Rhino.Geometry.Interval interval = new Rhino.Geometry.Interval(obj.StartAngle, obj.EndAngle);
                Rhino.Geometry.Plane    plane    = new Rhino.Geometry.Plane(obj.Points[0].ToRhino(), obj.XAxis.ToRhino(), obj.Normal.Cross(obj.XAxis).Normalize().ToRhino());
                Rhino.Geometry.Circle   circle   = new Rhino.Geometry.Circle(plane, obj.Radius);
                Rhino.Geometry.Arc      arc      = new Rhino.Geometry.Arc(circle, interval);
                return(new Rhino.Geometry.ArcCurve(arc));
            }
        }
Пример #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ConnectedLines(Geometry.Edge firstEdge, Geometry.Edge secondEdge, Geometry.FdVector3d localX, Geometry.FdVector3d localY, Releases.RigidityDataType3 rigidity, GuidListType[] references, string identifier, bool movingLocal, double interfaceStart, double interfaceEnd)
 {
     this.EntityCreated();
     this.Edges = new Geometry.Edge[2]
     {
         firstEdge,
         secondEdge
     };
     this.LocalX         = localX;
     this.LocalY         = localY;
     this.Rigidity       = rigidity;
     this.References     = references;
     this.Identifier     = identifier;
     this.MovingLocal    = movingLocal;
     this.InterfaceStart = interfaceStart;
     this.InterfaceEnd   = interfaceEnd;
 }
Пример #16
0
        /// <summary>
        /// Create a fictitious bar element.
        /// </summary>
        /// <param name="curve">Line or Arc.</param>
        /// <param name="AE">AE</param>
        /// <param name="ItG">ItG</param>
        /// <param name="I1E">I1E</param>
        /// <param name="I2E">I2E</param>
        /// <param name="connectivity">Connectivity. If 1 item this item defines both start and end connectivity. If two items the first item defines the start connectivity and the last item defines the end connectivity.</param>
        /// <param name="localY">Set local y-axis. Vector must be perpendicular to Curve mid-point local x-axis. This parameter overrides OrientLCS</param>
        /// <param name="orientLCS">Orient LCS to GCS? If true the LCS of this object will be oriented to the GCS trying to align local z to global z if possible or align local y to global y if possible (if object is vertical). If false local y-axis from Curve coordinate system at mid-point will be used.</param>
        /// <param name="identifier">Identifier. Optional.</param>
        /// <returns></returns>
        public static FictitiousBar Define(Autodesk.DesignScript.Geometry.Curve curve, [DefaultArgument("10000000")] double AE, [DefaultArgument("10000000")] double ItG, [DefaultArgument("10000000")] double I1E, [DefaultArgument("10000000")] double I2E, [DefaultArgument("FemDesign.Bars.Connectivity.Default()")] List <Bars.Connectivity> connectivity, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, string identifier = "BF")
        {
            // convert geometry
            Geometry.Edge       edge = Geometry.Edge.FromDynamoLineOrArc2(curve);
            Geometry.FdVector3d y    = Geometry.FdVector3d.FromDynamo(localY);

            // get connectivity
            Bars.Connectivity startConnectivity;
            Bars.Connectivity endConnectivity;
            if (connectivity.Count == 1)
            {
                startConnectivity = connectivity[0];
                endConnectivity   = connectivity[0];
            }
            else if (connectivity.Count == 2)
            {
                startConnectivity = connectivity[0];
                endConnectivity   = connectivity[1];
            }
            else
            {
                throw new System.ArgumentException($"Connectivity must contain 1 or 2 items. Number of items is {connectivity.Count}");
            }

            // create virtual bar
            FictitiousBar bar = new FictitiousBar(edge, edge.CoordinateSystem.LocalY, startConnectivity, endConnectivity, identifier, AE, ItG, I1E, I2E);

            // set local y-axis
            if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                bar.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY);
            }

            // else orient coordinate system to GCS
            else
            {
                if (orientLCS)
                {
                    bar.OrientCoordinateSystemToGCS();
                }
            }

            // return
            return(bar);
        }
Пример #17
0
        public static ConnectedLines Define(Autodesk.DesignScript.Geometry.Curve firstCurve, Autodesk.DesignScript.Geometry.Curve secondCurve, Autodesk.DesignScript.Geometry.Vector localX, Autodesk.DesignScript.Geometry.Vector localY, Releases.Motions motions, Releases.Rotations rotations, System.Guid[] references, string identifier, bool movingLocal, double interfaceStart, double interfaceEnd)
        {
            // convert geometry
            Geometry.Edge       edge0 = Geometry.Edge.FromDynamoLineOrArc2(firstCurve);
            Geometry.Edge       edge1 = Geometry.Edge.FromDynamoLineOrArc2(secondCurve);
            Geometry.FdVector3d x     = Geometry.FdVector3d.FromDynamo(localX);
            Geometry.FdVector3d y     = Geometry.FdVector3d.FromDynamo(localY);

            // rigidity
            Releases.RigidityDataType3 rigidity = new Releases.RigidityDataType3(motions, rotations);

            // references
            GuidListType[] refs = new GuidListType[references.Length];
            for (int idx = 0; idx < refs.Length; idx++)
            {
                refs[idx] = new GuidListType(references[idx]);
            }

            return(new ConnectedLines(edge0, edge1, x, y, rigidity, refs, identifier, movingLocal, interfaceStart, interfaceEnd));
        }
Пример #18
0
        /// <summary>
        /// Construct beam or column with uniform section and uniform start/end conditions
        /// </summary>
        /// <param name="edge"></param>
        /// <param name="type"></param>
        /// <param name="material"></param>
        /// <param name="section">Section, same at start/end</param>
        /// <param name="eccentricity">Analytical eccentricity, same at start. Eccentricity set to 0,0 if null/end</param>
        /// <param name="connectivity">Connectivity, same at start/end. Connectivity set to Rigid if null</param>
        /// <param name="identifier">Identifier</param>
        public Bar(Geometry.Edge edge, BarType type, Materials.Material material, Sections.Section section, Eccentricity eccentricity = null, Connectivity connectivity = null, string identifier = "B")
        {
            if (type == BarType.Truss)
            {
                throw new System.Exception("Truss is not a valid type");
            }

            this.EntityCreated();
            this.Type       = type;
            this.Identifier = identifier;

            if (eccentricity == null)
            {
                eccentricity = Eccentricity.GetDefault();
            }
            if (connectivity == null)
            {
                connectivity = Connectivity.GetDefault();
            }
            this.BarPart = new BarPart(edge, this.Type, material, section, eccentricity, connectivity, this.Identifier);
        }
Пример #19
0
        public static LineSupport Define(Autodesk.DesignScript.Geometry.Curve curve, Motions motions, [DefaultArgument("MotionsPlasticLimits.Default()")] MotionsPlasticLimits motionsPlasticLimits, Rotations rotations, [DefaultArgument("RotationsPlasticLimits.Default()")] RotationsPlasticLimits rotationsPlasticLimits, [DefaultArgument("false")] bool movingLocal, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("true")] bool orientLCS, [DefaultArgument("S")] string identifier)
        {
            Geometry.Edge edge = Geometry.Edge.FromDynamoLineOrArc1(curve);
            FemDesign.Supports.LineSupport obj = new LineSupport(edge, motions, motionsPlasticLimits, rotations, rotationsPlasticLimits, movingLocal, identifier);

            // set local y-axis
            if (!localY.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                obj.Group.LocalY = FemDesign.Geometry.FdVector3d.FromDynamo(localY);
            }

            // else orient coordinate system to GCS
            else
            {
                if (orientLCS)
                {
                    obj.Group.OrientCoordinateSystemToGCS();
                }
            }

            return(obj);
        }
Пример #20
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            Curve curve = null;

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

            double stiffness = 1E7;
            double ae        = stiffness;

            if (!DA.GetData(1, ref ae))
            {
                // pass
            }

            double itg = stiffness;

            if (!DA.GetData(2, ref itg))
            {
                // pass
            }

            double i1e = stiffness;

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

            double i2e = stiffness;

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

            Bars.Connectivity        startConnectivity = Bars.Connectivity.GetDefault();
            Bars.Connectivity        endConnectivity   = Bars.Connectivity.GetDefault();
            List <Bars.Connectivity> connectivity      = new List <Bars.Connectivity>();

            if (!DA.GetDataList(5, connectivity))
            {
                // pass
            }
            else
            {
                if (connectivity.Count == 1)
                {
                    startConnectivity = connectivity[0];
                    endConnectivity   = connectivity[0];
                }
                else if (connectivity.Count == 2)
                {
                    startConnectivity = connectivity[0];
                    endConnectivity   = connectivity[1];
                }
                else
                {
                    throw new System.ArgumentException($"Connectivity must contain 1 or 2 items. Number of items is {connectivity.Count}");
                }
            }

            Vector3d v = Vector3d.Zero;

            if (!DA.GetData(6, ref v))
            {
                // pass
            }

            bool orientLCS = true;

            if (!DA.GetData(7, ref orientLCS))
            {
                // pass
            }

            string name = "BF";

            if (!DA.GetData(8, ref name))
            {
                // pass
            }

            if (curve == null || startConnectivity == null || endConnectivity == null || v == null || name == null)
            {
                return;
            }

            // convert geometry
            Geometry.Edge edge = curve.FromRhinoLineOrArc2();

            // create virtual bar
            ModellingTools.FictitiousBar bar = new ModellingTools.FictitiousBar(edge, edge.CoordinateSystem.LocalY, startConnectivity, endConnectivity, name, ae, itg, i1e, i2e);

            // set local y-axis
            if (!v.Equals(Vector3d.Zero))
            {
                bar.LocalY = v.FromRhino();
            }

            // else orient coordinate system to GCS
            else
            {
                if (orientLCS)
                {
                    bar.OrientCoordinateSystemToGCS();
                }
            }

            // output
            DA.SetData(0, bar);
        }
Пример #21
0
 /// <summary>
 /// Create Dynamo Line from Edge (Line).
 /// </summary>
 public static Autodesk.DesignScript.Geometry.Line ToDynamoLine(Geometry.Edge obj)
 {
     return(Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(obj.Points[0].ToDynamo(), obj.Points[1].ToDynamo()));
 }
Пример #22
0
 /// <summary>
 /// Create Dynamo Circle from Edge (Circle).
 /// </summary>
 public static Autodesk.DesignScript.Geometry.Circle ToDynamoCircle(Geometry.Edge obj)
 {
     return(Autodesk.DesignScript.Geometry.Circle.ByCenterPointRadiusNormal(obj.Points[0].ToDynamo(), obj.Radius, obj.Normal.ToDynamo()));
 }
Пример #23
0
 /// <summary>
 /// Create Rhino closed ArcCurve from Edge(Circle).
 /// </summary>
 public static Rhino.Geometry.ArcCurve ToRhinoArcCurveFromCircle(Geometry.Edge obj)
 {
     Rhino.Geometry.Plane  plane  = new Rhino.Geometry.Plane(obj.Points[0].ToRhino(), obj.Normal.ToRhino());
     Rhino.Geometry.Circle circle = new Rhino.Geometry.Circle(plane, obj.Radius);
     return(new Rhino.Geometry.ArcCurve(circle));
 }
Пример #24
0
 /// <summary>
 /// Create Rhino LineCurve from Edge(Line).
 /// </summary>
 public static Rhino.Geometry.LineCurve ToRhinoLineCurve(Geometry.Edge obj)
 {
     return(new Rhino.Geometry.LineCurve(obj.Points[0].ToRhino(), obj.Points[1].ToRhino()));
 }
Пример #25
0
        static void Main()
        {
            // EXAMPLE 1: CREATING A SIMPLE BEAM
            // This example will show you how to model a simple supported beam,
            // and how to save it for export to FEM-Design.Before running,
            // make sure you have a window with FEM-Design open.

            // This example was last updated 2022-04-27, using the ver. 21.1.0 FEM-Design API.


            // Define geometry
            var p1  = new Geometry.FdPoint3d(2.0, 2.0, 0);
            var p2  = new Geometry.FdPoint3d(10, 2.0, 0);
            var mid = p1 + (p2 - p1) * 0.5;

            // Create elements
            var edge = new Geometry.Edge(p1, p2, Geometry.FdVector3d.UnitZ());

            Materials.MaterialDatabase materialsDB = Materials.MaterialDatabase.DeserializeStruxml("materials.struxml");
            Sections.SectionDatabase   sectionsDB  = Sections.SectionDatabase.DeserializeStruxml("sections.struxml");

            var material = materialsDB.MaterialByName("C35/45");
            var section  = sectionsDB.SectionByName("Concrete sections, Rectangle, 300x900");

            var bar = new Bars.Bar(
                edge,
                Bars.BarType.Beam,
                material,
                sections: new Sections.Section[] { section },
                connectivities: new Bars.Connectivity[] { Bars.Connectivity.GetRigid() },
                eccentricities: new Bars.Eccentricity[] { Bars.Eccentricity.GetDefault() },
                identifier: "B");

            bar.BarPart.LocalY = Geometry.FdVector3d.UnitY();
            var elements = new List <GenericClasses.IStructureElement>()
            {
                bar
            };


            // Create supports
            var s1 = new Supports.PointSupport(
                point: p1,
                motions: Releases.Motions.RigidPoint(),
                rotations: Releases.Rotations.Free()
                );

            var s2 = new Supports.PointSupport(
                point: p2,
                motions: new Releases.Motions(yNeg: 1e10, yPos: 1e10, zNeg: 1e10, zPos: 1e10),
                rotations: Releases.Rotations.Free()
                );
            var supports = new List <GenericClasses.ISupportElement>()
            {
                s1, s2
            };


            // Create load cases
            var deadload  = new Loads.LoadCase("Deadload", Loads.LoadCaseType.DeadLoad, Loads.LoadCaseDuration.Permanent);
            var liveload  = new Loads.LoadCase("Liveload", Loads.LoadCaseType.Static, Loads.LoadCaseDuration.Permanent);
            var loadcases = new List <Loads.LoadCase>()
            {
                deadload, liveload
            };


            // Create load combinations
            var slsFactors = new List <double>()
            {
                1.0, 1.0
            };
            var SLS        = new Loads.LoadCombination("SLS", Loads.LoadCombType.ServiceabilityCharacteristic, loadcases, slsFactors);
            var ulsFactors = new List <double>()
            {
                1.35, 1.5
            };
            var ULS = new Loads.LoadCombination("ULS", Loads.LoadCombType.UltimateOrdinary, loadcases, ulsFactors);
            var loadCombinations = new List <Loads.LoadCombination>()
            {
                SLS, ULS
            };


            // Create loads
            var pointForce  = new Loads.PointLoad(mid, new Geometry.FdVector3d(0.0, 0.0, -5.0), liveload, null, Loads.ForceLoadType.Force);
            var pointMoment = new Loads.PointLoad(p2, new Geometry.FdVector3d(0.0, 5.0, 0.0), liveload, null, Loads.ForceLoadType.Moment);

            var lineLoadStart = new Geometry.FdVector3d(0.0, 0.0, -2.0);
            var lineLoadEnd   = new Geometry.FdVector3d(0.0, 0.0, -4.0);
            var lineLoad      = new Loads.LineLoad(edge, lineLoadStart, lineLoadEnd, liveload, Loads.ForceLoadType.Force, "", constLoadDir: true, loadProjection: true);

            var loads = new List <GenericClasses.ILoadElement>()
            {
                pointForce,
                pointMoment,
                lineLoad
            };


            // Add to model
            Model model = new Model(Country.S);

            model.AddElements(elements);
            model.AddSupports(supports);
            model.AddLoadCases(loadcases);
            model.AddLoadCombinations(loadCombinations);
            model.AddLoads(loads);


            // Save model then open in FEM-Design
            string path = System.IO.Path.GetFullPath("simple_model.struxml");

            model.SerializeModel(path);

            var app = new Calculate.Application();

            app.OpenStruxml(path, true);
        }
Пример #26
0
        public static Bar Modify(Bar bar, [DefaultArgument("false")] bool newGuid, [DefaultArgument("null")] Autodesk.DesignScript.Geometry.Curve curve, [DefaultArgument("null")] Materials.Material material, [DefaultArgument("null")] Sections.Section[] section, [DefaultArgument("null")] Connectivity[] connectivity, [DefaultArgument("null")] Eccentricity[] eccentricity, [DefaultArgument("null")] Autodesk.DesignScript.Geometry.Vector localY, [DefaultArgument("false")] bool orientLCS, [DefaultArgument("null")] string identifier)
        {
            if (bar.BarPart.HasComplexCompositeRef || bar.BarPart.HasDeltaBeamComplexSectionRef)
            {
                throw new System.Exception("Composite Section in the model.The object has not been implemented yet. Please, get in touch if needed.");
            }
            else
            {
                bar = bar.DeepClone();

                if (newGuid)
                {
                    bar.EntityCreated();
                    bar.BarPart.EntityCreated();
                }

                if (curve != null)
                {
                    // convert geometry
                    Geometry.Edge edge = Geometry.Edge.FromDynamoLineOrArc2(curve);

                    // update edge
                    bar.BarPart.Edge = edge;
                }

                if (material != null)
                {
                    bar.BarPart.ComplexMaterialObj = material;
                }

                if (section != null)
                {
                    bar.BarPart.ComplexSectionObj.Sections = section;
                }

                if (connectivity != null)
                {
                    bar.BarPart.Connectivity = connectivity;
                }

                if (eccentricity != null)
                {
                    bar.BarPart.ComplexSectionObj.Eccentricities = eccentricity;
                }

                if (localY != null)
                {
                    bar.BarPart.LocalY = Geometry.FdVector3d.FromDynamo(localY);
                }

                if (orientLCS)
                {
                    bar.BarPart.OrientCoordinateSystemToGCS();
                }

                if (identifier != null)
                {
                    bar.Identifier         = identifier;
                    bar.BarPart.Identifier = bar.Identifier;
                }

                return(bar);
            }
        }
Пример #27
0
        static void Main()
        {
            // EXAMPLE 9: READ RESULTS
            // This example will show you how to model a simple supported beam,
            // and read some of the results.

            // This example was last updated 2022-07-01, using the ver. 21.2.0 FEM-Design API.

            #region DEFINE GEOMETRY
            // Define geometry
            var p1  = new Geometry.FdPoint3d(2.0, 2.0, 0);
            var p2  = new Geometry.FdPoint3d(10, 2.0, 0);
            var mid = p1 + (p2 - p1) * 0.5;


            // Create elements
            var edge = new Geometry.Edge(p1, p2, Geometry.FdVector3d.UnitZ());
            Materials.MaterialDatabase materialsDB = Materials.MaterialDatabase.DeserializeStruxml("materials.struxml");
            Sections.SectionDatabase   sectionsDB  = Sections.SectionDatabase.DeserializeStruxml("sections.struxml");

            var material = materialsDB.MaterialByName("C35/45");
            var section  = sectionsDB.SectionByName("Concrete sections, Rectangle, 300x900");

            var bar = new Bars.Bar(
                edge,
                Bars.BarType.Beam,
                material,
                sections: new Sections.Section[] { section },
                connectivities: new Bars.Connectivity[] { Bars.Connectivity.GetRigid() },
                eccentricities: new Bars.Eccentricity[] { Bars.Eccentricity.GetDefault() },
                identifier: "B");
            bar.BarPart.LocalY = Geometry.FdVector3d.UnitY();
            var elements = new List <GenericClasses.IStructureElement>()
            {
                bar
            };
            #endregion

            #region DEFINE SUPPORTS
            // Create supports
            var s1 = new Supports.PointSupport(
                point: p1,
                motions: Releases.Motions.RigidPoint(),
                rotations: Releases.Rotations.Free()
                );

            var s2 = new Supports.PointSupport(
                point: p2,
                motions: new Releases.Motions(yNeg: 1e10, yPos: 1e10, zNeg: 1e10, zPos: 1e10),
                rotations: Releases.Rotations.Free()
                );
            var supports = new List <GenericClasses.ISupportElement>()
            {
                s1, s2
            };
            #endregion

            #region DEFINE LOAD CASES/COMBINATIONS
            // Create load cases
            var deadload  = new Loads.LoadCase("Deadload", Loads.LoadCaseType.DeadLoad, Loads.LoadCaseDuration.Permanent);
            var liveload  = new Loads.LoadCase("Liveload", Loads.LoadCaseType.Static, Loads.LoadCaseDuration.Permanent);
            var loadcases = new List <Loads.LoadCase>()
            {
                deadload, liveload
            };


            // Create load combinations
            var slsFactors = new List <double>()
            {
                1.0, 1.0
            };
            var SLS        = new Loads.LoadCombination("SLS", Loads.LoadCombType.ServiceabilityCharacteristic, loadcases, slsFactors);
            var ulsFactors = new List <double>()
            {
                1.35, 1.5
            };
            var ULS = new Loads.LoadCombination("ULS", Loads.LoadCombType.UltimateOrdinary, loadcases, ulsFactors);
            var loadCombinations = new List <Loads.LoadCombination>()
            {
                SLS, ULS
            };


            // Create loads
            var pointForce  = new Loads.PointLoad(mid, new Geometry.FdVector3d(0.0, 0.0, -5.0), liveload, null, Loads.ForceLoadType.Force);
            var pointMoment = new Loads.PointLoad(p2, new Geometry.FdVector3d(0.0, 5.0, 0.0), liveload, null, Loads.ForceLoadType.Moment);

            var lineLoadStart = new Geometry.FdVector3d(0.0, 0.0, -2.0);
            var lineLoadEnd   = new Geometry.FdVector3d(0.0, 0.0, -4.0);
            var lineLoad      = new Loads.LineLoad(edge, lineLoadStart, lineLoadEnd, liveload, Loads.ForceLoadType.Force, "", constLoadDir: true, loadProjection: true);

            var loads = new List <GenericClasses.ILoadElement>()
            {
                pointForce,
                pointMoment,
                lineLoad
            };
            #endregion

            #region ASSEMBLE
            // Add to model
            Model model = new Model(Country.S);
            model.AddElements(elements);
            model.AddSupports(supports);
            model.AddLoadCases(loadcases);
            model.AddLoadCombinations(loadCombinations);
            model.AddLoads(loads);
            #endregion

            #region SETTINGS

            // define the file name
            string fileName = "SimpleBeam.struxml";
            fileName = Path.GetFullPath(fileName);

            // Define the Units
            // it is an optional operation and it can be omitted
            // Default Units can be seen looking at FemDesign.Results.UnitResults.Default()

            var units = new FemDesign.Results.UnitResults(Results.Length.m, Results.Angle.deg, Results.SectionalData.mm, Results.Force.daN, Results.Mass.kg, Results.Displacement.cm, Results.Stress.MPa);

            // Select the results to extract
            var resultTypes = new List <Results.ResultType>
            {
                Results.ResultType.PointSupportReaction,
                Results.ResultType.NodalDisplacement
            };

            var bscPathsFromResultTypes = Calculate.Bsc.BscPathFromResultTypes(resultTypes, fileName, units);
            #endregion

            #region ANALYSIS
            // Running the analysis
            FemDesign.Calculate.Analysis analysisSettings = new FemDesign.Calculate.Analysis(null, null, null, null, calcCase: true, false, false, calcComb: true, false, false, false, false, false, false, false, false, false);

            var fdScript = FemDesign.Calculate.FdScript.Analysis(fileName, analysisSettings, bscPathsFromResultTypes, null, true);


            var app = new FemDesign.Calculate.Application();
            app.RunFdScript(fdScript, false, true);
            model.SerializeModel(fileName);

            // Read model and results
            model = Model.DeserializeFromFilePath(fdScript.StruxmlPath);
            #endregion

            #region EXTRACT RESULTS

            IEnumerable <Results.IResult> results = Enumerable.Empty <Results.IResult>();

            foreach (var cmd in fdScript.CmdListGen)
            {
                string path     = cmd.OutFile;
                var    _results = Results.ResultsReader.Parse(path);
                results = results.Concat(_results);
            }
            #endregion

            #region DO SOMETHING WITH RESULTS
            // Display Results on Screen
            // The results are grouped by their type
            var resultGroups = results.GroupBy(t => t.GetType()).ToList();
            foreach (var resultGroup in resultGroups)
            {
                Console.WriteLine(resultGroup.Key.Name);
                Console.WriteLine();
                foreach (var result in resultGroup)
                {
                    Console.WriteLine(result);
                }
                Console.WriteLine();
                Console.WriteLine();
            }


            // Select a specific result
            Console.WriteLine("Vertical Reaction Forces");
            var zReactions = results.Where(t => t.GetType() == typeof(Results.PointSupportReaction)).Cast <Results.PointSupportReaction>();
            foreach (var zReaction in zReactions)
            {
                Console.WriteLine($"Node {zReaction.Id}: {zReaction.Fz} {units.Force}");
            }
            #endregion

            // ENDING THE PROGRAM
            Console.WriteLine("\nPress any key to close console.");
            Console.ReadKey();
        }
Пример #28
0
        static void Main()
        {
            // PRACTICAL EXAMPLE: CREATE POST-TENSIONED CABLES
            // This example will show you how to add post-tensioned cables to your concrete beam.

            // This example was last updated 2022-05-03, using the ver. 21.1.0 FEM-Design API.


            // DEFINE GEOMETRY
            var p1   = new Geometry.FdPoint3d(0.0, 2.0, 0);
            var p2   = new Geometry.FdPoint3d(10, 2.0, 0);
            var edge = new Geometry.Edge(p1, p2, Geometry.FdVector3d.UnitY());

            // CREATE BEAM
            Materials.MaterialDatabase materialsDB = Materials.MaterialDatabase.DeserializeStruxml("materials.struxml");
            Sections.SectionDatabase   sectionsDB  = Sections.SectionDatabase.DeserializeStruxml("sections.struxml");

            var material = materialsDB.MaterialByName("C35/45");
            var section  = sectionsDB.SectionByName("Concrete sections, Rectangle, 300x900");

            var bar = new Bars.Bar(
                edge,
                Bars.BarType.Beam,
                material,
                sections: new Sections.Section[] { section },
                connectivities: new Bars.Connectivity[] { Bars.Connectivity.GetRigid() },
                eccentricities: new Bars.Eccentricity[] { Bars.Eccentricity.GetDefault() },
                identifier: "B");


            // CREATE POST-TENSIONED CABLE
            var shape = new Reinforcement.PtcShapeType(
                start: new Reinforcement.PtcShapeStart(0.0, 0.0),
                intermediates: new List <Reinforcement.PtcShapeInner>()
            {
                new Reinforcement.PtcShapeInner(0.4, -0.20, 0.0, 0.1),
                new Reinforcement.PtcShapeInner(0.6, -0.20, 0.0),
            },
                end: new Reinforcement.PtcShapeEnd(0.0, 0.0, 0.9)
                );

            var losses = new Reinforcement.PtcLosses(
                curvatureCoefficient: 0.05,
                wobbleCoefficient: 0.007,
                anchorageSetSlip: 0.0,
                elasticShortening: 0.0,
                creepStress: 0.0,
                shrinkageStress: 0.0,
                relaxationStress: 0.0);

            var manufacturing = new Reinforcement.PtcManufacturingType(
                positions: new List <double>()
            {
                0.3, 0.7
            },
                shiftX: 0.0,
                shiftZ: 0.1);

            var strandData = new Reinforcement.PtcStrandLibType(
                name: "Custom ptc material",
                f_pk: 1860.0,
                a_p: 150.0,
                e_p: 195000.0,
                rho: 7.810,
                relaxationClass: 2,
                rho_1000: 0.1);

            var ptc = new Reinforcement.Ptc(
                bar,
                shape,
                losses,
                manufacturing,
                strandData,
                jackingSide: Reinforcement.JackingSide.Start,
                jackingStress: 1000.0,
                numberOfStrands: 3,
                identifier: "PTC");

            var elements = new List <GenericClasses.IStructureElement>()
            {
                bar,
                ptc
            };


            // CREATE AND OPEN MODEL
            Model  model = new Model(Country.S, elements);
            string path  = "output/post_tensioned_cable.struxml";

            if (!Directory.Exists("output"))
            {
                Directory.CreateDirectory("output");
            }
            model.SerializeModel(path);

            var app = new Calculate.Application();

            app.OpenStruxml(Path.GetFullPath(path), false);
        }
Пример #29
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve curve = null;

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

            Vector3d startForce = Vector3d.Zero;

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

            Vector3d endForce = Vector3d.Zero;

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

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

            bool constLoadDir = true;

            DA.GetData("ConstLoadDir", ref constLoadDir);

            bool loadProjection = true;

            DA.GetData("LoadProjection", ref loadProjection);

            string comment = null;

            DA.GetData("Comment", ref comment);

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

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

            try
            {
                var obj = new Loads.LineLoad(edge, _startForce, _endForce, loadCase, Loads.ForceLoadType.Force, comment, constLoadDir, loadProjection);
                DA.SetData("LineLoad", obj);
            }
            catch (ArgumentException e)
            {
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, e.Message);
            }
        }