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

        private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null)
        {
            List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>();

            Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x));

            int nameCount = 0;

            string[] nameArr = { };
            m_model.PropArea.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);

            foreach (string id in ids)
            {
                eSlabType     slabType        = eSlabType.Slab;
                eShellType    shellType       = eShellType.ShellThin;
                eWallPropType wallType        = eWallPropType.Specified;
                string        material        = "";
                double        thickness       = 0;
                int           colour          = 0;
                string        notes           = "";
                string        guid            = null;
                double        depth           = 0;
                double        stemWidthTop    = 0;
                double        stemWidthBottom = 0;//not used
                double        ribSpacing      = 0;
                double        ribSpacing2nd   = 0;
                int           direction       = 0;
                double[]      modifiers       = new double[] { };


                int ret = m_model.PropArea.GetSlab(id, ref slabType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid);
                if (ret != 0)
                {
                    m_model.PropArea.GetWall(id, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid);
                }

                SurfacePropertyModifier modifier = null;
                if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0 && modifiers != null && modifiers.Length == 10 && modifiers.Any(x => x != 1))
                {
                    modifier = new SurfacePropertyModifier
                    {
                        FXX    = modifiers[0],
                        FYY    = modifiers[1],
                        FXY    = modifiers[2],
                        MXX    = modifiers[3],
                        MYY    = modifiers[4],
                        MXY    = modifiers[5],
                        VXZ    = modifiers[6],
                        VYZ    = modifiers[7],
                        Mass   = modifiers[8],
                        Weight = modifiers[9]
                    };
                }

                IMaterialFragment bhMaterial = null;

                try
                {
                    bhMaterial = bhomMaterials[material];
                }
                catch (Exception)
                {
                    Engine.Base.Compute.RecordNote("Could not get material from ETABS. Material for surface property " + id + " will be null");
                }

                if (wallType == eWallPropType.AutoSelectList)
                {
                    string[] propList        = null;
                    string   currentProperty = "";

                    m_model.PropArea.GetWallAutoSelectList(id, ref propList, ref currentProperty);
                    m_model.PropArea.GetWall(currentProperty, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid);

                    ConstantThickness panelConstant = new ConstantThickness();
                    panelConstant.Name      = currentProperty;
                    panelConstant.Material  = bhMaterial;
                    panelConstant.Thickness = thickness;
                    panelConstant.PanelType = PanelType.Wall;
                    SetShellType(panelConstant, shellType);
                    if (modifier != null)
                    {
                        panelConstant.Fragments.Add(modifier);
                    }

                    SetAdapterId(panelConstant, id);
                    propertyList.Add(panelConstant);
                }
                else
                {
                    switch (slabType)
                    {
                    case eSlabType.Ribbed:
                        Ribbed panelRibbed = new Ribbed();

                        m_model.PropArea.GetSlabRibbed(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref direction);
                        panelRibbed.Name       = id;
                        panelRibbed.Material   = bhMaterial;
                        panelRibbed.Thickness  = thickness;
                        panelRibbed.PanelType  = PanelType.Slab;
                        panelRibbed.Direction  = (PanelDirection)direction;
                        panelRibbed.Spacing    = ribSpacing;
                        panelRibbed.StemWidth  = stemWidthTop;
                        panelRibbed.TotalDepth = depth;
                        SetShellType(panelRibbed, shellType);
                        if (modifier != null)
                        {
                            panelRibbed.Fragments.Add(modifier);
                        }

                        SetAdapterId(panelRibbed, id);
                        propertyList.Add(panelRibbed);
                        break;

                    case eSlabType.Waffle:
                        Waffle panelWaffle = new Waffle();

                        m_model.PropArea.GetSlabWaffle(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref ribSpacing2nd);
                        panelWaffle.Name        = id;
                        panelWaffle.Material    = bhMaterial;
                        panelWaffle.SpacingX    = ribSpacing;
                        panelWaffle.SpacingY    = ribSpacing2nd;
                        panelWaffle.StemWidthX  = stemWidthTop;
                        panelWaffle.StemWidthY  = stemWidthTop;    //ETABS does not appear to support direction dependent stem width
                        panelWaffle.Thickness   = thickness;
                        panelWaffle.TotalDepthX = depth;
                        panelWaffle.TotalDepthY = depth;     // ETABS does not appear to to support direction dependent depth
                        panelWaffle.PanelType   = PanelType.Slab;
                        SetShellType(panelWaffle, shellType);
                        if (modifier != null)
                        {
                            panelWaffle.Fragments.Add(modifier);
                        }

                        SetAdapterId(panelWaffle, id);
                        propertyList.Add(panelWaffle);
                        break;

                    case eSlabType.Slab:
                    case eSlabType.Drop:
                    case eSlabType.Stiff_DO_NOT_USE:
                    default:
                        ConstantThickness panelConstant = new ConstantThickness();
                        panelConstant.Name      = id;
                        panelConstant.Material  = bhMaterial;
                        panelConstant.Thickness = thickness;
                        panelConstant.Name      = id;
                        panelConstant.PanelType = PanelType.Slab;
                        SetShellType(panelConstant, shellType);
                        if (modifier != null)
                        {
                            panelConstant.Fragments.Add(modifier);
                        }

                        SetAdapterId(panelConstant, id);
                        propertyList.Add(panelConstant);
                        break;
                    }
                }
            }

            return(propertyList);
        }
Ejemplo n.º 4
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null)
        {
            List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>();

            Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x));

            int nameCount = 0;

            string[] nameArr = { };
            m_model.PropArea.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);

            foreach (string id in ids)
            {
                int       shellType          = 0;
                bool      includeDrillingDOF = true;
                string    materialName       = "";
                double    matAng             = 0;
                double    thickness          = 0;
                double    bending            = 0;
                int       color     = 0;
                string    notes     = "";
                string    guid      = null;
                SAP2000Id sap2000id = new SAP2000Id();
                sap2000id.Id = id;


                if (m_model.PropArea.GetShell_1(id, ref shellType, ref includeDrillingDOF, ref materialName, ref matAng, ref thickness, ref bending, ref color, ref notes, ref guid) != 0)
                {
                    Engine.Base.Compute.RecordWarning($"Error while pulling Surface Property {id}. Check results carefully.");
                }

                ConstantThickness bhSurfProp = new ConstantThickness();

                bhSurfProp.Name      = id;
                bhSurfProp.Thickness = thickness;
                bhSurfProp.CustomData.Add("MaterialAngle", matAng);
                bhSurfProp.CustomData.Add("BendingThickness", bending);
                bhSurfProp.CustomData.Add("Color", color);
                bhSurfProp.CustomData.Add("Notes", notes);
                bhSurfProp.CustomData.Add("GUID", guid);

                IMaterialFragment bhMat = new GenericIsotropicMaterial();
                bhomMaterials.TryGetValue(materialName, out bhMat);
                bhSurfProp.Material = bhMat;

                double[] modifiers = new double[6];

                if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0)
                {
                    SurfacePropertyModifier modifier = new SurfacePropertyModifier
                    {
                        FXX    = modifiers[0],
                        FYY    = modifiers[1],
                        FXY    = modifiers[2],
                        MXX    = modifiers[3],
                        MYY    = modifiers[4],
                        MXY    = modifiers[5],
                        VXZ    = modifiers[6],
                        VYZ    = modifiers[7],
                        Mass   = modifiers[8],
                        Weight = modifiers[9]
                    };
                    bhSurfProp.Fragments.Add(modifier);
                }

                bhSurfProp.SetAdapterId(sap2000id);
                propertyList.Add(bhSurfProp);
            }

            return(propertyList);
        }
Ejemplo n.º 5
0
        /***************************************************/
        /**** Private Methods                            ****/
        /***************************************************/
        private bool CreateObject(ISurfaceProperty surfaceProperty)
        {
            string propName = surfaceProperty.DescriptionOrName();
            string matName  = "Default";

            if (surfaceProperty.Material != null)
            {
                matName = GetAdapterId <string>(surfaceProperty.Material);
            }
            else
            {
                Engine.Base.Compute.RecordWarning($"SurfaceProperty {propName} had no material defined. Using a default material.");
            }

            SAP2000Id sap2000id = new SAP2000Id();

            if (surfaceProperty.GetType() == typeof(Waffle))
            {
                // not implemented!
                CreatePropertyError("Waffle Not Implemented!", "Panel", propName);
            }
            else if (surfaceProperty.GetType() == typeof(Ribbed))
            {
                // not implemented!
                CreatePropertyError("Ribbed Not Implemented!", "Panel", propName);
            }
            else if (surfaceProperty.GetType() == typeof(LoadingPanelProperty))
            {
                // not implemented!
                CreatePropertyError("Loading Panel Not Implemented!", "Panel", propName);
            }
            else if (surfaceProperty.GetType() == typeof(ConstantThickness))
            {
                ConstantThickness constantThickness = (ConstantThickness)surfaceProperty;
                int  shellType          = 1;
                bool includeDrillingDOF = true;
                if (m_model.PropArea.SetShell_1(propName, shellType, includeDrillingDOF, matName, 0, constantThickness.Thickness, constantThickness.Thickness) != 0)
                {
                    CreatePropertyError("ConstantThickness", "SurfaceProperty", propName);
                }
            }

            sap2000id.Id = propName;
            surfaceProperty.SetAdapterId(sap2000id);

            SurfacePropertyModifier modifier = surfaceProperty.FindFragment <SurfacePropertyModifier>();

            if (modifier != null)
            {
                double[] modifiers = new double[]
                {
                    modifier.FXX,
                    modifier.FYY,
                    modifier.FXY,
                    modifier.MXX,
                    modifier.MYY,
                    modifier.MXY,
                    modifier.VXZ,
                    modifier.VYZ,
                    modifier.Mass,
                    modifier.Weight
                };

                if (m_model.PropArea.SetModifiers(propName, ref modifiers) != 0)
                {
                    CreatePropertyError("Modifiers", "SurfaceProperty", propName);
                }
            }

            return(true);
        }
Ejemplo n.º 6
0
        /***************************************************/
        /***    Create Methods                           ***/
        /***************************************************/

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

            string propertyName = property2d.DescriptionOrName();

            SetAdapterId(property2d, propertyName);

            string materialName = "";

            if (CheckPropertyWarning(property2d, p => p.Material))
            {
                materialName = GetAdapterId <string>(property2d.Material) ?? "";
            }

            eShellType shellType = ShellTypeToCSI(property2d);

            if (property2d.GetType() == typeof(Waffle))
            {
                Waffle waffleProperty = (Waffle)property2d;
                m_model.PropArea.SetSlab(propertyName, eSlabType.Waffle, shellType, materialName, 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, eSlabType.Ribbed, shellType, materialName, 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, eSlabType.Slab, shellType, materialName, 0);
            }
            else if (property2d.GetType() == typeof(ConstantThickness))
            {
                ConstantThickness constantThickness = (ConstantThickness)property2d;
                if (constantThickness.PanelType == PanelType.Wall)
                {
                    retA = m_model.PropArea.SetWall(propertyName, eWallPropType.Specified, shellType, materialName, constantThickness.Thickness);
                }
                else
                {
                    retA = m_model.PropArea.SetSlab(propertyName, eSlabType.Slab, shellType, materialName, constantThickness.Thickness);
                }
            }

            SurfacePropertyModifier modifier = property2d.FindFragment <SurfacePropertyModifier>();

            if (modifier != null)
            {
                double[] modifiers = new double[] { modifier.FXX, modifier.FYY, modifier.FXY, modifier.MXX, modifier.MYY, modifier.MXY, modifier.VXZ, modifier.VYZ, modifier.Mass, modifier.Weight };
                m_model.PropArea.SetModifiers(propertyName, ref modifiers);
            }

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

            return(success);
        }