private static void TestBarReleases() { cSapModel m_model; cOAPI m_app; string pathToETABS = @"C:\Program Files\Computers and Structures\ETABS 2016\ETABS.exe"; cHelper helper = new ETABS2016.Helper(); //open ETABS if not running - NOTE: this behaviour is different from other adapters m_app = helper.CreateObject(pathToETABS); m_app.ApplicationStart(); m_model = m_app.SapModel; m_model.InitializeNewModel(); m_model.File.NewBlank(); string name = "1"; m_model.FrameObj.AddByCoord(0, 0, 0, 0, 0, 10, ref name); bool[] ii = new bool[6]; bool[] jj = new bool[6]; double[] startVal = new double[6]; double[] endVal = new double[6]; ii[5] = true; jj[5] = true; int ret = m_model.FrameObj.SetReleases(name, ref ii, ref jj, ref startVal, ref endVal); }
/***************************************************/ /**** Constructors ****/ /***************************************************/ public ETABSAdapter(string filePath = "", EtabsConfig etabsConfig = null, bool active = false) { if (active) { AdapterId = ID; this.EtabsConfig = etabsConfig == null ? new EtabsConfig() : etabsConfig; Config.SeparateProperties = true; Config.MergeWithComparer = true; Config.ProcessInMemory = false; Config.CloneBeforePush = true; //string pathToETABS = System.IO.Path.Combine(Environment.GetEnvironmentVariable("PROGRAMFILES"), "Computers and Structures", "ETABS 2016", "ETABS.exe"); //string pathToETABS = System.IO.Path.Combine("C:","Program Files", "Computers and Structures", "ETABS 2016", "ETABS.exe"); string pathToETABS = @"C:\Program Files\Computers and Structures\ETABS 2016\ETABS.exe"; cHelper helper = new ETABS2016.Helper(); object runningInstance = null; if (System.Diagnostics.Process.GetProcessesByName("ETABS").Length > 0) { runningInstance = System.Runtime.InteropServices.Marshal.GetActiveObject("CSI.ETABS.API.ETABSObject"); m_app = (cOAPI)runningInstance; m_model = m_app.SapModel; if (System.IO.File.Exists(filePath)) { m_model.File.OpenFile(filePath); } m_model.SetPresentUnits(eUnits.N_m_C); } else { //open ETABS if not running - NOTE: this behaviour is different from other adapters m_app = helper.CreateObject(pathToETABS); m_app.ApplicationStart(); m_model = m_app.SapModel; m_model.InitializeNewModel(eUnits.N_m_C); if (System.IO.File.Exists(filePath)) { m_model.File.OpenFile(filePath); } else { m_model.File.NewBlank(); } } } }