Esempio n. 1
0
        private void createElementOfOnePoint(string name, int number)
        {
            CustomPart customPart = new CustomPart();

            customPart.Name   = name;
            customPart.Number = number;

            Picker picker = new Picker();

            try
            {
                Point startPoint = picker.PickPoint("Wybierz punkt");
                customPart.SetInputPositions(startPoint, startPoint + new Point(0, 0, 1000));
            }
            catch (ApplicationException ex)
            {
                Operation.DisplayPrompt("Przerwano operację");
                return;
            }
            if (number != BaseComponent.CUSTOM_OBJECT_NUMBER)
            {
                customPart.Insert();
            }
            else
            {
                try
                {
                    if (isExisting(customPart))
                    {
                        customPart.Insert();
                    }
                    else
                    {
                        importCustomComponent(customPart);
                        customPart.Insert();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Nie udało się wstawić komponentu", "Error");
                }
            }
            MyModel.CommitChanges();
        }
        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 { }
        }