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 { }
        }
        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 { }
        }
Пример #3
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 { }
        }