Exemplo n.º 1
0
        /***************************************************/
        /***    Create Methods                           ***/
        /***************************************************/

        private bool CreateObject(Diaphragm diaphragm)
        {
            bool sucess = true;

            sucess &= m_model.Diaphragm.SetDiaphragm(diaphragm.Name, diaphragm.Rigidity == oM.Adapters.ETABS.DiaphragmType.SemiRigidDiaphragm) == 0;

            return(sucess);
        }
Exemplo n.º 2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetDiaphragm(this Panel panel, Diaphragm diaphragm)
        {
            Panel clone = (Panel)panel.GetShallowClone();

            clone.CustomData["EtabsDiaphragm"] = diaphragm;

            return(clone);
        }
Exemplo n.º 3
0
        /***************************************************/
        /**** Update Panel                              ****/
        /***************************************************/

        private bool UpdateObjects(IEnumerable <Panel> bhPanels)
        {
            //Make sure Diaphragms are pushed
            List <Diaphragm> diaphragms = bhPanels.Select(x => x.Diaphragm()).Where(x => x != null).ToList();

            this.FullCRUD(diaphragms, PushType.FullPush);

            bool success = true;

            m_model.SelectObj.ClearSelection();

            foreach (Panel bhPanel in bhPanels)
            {
                string name         = GetAdapterId <string>(bhPanel);
                string propertyName = GetAdapterId <string>(bhPanel.Property);

                Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry of panels. This includes the external edges as well as the openings. To update the panel geometry, delete the existing panel you want to update and create a new one.");

                m_model.AreaObj.SetProperty(name, propertyName);

                //Set local orientations:
                Basis orientation = bhPanel.LocalOrientation();
                m_model.AreaObj.SetLocalAxes(name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y));

                Pier      pier      = bhPanel.Pier();
                Spandrel  spandrel  = bhPanel.Spandrel();
                Diaphragm diaphragm = bhPanel.Diaphragm();

                if (pier != null)
                {
                    int ret = m_model.PierLabel.SetPier(pier.Name);
                    ret = m_model.AreaObj.SetPier(name, pier.Name);
                }
                if (spandrel != null)
                {
                    int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false);
                    ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name);
                }
                if (diaphragm != null)
                {
                    m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
                }
            }

            //Force refresh to make sure panel local orientation are set correctly
            ForceRefresh();

            return(success);
        }
Exemplo n.º 4
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetDiaphragm(this Panel panel, Diaphragm diaphragm)
        {
            panel.Fragments.AddOrReplace(diaphragm);
            return(panel);
        }
Exemplo n.º 5
0
        /***************************************************/
        /***    Create Methods                           ***/
        /***************************************************/

        private bool CreateObject(Panel bhPanel)
        {
            bool success = true;
            int  retA    = 0;

            double mergeTol = 1e-3; //Merging panel points to the mm, same behaviour as the default node comparer

            if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges, true))
            {
                return(false);
            }

            for (int i = 0; i < bhPanel.ExternalEdges.Count; i++)
            {
                if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges[i], true))
                {
                    return(false);
                }

                if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges[i].Curve, true))
                {
                    return(false);
                }
            }

            NonLinearEdgesCheck(bhPanel.ExternalEdges);

            string name         = "";
            string propertyName = "";

            if (CheckPropertyWarning(bhPanel, bhP => bhP.Property))
            {
                propertyName = GetAdapterId <string>(bhPanel.Property);
            }

            List <BH.oM.Geometry.Point> boundaryPoints = bhPanel.ControlPoints(true).CullDuplicates(mergeTol);

            int segmentCount = boundaryPoints.Count();

            double[] x = new double[segmentCount];
            double[] y = new double[segmentCount];
            double[] z = new double[segmentCount];
            for (int i = 0; i < segmentCount; i++)
            {
                x[i] = boundaryPoints[i].X;
                y[i] = boundaryPoints[i].Y;
                z[i] = boundaryPoints[i].Z;
            }

            retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, propertyName);
            ETABSId etabsid = new ETABSId();

            etabsid.Id = name;

            //Label and story
            string label = "";
            string story = "";
            string guid  = null;

            if (m_model.AreaObj.GetLabelFromName(name, ref label, ref story) == 0)
            {
                etabsid.Label = label;
                etabsid.Story = story;
            }

            if (m_model.AreaObj.GetGUID(name, ref guid) == 0)
            {
                etabsid.PersistentId = guid;
            }

            bhPanel.SetAdapterId(etabsid);

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

            if (bhPanel.Openings != null)
            {
                for (int i = 0; i < bhPanel.Openings.Count; i++)
                {
                    if (!CheckPropertyError(bhPanel, bhP => bhP.Openings[i]))
                    {
                        continue;
                    }

                    Opening opening = bhPanel.Openings[i];

                    for (int j = 0; j < opening.Edges.Count; j++)
                    {
                        if (!CheckPropertyError(opening, o => o.Edges[j], true))
                        {
                            return(false);
                        }

                        if (!CheckPropertyError(opening, o => o.Edges[j], true))
                        {
                            return(false);
                        }
                    }

                    NonLinearEdgesCheck(opening.Edges);

                    boundaryPoints = opening.ControlPoints().CullDuplicates(mergeTol);

                    segmentCount = boundaryPoints.Count();
                    x            = new double[segmentCount];
                    y            = new double[segmentCount];
                    z            = new double[segmentCount];

                    for (int j = 0; j < segmentCount; j++)
                    {
                        x[j] = boundaryPoints[j].X;
                        y[j] = boundaryPoints[j].Y;
                        z[j] = boundaryPoints[j].Z;
                    }

                    string openingName = name + "_Opening_" + i;
                    m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "");//<-- setting panel property to empty string, verify that this is correct
                    m_model.AreaObj.SetOpening(openingName, true);

                    SetAdapterId(bhPanel.Openings[i], openingName);
                }
            }

            //Set local orientations:
            Basis orientation = bhPanel.LocalOrientation();

            m_model.AreaObj.SetLocalAxes(name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y));

            Pier      pier      = bhPanel.Pier();
            Spandrel  spandrel  = bhPanel.Spandrel();
            Diaphragm diaphragm = bhPanel.Diaphragm();

            if (pier != null)
            {
                int ret = m_model.PierLabel.SetPier(pier.Name);
                ret = m_model.AreaObj.SetPier(name, pier.Name);
            }
            if (spandrel != null)
            {
                int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false);
                ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name);
            }
            if (diaphragm != null)
            {
                m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
            }
            return(success);
        }
Exemplo n.º 6
0
        /***************************************************/

        private bool CreateObject(Panel bhPanel)
        {
            bool success = true;
            int  retA    = 0;

            double mergeTol = 1e-3; //Merging panel points to the mm, same behaviour as the default node comparer

            string name         = bhPanel.CustomData[AdapterId].ToString();
            string propertyName = bhPanel.Property.Name;
            List <BH.oM.Geometry.Point> boundaryPoints = bhPanel.ControlPoints(true).CullDuplicates(mergeTol);

            int segmentCount = boundaryPoints.Count();

            double[] x = new double[segmentCount];
            double[] y = new double[segmentCount];
            double[] z = new double[segmentCount];
            for (int i = 0; i < segmentCount; i++)
            {
                x[i] = boundaryPoints[i].X;
                y[i] = boundaryPoints[i].Y;
                z[i] = boundaryPoints[i].Z;
            }

            retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, propertyName);

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

            if (bhPanel.Openings != null)
            {
                for (int i = 0; i < bhPanel.Openings.Count; i++)
                {
                    boundaryPoints = bhPanel.Openings[i].ControlPoints().CullDuplicates(mergeTol);

                    segmentCount = boundaryPoints.Count();
                    x            = new double[segmentCount];
                    y            = new double[segmentCount];
                    z            = new double[segmentCount];

                    for (int j = 0; j < segmentCount; j++)
                    {
                        x[j] = boundaryPoints[j].X;
                        y[j] = boundaryPoints[j].Y;
                        z[j] = boundaryPoints[j].Z;
                    }

                    string openingName = name + "_Opening_" + i;
                    m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "");//<-- setting panel property to empty string, verify that this is correct
                    m_model.AreaObj.SetOpening(openingName, true);
                }
            }


            Diaphragm diaphragm = bhPanel.Diaphragm();

            if (diaphragm != null)
            {
                m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
            }

            return(success);
        }