public static void Run(Tekla.Technology.Akit.IScript akit) { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); string[] split; split = model.GetCurrentProgramVersion().Split(new char[] { ' ' }); bool boolResult; double dblVersion; boolResult = double.TryParse(split[0], out dblVersion); dblVersion = dblVersion * 10; string strVersion = dblVersion.ToString(); string uelFilePath = @"X:\data2\TeklaStructures\KWP-settings" + strVersion + @"\CustomComponents\" + strVersion + @"-CC-Package.uel"; akit.FileSelection(uelFilePath); akit.ModalDialog(1); akit.Callback("acmdDisplayImportCustomComponentDialog", "", "main_frame"); }
public static void Run(Tekla.Technology.Akit.IScript akit) { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); string modelPath = model.GetInfo().ModelPath; string modelxlsFile = modelPath + @"\PLATE_GIRDER_CREATION.xls"; string[] split; split = model.GetCurrentProgramVersion().Split(new char[] { ' ' }); bool boolResult; double dblVersion; boolResult = double.TryParse(split[0], out dblVersion); dblVersion = dblVersion * 10; string strVersion = dblVersion.ToString(); string xlsFile = @"X:\data2\TeklaStructures\KWP-settings" + strVersion + @"\Spreadsheets\PLATE_GIRDER_CREATION.xls"; if (!File.Exists(@modelxlsFile)) { new FileInfo(@xlsFile).CopyTo(@modelxlsFile, true); } string uelFilePath = @"X:\data2\TeklaStructures\KWP-settings" + strVersion + @"\CustomComponents\BOXPG.uel"; akit.FileSelection(uelFilePath); akit.ModalDialog(1); akit.Callback("acmdDisplayImportCustomComponentDialog", "", "main_frame"); OpenFileDialog OpenFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = "Excel Files|*.xls"; OpenFileDialog.InitialDirectory = modelPath; if (OpenFileDialog.ShowDialog() == DialogResult.OK) { string XLSfileName = @"""" + OpenFileDialog.FileName + @""""; // format required to open .xls file int LenFileName = OpenFileDialog.FileName.Length; string LISfileName = OpenFileDialog.FileName.Remove(LenFileName - 4) + ".lis"; FileInfo FileInfo = new FileInfo(LISfileName); if (FileInfo.Exists) { File.Delete(LISfileName); // deletes existing .lis file if it exists } Process OpenSpreadsheetProcess = new Process(); OpenSpreadsheetProcess.EnableRaisingEvents = false; OpenSpreadsheetProcess.StartInfo.FileName = "EXCEL"; OpenSpreadsheetProcess.StartInfo.Arguments = XLSfileName; OpenSpreadsheetProcess.Start(); } }