private void DesignBtn_Click(object sender, RoutedEventArgs e)
        {
            int bindex = 0;

            foreach (var item in xbeams)
            {
                //clear all case and combo output selections:
                int ret1 = mySapModel.MySapObjectModel.Results.Setup.DeselectAllCasesAndCombosForOutput();

                //set case and combo output selections
                int ret2 = mySapModel.MySapObjectModel.Results.Setup.SetComboSelectedForOutput(designComboComboBox.SelectedItem as string);



                xbeams[bindex].FrameResults.Add(new SapFrameResult(mySapModel.MySapObjectModel, item.Label));

                //add sections created:
                xbeams[bindex].Sec.Add(B);
                bindex++;
            }
            /*----------------------------------------------------------*/
            //Design:
            double fcu       = Convert.ToDouble(fcutxtBox.Text);
            double fy        = Convert.ToDouble(fytxtBox.Text);
            double fystr     = Convert.ToDouble(fstirtxtBox.Text);
            int    nBranches = Convert.ToInt32(nBranchestxtBox.Text);

            BeamDesign design = new BeamDesign(xbeams, fy, fystr, fcu, nBranches);
        }
Example #2
0
        private void btn_oprn_report_Click(object sender, EventArgs e)
        {
            int r = -1;

            if (dgv_beams.SelectedCells.Count == 0)
            {
                return;
            }

            List <int> list_rows = new List <int>();

            int i = 0;
            //for (i = 0; i < dgv_beams.SelectedCells.Count; i++)
            //{
            //    list_rows.Add(dgv_beams.SelectedCells[i].RowIndex);
            //}
            bool fl = false;

            for (i = 0; i < dgv_beams.RowCount; i++)
            {
                fl = (bool)dgv_beams[1, i].Value;
                if (fl)
                {
                    list_rows.Add(i);
                }
            }



            list_rows.Sort();
            string f = "";


            List <string> list = new List <string>();

            list.AddRange(BeamDesign.Get_Banner());
            foreach (var item in list_rows)
            {
                r = item;

                f = beamDes.Get_Report_File(r + 1);

                if (File.Exists(f))
                {
                    list.AddRange(File.ReadAllLines(f));
                }
                else
                {
                    MessageBox.Show(this, string.Format("Design is not done for the selected Beam {0}.", dgv_beams[1, r].Value));
                }
            }
            if (list.Count > 0)
            {
                File.WriteAllLines(beamDes.Report_File, list.ToArray());

                f = beamDes.Report_File;

                if (File.Exists(f))
                {
                    frmASTRAReport.OpenReport(f, this);
                }
                else
                {
                    MessageBox.Show(this, "Design is not done for the selected Beam(s).");
                }
            }
        }
Example #3
0
        public static HndzFrameSingleBay3D AssembleSections(HndzFrameSingleBay3D Frame3d)
        {
            double Fy             = 2.4;
            double LUSupportedSap = 4.11;
            double Kfactor        = 2;
            //==========================
            double KfactorBeamEnd   = 0.7;
            double KfactorBeamStart = 0.65;
            //=======================

            double PurlinSpacing = Frame3d.PurlinSpacing / 1000;

            //
            foreach (HndzFrameSingleBay2D Frame in Frame3d.Frames2D)
            {
                //===========================
                //=======================
                //Has to Get it form an algorithm in sap
                //Kfactor Needs to Be calculated from InterActrion Diagrams - 2 For worst Case
                //What i want
                // Analysis Result at start and and end
                //Whats my Name ? Gecko

                double BeamLength   = Frame.LeftBeam.ExtrusionLine.RhinoLine.Length / 1000;
                double ColumnHeight = Frame.LeftColumn.ExtrusionLine.RhinoLine.Length / 1000;
                //=================
                double Lbin         = ColumnHeight;
                double Lbout        = ColumnHeight;
                double LUnsupported = ColumnHeight * 100 / 2;

                HndzAnalysisResults RColStartMax = Frame.LeftColumn.AnalysisResults[0];
                HndzAnalysisResults RColMidMax   = Frame.LeftColumn.AnalysisResults[1];
                HndzAnalysisResults RColEndMax   = Frame.LeftColumn.AnalysisResults[2];

                HndzAnalysisResults RColStartMin = Frame.LeftColumn.AnalysisResults[3];
                HndzAnalysisResults RColMidMin   = Frame.LeftColumn.AnalysisResults[4];
                HndzAnalysisResults RColEndMin   = Frame.LeftColumn.AnalysisResults[5];

                HndzAnalysisResults RBeamStartMax = Frame.LeftColumn.AnalysisResults[0];
                HndzAnalysisResults RBeamMidMax   = Frame.LeftColumn.AnalysisResults[1];
                HndzAnalysisResults RBeamEndMax   = Frame.LeftColumn.AnalysisResults[2];

                HndzAnalysisResults RBeamStartMin = Frame.LeftColumn.AnalysisResults[3];
                HndzAnalysisResults RBeamMidMin   = Frame.LeftColumn.AnalysisResults[4];
                HndzAnalysisResults RBeamEndMin   = Frame.LeftColumn.AnalysisResults[5];
                //=============================================
                //HndzAnalysisResults RBeamEnd = Frame.LeftBeam.AnalysisResults[1];
                //HndzAnalysisResults RBeamStart = Frame.LeftBeam.AnalysisResults[0];
                //==================================
                //station 0 = 0 ,3
                //station 1 = 2 , 5
                //============================

                //foreach (HndzAnalysisResults RColEnd in Frame.LeftBeam.AnalysisResults)
                //{
                SectionI ColEstimated = CrossSectionCalulator.CalculateColumnSection(CrossSectionCalulator.SteelGrade.st37, ColumnHeight, RColStartMax.Axial, RColEndMax.Moment3);

                SectionI ColEndMax = BeamColumnDesign.DesignEnd(ColEstimated.d, ColEstimated.t_w, ColEstimated.b_fTop, ColEstimated.t_fTop,
                                                                ColEstimated.b_fBot, ColEstimated.t_fBot, RColEndMax.Axial, RColStartMax.Moment3, RColEndMax.Moment3, Fy,
                                                                LUnsupported, Kfactor, Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway,
                                                                BeamColumnDesign.SteelGrade.st37, BeamColumnDesign.LoadingType.Case2);
                SectionI ColStartMax = CrossSectionCalulator.SectionTaperedColumn(ColEndMax);


                ColStartMax = BeamColumnDesign.DesignStart(ColStartMax.d, ColStartMax.t_w, ColStartMax.b_fTop, ColStartMax.t_fTop, ColStartMax.b_fBot,
                                                           ColStartMax.t_fBot, RColStartMax.Axial, RColStartMax.Moment3, RColEndMax.Moment3, Fy, LUnsupported, Kfactor,
                                                           Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway, BeamColumnDesign.SteelGrade.st37,
                                                           BeamColumnDesign.LoadingType.Case2);

                ColStartMax = CrossSectionCalulator.PostProcessing(ColStartMax);
                ColEndMax   = CrossSectionCalulator.PostProcessing(ColEndMax);
                //=======================================================



                //HndzISectionProfile Start = new HndzISectionProfile(ColStartMax);
                //HndzISectionProfile End = new HndzISectionProfile(ColEndMax);

                //HndzITaperedProfile ColumnTaperedSectionMax = new HndzITaperedProfile(Start, End);

                //======================================
                SectionI ColEstimatedMin = CrossSectionCalulator.CalculateColumnSection(CrossSectionCalulator.SteelGrade.st37, ColumnHeight, RColStartMax.Axial, RColEndMax.Moment3);

                SectionI ColEndMin = BeamColumnDesign.DesignEnd(ColEstimatedMin.d, ColEstimatedMin.t_w, ColEstimatedMin.b_fTop, ColEstimatedMin.t_fTop,
                                                                ColEstimatedMin.b_fBot, ColEstimatedMin.t_fBot, RColEndMin.Axial, RColStartMin.Moment3, RColEndMin.Moment3, Fy,
                                                                LUnsupported, Kfactor, Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway,
                                                                BeamColumnDesign.SteelGrade.st37, BeamColumnDesign.LoadingType.Case2);
                SectionI ColStartMin = CrossSectionCalulator.SectionTaperedColumn(ColEndMin);


                ColStartMin = BeamColumnDesign.DesignStart(ColStartMin.d, ColStartMin.t_w, ColStartMin.b_fTop, ColStartMin.t_fTop, ColStartMin.b_fBot,
                                                           ColStartMin.t_fBot, RColStartMin.Axial, RColStartMin.Moment3, RColEndMin.Moment3, Fy, LUnsupported, Kfactor,
                                                           Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway, BeamColumnDesign.SteelGrade.st37,
                                                           BeamColumnDesign.LoadingType.Case2);

                ColStartMin = CrossSectionCalulator.PostProcessing(ColStartMin);
                ColEndMin   = CrossSectionCalulator.PostProcessing(ColEndMin);



                //HndzISectionProfile StartMin = new HndzISectionProfile(ColStartMin);
                //HndzISectionProfile EndMin = new HndzISectionProfile(ColEndMax);

                //HndzITaperedProfile ColumnTaperedSectionMin = new HndzITaperedProfile(Start, End);

                SectionI FinalSectionStartCol = CrossSectionCalulator.SectionCompare(ColStartMax, ColStartMin);
                SectionI FinalSectionEndCol   = CrossSectionCalulator.SectionCompare(ColEndMax, ColEndMin);

                HndzISectionProfile ColStart = new HndzISectionProfile(FinalSectionStartCol);
                HndzISectionProfile ColEnd   = new HndzISectionProfile(FinalSectionEndCol);

                HndzITaperedProfile ColumnTaperedSection = new HndzITaperedProfile(ColEnd, ColStart);
                //==========================================



                // }

                //foreach (HndzAnalysisResults RBeamStart in Frame.LeftBeam.AnalysisResults)
                //{
                SectionI BeamEstimatedMax = CrossSectionCalulator.CalculateBeamSection(CrossSectionCalulator.SteelGrade.st37, BeamLength, RBeamStartMax.Axial, RBeamStartMax.Moment3);

                SectionI BeamStartMax = BeamDesign.DesignStart(BeamEstimatedMax.d, BeamEstimatedMax.t_w, BeamEstimatedMax.b_fTop, BeamEstimatedMax.t_fTop,
                                                               BeamEstimatedMax.b_fBot, BeamEstimatedMax.t_fBot, RBeamStartMax.Axial, RBeamStartMax.Shear2, RBeamStartMax.Moment3, RBeamEndMax.Moment3, Fy, LUSupportedSap, KfactorBeamStart, BeamLength, PurlinSpacing, BeamDesign.SwayCondtion.PermitedToSway, BeamDesign.SteelGrade.st37, BeamDesign.LoadingType.Case2);

                SectionI BeamEndMAX = CrossSectionCalulator.SectionTaperedBeam(BeamStartMax);

                BeamEndMAX = BeamDesign.DesignEnd(BeamEndMAX.d, BeamEndMAX.t_w, BeamEndMAX.b_fTop, BeamEndMAX.t_fTop,
                                                  BeamEndMAX.b_fBot, BeamEndMAX.t_fBot,
                                                  RBeamEndMax.Axial, RBeamEndMax.Shear2, RBeamStartMax.Moment3, RBeamEndMax.Moment3, Fy, PurlinSpacing, KfactorBeamEnd, BeamLength, PurlinSpacing, BeamDesign.SwayCondtion.PermitedToSway, BeamDesign.SteelGrade.st37, BeamDesign.LoadingType.Case2);


                BeamStartMax = CrossSectionCalulator.PostProcessing(BeamStartMax);
                BeamEndMAX   = CrossSectionCalulator.PostProcessing(BeamEndMAX);

                //HndzISectionProfile StartBeamMax = new HndzISectionProfile(BeamStartMax);
                //HndzISectionProfile EndBeamMax = new HndzISectionProfile(BeamEndMAX);
                //HndzITaperedProfile BeamTaperedSectionMax = new HndzITaperedProfile(StartBeamMax, EndBeamMax, new Rhino.Geometry.Vector2d(0, 1));

                SectionI BeamEstimatedMin = CrossSectionCalulator.CalculateColumnSection(CrossSectionCalulator.SteelGrade.st37, ColumnHeight, RColStartMax.Axial, RColEndMax.Moment3);

                SectionI BeamEndMin = BeamColumnDesign.DesignEnd(BeamEstimatedMin.d, BeamEstimatedMin.t_w, BeamEstimatedMin.b_fTop, BeamEstimatedMin.t_fTop,
                                                                 BeamEstimatedMin.b_fBot, BeamEstimatedMin.t_fBot, RColEndMin.Axial, RColStartMin.Moment3, RColEndMin.Moment3, Fy,
                                                                 LUnsupported, Kfactor, Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway,
                                                                 BeamColumnDesign.SteelGrade.st37, BeamColumnDesign.LoadingType.Case2);
                SectionI BeamStartMin = CrossSectionCalulator.SectionTaperedColumn(BeamEndMin);


                BeamStartMin = BeamColumnDesign.DesignStart(BeamStartMin.d, BeamStartMin.t_w, BeamStartMin.b_fTop, BeamStartMin.t_fTop, BeamStartMin.b_fBot,
                                                            BeamStartMin.t_fBot, RColStartMin.Axial, RColStartMin.Moment3, RColEndMin.Moment3, Fy, LUnsupported, Kfactor,
                                                            Lbin, Lbout, BeamColumnDesign.SwayCondtion.PermitedToSway, BeamColumnDesign.SteelGrade.st37,
                                                            BeamColumnDesign.LoadingType.Case2);

                BeamStartMin = CrossSectionCalulator.PostProcessing(BeamStartMin);
                BeamEndMin   = CrossSectionCalulator.PostProcessing(BeamEndMin);

                //  HndzISectionProfile StartMinBeam = new HndzISectionProfile(BeamStartMin);
                // HndzISectionProfile EndMinBeam = new HndzISectionProfile(BeamEndMin);



                //HndzISectionProfile StartMinBeam = new HndzISectionProfile(BeamEndMin);

                //HndzISectionProfile EndMinBeam = new HndzISectionProfile(BeamStartMin);

                //HndzITaperedProfile BeamTaperedSectionMin = new HndzITaperedProfile(EndMinBeam,StartMinBeam,new Rhino.Geometry.Vector2d(0, 1));


                SectionI FinalSectionStartBeam = CrossSectionCalulator.SectionCompare(BeamStartMax, BeamStartMin);
                SectionI FinalSectionEndBeam   = CrossSectionCalulator.SectionCompare(BeamEndMAX, BeamEndMin);

                HndzISectionProfile BeamStart = new HndzISectionProfile(FinalSectionStartBeam);
                HndzISectionProfile BeamEnd   = new HndzISectionProfile(FinalSectionEndBeam);

                HndzITaperedProfile BeamTaperedSection = new HndzITaperedProfile(BeamStart, BeamEnd, new Rhino.Geometry.Vector2d(0, 1));


                //==========================================

                //}
                // Sections Assumbtions

                //========================================
                Frame.LeftColumn.Profile  = ColumnTaperedSection;
                Frame.RightColumn.Profile = ColumnTaperedSection;
                Frame.LeftBeam.Profile    = BeamTaperedSection;
                Frame.RightBeam.Profile   = BeamTaperedSection;

                //SectionChannel AssumedCSection = new SectionChannel("Assumed hotRolled C Section", 180, 80, 10, 4);
                //HndzISectionProfile bigProfile = new HndzISectionProfile(new SectionI("big", 1000 * 2, 500 * 2, 100 * 2, 50 * 2));
                //HndzISectionProfile smallProfile = new HndzISectionProfile(new SectionI("small", 1000, 500, 100, 50));
            }
            return(Frame3d);
        }
        private void Btn_Design_Click(object sender, RoutedEventArgs e)
        {//----------------Consider Revision
            int[] secIndex = new int[GeometryEditorVM.GeometryEditor.GridData.Count];
            for (int i = 0; i < GeometryEditorVM.GeometryEditor.GridData.Count; i++)
            {
                for (int j = 0; j < AnalysisMapping.SapSectionsArr.Length; j++)
                {
                    if (GeometryEditorVM.GeometryEditor.GridData[i].SelectedSection.Width == AnalysisMapping.SapSectionsArr[j].B &&
                        GeometryEditorVM.GeometryEditor.GridData[i].SelectedSection.Depth == AnalysisMapping.SapSectionsArr[j].T)
                    {
                        secIndex[i] = j;
                    }
                }
            }
            int bindex = 0;

            foreach (var item in AnalysisMapping.xbeams)
            {
                //clear all case and combo output selections:
                int ret1 = AnalysisMapping.mySapModel.MySapObjectModel.Results.Setup.DeselectAllCasesAndCombosForOutput();

                //set case and combo output selections
                int ret2 = AnalysisMapping.mySapModel.MySapObjectModel.Results.Setup.SetComboSelectedForOutput(DesignCombinationComboBox.SelectedItem as string);



                AnalysisMapping.xbeams[bindex].FrameResults.Add(new SapFrameResult(AnalysisMapping.mySapModel.MySapObjectModel, item.Label));

                //add sections created:
                AnalysisMapping.xbeams[bindex].Sec.Add(AnalysisMapping.SapSectionsArr[secIndex[bindex]]);
                bindex++;
            }
            /*----------------------------------------------------------*/
            //Design:
            double fcu       = Convert.ToDouble(MaterialEditorVM.Material.Fcu);
            double fy        = Convert.ToDouble(MaterialEditorVM.Material.Fy);
            double fystr     = Convert.ToDouble(MaterialEditorVM.Material.FyStirrups);
            int    nBranches = Convert.ToInt32(MaterialEditorVM.Material.NoOfBranches);

            BeamDesign design = new BeamDesign(AnalysisMapping.xbeams, fy, fystr, fcu, nBranches);

            /* --------------------- ADD RFT --------------------- */

            #region RFT Visualization
            GeometryEngineRFT.Remove("RFT");

            /*----------RFT Visualization---------*/
            RFTCanvas.CalcSpanVals();
            RFTCanvas.CalcComSpanVals(GeometryEditorVM.GeometryEditor.NumberOfSpans);
            RFTCanvas.CalcThickness();

            //Points  /*--------the Order is Important-----------*/
            RFTCanvas.ConstructTopStartPoints(20);
            RFTCanvas.ConstructTopEndPoints(20);

            RFTCanvas.ConstructBotStartPoints(20);
            RFTCanvas.ConstructBotEndPoints(20);



            //Lines
            RFTCanvas.ConstructTopLines(GeometryEngineRFT.GCanvas, GeometryEngineRFT);
            RFTCanvas.ConstructBotLines(GeometryEngineRFT.GCanvas, GeometryEngineRFT);
            RFTCanvas.ConstructColLines(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            //RFT Lines
            RFTCanvas.BotRFT(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);
            RFTCanvas.TopRFT(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            //Stirrups
            RFTCanvas.LeftSecStirrups(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);
            RFTCanvas.RightSecStirrups(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            #region Text Trial
            //TxtRFTCanvas.CalcSpanVals();
            //TxtRFTCanvas.CalcComSpanVals();
            ////TxtRFTCanvas.CreateBottomRFTTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);
            //TxtRFTCanvas.CreateTopRFTTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            #endregion

            GeometryEngineRFT.Render("RFT");
            #endregion

            /* --------------------- ADD TEXT --------------------- */
            #region Text RFTCanvas
            GeometryEngineRFT.Remove("Text");


            TxtRFTCanvas.CalcSpanVals();
            TxtRFTCanvas.CalcComSpanVals();

            //Bottom RFT
            TxtRFTCanvas.GetnRebarBotArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.GetChosenDiameterArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.CreateBottomRFTTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            //Top RFT
            TxtRFTCanvas.GetnRebarTopSupportArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.GetChosenDiameterTopSupportArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.CreateTopRFTTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            //Stirrups Left
            TxtRFTCanvas.GetSpacingLeftArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.GetSpacingLeftArrIndexes(AnalysisMapping.xbeams);
            TxtRFTCanvas.StirrupLeftTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);


            //Stirrups Right
            TxtRFTCanvas.GetSpacingRightArr(AnalysisMapping.xbeams);
            TxtRFTCanvas.GetSpacingRightArrIndexes(AnalysisMapping.xbeams);
            TxtRFTCanvas.StirrupRightTxt(GeometryEngineRFT.GCanvas, GeometryEngineRFT, 20);

            GeometryEngineRFT.Render("Text");
            #endregion
        }