public static void Run(Tekla.Technology.Akit.IScript akit) { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); FileInfo fileInfo = new FileInfo(modelinfo.ModelPath + @"\attributes\CurrentContracts"); if (fileInfo.Exists) { using (StreamReader sr = new StreamReader(fileInfo.FullName)) { string line = sr.ReadLine(); DirectoryInfo CurrentContracts = new DirectoryInfo(line); if (CurrentContracts.Exists) { akit.Callback("acmd_shellexecute_open", CurrentContracts.FullName, "main_frame"); } } } else { FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog(); DialogResult result = folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { string folderName = folderBrowserDialog1.SelectedPath; using (StreamWriter sw = new StreamWriter(fileInfo.FullName)) { sw.WriteLine(folderName); } akit.Callback("acmd_shellexecute_open", folderName, "main_frame"); } } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); ArrayList ModelObjectArray = new ArrayList(); if (drawingHandler.GetActiveDrawing() != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); while (drawingObjectEnum.MoveNext()) { Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier)); } } else { ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); while (modelObjectEnum.MoveNext()) { Tekla.Structures.Model.ModelObject modelObject = (Tekla.Structures.Model.ModelObject)modelObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(modelObject.Identifier)); } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); akit.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "main_frame"); akit.Callback("acmd_interrupt", "", "main_frame"); } catch { } }
public static void RefRefresh(string PhaseNumber, string StrFinish) { // create the phase number filter System.IO.StreamWriter sw = new System.IO.StreamWriter("phase-macro.SObjGrp", false, System.Text.Encoding.Default); sw.WriteLine("TITLE_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("Version= 1.04"); sw.WriteLine("Count= 1"); sw.WriteLine("SECTION_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("0"); sw.WriteLine("1"); sw.WriteLine("co_part"); sw.WriteLine("proPHASE"); sw.WriteLine("albl_Phase"); sw.WriteLine("=="); sw.WriteLine("albl_Equals"); sw.WriteLine(PhaseNumber); // this is the phase value sw.WriteLine("0"); sw.WriteLine("Empty"); sw.WriteLine("}"); sw.WriteLine("}"); sw.Flush(); sw.Close(); // move new phase filter to attributes folder File.Delete("./attributes/phase-macro.SObjGrp"); File.Move("phase-macro.SObjGrp", "./attributes/phase-macro.SObjGrp"); /* get drawings for phase */ // set select switches and load phase number filter akit.ValueChange("main_frame", "sel_all", "0"); // deslect all switches akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); // choose parts in componets only akit.ValueChange("main_frame", "sel_parts", "1"); // pick parts only akit.ValueChange("main_frame", "sel_filter", "phase-macro"); // pick the filter to use akit.Callback("acmdSelectAll", "", "main_frame"); akit.Callback("gdr_menu_select_active_draw", "", "main_frame"); akit.PushButton("dia_draw_display_all", "Drawing_selection"); akit.PushButton("dia_draw_filter_by_parts", "Drawing_selection"); // deselect all objects akit.ValueChange("main_frame", "sel_views", "1"); akit.Callback("acmdSelectAll", "", "main_frame"); // clean up and close dialogues akit.ValueChange("main_frame", "sel_filter", "standard"); // pick the filter to use akit.ValueChange("main_frame", "sel_all", "1"); // re-select all switches akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); // this allows objects in joint //delete new phase filter from attributes folder File.Delete("./attributes/phase-macro.SObjGrp"); Application.Exit(); }
public static void Run(Tekla.Technology.Akit.IScript akit) { DrawingHandler DrawingHandler = new DrawingHandler(); Drawing Drawing = DrawingHandler.GetActiveDrawing(); DrawingObjectEnumerator DrawingObjEnum = Drawing.GetSheet().GetAllObjects(); ArrayList MarkArray = new ArrayList(); ArrayList PartArray = new ArrayList(); while (DrawingObjEnum.MoveNext()) { if (DrawingObjEnum.Current is MarkBase) { MarkArray.Add(DrawingObjEnum.Current); } if (DrawingObjEnum.Current is Tekla.Structures.Drawing.Part || DrawingObjEnum.Current is Tekla.Structures.Drawing.Bolt) { PartArray.Add(DrawingObjEnum.Current); } } DrawingHandler.GetDrawingObjectSelector().SelectObjects(MarkArray, true); // part mark properties akit.Callback("acmd_display_selected_drawing_object_dialog", "", "main_frame"); akit.TabChange("pmark_dial", "Container_2", "gr_mark_general_tab"); akit.PushButton("gr_pmark_place", "pmark_dial"); akit.ValueChange("pmpl_dial", "text_placing_mode", "1"); akit.PushButton("txpl_modify", "pmpl_dial"); akit.PushButton("txpl_cancel", "pmpl_dial"); akit.PushButton("pmark_cancel", "pmark_dial"); // bolt mark properties akit.Callback("acmd_display_attr_dialog", "smark_dial", "main_frame"); akit.TabChange("smark_dial", "Container_217", "gr_mark_general_tab"); akit.PushButton("gr_smark_place", "smark_dial"); akit.ValueChange("smpl_dial", "text_placing_mode", "1"); akit.PushButton("txpl_modify", "smpl_dial"); akit.PushButton("txpl_cancel", "smpl_dial"); akit.PushButton("smark_cancel", "smark_dial"); // connection mark properties akit.Callback("acmd_display_attr_dialog", "jmark_dial", "main_frame"); akit.TabChange("jmark_dial", "Container_217", "gr_mark_general_tab"); akit.PushButton("gr_jmark_place", "jmark_dial"); akit.ValueChange("jmpl_dial", "text_placing_mode", "1"); akit.PushButton("txpl_modify", "jmpl_dial"); akit.PushButton("txpl_cancel", "jmpl_dial"); akit.PushButton("jmark_cancel", "jmark_dial"); DrawingHandler.GetDrawingObjectSelector().UnselectAllObjects(); DrawingHandler.GetDrawingObjectSelector().SelectObjects(PartArray, true); akit.Callback("acmd_update_marks_selected", "", "main_frame"); }
public static void Run(Tekla.Technology.Akit.IScript akit) { akit.Callback("diaDisplaySnapshotDialog", "", "main_frame"); akit.PushButton("options", "snapshot_dialog"); akit.ValueChange("snapshot_option_dialog", "width", "387.000000000000"); akit.ValueChange("snapshot_option_dialog", "white_bg_enabled", "1"); akit.PushButton("option_apply", "snapshot_option_dialog"); akit.PushButton("option_ok", "snapshot_option_dialog"); Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); string ScreenshotsFolderPath = modelinfo.ModelPath + @"\screenshots\"; string now = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString("0#") + "-" + DateTime.Now.Day.ToString("0#") + "-" + DateTime.Now.Hour.ToString("0#") + DateTime.Now.Minute.ToString("0#") + DateTime.Now.Second.ToString("0#"); string ScreenshotFilePath = ScreenshotsFolderPath + Environment.UserName + "_" + now + ".png"; akit.ValueChange("snapshot_dialog", "filename", ScreenshotFilePath); akit.ValueChange("snapshot_dialog", "target_selection", "1"); akit.ValueChange("snapshot_dialog", "show_with_viewer_enabled", "1"); akit.PushButton("take_snapshot", "snapshot_dialog"); akit.PushButton("cancel", "snapshot_dialog"); if (!File.Exists(ScreenshotFilePath)) { return; } else { string argument = @"/select, " + ScreenshotFilePath; System.Diagnostics.Process.Start("explorer.exe", argument); } }
private static void removeAssemblyPropertys(Assembly currentAssembly, Tekla.Technology.Akit.IScript akit) { akit.Callback("acmd_display_selected_object_dialog", "", "View_01 window_1"); Part currentMainPart = currentAssembly.GetMainPart() as Part; if (!currentMainPart.Material.MaterialString.StartsWith("C")) { akit.ValueChange("steelassembly_1", "AssemblyPrefix", ""); akit.ValueChange("steelassembly_1", "AssemblyStartNumber", ""); akit.ValueChange("steelassembly_1", "AssemblyName", ""); akit.PushButton("modify_button", "steelassembly_1"); akit.PushButton("OK_button", "steelassembly_1"); } else { if (currentMainPart.CastUnitType == 0) { akit.ValueChange("precastassembly_1", "AssemblyPrefix", ""); akit.ValueChange("precastassembly_1", "AssemblyStartNumber", ""); akit.ValueChange("precastassembly_1", "AssemblyName", ""); akit.PushButton("modify_button", "precastassembly_1"); akit.PushButton("OK_button", "precastassembly_1"); } else { akit.ValueChange("insituassembly_1", "AssemblyPrefix", ""); akit.ValueChange("insituassembly_1", "AssemblyStartNumber", ""); akit.ValueChange("insituassembly_1", "AssemblyName", ""); akit.PushButton("modify_button", "insituassembly_1"); akit.PushButton("OK_button", "insituassembly_1"); } } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); ArrayList ModelObjectArray = new ArrayList(); if (drawingObjectEnum.GetSize() > 0) { while (drawingObjectEnum.MoveNext()) { if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part) { Tekla.Structures.Drawing.Part part = drawingObjectEnum.Current as Tekla.Structures.Drawing.Part; ModelObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID))); } if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Bolt) { Tekla.Structures.Drawing.Bolt bolt = drawingObjectEnum.Current as Tekla.Structures.Drawing.Bolt; ModelObjectArray.Add(model.SelectModelObject(new Identifier(bolt.ModelIdentifier.ID))); } } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); akit.Callback("acmd_display_selected_object_dialog", "", "main_frame"); } catch { } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); ArrayList ModelObjectArray = new ArrayList(); if (drawingHandler.GetActiveDrawing() != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() > 0) { while (drawingObjectEnum.MoveNext()) { Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier)); } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); } akit.Callback("acmdZoomToSelected", "", "main_frame"); } catch { } }
public static void Run(Tekla.Technology.Akit.IScript akit) { TSM.UI.ModelViewEnumerator views = TSM.UI.ViewHandler.GetSelectedViews(); if (views.Count > 0) { while (views.MoveNext()) { TSM.UI.View activeView = views.Current; TSM.UI.ModelObjectSelector selector = new Tekla.Structures.Model.UI.ModelObjectSelector(); ArrayList visibleParts = ItemSelector.getParts(activeView); selector.Select(visibleParts); akit.Callback("acmdViewTopInFormFace", "", "View_01 window_1"); ArrayList empty = new ArrayList(); selector.Select(empty); } } else { MessageBox.Show("Vaate aken peab olema aktiivne"); } }
public static void Run(Tekla.Technology.Akit.IScript akit) { akit.Callback("gdr_menu_select_active_draw", "", "main_frame"); // opens drawing list akit.PushButton("dia_draw_display_all", "Drawing_selection"); // show all drawings akit.ValueChange("Drawing_selection", "diaSavedSearchOptionMenu", "0"); // resets the filter akit.ValueChange("Drawing_selection", "diaSavedSearchOptionMenu", "10"); // filters assembly drawings akit.PushButton("dia_draw_filter_by_parts", "Drawing_selection"); // filters by parts akit.TableSelect("Drawing_selection", "dia_draw_select_list", 1); // selects the first drawing in the list akit.PushButton("dia_draw_open", "Drawing_selection"); // opens the drawing }
public static void Run(Tekla.Technology.Akit.IScript akit) { akit.Callback("acmd_display_selected_object_dialog", "object_attr", "main_frame"); //akit.ValueChange("beam_1", "PRELIM_MARK", ""); akit.TabChange("beam_1", "tw", "tab6"); akit.PushButton("on_off_button", "beam_1"); akit.TabChange("column_1", "tw", "tab6"); akit.PushButton("on_off_button", "column_1"); }
public static void CreatePhaseIssueFolders(string PhaseNumber) { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); ProjectInfo projectinfo = model.GetProjectInfo(); string IssueFolder = projectinfo.ProjectNumber + " Phase " + PhaseNumber; string IssueFolderPath = modelinfo.ModelPath + @"\Issues\" + IssueFolder + @"\"; /** - Check for existence of a file - **/ if (Directory.Exists(IssueFolderPath)) { System.Windows.Forms.MessageBox.Show("Directory exists"); akit.Callback("acmd_shellexecute_open", IssueFolderPath, "main_frame"); } else { Directory.CreateDirectory(IssueFolderPath); string DrawingsFolderPath = IssueFolderPath + IssueFolder + @"\"; Directory.CreateDirectory(DrawingsFolderPath + @"ASS\A0"); Directory.CreateDirectory(DrawingsFolderPath + @"ASS\A1"); Directory.CreateDirectory(DrawingsFolderPath + @"ASS\A2"); Directory.CreateDirectory(DrawingsFolderPath + @"ASS\A3"); Directory.CreateDirectory(DrawingsFolderPath + "FIT"); Directory.CreateDirectory(DrawingsFolderPath + "GAS"); string ListsFolderPath = IssueFolderPath + IssueFolder + " LISTS"; Directory.CreateDirectory(ListsFolderPath); string ncFittsFolderPath = IssueFolderPath + IssueFolder + " NCFITTS"; Directory.CreateDirectory(ncFittsFolderPath); string ncShaftsFolderPath = IssueFolderPath + IssueFolder + " NCSHAFTS"; Directory.CreateDirectory(ncShaftsFolderPath); string CopyofModel = IssueFolderPath + projectinfo.ProjectNumber + " Copy of Model " + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString(); Directory.CreateDirectory(CopyofModel); akit.Callback("acmd_shellexecute_open", IssueFolderPath, "main_frame"); } Application.Exit(); }
/*****************************************************************************/ 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 modelDir; string spreadsheet; /** Get model directory **/ modelDir = new System.IO.DirectoryInfo("./").FullName; //test for the file path //System.Windows.Forms.MessageBox.Show(modelDir); akit.Callback("acmd_display_report_dialog", "", "main_frame"); akit.ListSelect("xs_report_dialog", "xs_report_list", "ga_register"); akit.TabChange("xs_report_dialog", "Container_516", "Container_519"); akit.ValueChange("xs_report_dialog", "display_created_report", "0"); akit.TabChange("xs_report_dialog", "Container_516", "Container_517"); akit.ModalDialog(1); akit.PushButton("xs_report_selected", "xs_report_dialog"); akit.ListSelect("xs_report_dialog", "xs_report_list", "rev-iss-dates"); akit.ModalDialog(1); akit.PushButton("xs_report_selected", "xs_report_dialog"); akit.PushButton("xs_report_cancel", "xs_report_dialog"); /** Check for existence of a file - **/ if (System.IO.File.Exists(@modelDir + "Reports/" + file)) { System.Windows.Forms.MessageBox.Show("file exists, opening the one in the model folder", "Kennedy Watts"); } else { /** Copy a file to the model folder **/ new System.IO.FileInfo("X:/data2/TeklaStructures/KWP-settings" + strVersion + "/Spreadsheets/GA-Drawing-Register.xls").CopyTo(@modelDir + @"Reports\" + file, true); } spreadsheet = @modelDir + @"Reports\" + file; System.Diagnostics.Process Process2 = new System.Diagnostics.Process(); Process2.EnableRaisingEvents = false; Process2.StartInfo.FileName = "EXCEL"; Process2.StartInfo.Arguments = "\"" + @spreadsheet + "\""; Process2.Start(); }
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(); } }
private static void changePartToSubAssembly(TSM.Assembly assembly, ArrayList wrongParts, Tekla.Technology.Akit.IScript akit) { TSM.UI.ModelObjectSelector selector = new TSM.UI.ModelObjectSelector(); selector.Select(wrongParts); akit.Callback("acmdRemoveFromAssemblyActionCB", "", "View_01 window_1"); //assembly.Modify(); selector = new TSM.UI.ModelObjectSelector(); TSM.ModelObjectEnumerator selectionEnum = selector.GetSelectedObjects(); while (selectionEnum.MoveNext()) { if (selectionEnum.Current is TSM.Part) { TSM.Part newPart = selectionEnum.Current as TSM.Part; TSM.Assembly partNewAssembly = newPart.GetAssembly() as TSM.Assembly; ArrayList currentSelection = new ArrayList(); currentSelection.Add(assembly); selector.Select(currentSelection); TSM.ModelObjectEnumerator selectionEnum2 = selector.GetSelectedObjects(); while (selectionEnum2.MoveNext()) { if (selectionEnum2.Current is TSM.Assembly) { TSM.Assembly newAssembly = selectionEnum2.Current as TSM.Assembly; newAssembly.Add(partNewAssembly); newAssembly.Modify(); } } } } foreach (TSM.Part part in wrongParts) { TSM.Assembly newAssembly = part.GetAssembly() as TSM.Assembly; removeAssemblyPropertys(newAssembly, akit); } }
public static void Run(Tekla.Technology.Akit.IScript akit) { akit.Callback("acmdRemoveAllMarkChangeSymbols", "", "main_frame"); }
public static void RefRefresh(string PhaseNumber) { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); ProjectInfo projectInfo = model.GetProjectInfo(); string projectNumber = projectInfo.ProjectNumber; string NCShaftsPath = @".\nc-files\" + projectNumber + " Phase " + PhaseNumber + @" NCSHAFTS\"; string NCFittingsPath = @".\nc-files\" + projectNumber + " Phase " + PhaseNumber + @" NCFITTS\"; string PhaseNCFolderPath = modelinfo.ModelPath + @"\nc-files\"; akit.Callback("acmd_shellexecute_open", PhaseNCFolderPath, "main_frame"); // shafts // creates the select filter so its visible in the list akit.Callback("diaDisplayObjectGroupDialogCB", "diaSelectObjectGroup", "main_frame"); //opens select filter dialog box akit.ValueChange("diaSelectObjectGroup", "saveas_file", "phase-main-macro"); //filename to save select filter akit.PushButton("attrib_saveas", "diaSelectObjectGroup"); //saves the select filter akit.PushButton("dia_pa_cancel", "diaSelectObjectGroup"); //closes select filter dialog box // creates the filter System.IO.StreamWriter sw = new System.IO.StreamWriter("phase-main-macro.SObjGrp", false, System.Text.Encoding.Default); sw.WriteLine("TITLE_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("Version= 1.04"); sw.WriteLine("Count= 2"); sw.WriteLine("SECTION_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("0"); sw.WriteLine("1"); sw.WriteLine("co_part"); sw.WriteLine("proPHASE"); sw.WriteLine("albl_Phase"); sw.WriteLine("=="); sw.WriteLine("albl_Equals"); // this is the phase value sw.WriteLine(PhaseNumber); sw.WriteLine("0"); sw.WriteLine("Empty"); sw.WriteLine("}"); sw.WriteLine("SECTION_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("0"); sw.WriteLine("1"); sw.WriteLine("co_part"); sw.WriteLine("proPrimaryPart"); sw.WriteLine("albl_Primary_part"); sw.WriteLine("=="); sw.WriteLine("albl_Equals"); // this is the setting for primary part sw.WriteLine("1"); sw.WriteLine("0"); sw.WriteLine("Empty"); sw.WriteLine("}"); sw.WriteLine("}"); sw.Flush(); sw.Close(); // move filter to attributes folder File.Delete("./attributes/phase-main-macro.SObjGrp"); File.Move("phase-main-macro.SObjGrp", "./attributes/phase-main-macro.SObjGrp"); // set select switches and load phase and main part filter akit.ValueChange("main_frame", "sel_all", "0"); //deslect all switches akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); //choose parts in componets only akit.ValueChange("main_frame", "sel_parts", "1"); //pick parts only akit.ValueChange("main_frame", "sel_filter", "phase-main-macro"); //pick the filter to use akit.Callback("acmdSelectAll", "", "main_frame"); //select all Operation.CreateNCFilesFromSelected("Severs-shafts", NCShaftsPath); // fittings // creates the select filter so its visible in the list akit.Callback("diaDisplayObjectGroupDialogCB", "diaSelectObjectGroup", "main_frame"); //opens select filter dialog box akit.ValueChange("diaSelectObjectGroup", "saveas_file", "phase-sec-macro"); //filename to save select filter akit.PushButton("attrib_saveas", "diaSelectObjectGroup"); //saves the select filter akit.PushButton("dia_pa_cancel", "diaSelectObjectGroup"); //closes select filter dialog box // creates the filter System.IO.StreamWriter sw1 = new System.IO.StreamWriter("phase-sec-macro.SObjGrp", false, System.Text.Encoding.Default); sw1.WriteLine("TITLE_OBJECT_GROUP"); sw1.WriteLine("{"); sw1.WriteLine("Version= 1.04"); sw1.WriteLine("Count= 2"); sw1.WriteLine("SECTION_OBJECT_GROUP"); sw1.WriteLine("{"); sw1.WriteLine("0"); sw1.WriteLine("1"); sw1.WriteLine("co_part"); sw1.WriteLine("proPHASE"); sw1.WriteLine("albl_Phase"); sw1.WriteLine("=="); sw1.WriteLine("albl_Equals"); // this is the phase value sw1.WriteLine(PhaseNumber); sw1.WriteLine("0"); sw1.WriteLine("Empty"); sw1.WriteLine("}"); sw1.WriteLine("SECTION_OBJECT_GROUP"); sw1.WriteLine("{"); sw1.WriteLine("0"); sw1.WriteLine("1"); sw1.WriteLine("co_part"); sw1.WriteLine("proPrimaryPart"); sw1.WriteLine("albl_Primary_part"); sw1.WriteLine("=="); sw1.WriteLine("albl_Equals"); // this is the setting for primary part sw1.WriteLine("0"); sw1.WriteLine("0"); sw1.WriteLine("Empty"); sw1.WriteLine("}"); sw1.WriteLine("}"); sw1.Flush(); sw1.Close(); // move filter to attributes folder File.Delete("./attributes/phase-sec-macro.SObjGrp"); File.Move("phase-sec-macro.SObjGrp", "./attributes/phase-sec-macro.SObjGrp"); // set select switches and load filter akit.ValueChange("main_frame", "sel_all", "0"); //deslect all switches akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); //choose parts in componets only akit.ValueChange("main_frame", "sel_parts", "1"); //pick parts only akit.ValueChange("main_frame", "sel_filter", "phase-sec-macro"); //pick the filter to use akit.Callback("acmdSelectAll", "", "main_frame"); //select all Operation.CreateNCFilesFromSelected("Severs-fittings", NCFittingsPath); // clean up and close dialogues and deselect all objects akit.PushButton("pushbutton_916", "diaNCFilesDialog"); //closes nc dialog box akit.ValueChange("main_frame", "sel_views", "1"); akit.Callback("acmdSelectAll", "", "main_frame"); akit.ValueChange("main_frame", "sel_filter", "standard"); //pick the filter to use akit.ValueChange("main_frame", "sel_all", "1"); //re-slect all switches akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); //this allows objects in joint akit.ValueChange("main_frame", "sel_all", "1"); //select all switches File.Delete("./attributes/phase-main-macro.SObjGrp"); File.Delete("./attributes/phase-sec-macro.SObjGrp"); System.Windows.Forms.MessageBox.Show("NC Data created for phase " + PhaseNumber, "Tekla Structures"); akit.Callback("acmd_shellexecute_open", PhaseNCFolderPath, "main_frame"); Application.Exit(); }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); DrawingObjectEnumerator MyDrawingObjEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); Tekla.Structures.Model.UI.ModelObjectSelector SelectObjects = new Tekla.Structures.Model.UI.ModelObjectSelector(); Tekla.Structures.Drawing.Weld SelectedWeld = null; if (MyDrawingObjEnum.GetSize() == 1) { while (MyDrawingObjEnum.MoveNext()) { if (MyDrawingObjEnum.Current is Tekla.Structures.Drawing.Weld) { SelectedWeld = MyDrawingObjEnum.Current as Tekla.Structures.Drawing.Weld; ArrayList temp = new ArrayList(); temp.Add(model.SelectModelObject(new Identifier(SelectedWeld.ModelIdentifier.ID))); SelectObjects.Select(temp); BaseWeld SelectedModelWeld = temp[0] as BaseWeld; string strSizeAbove = SelectedModelWeld.SizeAbove.ToString(); string strTypeAbove = SelectedModelWeld.TypeAbove.ToString(); if (strTypeAbove == "WELD_TYPE_FILLET") { strTypeAbove = "10"; // Fillet weld } if (strTypeAbove == "WELD_TYPE_SINGLE_BEVEL_BUTT_WITH_BROAD_ROOT_FACE") { strTypeAbove = "6"; // W1 weld } if (strTypeAbove == "WELD_TYPE_NONE") { strTypeAbove = "0"; // No weld } if (strTypeAbove == "WELD_TYPE_BEVEL_GROOVE_SINGLE_BEVEL_BUTT") { strTypeAbove = "4"; // W6 weld } if (strTypeAbove == "WELD_TYPE_SQUARE_GROOVE_SQUARE_BUTT") { strTypeAbove = "2"; // W3 weld } if (strTypeAbove == "WELD_TYPE_PLUG") { strTypeAbove = "11"; // Plug weld } if (strTypeAbove == "WELD_TYPE_BEVEL_BACKING") { strTypeAbove = "9"; // Seal weld } if (strTypeAbove == "WELD_TYPE_PARTIAL_PENETRATION_SINGLE_BEVEL_BUTT_PLUS_FILLET") { strTypeAbove = "18"; // W1 weld + reinforced } string strContourAbove = SelectedModelWeld.ContourAbove.ToString(); if (strContourAbove == "WELD_CONTOUR_NONE") { strContourAbove = "0"; } if (strContourAbove == "WELD_CONTOUR_FLUSH") { strContourAbove = "1"; } string strSizeBelow = SelectedModelWeld.SizeBelow.ToString(); string strTypeBelow = SelectedModelWeld.TypeBelow.ToString(); if (strTypeBelow == "WELD_TYPE_FILLET") { strTypeBelow = "10"; } if (strTypeBelow == "WELD_TYPE_SINGLE_BEVEL_BUTT_WITH_BROAD_ROOT_FACE") { strTypeBelow = "6"; } if (strTypeBelow == "WELD_TYPE_NONE") { strTypeBelow = "0"; // No weld } if (strTypeBelow == "WELD_TYPE_BEVEL_GROOVE_SINGLE_BEVEL_BUTT") { strTypeBelow = "4"; // W6 weld } if (strTypeBelow == "WELD_TYPE_SQUARE_GROOVE_SQUARE_BUTT") { strTypeBelow = "2"; // W3 weld } if (strTypeBelow == "WELD_TYPE_PLUG") { strTypeBelow = "11"; // Plug weld } if (strTypeBelow == "WELD_TYPE_BEVEL_BACKING") { strTypeBelow = "9"; // Seal weld } if (strTypeBelow == "WELD_TYPE_PARTIAL_PENETRATION_SINGLE_BEVEL_BUTT_PLUS_FILLET") { strTypeBelow = "18"; // W1 weld + reinforced } string strContourBelow = SelectedModelWeld.ContourBelow.ToString(); if (strContourBelow == "WELD_CONTOUR_NONE") { strContourBelow = "0"; } if (strContourBelow == "WELD_CONTOUR_FLUSH") { strContourBelow = "1"; } string strAroundWeld = SelectedModelWeld.AroundWeld.ToString(); if (strAroundWeld == "False") { strAroundWeld = "0"; } if (strAroundWeld == "True") { strAroundWeld = "1"; } string strRefText = SelectedModelWeld.ReferenceText; akit.PushButton("wld_cancel", "Weld Mark Properties"); akit.Callback("acmd_display_attr_dialog", "wld_dial", "main_frame"); akit.ValueChange("wld_dial", "gr_wld_get_menu", "standard"); akit.ValueChange("wld_dial", "w_size", strSizeAbove); akit.ValueChange("wld_dial", "w_size2", strSizeBelow); akit.ValueChange("wld_dial", "w_type", strTypeAbove); akit.ValueChange("wld_dial", "w_type2", strTypeBelow); akit.ValueChange("wld_dial", "w_ftype", strContourAbove); akit.ValueChange("wld_dial", "w_ftype2", strContourBelow); akit.ValueChange("wld_dial", "w_around", strAroundWeld); akit.ValueChange("wld_dial", "w_wld", strRefText); akit.PushButton("wld_apply", "wld_dial"); akit.CommandStart("ail_create_wld", "", "main_frame"); } } Tekla.Structures.Drawing.UI.DrawingObjectSelector drawingObjectSelector = drawingHandler.GetDrawingObjectSelector(); drawingObjectSelector.SelectObject(SelectedWeld); } } catch { } }
public static void RefRefresh(string PhaseNumber) { try { Model model = new Model(); ModelInfo modelinfo = model.GetInfo(); ProjectInfo projectInfo = model.GetProjectInfo(); string PhaseReportsFolder = projectInfo.ProjectNumber + " Phase " + PhaseNumber + " LISTS"; string PhaseReportsFolderPath = modelinfo.ModelPath + @"\Reports\" + PhaseReportsFolder + @"\"; Directory.CreateDirectory(PhaseReportsFolderPath); akit.Callback("acmd_shellexecute_open", PhaseReportsFolderPath, "main_frame"); /* creates the select filter so its visible in the list */ akit.Callback("diaDisplayObjectGroupDialogCB", "diaSelectObjectGroup", "main_frame"); //opens select filter dialog box akit.ValueChange("diaSelectObjectGroup", "saveas_file", "phase-macro"); //filename to save select filter akit.PushButton("attrib_saveas", "diaSelectObjectGroup"); //saves the select filter akit.PushButton("dia_pa_cancel", "diaSelectObjectGroup"); //closes select filter dialog box /* writes the new select filter to the model folder */ System.IO.StreamWriter sw = new System.IO.StreamWriter("phase-macro.SObjGrp", false, System.Text.Encoding.Default); sw.WriteLine("TITLE_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("Version= 1.04"); sw.WriteLine("Count= 2"); sw.WriteLine("SECTION_OBJECT_GROUP"); sw.WriteLine("{"); sw.WriteLine("0"); sw.WriteLine("1"); sw.WriteLine("co_part"); sw.WriteLine("proPHASE"); sw.WriteLine("albl_Phase"); sw.WriteLine("=="); sw.WriteLine("albl_Equals"); sw.WriteLine(PhaseNumber); sw.WriteLine("0"); sw.WriteLine("Empty"); sw.WriteLine("}"); sw.WriteLine("}"); sw.Flush(); sw.Close(); /* moves new select filter to attributes folder */ File.Delete("./attributes/phase-macro.SObjGrp"); File.Move("phase-macro.SObjGrp", "./attributes/phase-macro.SObjGrp"); /* set select switches and load phase and main part filter */ akit.ValueChange("main_frame", "sel_objects_in_joints", "1"); //choose parts in componets only akit.ValueChange("main_frame", "sel_parts", "1"); //pick parts only akit.ValueChange("main_frame", "sel_filter", "phase-macro"); //pick the filter to use akit.Callback("acmdSelectAll", "", "main_frame"); //selects parts System.Runtime.Remoting.Lifetime.ClientSponsor sponsor = null; sponsor = new System.Runtime.Remoting.Lifetime.ClientSponsor(); sponsor.Register((System.MarshalByRefObject)akit); Operation.CreateReportFromSelected("KWP-ass_issue_list_SUB", PhaseReportsFolderPath + "ass_issue_list_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); Operation.CreateReportFromSelected("KWP-part_list_SUB", PhaseReportsFolderPath + "part_list_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); Operation.CreateReportFromSelected("g2_assy6_SUB", PhaseReportsFolderPath + "g2_assy6_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); Operation.CreateReportFromSelected("KWP-assembly_bolt_list1_comment", PhaseReportsFolderPath + "assembly_bolt_list1_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); Operation.CreateReportFromSelected("KWP-bolt_list_shop_only_comment", PhaseReportsFolderPath + "bolt_list_shop_only_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); Operation.CreateReportFromSelected("KWP-bolt_list_site_only_comment", PhaseReportsFolderPath + "bolt_list_site_only_PH" + PhaseNumber + ".xsr", PhaseNumber, "", ""); /* closes report dialog and resets switches/filter */ akit.ValueChange("main_frame", "sel_filter", "standard"); //pick the filter to use akit.ValueChange("main_frame", "sel_views", "1"); //selects views akit.Callback("acmdSelectAll", "", "main_frame"); //deselects objects akit.ValueChange("main_frame", "sel_all", "1"); //reselects all switches System.Windows.Forms.MessageBox.Show("Reports created for phase " + PhaseNumber, "Tekla Structures"); Application.Exit(); } catch { MessageBox.Show("Operation timed out"); } }
public static void Run(Tekla.Technology.Akit.IScript akit) { akit.PushButton("dia_draw_display_all", "Drawing_selection"); akit.Callback("gdr_menu_select_active_draw", "", "main_frame"); akit.PushButton("dia_draw_filter_by_parts", "Drawing_selection"); }