示例#1
0
        /***************************************************/

        public static List <MeshFace> MeshFaces(BH.oM.Geometry.Mesh mesh, ISurfaceProperty property = null, string name = null)
        {
            List <MeshFace> meshFaces = new List <MeshFace>();

            foreach (Face face in mesh.Faces)
            {
                List <Node> nodes = new List <Node>();
                nodes.Add(Create.Node(mesh.Vertices[face.A]));
                nodes.Add(Create.Node(mesh.Vertices[face.B]));
                nodes.Add(Create.Node(mesh.Vertices[face.C]));

                if (BH.Engine.Geometry.Query.IsQuad(face))
                {
                    nodes.Add(Create.Node(mesh.Vertices[face.D]));
                }
                MeshFace mf = new MeshFace()
                {
                    Property = property, Nodes = nodes
                };

                if (name != null)
                {
                    mf.Name = name;
                }

                meshFaces.Add(mf);
            }

            return(meshFaces);
        }
示例#2
0
        public static ISurfaceProperty ApplyModifiers(this ISurfaceProperty prop, double fxx = 1, double fxy = 1, double fyy = 1, double mxx = 1, double mxy = 1, double myy = 1, double vxz = 1, double vyz = 1, double mass = 1, double weight = 1)
        {
            if (prop.IsNull())
            {
                return(null);
            }

            ISurfaceProperty clone = prop.ShallowClone();

            SurfacePropertyModifier modifier = new SurfacePropertyModifier
            {
                FXX    = fxx,
                FXY    = fxy,
                FYY    = fyy,
                MXX    = mxx,
                MXY    = mxy,
                MYY    = myy,
                VXZ    = vxz,
                VYZ    = vyz,
                Mass   = mass,
                Weight = weight
            };

            clone.Fragments = new oM.Base.FragmentSet(clone.Fragments);
            clone.Fragments.AddOrReplace(modifier);
            return(clone);
        }
示例#3
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static ISurfaceProperty SetShellType(this ISurfaceProperty property, ShellType shellType)
        {
            property.Fragments.AddOrReplace(new ShellTypeFragment {
                ShellType = shellType
            });
            return(property);
        }
示例#4
0
        public static List <Panel> Panel(List <ICurve> outlines, ISurfaceProperty property = null, string name = "")
        {
            List <Panel> result = new List <Panel>();
            List <List <IElement1D> > outlineEdges = outlines.Select(x => x.ISubParts().Select(y => new Edge {
                Curve = y
            } as IElement1D).ToList()).ToList();

            List <List <List <IElement1D> > > sortedOutlines = outlineEdges.DistributeOutlines(true);

            foreach (List <List <IElement1D> > panelOutlines in sortedOutlines)
            {
                Panel panel = new Panel();
                panel = panel.SetOutlineElements1D(panelOutlines[0]);
                List <Opening> openings = new List <Opening>();
                foreach (List <IElement1D> p in panelOutlines.Skip(1))
                {
                    Opening opening = (new Opening()).SetOutlineElements1D(p);
                    openings.Add(opening);
                }
                panel.Openings = openings;
                panel.Property = property;
                panel.Name     = name;
                result.Add(panel);
            }
            return(result);
        }
示例#5
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static FEMesh FEMesh(BH.oM.Geometry.Mesh mesh, ISurfaceProperty property = null, string name = null)
        {
            FEMesh feMesh = new FEMesh();

            feMesh.Nodes = mesh.Vertices.Select(x => Node(x)).ToList();

            foreach (Face face in mesh.Faces)
            {
                FEMeshFace feFace = new FEMeshFace();
                feFace.NodeListIndices.Add(face.A);
                feFace.NodeListIndices.Add(face.B);
                feFace.NodeListIndices.Add(face.C);

                if (face.IsQuad())
                {
                    feFace.NodeListIndices.Add(face.D);
                }

                feMesh.MeshFaces.Add(feFace);
            }

            if (property != null)
            {
                feMesh.Property = property;
            }

            if (name != null)
            {
                feMesh.Name = name;
            }

            return(feMesh);
        }
示例#6
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static ISurfaceProperty SetShellType(this ISurfaceProperty property, ShellType shellType)
        {
            ISurfaceProperty clone = (ISurfaceProperty)property.GetShallowClone();

            clone.CustomData["ShellType"] = shellType;

            return(clone);
        }
示例#7
0
        public static string IDescription(this ISurfaceProperty property)
        {
            if (property == null)
            {
                return("null property");
            }

            return(Description(property as dynamic));
        }
示例#8
0
        public static bool IsNull(this ISurfaceProperty surfaceProperty, string msg = "", [CallerMemberName] string methodName = "Method")
        {
            if (surfaceProperty == null)
            {
                ErrorMessage(methodName, "SurfaceProperty", msg);
                return(true);
            }

            return(false);
        }
示例#9
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static ISurfaceProperty ApplyModifiers(this ISurfaceProperty prop, double f11 = 1, double f12 = 1, double f22 = 1, double m11 = 1, double m12 = 1, double m22 = 1, double v13 = 1, double v23 = 1, double mass = 1, double weight = 1)
        {
            ISurfaceProperty clone = prop.GetShallowClone() as ISurfaceProperty;

            double[] modifiers = new double[] { f11, f12, f22, m11, m12, m22, v13, v23, mass, weight };

            clone.CustomData["Modifiers"] = modifiers;

            return(clone);
        }
示例#10
0
        /***************************************************/

        public static string DescriptionOrName(this ISurfaceProperty surface)
        {
            if (String.IsNullOrWhiteSpace(surface.Name))
            {
                return(IDescription(surface));
            }
            else
            {
                return(surface.Name);
            }
        }
示例#11
0
        /***************************************************/

        public static double[] Modifiers(this ISurfaceProperty property)
        {
            object modifersObj;

            if (property.CustomData.TryGetValue("Modifiers", out modifersObj))
            {
                return(modifersObj as double[]);
            }

            return(null);
        }
示例#12
0
 public static string DescriptionOrName(this ISurfaceProperty property)
 {
     if (string.IsNullOrWhiteSpace(property.Name))
     {
         return(IDescription(property));
     }
     else
     {
         return(property.Name);
     }
 }
示例#13
0
        public static double[] Modifiers(this ISurfaceProperty property)
        {
            SurfacePropertyModifier modifier = property.FindFragment <SurfacePropertyModifier>();

            if (modifier == null)
            {
                return(null);
            }

            return(new double[] { modifier.FXX, modifier.FXY, modifier.FYY, modifier.MXX, modifier.MXY, modifier.MYY, modifier.VXZ, modifier.VYZ, modifier.Mass, modifier.Weight });
        }
示例#14
0
        /***************************************************/

        private void SetShellType(ISurfaceProperty property, eShellType shellType)
        {
            oM.Adapters.ETABS.ShellType?bhSHellType = ShellTypeToBHoM(shellType);

            if (bhSHellType.HasValue)
            {
                property.Fragments.AddOrReplace(new ShellTypeFragment {
                    ShellType = bhSHellType.Value
                });
            }
        }
示例#15
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel FromRFEM(this rf.Surface surface, ISurfaceProperty surfaceProperty)
        {
            ICurve outline = null;

            string[]       boundLineList = surface.BoundaryLineList.Split(',');
            List <Opening> openings      = null;
            Panel          bhPanel       = Engine.Structure.Create.Panel(outline, openings, surfaceProperty);

            bhPanel.SetAdapterId(typeof(RFEMId), surface.No);

            return(bhPanel);
        }
示例#16
0
        /***************************************************/

        private bool CreateObject(ISurfaceProperty property2d)
        {
            bool success = true;
            int  retA    = 0;

            string propertyName = property2d.Name;// property2d.CustomData[AdapterId].ToString();

            ETABS2016.eShellType shellType = property2d.EtabsShellType();

            if (property2d.GetType() == typeof(Waffle))
            {
                Waffle waffleProperty = (Waffle)property2d;
                m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Waffle, shellType, property2d.Material.Name, waffleProperty.Thickness);
                retA = m_model.PropArea.SetSlabWaffle(propertyName, waffleProperty.TotalDepthX, waffleProperty.Thickness, waffleProperty.StemWidthX, waffleProperty.StemWidthX, waffleProperty.SpacingX, waffleProperty.SpacingY);
            }
            else if (property2d.GetType() == typeof(Ribbed))
            {
                Ribbed ribbedProperty = (Ribbed)property2d;
                m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Ribbed, shellType, property2d.Material.Name, ribbedProperty.Thickness);
                retA = m_model.PropArea.SetSlabRibbed(propertyName, ribbedProperty.TotalDepth, ribbedProperty.Thickness, ribbedProperty.StemWidth, ribbedProperty.StemWidth, ribbedProperty.Spacing, (int)ribbedProperty.Direction);
            }
            else if (property2d.GetType() == typeof(LoadingPanelProperty))
            {
                retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, 0);
            }

            else if (property2d.GetType() == typeof(ConstantThickness))
            {
                ConstantThickness constantThickness = (ConstantThickness)property2d;
                if (constantThickness.PanelType == PanelType.Wall)
                {
                    retA = m_model.PropArea.SetWall(propertyName, ETABS2016.eWallPropType.Specified, shellType, property2d.Material.Name, constantThickness.Thickness);
                }
                else
                {
                    retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, constantThickness.Thickness);
                }
            }


            if (property2d.HasModifiers())
            {
                double[] modifier = property2d.Modifiers();//(double[])property2d.CustomData["Modifiers"];
                m_model.PropArea.SetModifiers(propertyName, ref modifier);
            }

            if (retA != 0)
            {
                success = false;
            }

            return(success);
        }
示例#17
0
        public static Panel Panel(ICurve outline, List <Opening> openings = null, ISurfaceProperty property = null, string name = "")
        {
            if (!outline.IIsClosed())
            {
                return(null);
            }
            List <Edge> externalEdges = outline.ISubParts().Select(x => new Edge {
                Curve = x
            }).ToList();

            return(Panel(externalEdges, openings, property, name));
        }
示例#18
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        public static bool InvalidSurfaceProperty(this ISurfaceProperty surfaceProperty)
        {
            bool isInvalid = true;

            if (surfaceProperty is ConstantThickness)
            {
                isInvalid = false;
            }
            else
            {
                Base.Compute.RecordWarning("Unsupported SurfaceProperty (Waffle, Ribbed or LoadingPanelProperty) assigned to Panel.");
            }

            return(isInvalid);
        }
示例#19
0
        /***************************************************/

        private void SetShellType(ISurfaceProperty prop, eShellType eShellType)
        {
            switch (eShellType)
            {
            case eShellType.ShellThin:
                prop.CustomData["ShellType"] = oM.Adapters.ETABS.ShellType.ShellThin;
                break;

            case eShellType.ShellThick:
                prop.CustomData["ShellType"] = oM.Adapters.ETABS.ShellType.ShellThick;
                break;

            case eShellType.Membrane:
                prop.CustomData["ShellType"] = oM.Adapters.ETABS.ShellType.Membrane;
                break;
            }
        }
示例#20
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ISurfaceProperty> Read2DProperties(List <string> ids = null)
        {
            object[] lusasGeometrics = d_LusasData.getAttributes("Surface Geometric");
            List <ISurfaceProperty> surfaceProperties = new List <ISurfaceProperty>();

            for (int i = 0; i < lusasGeometrics.Count(); i++)
            {
                IFAttribute      lusasGeometric  = (IFAttribute)lusasGeometrics[i];
                ISurfaceProperty surfaceProperty = Adapters.Lusas.Convert.ToSurfaceProperty(lusasGeometric);
                if (surfaceProperty != null)
                {
                    surfaceProperties.Add(surfaceProperty);
                }
            }

            return(surfaceProperties);
        }
示例#21
0
        public static FEMesh FEMesh(Mesh mesh, ISurfaceProperty property = null, Vector localX = null, string name = null)
        {
            if (mesh.IsNull())
            {
                return(null);
            }

            FEMesh feMesh = new FEMesh();

            feMesh.Nodes = mesh.Vertices.Select(x => Node(x)).ToList();

            foreach (Face face in mesh.Faces)
            {
                FEMeshFace feFace = new FEMeshFace();
                feFace.NodeListIndices.Add(face.A);
                feFace.NodeListIndices.Add(face.B);
                feFace.NodeListIndices.Add(face.C);

                if (face.IsQuad())
                {
                    feFace.NodeListIndices.Add(face.D);
                }

                feMesh.Faces.Add(feFace);
            }

            if (property != null)
            {
                feMesh.Property = property;
            }

            if (name != null)
            {
                feMesh.Name = name;
            }

            if (localX != null)
            {
                return(feMesh.SetLocalOrientations(localX));
            }
            else
            {
                return(feMesh);
            }
        }
示例#22
0
        public static bool HasModifiers(this ISurfaceProperty property)
        {
            double[] modifiers = property.Modifiers();

            if (modifiers == null)
            {
                return(false);
            }

            foreach (double modifier in modifiers)
            {
                if (modifier != 1)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#23
0
        /***************************************************/

        public static MeshFace MeshFace(IEnumerable <Node> nodes, ISurfaceProperty property = null, string name = null)
        {
            int nodeCount = nodes.Count();

            if (nodeCount != 3 && nodeCount != 4)
            {
                throw new ArgumentException("Mesh faces only support 3 or 4 nodes");
            }

            MeshFace mf = new MeshFace {
                Nodes = nodes.ToList(), Property = property
            };

            if (name != null)
            {
                mf.Name = name;
            }
            return(mf);
        }
示例#24
0
        public static Panel Panel(ICurve outline, List <ICurve> openings = null, ISurfaceProperty property = null, Vector localX = null, string name = "")
        {
            if (outline.IsNull())
            {
                return(null);
            }
            else if (!outline.IIsClosed())
            {
                Reflection.Compute.RecordError("Outline is not closed. Could not create Panel.");
                return(null);
            }
            List <Opening> pOpenings = openings != null?openings.Select(o => Create.Opening(o)).Where(x => x != null).ToList() : new List <Opening>();

            List <Edge> externalEdges = outline.ISubParts().Select(x => new Edge {
                Curve = x
            }).ToList();

            return(Create.Panel(externalEdges, pOpenings, property, localX, name));
        }
示例#25
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static MeshFace MeshFace(Node n0, Node n1, Node n2, Node n3 = null, ISurfaceProperty property = null, string name = null)
        {
            MeshFace mf = new MeshFace {
                Nodes = new List <Node> {
                    n0, n1, n2
                }, Property = property
            };

            if (n3 != null)
            {
                mf.Nodes.Add(n3);
            }

            if (name != null)
            {
                mf.Name = name;
            }

            return(mf);
        }
示例#26
0
        /***************************************************/
        /***    Helper Methods                           ***/
        /***************************************************/

        private eShellType ShellTypeToCSI(ISurfaceProperty property)
        {
            ShellTypeFragment shelltypeFr = property.FindFragment <ShellTypeFragment>();

            if (shelltypeFr != null)
            {
                switch (shelltypeFr.ShellType)
                {
                case ShellType.ShellThin:
                    return(eShellType.ShellThin);

                case ShellType.ShellThick:
                    return(eShellType.ShellThick);

                case ShellType.Membrane:
                    return(eShellType.Membrane);
                }
            }
            return(eShellType.ShellThin);
        }
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static eShellType EtabsShellType(this ISurfaceProperty panel)
        {
            object obj;

            if (panel.CustomData.TryGetValue("ShellType", out obj) && obj is ShellType)
            {
                switch ((ShellType)obj)
                {
                case ShellType.ShellThin:
                    return(eShellType.ShellThin);

                case ShellType.ShellThick:
                    return(eShellType.ShellThick);

                case ShellType.Membrane:
                    return(eShellType.Membrane);
                }
            }
            return(eShellType.ShellThin);
        }
示例#28
0
        public static Panel Panel(ICurve outline, List <ICurve> openings = null, ISurfaceProperty property = null, string name = "")
        {
            if (!outline.IIsClosed())
            {
                Reflection.Compute.RecordError("Outline not closed. Could not create Panel.");
                return(null);
            }
            List <Opening> pOpenings = openings != null?openings.Select(o => Create.Opening(o)).Where(x => x != null).ToList() : new List <Opening>();

            List <Edge> externalEdges = outline.ISubParts().Select(x => new Edge {
                Curve = x
            }).ToList();

            return(new Panel
            {
                ExternalEdges = externalEdges,
                Openings = pOpenings ?? new List <Opening>(),
                Property = property,
                Name = name
            });
        }
示例#29
0
        public static List <Panel> Panel(List <ICurve> outlines, ISurfaceProperty property = null, Vector localX = null, string name = "")
        {
            if (outlines.IsNullOrEmpty() || outlines.Any(x => x.IsNull()))
            {
                return(null);
            }

            List <Panel> result = new List <Panel>();
            List <List <IElement1D> > outlineEdges = outlines.Select(x => x.ISubParts().Select(y => new Edge {
                Curve = y
            } as IElement1D).ToList()).ToList();

            List <List <List <IElement1D> > > sortedOutlines = outlineEdges.DistributeOutlines(true);

            foreach (List <List <IElement1D> > panelOutlines in sortedOutlines)
            {
                Panel panel = new Panel();
                panel = panel.SetOutlineElements1D(panelOutlines[0]) as Panel;
                List <Opening> openings = new List <Opening>();
                foreach (List <IElement1D> p in panelOutlines.Skip(1))
                {
                    Opening opening = (new Opening()).SetOutlineElements1D(p) as Opening;
                    openings.Add(opening);
                }
                panel.Openings = openings;
                panel.Property = property;
                panel.Name     = name;

                if (localX != null)
                {
                    result.Add(panel.SetLocalOrientation(localX));
                }
                else
                {
                    result.Add(panel);
                }
            }
            return(result);
        }
示例#30
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <ISurfaceProperty> ReadSurfaceProperties(List <string> ids = null)
        {
            List <ISurfaceProperty> surfacePropList = new List <ISurfaceProperty>();


            if (ids == null)
            {
                foreach (rf.Surface surface in modelData.GetSurfaces())
                {
                    IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM();

                    rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo);
                    rf.IOrthotropicThickness ortho     = s.GetOrthotropicThickness();
                    rf.SurfaceStiffness      stiffness = ortho.GetData();

                    ISurfaceProperty surfaceProperty = stiffness.FromRFEM(material);


                    surfacePropList.Add(surfaceProperty);

                    /*
                     * int srfThickId = srfThickness.No;
                     * if (!m_sectionDict.ContainsKey(srfThickId))
                     * {
                     *  m_sectionDict.Add(srfThickId, srfProp);
                     * }
                     */
                }
            }
            else
            {
                foreach (string id in ids)
                {
                }
            }

            return(surfacePropList);
        }