Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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 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
 }
Ejemplo n.º 4
0
        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)
        {
            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)
        {
            try
            {
                Model model = new Model();
                TransformationPlane transformationplane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

                if (modelObjectEnum.GetSize() == 1)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                        {
                            Tekla.Structures.Model.Part part = modelObjectEnum.Current as Tekla.Structures.Model.Part;
                            double level = 0; part.GetReportProperty("TOP_LEVEL_UNFORMATTED", ref level);
                            akit.CommandStart("ail_create_basic_view", "", "main_frame");
                            akit.ValueChange("Modelling create view", "v1_coordinate", level.ToString("F02"));
                            akit.PushButton("v1_create", "Modelling create view");
                        }
                    }
                }

                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationplane);
            }
            catch { }
        }
        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
            {
                akit.ValueChange("main_frame", "depth_position_om", "3");
                akit.CommandStart("ail_create_basic_view", "", "main_frame");

                Model model = new Model();
                TransformationPlane transformationplane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
                Tekla.Structures.Model.UI.Picker  picker = new Tekla.Structures.Model.UI.Picker();
                Tekla.Structures.Geometry3d.Point point  = picker.PickPoint();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationplane);

                akit.ValueChange("Modelling create view", "v1_coordinate", point.Z.ToString("F02"));
                akit.PushButton("v1_create", "Modelling create view");
                //akit.PushButton("v1_create_cancel", "Modelling create view");
            }
            catch { }
        }
Ejemplo n.º 9
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            DrawingHandler    DrawingHandler = new DrawingHandler();
            DrawingEnumerator DrawingEnum    = DrawingHandler.GetDrawingSelector().GetSelected();

            if (DrawingEnum.GetSize() == 0)
            {
                // No drawings selected
                MessageBox.Show("No Drawings Selected");
                return;
            }

            while (DrawingEnum.MoveNext())
            {
                Drawing Drawing = DrawingEnum.Current;
                DrawingHandler.SetActiveDrawing(Drawing, false);
                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");

                DrawingHandler.SaveActiveDrawing();
                DrawingHandler.CloseActiveDrawing();
            }
        }
        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");
            }
        }
Ejemplo n.º 11
0
 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");
 }
Ejemplo n.º 12
0
        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();
        }
Ejemplo n.º 13
0
        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 { }
        }