Bilindiği üzere güncel Etabs versiyonlarında OAPI desteği gelmiştir. Bu basitçe Etabs programına yazmış olduğunuz bir yazılımla dışardan erişimine imkân veren bir özelliktir. Böylece ister hazır bir Etabs modelinden veri çekilmesi, ister parametrik modeller kurulmasına yardımcı olmaktadır.

Halihazırda yazmış olduğumuz program ile Etabs programından analiz giriş ve çıkış bilgileri okunarak bu bilgiler üzerinden etkili bir şekilde değerlendirme yapabilmekteyiz. Bu program ile analiz özet sonuçları isteğimiz formatta Notepad, Excel ve grafiklere aktarılabilmektedir. Yönetmelikteki ilave kontrol alınan sonuçlar ile sistematik yapılması mümkündür.

Aşağıda basit bir kod örneği paylaştım. Bu basit örnek, yazılıma meraklı genç meslektaşlarımız için programlamaya başlarken işlerine yarabilir. Mühendisliğin ve gelişen teknolojin önemli bir aracı olan yazılım bilgisi umarım daha fazla arkadaşımızın ilgisini çeker.

Geliştirme Programı: Visual Studio 2017

Programlama Dili: C#

Etabs Versiyon: ETABS Ultimate V18.1.1

Program ile oluşturulan model:


Örnek kod:


public void Etabs()
        {
            //Reference Variables
            int ret;
            String Name = "";
            String UniqueName;

            //Create Etabs Object
            cOAPI myEtabs = null;
            cSapModel myModel = null;

            cHelper myHelper;
            try
            {
                myHelper = new Helper();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot create an instance of the Helper object.\n" + ex.ToString() );
                return;
            }
            //create ETABS object
            try
            {                
                myEtabs = myHelper.CreateObjectProgID("CSI.ETABS.API.ETABSObject");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot start a new instance of the program.\n" + ex.ToString());
                return;
            }

            ret = myEtabs.ApplicationStart();

            //Create Model
            myModel = myEtabs.SapModel;
            myModel.InitializeNewModel(eUnits.kN_m_C);
            ret = myModel.File.NewGridOnly(3, 3, 3, 2, 2, 8, 8);
            //ret = myModel.File.NewBlank();

            //Define Material
            ret = myModel.PropMaterial.AddMaterial(ref Name, eMatType.Concrete, "Europe", "EN 1992-1-1 per EN-206-1", "C30/37", "C30");
            ret = myModel.PropMaterial.AddMaterial(ref Name, eMatType.Rebar, "Europe", "User", " ", "S420");
            ret = myModel.PropMaterial.SetORebar("S420", 420000.0, 500000.0, 504000.0, 600000.0, 1, 1, 0.01, 0.10, false);

            //Define Frame Section
            String[] DefinedFrameNamelist = { "B70/50", "C50/80" };
            //Define Beam Section
            ret = myModel.PropFrame.SetRectangle("B70/50", "C30", 0.5, 0.7);
            ret = myModel.PropFrame.SetRectangle("C50/80", "C30", 0.5, 0.8);

            //Define Column Section
            ret = myModel.PropFrame.SetRebarBeam("B70/50", "S420", "S420", 0.05, 0.05, 0.0175, 0.0175, 0.0175, 0.0175);
            ret = myModel.PropFrame.SetRebarColumn("C50/80", "S420", "S420", 1, 1, 0.05, 1, 7, 4, "20", "12", 0.10, 4, 3, true);
            //Delete Default Frames Sections
            Int32 NumberNames = 0;
            String[] FrameNamelist = new String[1];
            ret = myModel.PropFrame.GetNameList(ref NumberNames, ref FrameNamelist);
            for (int i = 0; i < FrameNamelist.Count(); i++)
            {
                if (DefinedFrameNamelist.Contains(FrameNamelist[i]) == false)
                {
                    ret = myModel.PropFrame.Delete(FrameNamelist[i]);
                }
            }

            //Define Slab Section
            //Plak Doseme
            //int SetSlab(string Name,eSlabType SlabType,	eShellType ShellType, string MatProp, double Thickness,	int color = -1,	string notes = "",	string GUID = "")
            ret = myModel.PropArea.SetSlab("D20", eSlabType.Slab, eShellType.Membrane, "C30", 0.2);
            ret = myModel.PropArea.SetSlab("R60", eSlabType.Ribbed, eShellType.Membrane, "C30", 0.2);
            ret = myModel.PropArea.SetSlab("W50", eSlabType.Waffle, eShellType.Membrane, "C30", 0.2);
            //Nervür Doseme
            //int SetSlabRibbed( string Name, double OverallDepth, double SlabThickness, double StemWidthTop, double StemWidthBot, double RibSpacing, int RibsParallelTo)
            ret = myModel.PropArea.SetSlabRibbed("R60", 0.60, 0.15, 0.40, 0.40, 2.00, 1);
            //Kaset Doseme
            //int SetSlabWaffle(string Name, double OverallDepth, double SlabThickness,	double StemWidthTop, double StemWidthBot, double RibSpacingDir1, double RibSpacingDir2)
            ret = myModel.PropArea.SetSlabWaffle("W50", 0.50, 0.10, 0.30, 0.20, 1.20, 1.20);

            //Define Wall Section
            ret = myModel.PropArea.SetWall("P40", eWallPropType.Specified, eShellType.ShellThin, "C30", 0.4);

            //Add Stories
            String[] StoryNames = { "KAT1", "KAT2", "KAT3" };
            Double[] StoryElevations = { 3.00, 6.00, 9.00 };
            Double[] StoryHeights = { 3.00, 3.00, 3.00 };
            Boolean[] IsMasterStory = { false, false, false };
            String[] SimilartoStory = { "None", "None", "None" };
            Boolean[] SpliceAbove = { false, false, false };
            Double[] SpliceHeight = { 0.00, 0.00, 0.00 };
            ret = myModel.Story.SetStories(StoryNames, StoryElevations, StoryHeights, IsMasterStory, SimilartoStory, SpliceAbove, SpliceHeight);

            //Add Points  
            Double x;
            Double y;
            Double z;
            UniqueName = "N0-1";
            x = 0.0;
            y = 8.0;
            z = 0.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N0-2";
            x = 8.0;
            y = 8.0;
            z = 0.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N0-3";
            x = 0.0;
            y = 0.0;
            z = 0.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N0-4";
            x = 8.0;
            y = 0.0;
            z = 0.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N1-1";
            x = 0.0;
            y = 8.0;
            z = 3.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N1-2";
            x = 8.0;
            y = 8.0;
            z = 3.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N1-3";
            x = 0.0;
            y = 0.0;
            z = 3.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N1-4";
            x = 8.0;
            y = 0.0;
            z = 3.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N2-1";
            x = 0.0;
            y = 8.0;
            z = 6.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N2-2";
            x = 8.0;
            y = 8.0;
            z = 6.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N2-3";
            x = 0.0;
            y = 0.0;
            z = 6.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N2-4";
            x = 8.0;
            y = 0.0;
            z = 6.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N3-1";
            x = 0.0;
            y = 8.0;
            z = 9.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N3-2";
            x = 8.0;
            y = 8.0;
            z = 9.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N3-3";
            x = 0.0;
            y = 0.0;
            z = 9.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);
            UniqueName = "N3-4";
            x = 8.0;
            y = 0.0;
            z = 9.0;
            ret = myModel.PointObj.AddCartesian(x, y, z, ref Name, UniqueName);

            //AddRestrained
            Boolean[] restrained = { true, true, true, true, true, true };
            ret = myModel.PointObj.SetRestraint("N0-1", ref restrained);
            ret = myModel.PointObj.SetRestraint("N0-2", ref restrained);
            ret = myModel.PointObj.SetRestraint("N0-3", ref restrained);
            ret = myModel.PointObj.SetRestraint("N0-4", ref restrained);

            //Add Columns                       
            ret = myModel.FrameObj.AddByPoint("N0-1", "N1-1", ref Name, "C50/80", "S101");
            ret = myModel.FrameObj.AddByPoint("N0-2", "N1-2", ref Name, "C50/80", "S102");
            ret = myModel.FrameObj.AddByPoint("N0-3", "N1-3", ref Name, "C50/80", "S103");
            ret = myModel.FrameObj.SetLocalAxes("S103", 30);
            ret = myModel.FrameObj.AddByPoint("N0-4", "N1-4", ref Name, "C50/80", "S104");

            ret = myModel.FrameObj.AddByPoint("N1-1", "N2-1", ref Name, "C50/80", "S201");
            ret = myModel.FrameObj.AddByPoint("N1-2", "N2-2", ref Name, "C50/80", "S202");
            ret = myModel.FrameObj.AddByPoint("N1-3", "N2-3", ref Name, "C50/80", "S203");
            ret = myModel.FrameObj.SetLocalAxes("S203", 30);
            ret = myModel.FrameObj.AddByPoint("N1-4", "N2-4", ref Name, "C50/80", "S204");

            ret = myModel.FrameObj.AddByPoint("N2-1", "N3-1", ref Name, "C50/80", "S301");
            ret = myModel.FrameObj.AddByPoint("N2-2", "N3-2", ref Name, "C50/80", "S302");
            ret = myModel.FrameObj.AddByPoint("N2-3", "N3-3", ref Name, "C50/80", "S303");
            ret = myModel.FrameObj.SetLocalAxes("S303", 30);
            ret = myModel.FrameObj.AddByPoint("N2-4", "N3-4", ref Name, "C50/80", "S304");

            //Add Beams                       
            ret = myModel.FrameObj.AddByPoint("N1-1", "N1-2", ref Name, "B70/50", "K101");
            ret = myModel.FrameObj.AddByPoint("N1-3", "N1-4", ref Name, "B70/50", "K102");
            ret = myModel.FrameObj.AddByPoint("N1-3", "N1-1", ref Name, "B70/50", "K103");
            ret = myModel.FrameObj.AddByPoint("N1-4", "N1-2", ref Name, "B70/50", "K104");

            ret = myModel.FrameObj.AddByPoint("N2-1", "N2-2", ref Name, "B70/50", "K201");
            ret = myModel.FrameObj.AddByPoint("N2-3", "N2-4", ref Name, "B70/50", "K202");
            ret = myModel.FrameObj.AddByPoint("N2-3", "N2-1", ref Name, "B70/50", "K203");
            ret = myModel.FrameObj.AddByPoint("N2-4", "N2-2", ref Name, "B70/50", "K204");

            ret = myModel.FrameObj.AddByPoint("N3-1", "N3-2", ref Name, "B70/50", "K301");
            ret = myModel.FrameObj.AddByPoint("N3-3", "N3-4", ref Name, "B70/50", "K302");
            ret = myModel.FrameObj.AddByPoint("N3-3", "N3-1", ref Name, "B70/50", "K303");
            ret = myModel.FrameObj.AddByPoint("N3-4", "N3-2", ref Name, "B70/50", "K304");
            
            //Add Slab
            String[] SlabCon1 = { "N1-3", "N1-4", "N1-2", "N1-1" };
            ret = myModel.AreaObj.AddByPoint(4, ref SlabCon1, ref Name, "D20", "D101");
            String[] SlabCon2 = { "N2-3", "N2-4", "N2-2", "N2-1" };
            ret = myModel.AreaObj.AddByPoint(4, ref SlabCon2, ref Name, "R60", "D201");
            String[] SlabCon3 = { "N3-3", "N3-4", "N3-2", "N3-1" };
            ret = myModel.AreaObj.AddByPoint(4, ref SlabCon3, ref Name, "W50", "D301");

            //Add Wall
            String[] WallCon1 = { "N0-4", "N0-2", "N1-2", "N1-4" };
            ret = myModel.AreaObj.AddByPoint(4, ref WallCon1, ref Name, "P40", "P101");
            String[] WallCon2 = { "N1-4", "N1-2", "N2-2", "N2-4" };
            ret = myModel.AreaObj.AddByPoint(4, ref WallCon2, ref Name, "P40", "P201");
            String[] WallCon3 = { "N2-4", "N2-2", "N3-2", "N3-4" };
            ret = myModel.AreaObj.AddByPoint(4, ref WallCon3, ref Name, "P40", "P301");

            //Add Loads
            ret = myModel.AreaObj.SetLoadUniform("D101", "Dead", -2.50, 3, true, "Local");
            ret = myModel.AreaObj.SetLoadUniform("D101", "Live", -5.00, 3, true, "Local");

            ret = myModel.AreaObj.SetLoadUniform("D201", "Dead", -2.50, 3, true, "Local");
            ret = myModel.AreaObj.SetLoadUniform("D201", "Live", -5.00, 3, true, "Local");

            ret = myModel.AreaObj.SetLoadUniform("D301", "Dead", -2.50, 3, true, "Local");
            ret = myModel.AreaObj.SetLoadUniform("D301", "Live", -5.00, 3, true, "Local");

            //Run Analysis
            //ret = myEtabs.SapModel.File.Save("e:\\4_Yazilim\\1-ckEtabs\\Data\\BasitModel\\BasitModelE18.edb");
            ret = myEtabs.SapModel.File.Save(@"e:\BasitModelE18.edb");
            ret = myModel.Analyze.RunAnalysis();

            //Get Frame Force Results
            int NumberResults = 1;
            String[] Obj = new String[1];
            Double[] ObjSta = new Double[1];
            String[] Elm = new String[1];
            Double[] ElmSta = new Double[1];
            String[] LoadCase = new String[1];
            String[] StepType = new String[1];
            Double[] StepNum = new Double[1];
            Double[] P = new Double[1];
            Double[] V2 = new Double[1];
            Double[] V3 = new Double[1];
            Double[] T = new Double[1];
            Double[] M2 = new Double[1];
            Double[] M3 = new Double[1];

            ret = myModel.Results.Setup.SetCaseSelectedForOutput("Dead");
            ret = myModel.Results.FrameForce("K101", eItemTypeElm.ObjectElm,
                ref NumberResults, ref Obj, ref ObjSta, ref Elm, ref ElmSta, ref LoadCase, ref StepType, ref StepNum,
                ref P, ref V2, ref V3, ref T, ref M2, ref M3);

            //Show Value
            MessageBox.Show("M3 = " + String.Format("{0:0.00}", Math.Round(M3[0], 2)));

            //Exit ETABS
            ret = myEtabs.ApplicationExit(true);           

        }

Program OAPI özelliği için Etabsın yardım dosyasında daha detaylı bilgiler yer almaktadır. Bu doküman incelenerek çok farklı uygulamalar yapılabilir. Yardım dosyası c:\Program Files\Computers and Structures\ETABS 18\CSi API ETABS v17.chm dosyası içerisindedir. Ayrıca aşağıdaki linkten indirebilirsiniz.

Yardım Dosyası Link:  CSi API ETABS v17.chm

 

Mertebe Mühendislik