Exemple #1
0
        public static string Description(this BarRelease release)
        {
            if (release == null)
            {
                return("null release");
            }

            return(release.StartRelease.DescriptionOrName() + " - " + release.EndRelease.DescriptionOrName());
        }
Exemple #2
0
        /***************************************************/

        private static void SetEndConditions(IFMeshLine lusasLineMesh, BarRelease barReleases)
        {
            if (barReleases.StartRelease.TranslationX == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "u", "free");
            }
            if (barReleases.StartRelease.TranslationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "v", "free");
            }
            if (barReleases.StartRelease.TranslationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "w", "free");
            }
            if (barReleases.StartRelease.RotationX == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "thx", "free");
            }
            if (barReleases.StartRelease.RotationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "thy", "free");
            }
            if (barReleases.StartRelease.RotationZ == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("Start", "thz", "free");
            }

            if (barReleases.EndRelease.TranslationX == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "u", "free");
            }
            if (barReleases.EndRelease.TranslationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "v", "free");
            }
            if (barReleases.EndRelease.TranslationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "w", "free");
            }
            if (barReleases.EndRelease.RotationX == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "thx", "free");
            }
            if (barReleases.EndRelease.RotationY == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "thy", "free");
            }
            if (barReleases.EndRelease.RotationZ == DOFType.Free)
            {
                lusasLineMesh.setEndRelease("End", "thz", "free");
            }
        }
Exemple #3
0
        /***************************************************/

        private static BarRelease GetBarRelease(IFMeshLine lusasLineMesh)
        {
            object[]       startReleases    = lusasLineMesh.getValue("start");
            object[]       endReleases      = lusasLineMesh.getValue("end");
            List <DOFType> startReleaseType = GetConstraints(startReleases);
            List <DOFType> endReleaseType   = GetConstraints(endReleases);

            Constraint6DOF startConstraint = SetConstraint(startReleaseType);
            Constraint6DOF endConstraint   = SetConstraint(endReleaseType);

            BarRelease barRelease = new BarRelease
            {
                StartRelease = startConstraint,
                EndRelease   = endConstraint
            };

            return(barRelease);
        }
Exemple #4
0
        /***************************************************/

        public static BarRelease GetBarRelease(bool[] startRelease, double[] startSpring, bool[] endRelease, double[] endSpring)
        {
            Constraint6DOF bhStartRelease = new Constraint6DOF();

            bhStartRelease.TranslationX = GetDofType(startRelease, startSpring, 0);
            bhStartRelease.TranslationY = GetDofType(startRelease, startSpring, 2);
            bhStartRelease.TranslationZ = GetDofType(startRelease, startSpring, 1);
            bhStartRelease.RotationX    = GetDofType(startRelease, startSpring, 3);
            bhStartRelease.RotationY    = GetDofType(startRelease, startSpring, 5);
            bhStartRelease.RotationZ    = GetDofType(startRelease, startSpring, 4);

            bhStartRelease.TranslationalStiffnessX = startSpring[0];
            bhStartRelease.TranslationalStiffnessY = startSpring[2];
            bhStartRelease.TranslationalStiffnessZ = startSpring[1];
            bhStartRelease.RotationalStiffnessX    = startSpring[3];
            bhStartRelease.RotationalStiffnessY    = startSpring[5];
            bhStartRelease.RotationalStiffnessZ    = startSpring[4];

            Constraint6DOF bhEndRelease = new Constraint6DOF();

            bhEndRelease.TranslationX = GetDofType(endRelease, endSpring, 0);
            bhEndRelease.TranslationY = GetDofType(endRelease, endSpring, 2);
            bhEndRelease.TranslationZ = GetDofType(endRelease, endSpring, 1);
            bhEndRelease.RotationX    = GetDofType(endRelease, endSpring, 3);
            bhEndRelease.RotationY    = GetDofType(endRelease, endSpring, 5);
            bhEndRelease.RotationZ    = GetDofType(endRelease, endSpring, 4);

            bhEndRelease.TranslationalStiffnessX = endSpring[0];
            bhEndRelease.TranslationalStiffnessY = endSpring[2];
            bhEndRelease.TranslationalStiffnessZ = endSpring[1];
            bhEndRelease.RotationalStiffnessX    = endSpring[3];
            bhEndRelease.RotationalStiffnessY    = endSpring[5];
            bhEndRelease.RotationalStiffnessZ    = endSpring[4];

            BarRelease barRelease = new BarRelease()
            {
                StartRelease = bhStartRelease, EndRelease = bhEndRelease
            };

            return(barRelease);
        }
Exemple #5
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        public static Tuple <bool, double, BarRelease, BarFEAType> GetMeshProperties(IFLine lusasLine)
        {
            bool       meshAssigned = true;
            double     betaAngle    = 0;
            BarRelease barRelease   = null;
            BarFEAType barType      = BarFEAType.Flexural;

            object[] meshAssignments = lusasLine.getAssignments("Mesh");

            if (meshAssignments.Length > 0)
            {
                foreach (object assignment in meshAssignments)
                {
                    IFAssignment lusasAssignment = (IFAssignment)assignment;
                    IFAttribute  lusasMesh       = lusasAssignment.getAttribute();
                    IFMeshLine   lusasLineMesh   = (IFMeshLine)lusasMesh;
                    betaAngle = lusasAssignment.getBetaAngle();

                    barRelease = GetBarRelease(lusasLineMesh);

                    object[] barMeshName = lusasLineMesh.getElementNames();

                    foreach (object type in barMeshName)
                    {
                        barType = GetFEAType(type);
                    }
                }
            }
            else
            {
                meshAssigned = false;
            }

            Tuple <bool, double, BarRelease, BarFEAType> lineMeshProperties =
                new Tuple <bool, double, BarRelease, BarFEAType>(meshAssigned, betaAngle, barRelease, barType);

            return(lineMeshProperties);
        }
Exemple #6
0
        public static Bar Bar(Line line, ISectionProperty sectionProperty = null, Vector normal = null, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
        {
            double orientationAngle;

            if (normal == null)
            {
                orientationAngle = 0;
            }
            else
            {
                normal = normal.Normalise();
                Vector tan = (line.End - line.Start).Normalise();

                double dot = normal.DotProduct(tan);

                if (Math.Abs(1 - dot) < oM.Geometry.Tolerance.Angle)
                {
                    Reflection.Compute.RecordError("The normal is parallell to the centreline of the Bar.");
                    return(null);
                }
                else if (Math.Abs(dot) > oM.Geometry.Tolerance.Angle)
                {
                    Reflection.Compute.RecordWarning("Normal not othogonal to the centreline and will get projected.");
                }

                Vector reference;

                if (!line.IsVertical())
                {
                    reference = Vector.ZAxis;
                }
                else
                {
                    reference = tan.CrossProduct(Vector.YAxis);
                }

                orientationAngle = reference.Angle(normal, new Plane {
                    Normal = tan
                });
            }

            return(Bar(line, sectionProperty, orientationAngle, release, feaType, name));
        }
Exemple #7
0
 public static Bar Bar(Line line, ISectionProperty sectionProperty = null, double orientationAngle = 0, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
 {
     return(new Bar
     {
         Name = name,
         StartNode = (Node)line.Start,
         EndNode = (Node)line.End,
         SectionProperty = sectionProperty,
         Release = release == null?BarReleaseFixFix() : release,
                       FEAType = feaType,
                       OrientationAngle = orientationAngle
     });
 }
Exemple #8
0
 public static Bar Bar(Node startNode, Node endNode, ISectionProperty property = null, double orientationAngle = 0, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
 {
     return(new Bar
     {
         Name = name,
         StartNode = startNode,
         EndNode = endNode,
         SectionProperty = property,
         Release = release == null?BarReleaseFixFix() : release,
                       FEAType = feaType,
                       OrientationAngle = orientationAngle
     });
 }
Exemple #9
0
        /***************************************************/

        public static bool ToSAP(this BarRelease release, ref bool[] startRelease, ref double[] startSpring, ref bool[] endRelease, ref double[] endSpring)
        {
            if (release.StartRelease == null)
            {
                Engine.Base.Compute.RecordNote("Start Release was null, no release was set");
                return(false);
            }

            startRelease    = new bool[6];
            startRelease[0] = release.StartRelease.TranslationX != DOFType.Fixed;
            startRelease[1] = release.StartRelease.TranslationZ != DOFType.Fixed;
            startRelease[2] = release.StartRelease.TranslationY != DOFType.Fixed;
            startRelease[3] = release.StartRelease.RotationX != DOFType.Fixed;
            startRelease[4] = release.StartRelease.RotationZ != DOFType.Fixed;
            startRelease[5] = release.StartRelease.RotationY != DOFType.Fixed;

            startSpring    = new double[6];
            startSpring[0] = release.StartRelease.TranslationalStiffnessX;
            startSpring[1] = release.StartRelease.TranslationalStiffnessZ;
            startSpring[2] = release.StartRelease.TranslationalStiffnessY;
            startSpring[3] = release.StartRelease.RotationalStiffnessX;
            startSpring[4] = release.StartRelease.RotationalStiffnessZ;
            startSpring[5] = release.StartRelease.RotationalStiffnessY;


            if (release.EndRelease == null)
            {
                Engine.Base.Compute.RecordNote("End Release was null, no release was set");
                return(false);
            }

            endRelease    = new bool[6];
            endRelease[0] = release.EndRelease.TranslationX != DOFType.Fixed;
            endRelease[1] = release.EndRelease.TranslationZ != DOFType.Fixed;
            endRelease[2] = release.EndRelease.TranslationY != DOFType.Fixed;
            endRelease[3] = release.EndRelease.RotationX != DOFType.Fixed;
            endRelease[4] = release.EndRelease.RotationZ != DOFType.Fixed;
            endRelease[5] = release.EndRelease.RotationY != DOFType.Fixed;

            endSpring    = new double[6];
            endSpring[0] = release.EndRelease.TranslationalStiffnessX;
            endSpring[1] = release.EndRelease.TranslationalStiffnessZ;
            endSpring[2] = release.EndRelease.TranslationalStiffnessY;
            endSpring[3] = release.EndRelease.RotationalStiffnessX;
            endSpring[4] = release.EndRelease.RotationalStiffnessZ;
            endSpring[5] = release.EndRelease.RotationalStiffnessY;

            bool[] startReleased = startRelease.Zip(startSpring, (x, y) => x && y == 0).ToArray();
            bool[] endReleased   = endRelease.Zip(endSpring, (x, y) => x && y == 0).ToArray();

            if (startReleased[0] && endReleased[0])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationX for both ends"); return(false);
            }
            if (startReleased[1] && endReleased[1])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationZ for both ends"); return(false);
            }
            if (startReleased[2] && endReleased[2])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationY for both ends"); return(false);
            }
            if (startReleased[3] && endReleased[3])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release RotationX for both ends"); return(false);
            }
            if (startReleased[4] && endReleased[4] && (startReleased[2] || endReleased[2]))
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationY when RotationZ is released for both ends"); return(false);
            }
            if (startReleased[5] && endReleased[5] && (startReleased[1] || endReleased[1]))
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationZ when RotationY is released for both ends"); return(false);
            }

            return(true);
        }
Exemple #10
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Bar Bar(Line line, ISectionProperty property = null, double orientationAngle = 0, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
        {
            return(Bar(Node(line.Start), Node(line.End), property, orientationAngle, release, feaType, name));
        }
 public static string Description(this BarRelease release)
 {
     return(release.StartRelease.DescriptionOrName() + " - " + release.EndRelease.DescriptionOrName());
 }
Exemple #12
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static bool ToCSI(this BarRelease release, ref bool[] startRestraint, ref double[] startSpring, ref bool[] endRestraint, ref double[] endSpring)
        {
            startRestraint    = new bool[6];
            startRestraint[0] = release.StartRelease.TranslationX != DOFType.Fixed;
            startRestraint[1] = release.StartRelease.TranslationZ != DOFType.Fixed;
            startRestraint[2] = release.StartRelease.TranslationY != DOFType.Fixed;
            startRestraint[3] = release.StartRelease.RotationX != DOFType.Fixed;
            startRestraint[4] = release.StartRelease.RotationZ != DOFType.Fixed;
            startRestraint[5] = release.StartRelease.RotationY != DOFType.Fixed;

            startSpring    = new double[6];
            startSpring[0] = release.StartRelease.TranslationalStiffnessX;
            startSpring[1] = release.StartRelease.TranslationalStiffnessZ;
            startSpring[2] = release.StartRelease.TranslationalStiffnessY;
            startSpring[3] = release.StartRelease.RotationalStiffnessX;
            startSpring[4] = release.StartRelease.RotationalStiffnessZ;
            startSpring[5] = release.StartRelease.RotationalStiffnessY;

            endRestraint    = new bool[6];
            endRestraint[0] = release.EndRelease.TranslationX != DOFType.Fixed;
            endRestraint[1] = release.EndRelease.TranslationZ != DOFType.Fixed;
            endRestraint[2] = release.EndRelease.TranslationY != DOFType.Fixed;
            endRestraint[3] = release.EndRelease.RotationX != DOFType.Fixed;
            endRestraint[4] = release.EndRelease.RotationZ != DOFType.Fixed;
            endRestraint[5] = release.EndRelease.RotationY != DOFType.Fixed;

            endSpring    = new double[6];
            endSpring[0] = release.EndRelease.TranslationalStiffnessX;
            endSpring[1] = release.EndRelease.TranslationalStiffnessZ;
            endSpring[2] = release.EndRelease.TranslationalStiffnessY;
            endSpring[3] = release.EndRelease.RotationalStiffnessX;
            endSpring[4] = release.EndRelease.RotationalStiffnessZ;
            endSpring[5] = release.EndRelease.RotationalStiffnessY;

            bool[] startReleased = startRestraint.Zip(startSpring, (x, y) => x && y == 0).ToArray();
            bool[] endReleased   = endRestraint.Zip(endSpring, (x, y) => x && y == 0).ToArray();
            bool   success       = true;

            if (startReleased[0] && endReleased[0])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationX for both ends"); success = false;
            }
            if (startReleased[1] && endReleased[1])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationZ for both ends"); success = false;
            }
            if (startReleased[2] && endReleased[2])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationY for both ends"); success = false;
            }
            if (startReleased[3] && endReleased[3])
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release RotationX for both ends"); success = false;
            }
            if (startReleased[4] && endReleased[4] && (startReleased[2] || endReleased[2]))
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationY when RotationZ is released for both ends"); success = false;
            }
            if (startReleased[5] && endReleased[5] && (startReleased[1] || endReleased[1]))
            {
                Engine.Base.Compute.RecordWarning($"Unstable releases have not been set, can not release TranslationZ when RotationY is released for both ends"); success = false;
            }

            return(success);
        }
Exemple #13
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private IFMeshLine CreateMeshSettings1D(MeshSettings1D meshSettings1D, BarFEAType barFEAType = BarFEAType.Flexural, BarRelease barRelease = null)
        {
            if (!Engine.Adapters.Lusas.Query.CheckIllegalCharacters(meshSettings1D.Name))
            {
                return(null);
            }

            if (barRelease != null && barFEAType == BarFEAType.Axial)
            {
                Engine.Base.Compute.RecordWarning(
                    barFEAType + " used with barReleases, this information will be lost when pushed to Lusas");
            }
            else if (barRelease == null)
            {
                barRelease = Engine.Structure.Create.BarReleaseFixFix();
            }

            string releaseString = CreateReleaseString(barRelease);

            IFMeshLine lusasLineMesh;
            string     lusasName = meshSettings1D.Name + "\\" + barFEAType.ToString() + "|" + releaseString;

            if (d_LusasData.existsAttribute("Mesh", lusasName))
            {
                lusasLineMesh = (IFMeshLine)d_LusasData.getAttribute("Mesh", lusasName);
            }
            else
            {
                lusasLineMesh = d_LusasData.createMeshLine(lusasName);
                SetSplitMethod(lusasLineMesh, meshSettings1D, barFEAType);
                if (barRelease != null)
                {
                    SetEndConditions(lusasLineMesh, barRelease);
                }
            }

            if (lusasLineMesh != null)
            {
                int adapterNameId = d_LusasData.getLargestAttributeID("Mesh");
                meshSettings1D.SetAdapterId(typeof(LusasId), adapterNameId);

                return(lusasLineMesh);
            }

            return(null);
        }
Exemple #14
0
        /***************************************************/

        private void GetBarReleaseArrays(BarRelease release, out bool[] startFixities, out bool[] endFixities, out double[] startValues, out double[] endValues)
        {
            GetOneSideBarReleaseArrays(release.StartRelease, out startFixities, out startValues);
            GetOneSideBarReleaseArrays(release.EndRelease, out endFixities, out endValues);
        }
Exemple #15
0
        /***************************************************/

        private bool CreateObject(Bar bhBar)
        {
            bool success = true;
            int  ret     = 0;


            string name = "";
            string bhId = bhBar.CustomData[AdapterId].ToString();

            name = bhId;

            ret = m_model.FrameObj.AddByPoint(bhBar.StartNode.CustomData[AdapterId].ToString(), bhBar.EndNode.CustomData[AdapterId].ToString(), ref name);

            if (ret != 0)
            {
                CreateElementError("Bar", name);
                return(false);
            }

            if (m_model.FrameObj.SetSection(name, bhBar.SectionProperty.Name) != 0)
            {
                CreatePropertyWarning("SectionProperty", "Bar", name);
                ret++;
            }

            if (m_model.FrameObj.SetLocalAxes(name, bhBar.OrientationAngle * 180 / System.Math.PI) != 0)
            {
                CreatePropertyWarning("Orientation angle", "Bar", name);
                ret++;
            }

            Offset offset = bhBar.Offset;

            double[] offset1 = new double[3];
            double[] offset2 = new double[3];

            if (offset != null)
            {
                offset1[1] = offset.Start.Z;
                offset1[2] = offset.Start.Y;
                offset2[1] = offset.End.Z;
                offset2[2] = offset.End.Y;
            }

            if (m_model.FrameObj.SetInsertionPoint(name, (int)bhBar.InsertionPoint(), false, true, ref offset1, ref offset2) != 0)
            {
                CreatePropertyWarning("insertion point and perpendicular offset", "Bar", name);
                ret++;
            }

            BarRelease barRelease = bhBar.Release;

            if (barRelease != null)
            {
                bool[]   restraintStart; // = barRelease.StartRelease.Fixities();// Helper.GetRestraint6DOF(barRelease.StartRelease);
                double[] springStart;    // = barRelease.StartRelease.ElasticValues();// Helper.GetSprings6DOF(barRelease.StartRelease);
                bool[]   restraintEnd;   // = barRelease.EndRelease.Fixities();// Helper.GetRestraint6DOF(barRelease.EndRelease);
                double[] springEnd;      // = barRelease.EndRelease.ElasticValues();// Helper.GetSprings6DOF(barRelease.EndRelease);


                GetBarReleaseArrays(barRelease, out restraintStart, out restraintEnd, out springStart, out springEnd);

                if (m_model.FrameObj.SetReleases(name, ref restraintStart, ref restraintEnd, ref springStart, ref springEnd) != 0)
                {
                    CreatePropertyWarning("Release", "Bar", name);
                    ret++;
                }
            }

            AutoLengthOffset autoLengthOffset = bhBar.AutoLengthOffset();

            if (autoLengthOffset != null)
            {
                //the Rigid Zone Factor is not picked up when setting the auto length = true for the method call. Hence need to call this method twice.
                int retAutoLEngthOffset = m_model.FrameObj.SetEndLengthOffset(name, false, 0, 0, autoLengthOffset.RigidZoneFactor);
                retAutoLEngthOffset += m_model.FrameObj.SetEndLengthOffset(name, autoLengthOffset.AutoOffset, 0, 0, 0);
                if (retAutoLEngthOffset != 0)
                {
                    CreatePropertyWarning("Auto length offset", "Bar", name);
                    ret++;
                }
            }
            else if (bhBar.Offset != null)
            {
                if (m_model.FrameObj.SetEndLengthOffset(name, false, -1 * (bhBar.Offset.Start.X), bhBar.Offset.End.X, 1) != 0)
                {
                    CreatePropertyWarning("Length offset", "Bar", name);
                    ret++;
                }
            }


            return(ret == 0);
        }
Exemple #16
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/
        private List <Bar> ReadBars(List <string> ids = null)
        {
            int        err   = 0;
            List <Bar> beams = new List <Bar>();
            Dictionary <int, ISectionProperty> allBeamProperties = ReadSectionProperties().ToDictionary(x => GetAdapterId <int>(x));
            Dictionary <int, Node>             allNodes          = ReadNodes().ToDictionary(x => GetAdapterId <int>(x));
            int beamCount = 0;

            err = St7.St7GetTotal(1, St7.tyBEAM, ref beamCount);
            if (!St7ErrorCustom(err, "Could not get total number of beams."))
            {
                return(beams);
            }
            for (int bm = 0; bm < beamCount; bm++)
            {
                // Getting nodes for a beam
                int   beamId  = bm + 1;
                int[] bmNodes = new int[St7.kMaxElementNode + 1];
                err = St7.St7GetElementConnection(1, St7.tyBEAM, beamId, bmNodes);
                if (!St7ErrorCustom(err, "Could not get nodes for a beam " + beamId.ToString()))
                {
                    continue;
                }
                if (bmNodes[0] != 2)    // checking number of nodes bmNodes[0]
                {
                    BH.Engine.Base.Compute.RecordError("Number of nodes doesn't equal 2 for beam N: " + beamId.ToString());
                    return(beams);
                }
                Node nd1 = allNodes[bmNodes[1]];
                Node nd2 = allNodes[bmNodes[2]];

                // getting a property for a beam
                int beamPropNum = 0;
                err = St7.St7GetElementProperty(1, St7.ptBEAMPROP, beamId, ref beamPropNum);
                if (!St7ErrorCustom(err, "Could not get property for a beam " + beamId.ToString()))
                {
                    continue;
                }
                ISectionProperty prop = allBeamProperties.ContainsKey(beamPropNum)? allBeamProperties[beamPropNum] : null;
                //// getting an orientation vector
                //double[] beamAxes = new double[9];
                //err = St7.St7GetBeamAxisSystem(1, beamId, St7.btTrue, beamAxes);
                //if (!St7ErrorCustom(err, "Could not get local axes for a beam " + beamId.ToString())) continue;
                //Vector i2 = BH.Engine.Geometry.Create.Vector(beamAxes[3], beamAxes[4], beamAxes[5]); // normal vector
                //Vector i3 = BH.Engine.Geometry.Create.Vector(beamAxes[6], beamAxes[7], beamAxes[8]); // vector along the beam
                //Vector reference = Vector.ZAxis;
                //if (Abs(1 - Query.DotProduct(i3, Vector.ZAxis)) < 0.001) reference = i3.CrossProduct(Vector.YAxis); // if beam is vertical use X or -X axis as reference
                //double orientationAngle = reference.Angle(i2, new Plane { Normal = i3 });
                double[] orientationAngle = new double[1];
                err = St7.St7GetBeamReferenceAngle1(1, beamId, orientationAngle);
                int[]    restrTranslationStart = new int[3];
                int[]    restrTranslationEnd   = new int[3];
                int[]    restrRotationStart    = new int[3];
                int[]    restrRotationEnd      = new int[3];
                double[] stiffTranslationStart = new double[3];
                double[] stiffTranslationEnd   = new double[3];
                double[] stiffRotationStart    = new double[3];
                double[] stiffRotationEnd      = new double[3];
                // getting beam releases
                err = St7.St7GetBeamTRelease3(1, beamId, 1, restrTranslationStart, stiffTranslationStart);
                if (err != St7.ERR7_NoError)
                {
                    restrTranslationStart = new int[] { 1, 1, 1 }
                }
                ;                                                                           // fixed if not set
                err = St7.St7GetBeamRRelease3(1, beamId, 1, restrRotationStart, stiffRotationStart);
                if (err != St7.ERR7_NoError)
                {
                    restrRotationStart = new int[] { 1, 1, 1 }
                }
                ;                                                                        // fixed if not set
                List <bool>   beamStartRestraint = restrTranslationStart.Concat(restrRotationStart).Select(rst => rst == St7.brFixed).ToList();
                List <double> stiffnessValsStart = stiffTranslationStart.Concat(stiffRotationStart).ToList();
                err = St7.St7GetBeamTRelease3(1, beamId, 2, restrTranslationEnd, stiffTranslationEnd);
                if (err != St7.ERR7_NoError)
                {
                    restrTranslationEnd = new int[] { 1, 1, 1 }
                }
                ;                                                                         // fixed if not set
                err = St7.St7GetBeamRRelease3(1, beamId, 2, restrRotationEnd, stiffRotationEnd);
                if (err != St7.ERR7_NoError)
                {
                    restrRotationEnd = new int[] { 1, 1, 1 }
                }
                ;                                                                      // fixed if not set
                List <bool>    beamEndRestraint = restrTranslationEnd.Concat(restrRotationEnd).Select(rst => rst == St7.brFixed).ToList();
                List <double>  stiffnessValsEnd = stiffTranslationEnd.Concat(stiffRotationEnd).ToList();
                Constraint6DOF startRelease     = BH.Engine.Structure.Create.Constraint6DOF("", beamStartRestraint, stiffnessValsStart);
                Constraint6DOF endRelease       = BH.Engine.Structure.Create.Constraint6DOF("", beamEndRestraint, stiffnessValsEnd);
                BarRelease     barRelease       = BH.Engine.Structure.Create.BarRelease(startRelease, endRelease);
                Bar            bar = BH.Engine.Structure.Create.Bar(nd1, nd2, prop, orientationAngle[0] * System.Math.PI / 180, barRelease);
                SetAdapterId(bar, beamId);
                beams.Add(bar);
            }

            return(beams);
        }

        /***************************************************/
    }
}
Exemple #17
0
        public static Bar Bar(Line line, ISectionProperty sectionProperty = null, Vector normal = null, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
        {
            double orientationAngle = normal.OrientationAngleLinear(line);

            if (double.IsNaN(orientationAngle))
            {
                return(null);
            }

            return(Bar(line, sectionProperty, orientationAngle, release, feaType, name));
        }
Exemple #18
0
        /***************************************************/

        private static string CreateReleaseString(BarRelease barRelease)
        {
            string releaseString = "";

            if (barRelease != null)
            {
                if (barRelease.StartRelease != null && barRelease.EndRelease != null)
                {
                    if (barRelease.StartRelease.TranslationX == DOFType.Free)
                    {
                        releaseString = releaseString + "FX";
                    }
                    if (barRelease.StartRelease.TranslationY == DOFType.Free)
                    {
                        releaseString = releaseString + "FY";
                    }
                    if (barRelease.StartRelease.TranslationZ == DOFType.Free)
                    {
                        releaseString = releaseString + "FZ";
                    }
                    if (barRelease.StartRelease.RotationX == DOFType.Free)
                    {
                        releaseString = releaseString + "MX";
                    }
                    if (barRelease.StartRelease.RotationY == DOFType.Free)
                    {
                        releaseString = releaseString + "MY";
                    }
                    if (barRelease.StartRelease.RotationZ == DOFType.Free)
                    {
                        releaseString = releaseString + "MZ";
                    }

                    if (releaseString != "")
                    {
                        releaseString = releaseString + ",";
                    }

                    if (barRelease.EndRelease.TranslationX == DOFType.Free)
                    {
                        releaseString = releaseString + "FX";
                    }
                    if (barRelease.EndRelease.TranslationY == DOFType.Free)
                    {
                        releaseString = releaseString + "FY";
                    }
                    if (barRelease.EndRelease.TranslationZ == DOFType.Free)
                    {
                        releaseString = releaseString + "FZ";
                    }
                    if (barRelease.EndRelease.RotationX == DOFType.Free)
                    {
                        releaseString = releaseString + "MX";
                    }
                    if (barRelease.EndRelease.RotationY == DOFType.Free)
                    {
                        releaseString = releaseString + "MY";
                    }
                    if (barRelease.EndRelease.RotationZ == DOFType.Free)
                    {
                        releaseString = releaseString + "MZ";
                    }
                }
            }

            return(releaseString);
        }