コード例 #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //
            Curve curve       = null;
            bool  movingLocal = false;

            if (!DA.GetData(0, ref curve))
            {
                return;
            }
            if (!DA.GetData(1, ref movingLocal))
            {
                // pass
            }
            Vector3d v = Vector3d.Zero;

            if (!DA.GetData(2, ref v))
            {
                // pass
            }
            bool orientLCS = true;

            if (!DA.GetData(3, ref orientLCS))
            {
                // pass
            }
            string identifier = "S";

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

            // convert geometry
            FemDesign.Geometry.Edge edge = Convert.FromRhinoLineOrArc1(curve);

            var obj = FemDesign.Supports.LineSupport.Hinged(edge, movingLocal, identifier);

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

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

            // 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
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input

            Curve curve = null;

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

            FemDesign.Materials.Material material = null;
            if (!DA.GetData(1, ref material))
            {
                material = FemDesign.Materials.MaterialDatabase.GetDefault().MaterialByName("C30/37");
            }

            FemDesign.Sections.Section section = null;
            if (!DA.GetData(2, ref section))
            {
                section = FemDesign.Sections.SectionDatabase.GetDefault().SectionByName("Concrete sections, Rectangle, 250x600");
            }

            Vector3d v = Vector3d.Zero;

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

            bool orientLCS = true;

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

            string identifier = "T";

            if (!DA.GetData(5, ref identifier))
            {
                // pass
            }

            // convert geometry
            if (curve.GetType() != typeof(LineCurve))
            {
                throw new System.ArgumentException("Curve must be a LineCurve");
            }
            FemDesign.Geometry.Edge edge = Convert.FromRhinoLineCurve((LineCurve)curve);

            // bar
            var type = FemDesign.Bars.BarType.Truss;

            FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, identifier);

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

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

            // return
            DA.SetData(0, bar);
        }
コード例 #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            Bars.Bar bar = null;
            if (DA.GetData(0, ref bar))
            {
                if (bar.BarPart.HasComplexCompositeRef || bar.BarPart.HasDeltaBeamComplexSectionRef)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The bar has a Composite Section. The object has not been implemented yet. Please, get in touch if needed.");
                    return;
                }

                bar = bar.DeepClone();
            }

            bool newGuid = false;

            if (DA.GetData(1, ref newGuid))
            {
                if (newGuid)
                {
                    bar.EntityCreated();
                    bar.BarPart.EntityCreated();
                }
            }

            Curve curve = null;

            if (DA.GetData(2, ref curve))
            {
                // convert geometry
                FemDesign.Geometry.Edge edge = Convert.FromRhinoLineOrArc2(curve);

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

            FemDesign.Materials.Material material = null;
            if (DA.GetData(3, ref material))
            {
                bar.BarPart.ComplexMaterialObj = material;
            }

            List <FemDesign.Sections.Section> sections = new List <Sections.Section>();

            if (DA.GetDataList(4, sections))
            {
                bar.BarPart.ComplexSectionObj.Sections = sections.ToArray();
            }

            List <FemDesign.Bars.Connectivity> connectivities = new List <Bars.Connectivity>();

            if (DA.GetDataList(5, connectivities))
            {
                bar.BarPart.Connectivity = connectivities.ToArray();
            }

            List <FemDesign.Bars.Eccentricity> eccentricities = new List <Bars.Eccentricity>();

            if (DA.GetDataList(6, eccentricities))
            {
                if (bar.Type != Bars.BarType.Truss)
                {
                    bar.BarPart.ComplexSectionObj.Eccentricities = eccentricities.ToArray();
                }
            }

            Vector3d v = Vector3d.Zero;

            if (DA.GetData(7, ref v))
            {
                bar.BarPart.LocalY = v.FromRhino();
            }

            bool orientLCS = true;

            if (DA.GetData(8, ref orientLCS))
            {
                bar.BarPart.OrientCoordinateSystemToGCS();
            }

            string identifier = null;

            if (DA.GetData(9, ref identifier))
            {
                bar.Identifier         = identifier;
                bar.BarPart.Identifier = bar.Identifier;
            }

            // output
            DA.SetData(0, bar);
        }
コード例 #5
0
ファイル: BarsBeam.cs プロジェクト: strusoft/femdesign-api
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            Curve curve = null;

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

            FemDesign.Materials.Material material = null;
            if (!DA.GetData(1, ref material))
            {
                material = FemDesign.Materials.MaterialDatabase.GetDefault().MaterialByName("C30/37");
            }

            List <FemDesign.Sections.Section> sections = new List <Sections.Section>();

            if (!DA.GetDataList(2, sections))
            {
                sections = new List <Sections.Section>();
                sections.Add(FemDesign.Sections.SectionDatabase.GetDefault().SectionByName("Concrete sections, Rectangle, 250x600"));
            }

            List <FemDesign.Bars.Connectivity> connectivities = new List <Bars.Connectivity>();

            if (!DA.GetDataList(3, connectivities))
            {
                connectivities = new List <Bars.Connectivity> {
                    FemDesign.Bars.Connectivity.GetRigid()
                };
            }

            List <FemDesign.Bars.Eccentricity> eccentricities = new List <Bars.Eccentricity>();

            if (!DA.GetDataList(4, eccentricities))
            {
                eccentricities = new List <Bars.Eccentricity> {
                    FemDesign.Bars.Eccentricity.GetDefault()
                };
            }

            Vector3d v = Vector3d.Zero;

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

            bool orientLCS = true;

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

            string identifier = "B";

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


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

            // create bar
            var type = FemDesign.Bars.BarType.Beam;

            FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, sections.ToArray(), eccentricities.ToArray(), connectivities.ToArray(), identifier);

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

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

            // output
            DA.SetData(0, bar);
        }
コード例 #6
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            Curve curve = null;

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

            FemDesign.Materials.Material material = null;
            if (!DA.GetData(1, ref material))
            {
                return;
            }

            FemDesign.Sections.Section section = null;
            if (!DA.GetData(2, ref section))
            {
                return;
            }

            double maxCompression = 0;

            if (!DA.GetData(3, ref maxCompression))
            {
                return;
            }

            bool compressionPlasticity = false;

            if (!DA.GetData(4, ref compressionPlasticity))
            {
                return;
            }

            double maxTension = 0;

            if (!DA.GetData(5, ref maxTension))
            {
                return;
            }

            bool tensionPlasticity = false;

            if (!DA.GetData(6, ref tensionPlasticity))
            {
                return;
            }

            Vector3d v = Vector3d.Zero;

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

            bool orientLCS = true;

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

            string identifier = "T";

            if (!DA.GetData(9, ref identifier))
            {
                // pass
            }
            if (curve == null || material == null || section == null || identifier == null)
            {
                return;
            }

            // convert geometry
            if (curve.GetType() != typeof(LineCurve))
            {
                throw new System.ArgumentException("Curve must be a LineCurve");
            }
            FemDesign.Geometry.Edge edge = Convert.FromRhinoLineCurve((LineCurve)curve);

            // bar
            var type = FemDesign.Bars.BarType.Truss;

            FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, identifier);
            bar.MaxCompression        = maxCompression;
            bar.MaxTension            = maxTension;
            bar.CompressionPlasticity = compressionPlasticity;
            bar.TensionPlasticity     = tensionPlasticity;

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

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

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

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

            FemDesign.Materials.Material material = null;
            if (!DA.GetData(1, ref material))
            {
                return;
            }

            FemDesign.Sections.Section section = null;
            if (!DA.GetData(2, ref section))
            {
                return;
            }

            FemDesign.Bars.Connectivity connectivity = FemDesign.Bars.Connectivity.GetRigid();
            if (!DA.GetData(3, ref connectivity))
            {
                // pass
            }

            FemDesign.Bars.Eccentricity eccentricity = FemDesign.Bars.Eccentricity.GetDefault();
            if (!DA.GetData(4, ref eccentricity))
            {
                // pass
            }

            Vector3d v = Vector3d.Zero;

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

            bool orientLCS = true;

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

            string identifier = "B";

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

            if (curve == null || material == null || section == null || connectivity == null || eccentricity == null || identifier == null)
            {
                return;
            }

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

            // create bar
            var type = FemDesign.Bars.BarType.Beam;

            FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, eccentricity, connectivity, identifier);

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

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

            // output
            DA.SetData(0, bar);
        }