Exemple #1
0
        private void addMark(string attributeName, bool customAmount, string barNo = null)
        {
            if (!TeklaStructures.Connect())
            {
                return;
            }
            var macroBuilder = new MacroBuilder();

            if (customAmount)
            {
                macroBuilder.Callback("acmd_create_marks_selected", "", "View_10 window_1");
                macroBuilder.ValueChange("rebar_mark_dial", "gr_rebar_mark_get_menu", attributeName);
                macroBuilder.PushButton("gr_rebar_get", "rebar_mark_dial");
                macroBuilder.TableSelect("rebar_mark_dial", "gr_mark_selected_elements", new int[] { 1 });
                macroBuilder.Activate("rebar_mark_dial", "gr_mark_selected_elements");
                macroBuilder.ValueChange("gr_mark_text", "gr_text", barNo);
                macroBuilder.PushButton("gr_mark_prompt_modify", "gr_mark_text");
                macroBuilder.PushButton("rebar_mark_modify", "rebar_mark_dial");
                macroBuilder.Run();
            }
            else
            {
                macroBuilder.Callback("acmd_create_marks_selected", "", "View_10 window_1");
                macroBuilder.ValueChange("rebar_mark_dial", "gr_rebar_mark_get_menu", attributeName);
                macroBuilder.PushButton("gr_rebar_get", "rebar_mark_dial");
                macroBuilder.PushButton("rebar_mark_modify", "rebar_mark_dial");
                macroBuilder.Run();
            }
        }
Exemple #2
0
        /// <summary>*******************************************************************
        ///
        ///
        /// HELPER METHODS
        ///
        ///
        /// </summary>*******************************************************************

        private void changeDialog(string attributeFileName, dialogType objectType)
        {
            if (!TeklaStructures.Connect())
            {
                return;
            }
            var macroBuilder = new MacroBuilder();

            switch (objectType)
            {
            case dialogType.bar:
                macroBuilder.Callback("acmd_display_selected_drawing_object_dialog", "", "View_10 window_1");
                macroBuilder.ValueChange("rebar_dial", "gr_rebar_get_menu", attributeFileName);
                macroBuilder.PushButton("gr_rebar_get", "rebar_dial");
                macroBuilder.PushButton("rebar_modify", "rebar_dial");
                macroBuilder.Run();
                break;

            case dialogType.coupler:
                macroBuilder.Callback("acmd_display_selected_drawing_object_dialog", "", "View_10 window_1");
                macroBuilder.ValueChange("part_dial", "gr_part_get_menu", attributeFileName);
                macroBuilder.PushButton("gr_part_get", "part_dial");
                macroBuilder.PushButton("part_modify", "part_dial");
                macroBuilder.Run();
                break;

            default:
                break;
            }
        }
Exemple #3
0
        public void OpenDrawingListOfColumns()
        {
            var macroBuilder = new MacroBuilder();

            //open drawing list and show columns
            macroBuilder.ValueChange("main_frame", "sel_all", "0");
            macroBuilder.ValueChange("main_frame", "sel_all", "1");
            macroBuilder.ValueChange("main_frame", "sel_filter", "Steel_Column");
            macroBuilder.Callback("acmdSelectAll", "", "main_frame");
            macroBuilder.Callback("gdr_menu_select_active_draw", "", "main_frame");
            macroBuilder.PushButton("dia_draw_display_all", "Drawing_selection");
            macroBuilder.PushButton("dia_draw_filter_by_parts", "Drawing_selection");

            macroBuilder.Run();

            //recorded macro code for reference

            //akit.ValueChange("main_frame", "sel_all", "0");
            //akit.ValueChange("main_frame", "sel_all", "1");
            //akit.ValueChange("main_frame", "sel_filter", "Steel_Column");
            //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");
        }
Exemple #4
0
        public void CreateViewOfAllModelObject()
        {
            var macroBuilder = new MacroBuilder();

            //create view of all model objects
            macroBuilder.Callback("acmdSelectAll", "", "main_frame");
            macroBuilder.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "View_01 window_1");
            macroBuilder.Callback("acmd_set_view_representation", "rendered_joint", "main_frame");
            macroBuilder.Callback("acmd_set_view_representation", "rendered", "main_frame");

            macroBuilder.Run();

            //recorded macro code for reference

            //akit.Callback("acmdSelectAll", "", "main_frame");
            //akit.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "View_02 window_1");
            //akit.Callback("acmd_set_view_representation", "rendered", "main_frame");
            //akit.Callback("acmd_set_view_representation", "rendered_joint", "main_frame");
        }
Exemple #5
0
        private void changeSelectionFilter(string filterName, bool partOnly)
        {
            if (!TeklaStructures.Connect())
            {
                return;
            }
            var macroBuilder = new MacroBuilder();

            macroBuilder.Callback("acmd_display_gr_select_filter_dialog", "", "main_frame");
            macroBuilder.ValueChange("diaSelDrawingObjectGroupDialogInstance", "get_menu", filterName);
            macroBuilder.PushButton("dia_pa_apply", "diaSelDrawingObjectGroupDialogInstance");
            if (partOnly)
            {
                macroBuilder.ValueChange("main_frame", "gr_sel_all", "0");
                macroBuilder.ValueChange("main_frame", "gr_sel_drawing_part", "1");
            }
            else
            {
                macroBuilder.ValueChange("main_frame", "gr_sel_all", "1");
            }
            macroBuilder.Run();
        }
        /// <summary>
        /// Renumbers part that need renumbering.
        /// </summary>
        /// <param name="model">Tekla.Structures.Model model</param>
        public static void RenumberParts(TSM.Model model)
        {
            // check if numberinghistory.txt exists and change its name
            RenameNumberingHistory(model);

            foreach (PartCustom part in partList)
            {
                if (part.NeedsToChange)
                {
                    string partCurrentPosition;
                    partCurrentPosition = part.prefix.ToString() + part.number.ToString();

                    int newNum;
                    string oppositePrefix = ChangeCapitalization(part.Prefix);

                    // checks if a part with same position has already been assigned a new number.
                    // If so, it skips it --> tekla applies the new number from the first part to all of the same parts
                    // all changes are collected in prefixChanges dictionary.
                    if (!prefixChanges.ContainsKey(partCurrentPosition))
                    {
                        bool firstGo = true;
                        string preNumber = string.Empty;
                        string postNumber = string.Empty;

                        do
                        {
                            int maxOppositeNumber = positionsDictionary[oppositePrefix].Max();
                            int maxNumber = positionsDictionary[part.Prefix].Max();

                            newNum = Math.Max(maxNumber, maxOppositeNumber) + 1;

                            // adds new number to prefixChanges dictionary
                            Tuple<string, int> tuple = new Tuple<string, int>(part.prefix, newNum);

                            if (firstGo)
                            {
                                prefixChanges.Add(partCurrentPosition, tuple);
                            }
                            else
                            {
                                prefixChanges.Remove(partCurrentPosition);
                                prefixChanges.Add(partCurrentPosition, tuple);
                            }

                            // select part - clumsy, could it be improved?
                            ArrayList aList = new ArrayList();
                            TSM.Object tPart = model.SelectModelObject(part.Identifier);
                            TSM.UI.ModelObjectSelector selector = new TSM.UI.ModelObjectSelector();
                            aList.Add(tPart);
                            selector.Select(aList);

                            TSM.Part myPart = tPart as TSM.Part;

                            // preNumber and postNumber strings are compared in the 'while' of the do-while loop, to determine if Macrobuilder
                            // macro was succesfully run.
                            // (sometimes Tekla doesn't want to apply certain numbers - e.g.: if they were in use in previous model stages, ... )
                            preNumber = myPart.GetPartMark();

                            // use Macrobuilder dll to change numbering
                            MacroBuilder macroBuilder = new MacroBuilder();
                            macroBuilder.Callback("acmdAssignPositionNumber", "part", "main_frame");
                            macroBuilder.ValueChange("assign_part_number", "Position", newNum.ToString());
                            macroBuilder.PushButton("AssignPB", "assign_part_number");
                            macroBuilder.PushButton("CancelPB", "assign_part_number");
                            macroBuilder.Run();

                            postNumber = myPart.GetPartMark();

                            bool ismacrounning = true;
                            while (ismacrounning)
                            {
                                ismacrounning = TSM.Operations.Operation.IsMacroRunning();
                            }

                            // add newly created part mark to positionsDict
                            positionsDictionary[part.Prefix].Add(newNum);

                            firstGo = false;

                        }
                        //while (!AssignmentSuccesCheck(model));
                        while (preNumber == postNumber);
                    }
                }
            }
        }