/***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetSpandrel(this Panel panel, Spandrel spandrel)
        {
            Panel clone = (Panel)panel.GetShallowClone();

            clone.CustomData["EtabsSpandrel"] = spandrel;

            return(clone);
        }
示例#2
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);
        }
        private bool UpdateObjects(IEnumerable <Panel> bhPanels)
        {
            bool sucess = true;

            foreach (Panel bhPanel in bhPanels)
            {
                Pier          pier     = bhPanel.Pier();
                Spandrel      spandrel = bhPanel.Spandrel();
                List <string> pl       = new List <string>();
                string        name     = bhPanel.CustomData[AdapterId].ToString();

                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);
                }
            }
            return(sucess);
        }
 /// <summary>
 /// Removes the spandrel label assignment of the object.
 /// </summary>
 /// <param name="app">The application.</param>
 protected void removeSpandrel(ISpandrel app)
 {
     app.SetSpandrel(Name, Constants.NONE);
     _spandrelName = string.Empty;
     _spandrel     = null;
 }
 /// <summary>
 /// Adds the pier label assignment of the object.
 /// </summary>
 /// <param name="app">The application.</param>
 /// <param name="spandrel">The spandrel assignment.</param>
 protected void addSpandrel(ISpandrel app, Spandrel spandrel)
 {
     app.SetSpandrel(Name, spandrel.Name);
     _spandrelName = spandrel.Name;
     _spandrel     = spandrel;
 }
 /// <summary>
 /// Adds the spandrel label assignment to the object.
 /// Any existing spandrel label is replaced.
 /// </summary>
 /// <param name="spandrel">The spandrel assignment.</param>
 public abstract void AddToSpandrel(Spandrel spandrel);
示例#7
0
 /// <summary>
 /// Removes the spandrel label assignment of the object.
 /// </summary>
 /// <param name="app">The application.</param>
 protected void removeSpandrel(ISpandrel app)
 {
     app.SetSpandrel(Name, Constants.None);
     Spandrel = null;
 }
示例#8
0
 /// <summary>
 /// Retrieves the spandrel label assignments of an object.
 /// </summary>
 /// <param name="app">The application.</param>
 protected void getSpandrel(ISpandrel app)
 {
     Spandrel = Spandrel.Factory(app.GetSpandrel(Name));
 }
示例#9
0
 /// <summary>
 /// Adds the spandrel label assignment to the object.
 /// Any existing spandrel label is replaced.
 /// </summary>
 /// <param name="spandrel">The spandrel assignment.</param>
 public override void AddToSpandrel(Spandrel spandrel)
 {
     addSpandrel(_frameObject, spandrel);
 }
示例#10
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetSpandrel(this Panel panel, Spandrel spandrel)
        {
            panel.Fragments.AddOrReplace(spandrel);
            return(panel);
        }
示例#11
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);
        }
 /// <summary>
 /// Removes the spandrel label assignment of the object.
 /// </summary>
 protected void removeSpandrel()
 {
     _spandrelName = string.Empty;
     _spandrel     = null;
 }
 /// <summary>
 /// Adds the pier label assignment of the object.
 /// </summary>
 /// <param name="spandrel">The spandrel assignment.</param>
 protected void addSpandrel(Spandrel spandrel)
 {
     _spandrelName = spandrel.Name;
     _spandrel     = spandrel;
 }