示例#1
0
        private static bool VerifyDesignSection(ref SAPFrameElement elem, SAPSection sec)
        {
            string name = elem.Name;

            mySapModel.SelectObj.PropertyFrame(elem.Name);//Select Frame Element

            SAPDesignStatistics statistics = new SAPDesignStatistics();

            mySapModel.DesignSteel.StartDesign();
            int flag = mySapModel.DesignSteel.VerifyPassed(ref statistics.noVerified, ref statistics.noFailed, ref statistics.noUnchecked, ref statistics.failedElementsNames);

            if (flag != 0)
            {
                //Retrieving Sections Failed
                return(false);
            }
            else
            {
                if (statistics.failedElementsNames.FirstOrDefault(c => c == name) == null)
                {
                    elem.IsDesignPassed = true;
                }
            }
            mySapModel.SelectObj.PropertyFrame(elem.Name, true);//DeSelect Frame Element
            return(true);
        }
示例#2
0
        public static bool AddPointLoad(SAPFrameElement element, SAPPointLoad load)
        {
            int flag = mySapModel.FrameObj.SetLoadPoint(element.Name, load.LoadType.Name, 1, (int)load.LoadDirection, load.Distance, load.Value);

            if (flag != 0)
            {
                load.IsDefinedInSAP = false;
                return(false);
            }
            load.IsDefinedInSAP = true;
            return(true);
        }
示例#3
0
        public static bool AddDistributedLoad(SAPFrameElement element, SAPDistributedLoad load)
        {
            string coordinates = "Global";

            if (load.LoadDirection == HANDAZ.Entities.HndzLoadDirectionEnum.Local1axis || load.LoadDirection == HANDAZ.Entities.HndzLoadDirectionEnum.Local2axis || load.LoadDirection == HANDAZ.Entities.HndzLoadDirectionEnum.Local3axis)
            {
                coordinates = "Local";
            }
            int flag = mySapModel.FrameObj.SetLoadDistributed(element.Name, load.LoadType.Name, 1, (int)load.LoadDirection, load.Dist1, load.Dist2, load.Val1, load.Val2, coordinates, load.IsRelativeDist, load.IsReplacement);

            if (flag != 0)
            {
                load.IsDefinedInSAP = false;
                return(false);
            }
            load.IsDefinedInSAP = true;
            return(true);
        }
示例#4
0
        private static bool GetPointsByElement(ref SAPFrameElement element)
        {
            element.StartPoint = new SAPPoint();
            element.EndPoint   = new SAPPoint();

            int flag = mySapModel.FrameObj.GetPoints(element.name, ref element.StartPoint.name, ref element.EndPoint.name);

            if (flag != 0)
            {
                return(false);
            }
            else
            {
                element.StartPoint = GetPointCoordinates(element.StartPoint.name);
                element.EndPoint   = GetPointCoordinates(element.EndPoint.name);
                return(true);
            }
        }
示例#5
0
        public static SAPFrameElement[] GetAllFrameElements()
        {
            int noElements = 0;

            string[] elementsNames = new string[1]; //Elements Names

            int flag = mySapModel.FrameObj.GetNameList(ref noElements, ref elementsNames);

            if (flag != 0)
            {
                //Failed to retrieve Elements
                return(null);
            }
            SAPFrameElement[] elements = new SAPFrameElement[noElements];
            for (int i = 0; i < noElements; i++)
            {
                elements[i]         = new SAPFrameElement();
                elements[i].Name    = elements[i].Label = elementsNames[i];
                elements[i].Section = GetSectionByElement(elements[i].Name);
                GetPointsByElement(ref elements[i]);
            }
            return(elements);
        }
示例#6
0
        public static bool SetDesignSection(ref SAPFrameElement elem, SAPSection sec)
        {
            VerifyDesignSection(ref elem, elem.Section);
            if (sec.IsDefinedInSAP == false)
            {
                mySapModel.SetModelIsLocked(false);
                // DeleteSection(elem.Section);
                AddSection(sec);
                AnalayzeModel();
            }
            int flag = mySapModel.DesignSteel.SetDesignSection(elem.Name, sec.Name, false);

            if (flag != 0)
            {
                return(false);
            }
            else
            {
                elem.Section = sec;
                VerifyDesignSection(ref elem, sec);
                return(true);
            }
        }
示例#7
0
        public static bool AddFrameElement(SAPFrameElement element)
        {
            int flag;

            if (element.StartPoint.IsDefinedInSAP == false)
            {
                SetPoint(element.StartPoint);
            }
            if (element.EndPoint.IsDefinedInSAP == false)
            {
                SetPoint(element.EndPoint);
            }
            if (element.Section != null)
            {
                if (element.Section.IsDefinedInSAP == false)
                {
                    AddSection(element.Section);
                }
                flag = mySapModel.FrameObj.AddByPoint(element.StartPoint.Name, element.EndPoint.Name, ref element.name, element.Section.Name, element.Label);
            }
            else
            {
                flag = mySapModel.FrameObj.AddByPoint(element.StartPoint.Name, element.EndPoint.Name, ref element.name);
            }
            if (flag != 0)
            {
                element.IsDefinedInSAP = false;
                return(false);
            }
            element.IsDefinedInSAP = true;
            mySapModel.View.RefreshView(0, false);
            mySapModel.View.RefreshView(1, false);


            return(true);
        }
示例#8
0
        //Implemented in the interface part
        #endregion
        #region Analysis Results
        public static SAPAnalysisResults GetFrameElementAnalysisResults(IEnumerable <SAPLoadCombination> combos, SAPFrameElement elem, bool isEnvelope = false)
        {
            int flag = mySapModel.Results.Setup.DeselectAllCasesAndCombosForOutput();

            foreach (SAPLoadCombination combo in combos)
            {
                if (combo.IsDefinedInSAP == false)
                {
                    AddLoadCombination(combo);
                }
                flag = mySapModel.Results.Setup.SetComboSelectedForOutput(combo.Name, true);
                if (flag != 0)
                {
                    return(null);
                }
            }
            SAPAnalysisResults res;

            if (isEnvelope == false)
            {
                res = elem.AnalysisResults = new SAPAnalysisResults();
            }
            else
            {
                res = elem.AnalysisResultsEnvelope = new SAPAnalysisResults();
            }
            flag = mySapModel.Results.FrameForce(elem.Name, eItemTypeElm.ObjectElm, ref res.numberResults, ref res.frameText, ref res.station, ref res.elementText, ref res.elementStation,
                                                 ref res.loadCase, ref res.stepType, ref res.stepNum, ref res.axial, ref res.shear2, ref res.shear3, ref res.tortionalMoment, ref res.moment2, ref res.moment3);
            if (flag != 0)
            {
                return(null);
            }
            return(res);
        }
示例#9
0
        public static bool DesignSteelModel(string codeName, ref SAPDesignStatistics statistics, bool ToChangeSections, params IEnumerable <SAPFrameElement>[] elements)
        {
            // List<SAPITaperedSection> sectionsInventory = new List<SAPITaperedSection>();

            int flag = mySapModel.DesignSteel.SetCode(codeName); //Setting the design Code

            AddDesignDefaultCombos(eMatType.Steel);
            flag = mySapModel.DesignSteel.StartDesign();//Starting the design process
            if (flag != 0)
            {
                //Design Failed
                return(false);
            }
            else
            {
                //A Question to be answered, should we use here verify passed or verify sections
                flag = mySapModel.DesignSteel.VerifyPassed(ref statistics.noVerified, ref statistics.noFailed, ref statistics.noUnchecked, ref statistics.failedElementsNames);
            }
            if (flag != 0)
            {
                //Retrieving Sections Failed
                return(false);
            }
            else
            {
                //Changing Flags
                foreach (IEnumerable <SAPFrameElement> param in elements)
                {
                    foreach (string name in statistics.failedElementsNames)
                    {
                        //TODO: Optimizing search algorithm here is important
                        SAPFrameElement element = param.FirstOrDefault(c => c.Name == name);
                        if (element != null)
                        {
                            element.IsDesignPassed = false;
                            if (ToChangeSections == true)
                            {
                                //sectionsInventory.Add((SAPITaperedSection)element.Section);
                                //int k = 0;
                                //while (sectionsInventory[k]!=null)
                                //{
                                //    sectionsInventory.Add(sectionsInventory[k]);
                                //    k++;
                                //    mySapModel.SetModelIsLocked(false);
                                //    AddSection(sectionsInventory[k]);
                                //}
                                //AnalayzeModel();
                                int  iterationsNo = 0;
                                bool flagD        = true;
                                while (element.IsDesignPassed == false && iterationsNo < 30)
                                {
                                    SAPSection sec = element.Section.GetAssumedSection();
                                    if (sec == null || element.Section == sec || flagD == false)
                                    {
                                        flagD = true;
                                        break;
                                    }
                                    SAPSection sapSec = GetSection(sec);
                                    if (sapSec != null)
                                    {
                                        sec = sapSec;
                                    }
                                    flagD = SetDesignSection(ref element, sec);
                                    iterationsNo++;
                                }
                            }
                        }
                    }
                    foreach (SAPFrameElement element in param)
                    {
                        if (element.IsDesignPassed == null)
                        {
                            element.IsDesignPassed = true;
                        }
                    }
                }

                //    flag = mySapModel.DesignSteel.VerifySections(ref statistics.noDesigned, ref statistics.changedElementsNames);
                //}
                //if (flag != 0)
                //{
                //    //Retrieving changed sections failed
                //    return false;
                //}
                //else if (statistics.ChangedElementsNames[0] != null)
                //{
                //    foreach (IEnumerable<SAPFrameElement> param in elements)
                //    {
                //        foreach (string name in statistics.ChangedElementsNames)
                //        {
                //            SAPSection section = param.FirstOrDefault(c => c.Name == name).Section;
                //            if (section != null)
                //            {
                //                section = GetSection(section);
                //            }
                //        }
                //    }
                //}
                return(true);
            }
        }