Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static MeshSettings1D ToMeshSettings1D(this IFAttribute lusasAttrbute)
        {
            string attributeName = GetName(lusasAttrbute);

            IFMeshLine lusasMeshLine = (IFMeshLine)lusasAttrbute;

            double  value       = 0;
            Split1D splitMethod = Split1D.Automatic;
            int     meshType    = 0;

            lusasMeshLine.getMeshDivisions(ref meshType);

            if (meshType == 0)
            {
                value = 0;
            }
            else if (meshType == 1)
            {
                splitMethod = Split1D.Divisions;
                object[] ratios = lusasMeshLine.getValue("ratio");
                value = ratios.Count();
                if (value == 0)
                {
                    value = 4;
                }
            }
            else if (meshType == 2)
            {
                splitMethod = Split1D.Length;
                value       = lusasMeshLine.getValue("size");
            }

            MeshSettings1D meshSettings1D = new MeshSettings1D
            {
                Name           = attributeName,
                SplitMethod    = splitMethod,
                SplitParameter = value
            };

            int adapterNameId = GetAdapterID(lusasMeshLine, 'e');

            meshSettings1D.SetAdapterId(typeof(LusasId), adapterNameId);

            return(meshSettings1D);
        }
Ejemplo n.º 3
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <MeshSettings1D> ReadMeshSettings1D(List <string> ids = null)
        {
            List <MeshSettings1D> meshSettings1Ds = new List <MeshSettings1D>();

            object[] lusasMesh1Ds = d_LusasData.getAttributes("Line Mesh");

            for (int i = 0; i < lusasMesh1Ds.Count(); i++)
            {
                IFMeshLine     lusasMesh1D    = (IFMeshLine)lusasMesh1Ds[i];
                MeshSettings1D meshSettings1D = Adapters.Lusas.Convert.ToMeshSettings1D(lusasMesh1D);
                List <string>  analysisName   = new List <string> {
                    lusasMesh1D.getAttributeType()
                };
                meshSettings1D.Tags = new HashSet <string>(analysisName);
                if (meshSettings1D != null)
                {
                    meshSettings1Ds.Add(meshSettings1D);
                }
            }

            return(meshSettings1Ds);
        }
Ejemplo n.º 4
0
        /***************************************************/

        private static void SetSplitMethod(IFMeshLine lusasLineMesh, MeshSettings1D meshSettings1D, BarFEAType barFEAType)
        {
            if (meshSettings1D.SplitMethod == Split1D.Length)
            {
                if (barFEAType == BarFEAType.Axial)
                {
                    lusasLineMesh.setSize("BRS2", meshSettings1D.SplitParameter);
                }
                else if (barFEAType == BarFEAType.Flexural)
                {
                    lusasLineMesh.setSize("BMI21", meshSettings1D.SplitParameter);
                }
            }
            else if (meshSettings1D.SplitMethod == Split1D.Automatic)
            {
                lusasLineMesh.setValue("uiSpacing", "uniform");
                SetElementType(lusasLineMesh, barFEAType);
            }
            else if (meshSettings1D.SplitMethod == Split1D.Divisions)
            {
                lusasLineMesh.addSpacing(System.Convert.ToInt32(meshSettings1D.SplitParameter), 1);
                SetElementType(lusasLineMesh, barFEAType);
            }
        }
Ejemplo n.º 5
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private IFLine CreateLine(Bar bar)
        {
            if (!CheckPropertyError(bar, b => b.StartNode, true) || !CheckPropertyError(bar, b => b.EndNode, true) ||
                !CheckPropertyError(bar, b => b.StartNode.Position, true) || !CheckPropertyError(bar, b => b.EndNode.Position, true))
            {
                return(null);
            }

            if (
                bar.FEAType == BarFEAType.CompressionOnly ||
                bar.FEAType == BarFEAType.TensionOnly)
            {
                Engine.Base.Compute.RecordError("Lusas does not support " + bar.FEAType.ToString() + " Bars");
                return(null);
            }

            string startNodeId = GetAdapterId <string>(bar.StartNode);
            string endNodeId   = GetAdapterId <string>(bar.EndNode);

            if (string.IsNullOrEmpty(startNodeId) || string.IsNullOrEmpty(endNodeId))
            {
                Engine.Base.Compute.RecordError("Could not find the ids for at least one end node for at least one Bar. Bar not created.");
                return(null);
            }

            IFPoint startPoint = d_LusasData.getPointByNumber(bar.StartNode.AdapterId <int>(typeof(LusasId)));
            IFPoint endPoint   = d_LusasData.getPointByNumber(bar.EndNode.AdapterId <int>(typeof(LusasId)));
            IFLine  lusasLine  = d_LusasData.createLineByPoints(startPoint, endPoint);

            int adapterIdName = lusasLine.getID();

            bar.SetAdapterId(typeof(LusasId), adapterIdName);

            if (bar.Tags.Count != 0)
            {
                AssignObjectSet(lusasLine, bar.Tags);
            }

            if (CheckPropertyWarning(bar, b => b.SectionProperty) && !Engine.Adapters.Lusas.Query.InvalidSectionProperty(bar.SectionProperty))
            {
                if (!Engine.Adapters.Lusas.Query.InvalidSectionProfile(bar.SectionProperty))
                {
                    //Needed in case the SectionProfile is null and was not created
                    if (d_LusasData.existsAttribute("Line Geometric", bar.SectionProperty.AdapterId <int>(typeof(LusasId))))
                    {
                        IFAttribute lusasGeometricLine = d_LusasData.getAttribute("Line Geometric", bar.SectionProperty.AdapterId <int>(typeof(LusasId)));
                        lusasGeometricLine.assignTo(lusasLine);
                    }

                    if (CheckPropertyWarning(bar, b => b.SectionProperty.Material))
                    {
                        if (bar.SectionProperty.Material is IOrthotropic)
                        {
                            Engine.Base.Compute.RecordWarning($"Orthotropic Material {bar.SectionProperty.Material.DescriptionOrName()} cannot be assigned to Bar {bar.AdapterId<int>(typeof(LusasId))}, " +
                                                              $"orthotropic materials can only be applied to 2D and 3D elements in Lusas.");
                        }
                        else if (bar.SectionProperty.Material is IIsotropic)
                        {
                            if (d_LusasData.existsAttribute("Material", bar.SectionProperty.Material.AdapterId <int>(typeof(LusasId))))
                            {
                                IFAttribute lusasMaterial = d_LusasData.getAttribute("Material", bar.SectionProperty.Material.AdapterId <int>(typeof(LusasId)));
                                lusasMaterial.assignTo(lusasLine);
                            }
                        }
                    }
                }
            }

            if (bar.Support != null)
            {
                IFAttribute lusasSupport = d_LusasData.getAttribute("Support", System.Convert.ToInt32(bar.Support.AdapterId <int>(typeof(LusasId))));
                lusasSupport.assignTo(lusasLine);
                IFLocalCoord barLocalAxis = CreateLocalCoordinate(lusasLine);
                barLocalAxis.assignTo(lusasLine);
            }

            if (bar.Fragments.Contains(typeof(MeshSettings1D)))
            {
                IFAssignment meshAssignment = m_LusasApplication.newAssignment();
                meshAssignment.setAllDefaults();
                if (bar.OrientationAngle != 0 && bar.FEAType == BarFEAType.Axial)
                {
                    Engine.Base.Compute.RecordWarning(
                        "Orientation angle not supported in Lusas for " + bar.FEAType +
                        " element types, this information will be lost when pushed to Lusas");
                }

                meshAssignment.setBetaAngle(bar.OrientationAngle);

                MeshSettings1D meshSettings1D = bar.FindFragment <MeshSettings1D>();
                IFMeshAttr     mesh           = d_LusasData.getMesh(
                    meshSettings1D.Name + "\\" + bar.FEAType.ToString() + "|" + CreateReleaseString(bar.Release));
                mesh.assignTo(lusasLine, meshAssignment);
            }

            if (bar.Offset != null)
            {
                Engine.Base.Compute.RecordWarning("Offsets are currently unsupported.");
            }

            return(lusasLine);
        }