Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!validarMuroSeleccionado())
            {
                return;
            }

            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
            TransformationPlane currentTP = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

            T3D.CoordinateSystem coordenadasMuro = muro.GetCoordinateSystem();
            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(coordenadasMuro));

            ParametrosPanel p = new ParametrosPanel(muro);

            p.dx = Double.Parse(this.txtDx.Text);
            p.dy = Double.Parse(this.txtDz.Text);
            p.adicionalDerecha   = Double.Parse(this.txtAddDer.Text);
            p.adicionalIzquierda = Double.Parse(this.txtAdIzq.Text);
            p.adicionalSuperior  = Double.Parse(this.txtAdicionalSup.Text);
            p.adicionalInferior  = Double.Parse(this.txtAdicionalInf.Text);
            p.diametroBarras     = 7.0;
            p.diametroDiagonal   = 4.0;

            PanelMoldar panel = new PanelMoldar(p);

            panel.fabricar();

            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP);
            model.CommitChanges();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Callback function to create objects on corrent places.
 /// Two loops are used to go through all positions.
 /// </summary>
 private void CreatePadFootings(object sender, EventArgs e)
 {
     // Always remember to check that you really have working connection
     if (MyModel.GetConnectionStatus())
     {
         // Loop through X-axis  (these loops should be changed to match current grid)
         for (double PositionX = 0.0; PositionX <= 12000.0; PositionX += 3000.0)
         {
             // In first and in last line
             if (PositionX.Equals(0.0) || PositionX.Equals(12000.0))
             {
                 // Loop through Y-axis to get pad footings on the longer sides of the grid
                 for (double PositionY = 0.0; PositionY <= 30000.0; PositionY += 6000.0)
                 {
                     CreateFootingAndColumn(PositionX, PositionY);
                 }
             }
             else
             {
                 CreateFootingAndColumn(PositionX, 0.0);
                 CreateFootingAndColumn(PositionX, 30000.0);
             }
         }
         // Always remember to commit changes to Tekla Structures, otherwise some things might be left in uncertain state
         MyModel.CommitChanges();
     }
 }
Exemplo n.º 3
0
        private void btnWorkPlane_Click(object sender, EventArgs e)
        {
            // Reset workplane back to global
            currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

            TSMUI.Picker currentPicker = new TSMUI.Picker();
            Part         pickedPart    = null;

            try
            {
                pickedPart = currentPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Part;
            }
            catch
            {
                pickedPart = null;
            }

            if (pickedPart != null)
            {
                // Change the workplane to the coordinate system of the plate
                currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(pickedPart.GetCoordinateSystem()));

                // Show the plate in the model and the workplane change
                currentModel.CommitChanges();

                // Draw Positive Z axis
                TSMUI.GraphicsDrawer myDrawer = new TSMUI.GraphicsDrawer();
                myDrawer.DrawLineSegment(new T3D.LineSegment(new T3D.Point(0, 0, 0), new T3D.Point(0, 0, 500)), new TSMUI.Color(1, 0, 0));
            }
        }
Exemplo n.º 4
0
        private void buttonCreateBeams_Click(object sender, EventArgs e)
        {
            _primaryBeam = new Beam(new Point(5000, 0, 0), new Point(7000, 0, 0))
            {
                Name    = "BEAM",
                Class   = "3",
                Finish  = "PAINT",
                Profile = new Profile()
                {
                    ProfileString = "W16X36"
                },
                Material = new Material {
                    MaterialString = "A36"
                }
            };

            _secondaryBeam = new Beam(new Point(6000, 0, 0), new Point(6000, 1000, 0))
            {
                Name    = "BEAM",
                Class   = "5",
                Finish  = "PAINT",
                Profile = new Profile()
                {
                    ProfileString = "W10X15"
                },
                Material = new Material {
                    MaterialString = "A36"
                }
            };

            _primaryBeam.Insert();
            _secondaryBeam.Insert();

            _model.CommitChanges();
        }
Exemplo n.º 5
0
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            var startPoint = ExtendedPicker.PickPoint();
            var house      = new House(Convert.ToInt16(NumberOfRooms.Text), Convert.ToInt16(NumberOfFloors.Text),
                                       Lenght.Text.ToDouble(), Width.Text.ToDouble(), FloorHeight.Text.ToDouble(),
                                       RoofHeight.Text.ToDouble(), startPoint);

            house.Generate();
            model.CommitChanges();
        }
Exemplo n.º 6
0
        private static void CreateFloor(double StartZ, bool IsCreateColumn)
        {
            double XDist = 6096, YDist = 4572;
            double EndX = 0, StartX = 0, StartY = 0, EndY = 0;

            for (int j = 1; j <= 5; j++)
            {
                EndX = 0; StartX = 0;
                for (int i = 1; i <= 10; i++)
                {
                    EndX = XDist * i;
                    Point point  = new Point(StartX, StartY, StartZ);
                    Point point2 = new Point(EndX, StartY, StartZ);
                    InsertBeam(point, point2);

                    if (IsCreateColumn)
                    {
                        if (i == 1)
                        {
                            InsertColumn(point);
                        }

                        InsertColumn(point2);
                    }

                    StartX = EndX;
                    _model.CommitChanges();
                }
                StartY = YDist * j;
            }

            StartX = 0;
            double StartXMid = 0;

            for (int j = 1; j <= 11; j++)
            {
                EndY = 0; StartY = 0;
                for (int i = 1; i <= 4; i++)
                {
                    EndY = YDist * i;
                    Point point  = new Point(StartX, StartY, StartZ);
                    Point point2 = new Point(StartX, EndY, StartZ);
                    InsertBeam(point, point2);

                    point  = new Point(StartXMid, StartY, StartZ);
                    point2 = new Point(StartXMid, EndY, StartZ);
                    InsertBeam(point, point2);

                    StartY = EndY;
                }
                StartX    = XDist * j;
                StartXMid = StartX - (XDist / 2);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Beam NewBeam = new Beam();

            NewBeam.StartPoint              = new T3D.Point(0, 0, 0);
            NewBeam.EndPoint                = new T3D.Point(1000, 0, 0);
            NewBeam.Profile.ProfileString   = "I40B1_20_93";
            NewBeam.Material.MaterialString = "C245";
            NewBeam.Class = "4";
            NewBeam.Insert();
            Model.CommitChanges();
        }
Exemplo n.º 8
0
        private static void ApplyConn(Beam PrimB, Beam SecBeam, string Side)
        {
            Connection C = new Connection();

            C.Name = "Clip Angle";

            if (PrimB.Name == "COLUMN")
            {
                string ColumnPas = GetColumnPos(PrimB, SecBeam, Side);
                if (ColumnPas == "Flange")
                {
                    C.Number = 131;
                }
                else
                {
                    C.Number = 146;
                }
            }
            else
            {
                C.Number = 146;
            }

            C.LoadAttributesFromFile("Default_ShearPlate");
            C.UpVector     = new Vector(0, 0, 1000);
            C.PositionType = PositionTypeEnum.COLLISION_PLANE;

            C.SetPrimaryObject(PrimB);
            C.SetSecondaryObject(SecBeam);

            C.Insert();
            MyModel.CommitChanges();
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model model = new Model();
                ModelObjectEnumerator        modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                System.Collections.ArrayList array           = new System.Collections.ArrayList();
                if (modelObjectEnum.GetSize() == 0)
                {
                    Picker picker = new Picker();
                    Part   part   = (Part)picker.PickObject(Tekla.Structures.Model.UI.Picker.PickObjectEnum.PICK_ONE_PART);
                    part.Insert();
                    array.Add(part);
                }

                else
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Part)
                        {
                            Part part = (Part)modelObjectEnum.Current;
                            part.Insert();
                            array.Add(part);
                        }
                    }
                }
                model.CommitChanges();
                Tekla.Structures.Model.UI.ModelObjectSelector modelobjsel = new Tekla.Structures.Model.UI.ModelObjectSelector();
                modelobjsel.Select(array);
            }
            catch { }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            var model = new Model();

            if (model.GetConnectionStatus())
            {
                Console.WriteLine("Give diameter");
                int diameter       = Int32.Parse(Console.ReadLine());
                int numberOfPoints = 90;
                var slab           = new ContourPlate();
                for (int i = 0; i < numberOfPoints; i++)
                {
                    slab.AddContourPoint(new ContourPoint(
                                             new Tekla.Structures.Geometry3d.Point(
                                                 Math.Sin(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2,
                                                 Math.Cos(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2,
                                                 0),
                                             null));
                }

                slab.Class = "5";
                slab.Profile.ProfileString = "500";

                slab.Insert();

                //Beam beam = new Beam();
                //beam.StartPoint = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
                //beam.EndPoint = new Tekla.Structures.Geometry3d.Point(0, 1500, 0);
                //beam.Profile.ProfileString = "600*500";
                //beam.Class = "4";
                //beam.Insert();

                model.CommitChanges();
            }
        }
Exemplo n.º 11
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model myModel = new Model();

            ScaleToDrawingTitle3.main();
            myModel.CommitChanges();
        }
        public void CK06_ByPickPart()
        {
            ModelObject PickedObject = null;
            Picker      Picker       = new Picker();

            try
            {
                PickedObject = Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT);
            }
            catch { PickedObject = null; }

            if (PickedObject != null)
            {
                T3D.CoordinateSystem ObjectSystem = PickedObject.GetCoordinateSystem();
                Model.GetWorkPlaneHandler()
                .SetCurrentTransformationPlane(new TransformationPlane(ObjectSystem));

                double StartX = 500;
                for (int i = 0; i < 7; i++)
                {
                    T3D.Point p1 = new T3D.Point(StartX, 0);
                    T3D.Point p2 = new T3D.Point(StartX, 0, 1000);
                    CreateBeam("test Beam", "I30B1_20_93", p1, p2);
                    StartX += 500;
                }
                ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018
                Model.CommitChanges();
            }
            mw.Msg("Изображение ПСК теперь на стартовой точке - на желтой ручке балки:"
                   + " Х по опорной линии, Y вверх. Перпендикулярно балке создано"
                   + " 7 дополнительных отрезков другого цвета.  [OK]");
            MessageBox.Show("вывел ПСК и 7 перпендикулярных дополнительных балок");
            mw.Msg();
        }
Exemplo n.º 13
0
        public static void IntersectionTest()
        {
            var model = new Model();

            if (model.GetConnectionStatus())
            {
                var startPoint    = PickAPoint("выбери точку");
                var startPointTwo = new Point(startPoint.X, startPoint.Y + 1000, startPoint.Z);
                List <RandomlyPlate> plateList = new List <RandomlyPlate>();
                plateList.Add(new RandomlyPlate(startPoint, rnd));
                plateList.Add(new RandomlyPlate(startPointTwo, rnd));
                if (Helper.GetIntersectionPlate(plateList[0].ContourPoints, plateList[1].ContourPoints))
                {
                    plateList[0].Number = 1;
                    plateList[1].Number = 2;
                }

                foreach (var item in plateList)
                {
                    var plate = new ContourPlate();
                    foreach (var point in item.ContourPoints)
                    {
                        plate.AddContourPoint(new ContourPoint(point, null));
                    }
                    plate.Name = "Пластина";
                    plate.Profile.ProfileString   = "—6";
                    plate.Material.MaterialString = "С255";
                    plate.Class = $"{item.Number + 1}";
                    plate.Insert();
                }
            }
            model.CommitChanges();
        }
        public static void CopyToAnotherBeamByEndPoint(ArrayList objectsToCopyArray, Beam sourceBeam)
        {
            try
            {
                Model model = new Model();

                Beam destinationBeam = PickBeam();

                CoordinateSystem sourceCoordinateSystem = sourceBeam.GetCoordinateSystem();
                sourceCoordinateSystem.Origin = sourceBeam.EndPoint;

                CoordinateSystem destinationCoordinateSystem = destinationBeam.GetCoordinateSystem();
                destinationCoordinateSystem.Origin = destinationBeam.EndPoint;

                foreach (ModelObject objectToCopy in objectsToCopyArray)
                {
                    TSM.Operations.Operation.CopyObject(objectToCopy, sourceCoordinateSystem, destinationCoordinateSystem);
                }

                model.CommitChanges();

                CopyToAnotherBeamByEndPoint(objectsToCopyArray, sourceBeam);
            }
            catch { }
        }
Exemplo n.º 15
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model model = new Model();
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                if (modelObjectEnum.GetSize() > 0)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                        {
                            Tekla.Structures.Model.Part part = (Tekla.Structures.Model.Part)modelObjectEnum.Current;
                            string    mark                = "";
                            Hashtable strProps            = new Hashtable();
                            ArrayList PartStrRepPropNames = new ArrayList();
                            PartStrRepPropNames.Add("ASSEMBLY_POS");
                            part.GetStringReportProperties(PartStrRepPropNames, ref strProps);
                            if ((mark = (string)strProps["ASSEMBLY_POS"]) == null)
                            {
                                mark = "";
                            }

                            mark = mark.Replace("(?)", "");

                            part.SetUserProperty("USER_FIELD_4", mark);
                            part.Modify();
                        }
                    }
                    model.CommitChanges();
                    MessageBox.Show("Process Complete");
                }
            }
            catch { }
        }
Exemplo n.º 16
0
        public PDLength()
        {
            System.Type[] selectionType = new System.Type[1];
            selectionType.SetValue(typeof(TSM.CustomPart), 0);

            Model myModel = new Model();
            ModelObjectEnumerator allObjects = myModel.GetModelObjectSelector().GetAllObjectsWithType(selectionType);

            while (allObjects.MoveNext())
            {
                if (allObjects.Current is TSM.CustomPart)
                {
                    TSM.CustomPart currentComponent = allObjects.Current as TSM.CustomPart;
                    if (currentComponent.Name == "EB_PD")
                    {
                        double curWidth  = 0.0;
                        double curLength = 0.0;

                        currentComponent.GetUserProperty("w", ref curWidth);
                        currentComponent.GetUserProperty("L", ref curLength);

                        string newName = "PD" + curWidth.ToString() + " L=" + curLength.ToString();
                        currentComponent.SetUserProperty("P1a", newName);
                        currentComponent.Modify();
                    }
                }
            }
            myModel.CommitChanges();
        }
Exemplo n.º 17
0
        public bool ClashCheck()
        {
            bool result = false;

            _selector       = new ModelObectSelector();
            _clashes        = new ArrayList();
            _clashCheckDone = false;
            ArrayList objectsToSelect = new ArrayList();

            objectsToSelect = InsertThreeClashingParts();

            #region 전체 모델의 충돌에 대해 확인
            ModelObjectEnumerator modelObjectEnumerator = _model.GetModelObjectSelector().GetAllObjects();
            foreach (ModelObject modelObject in modelObjectEnumerator)
            {
                objectsToSelect.Add(modelObject);
            }
            #endregion

            _selector.Select(objectsToSelect);
            _model.CommitChanges();

            result = RunClashCheck();

            if (TsEvent != null)
            {
                TsEvent.UnRegister();
            }

            return(result);
        }
Exemplo n.º 18
0
 public override void Run()
 {
     _attack.Label = _battleModel.CurrentAttacker.Spells[0].Name;
     _defend.Label = _battleModel.CurrentAttacker.Spells[1].Name;
     _controller.ControlMenu(_menu, Input, () => { });
     Model.CommitChanges();
 }
        public void CK06_Pick2Points()
        {
            T3D.Point FirstPoint  = null;
            T3D.Point SecondPoint = null;
            Picker    Picker      = new Picker();

            try
            {
                ArrayList PickPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_TWO_POINTS);
                FirstPoint  = PickPoints[0] as T3D.Point;
                SecondPoint = PickPoints[1] as T3D.Point;
            }
            catch { FirstPoint = SecondPoint = null; }

            if (FirstPoint != null && SecondPoint != null)
            {
                T3D.Vector XVector = new T3D.Vector(SecondPoint.X - FirstPoint.X,
                                                    SecondPoint.Y - FirstPoint.Y, SecondPoint.Z - FirstPoint.Z);
                T3D.Vector YVector = XVector.Cross(new T3D.Vector(0, 0, -1));
                Model.GetWorkPlaneHandler()
                .SetCurrentTransformationPlane(new TransformationPlane(FirstPoint
                                                                       , XVector, YVector));
                ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018
                Model.CommitChanges();
                mw.Msg("Появляется рисунок осей X и Y ПСК, ось X в направлении от точки 1 к точке 2");
                MessageBox.Show("вывел ПСК");
                mw.Msg();
            }
        }
Exemplo n.º 20
0
        public void Modify(PropertyValueChangedEventArgs e)
        {
            string label = e.ChangedItem.Label;

            Tekla.Structures.Model.UI.ModelViewEnumerator modelViewEnum = Tekla.Structures.Model.UI.ViewHandler.GetSelectedViews();
            if (modelViewEnum.Count == 1)
            {
                while (modelViewEnum.MoveNext())
                {
                    Tekla.Structures.Model.UI.View view = (Tekla.Structures.Model.UI.View)modelViewEnum.Current;
                    if (label == "Name")
                    {
                        view.Name = name;
                    }
                    if (label == "ViewDepthUp")
                    {
                        view.ViewDepthUp = double.Parse(viewDepthUp);
                    }
                    if (label == "ViewDepthDown")
                    {
                        view.ViewDepthDown = double.Parse(viewDepthDown);
                    }

                    view.Modify();
                    model.CommitChanges();
                }
            }
        }
Exemplo n.º 21
0
        public void DumpClipBoardHere(Identifier selectedID)
        {
            ModelObject targetFather   = _tsModel.SelectModelObject(selectedID);
            Assembly    targetAssembly = null;

            if (targetFather is Assembly)
            {
                targetAssembly = targetFather as Assembly;
            }
            else if (targetFather is Part)
            {
                targetAssembly = (targetFather as Part).GetAssembly();
            }

            if (_sourceRootAssembly.Identifier.ID == GetRootAssembly(targetAssembly).Identifier.ID&&
                _operationEnum == TreeOperationEnum.CUT)
            {
                ChangeRelationToTarget(targetAssembly);
            }
            else
            {
                PasteToTarget(targetAssembly);
            }

            _tsModel.CommitChanges();
        }
Exemplo n.º 22
0
        public override void Run()
        {
            var state = CurrentState;

            _menuController.ControlMenu(state as IMenu, Input, CancelAction);
            Model.CommitChanges();
        }
Exemplo n.º 23
0
        internal void ModifyGrid(ref Model myModel)
        {
            bool Success = false;
            ModelObjectEnumerator Enumerator = myModel.GetModelObjectSelector().GetAllObjects();

            while (!Success && Enumerator.MoveNext())
            {
                ModelObject ModelObject = Enumerator.Current as ModelObject;
                Type        ObjectType  = ModelObject.GetType();

                while (ObjectType != typeof(Grid) && ObjectType.BaseType != null)
                {
                    ObjectType = ObjectType.BaseType;
                }


                if (ObjectType == typeof(Grid))
                {
                    Success = true;
                }
            }

            Grid curGr = Enumerator.Current as Grid;
            var  ff    = GetGridXString();

            curGr.CoordinateX = ff.Item1;
            curGr.CoordinateY = string.Format("{0:F2} 2*{1:F2}", BeamWidth * -0.5, BeamWidth * 0.5);
            curGr.LabelX      = ff.Item2;
            curGr.LabelY      = "R C L";
            curGr.Modify();
            myModel.CommitChanges();
        }
        public void CK10_SetWorkplane()
        {
            // Reset the workplane back to global
            Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

            Picker Picker     = new Picker();
            Part   PickedPart = null;

            try
            {
                PickedPart = Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART) as Part;
            }
            catch { PickedPart = null; }
            if (PickedPart != null)
            {
                // Change the workplane to the coordinate system of the plate
                var psk = new TransformationPlane(PickedPart.GetCoordinateSystem());
                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(psk);

                // Show the plate in the model and the workplane change
                Model.CommitChanges();

                // Draw Positive Z axis.
                GraphicsDrawer Drawer = new GraphicsDrawer();
                var            red    = new Color(1, 0, 0);
                Drawer.DrawLineSegment(new T3D.Point(0, 0, 0), new T3D.Point(0, 0, 500), red);
            }
        }
Exemplo n.º 25
0
        private void btnDraw_Click(object sender, EventArgs e)
        {
            if (!ValidateLengthTextBoxes())
            {
                ErrorDialog.Show("Alert", "Inputs are not valid!", ErrorDialog.Severity.ERROR);
                return;
            }

            var currentPlane = GetCurrentCorSystem().TransformFromCurrentToGlobal();

            SetPlane();
            Picker    pickMe    = new Picker();
            ArrayList frameList = pickMe.PickPoints(Picker.PickPointEnum.PICK_TWO_POINTS, "Please choose frame direction");

            alongFrameVector = new Vector((frameList[1] as Point) - (frameList[0] as Point));

            ArrayList replicationList = pickMe.PickPoints(Picker.PickPointEnum.PICK_TWO_POINTS, "Please choose replication direction");

            replicationVector = new Vector((replicationList[1] as Point) - (replicationList[0] as Point)).GetNormal();
            FramingOptions options = PopulateFramingOption(frameList[0] as Point);

            if (imgListCmbBoxFrameMode.SelectedIndex == 0)
            {
                GableSetting gableSystem = new GableSetting(options);
                gableSystem.Draw();
            }
            else if (imgListCmbBoxFrameMode.SelectedIndex == 1)
            {
                MonoSlopeSetting monoSystem = new MonoSlopeSetting(options);
                monoSystem.Draw();
            }
            SetPlane(currentPlane, TeklaGeometryExtender.ReferencePlane.GLOBAL);
            teklaModel.CommitChanges();
        }
Exemplo n.º 26
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model model = new Model();
            ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

            Tekla.Structures.Model.UI.Picker picker = new Tekla.Structures.Model.UI.Picker();

            if (modelObjectEnum.GetSize() == 0)
            {
                modelObjectEnum = picker.PickObjects(Tekla.Structures.Model.UI.Picker.PickObjectsEnum.PICK_N_PARTS);
            }

            ArrayList arrayPoints = picker.PickPoints(Tekla.Structures.Model.UI.Picker.PickPointEnum.PICK_TWO_POINTS);
            Point     point1      = (Tekla.Structures.Geometry3d.Point)arrayPoints[0];
            Point     point2      = (Tekla.Structures.Geometry3d.Point)arrayPoints[1];
            Line      line        = new Tekla.Structures.Geometry3d.Line(point1, point2);

            while (modelObjectEnum.MoveNext())
            {
                if (modelObjectEnum.Current is Beam)
                {
                    Beam  beam         = (Beam)modelObjectEnum.Current;
                    Line  line2        = new Line(beam.StartPoint, beam.EndPoint);
                    Point intersection = Intersection.LineToLine(line, line2).Point1;
                    Tekla.Structures.Model.Operations.Operation.Split(beam, intersection);
                }
            }
            model.CommitChanges();
        }
Exemplo n.º 27
0
        public Beam CutBeamByPart(Beam beam, Part part, bool startSideCut = true)
        {
            // вырезаем ThasBeam по MainBeam
            var         partClass = part.Class;
            BooleanPart Beam      = new BooleanPart();

            Beam.Father = beam;
            part.Class  = BooleanPart.BooleanOperativeClassName;
            Beam.SetOperativePart(part);
            Beam.Insert();
            part.Class = partClass;
            part.Modify();

            // создаем режущую плоскость, чтобы отбросить
            //..(левую) часть ThisBeam по плоскости MainBeam
            CutPlane BeamLineCut = new CutPlane();

            BeamLineCut.Father = beam;
            Plane BeamCutPlane = new Plane();
            var   cs           = part.GetCoordinateSystem();

            if (startSideCut)
            {
                cs.AxisX *= -1;
            }
            BeamCutPlane.AxisX  = cs.AxisX;
            BeamCutPlane.AxisY  = cs.AxisY;
            BeamCutPlane.Origin = cs.Origin;
            BeamLineCut.Plane   = BeamCutPlane;
            BeamLineCut.Insert();

            Model.CommitChanges();

            return(beam);
        }
Exemplo n.º 28
0
        public void PlaneShow(CoordinateSystem cs, int lng = 1000)
        {
            Model.GetWorkPlaneHandler()
            .SetCurrentTransformationPlane(new TransformationPlane(cs));

            Model.CommitChanges();
            ViewHandler.SetRepresentation("standard");
            var   p  = cs.Origin;
            Point p1 = new Point(p.X + lng, p.Y - lng);
            Point p2 = new Point(p.X + lng, p.Y + lng);
            Point p3 = new Point(p.X - lng, p.Y + lng);
            Point p4 = new Point(p.X - lng, p.Y - lng);

            //var trPlane = new TransformationPlane();
            //Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(trPlane);
            GraphicsDrawer GraphicsDrawer = new GraphicsDrawer();
            Color          _color         = new Color(1, 0, 0);

            GraphicsDrawer.DrawLineSegment(p1, p2, _color); Txt(p1, "p1");
            GraphicsDrawer.DrawLineSegment(p2, p3, _color); Txt(p2, "p2");
            GraphicsDrawer.DrawLineSegment(p3, p4, _color); Txt(p3, "p3");
            GraphicsDrawer.DrawLineSegment(p4, p1, _color); Txt(p4, "p4");

            Model.GetWorkPlaneHandler()
            .SetCurrentTransformationPlane(new TransformationPlane());

            ReperShow(cs);
        }
Exemplo n.º 29
0
        private void BtnAddCurrentModel_Click(object sender, EventArgs e)
        {
            var xPos = 0.0;

            if (this.xPos != null && !string.IsNullOrEmpty(this.xPos.Text))
            {
                xPos = double.Parse(this.xPos.Text);
            }

            var yPos = 0.0;

            if (this.yPos != null && !string.IsNullOrEmpty(this.yPos.Text))
            {
                yPos = double.Parse(this.yPos.Text);
            }

            var brep = new Brep();

            brep.StartPoint            = new Point(xPos, yPos, 0);
            brep.EndPoint              = new Point(xPos + Length, yPos, 0);
            brep.Profile.ProfileString = ShapeName;
            brep.Insert();

            var model = new Model();

            model.CommitChanges();
        }
Exemplo n.º 30
0
        public PDLength()
        {
            System.Type[] selectionType = new System.Type[1];
            selectionType.SetValue(typeof(TSM.CustomPart), 0);

            Model myModel = new Model();
            ModelObjectEnumerator allObjects = myModel.GetModelObjectSelector().GetAllObjectsWithType(selectionType);

            while (allObjects.MoveNext())
            {
                if (allObjects.Current is TSM.CustomPart)
                {
                    TSM.CustomPart currentComponent = allObjects.Current as TSM.CustomPart;
                    if (currentComponent.Name == "EB_PD")
                    {
                        double curWidth = 0.0;
                        double curLength = 0.0;

                        currentComponent.GetUserProperty("w", ref curWidth);
                        currentComponent.GetUserProperty("L", ref curLength);

                        string newName = "PD" + curWidth.ToString() + " L=" + curLength.ToString();
                        currentComponent.SetUserProperty("P1a", newName);
                        currentComponent.Modify();
                    }
                }
            }
            myModel.CommitChanges();
        }
Exemplo n.º 31
0
        public override void Run()
        {
            Initialize();

            SetCurrentState((int)Model.BattleModel.CurrentBattleState);
            if (CurrentState != null)
            {
                RunCurrentState();
            }

            Model.CommitChanges();

            if (_battleWonLogic.IsBattleOver)
            {
                Master.Previous();
                Model.BattleModel.ExperienceEarned = 0;
                Model.BattleModel.EndBattle();
            }

            if (_gameOverLogic.IsGameOver)
            {
                Master.Previous();
                Master.Next();
                Master.SetCurrentState(0);
                Model.BattleModel.EndBattle();
            }
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model myModel = new Model();

            ModelObjectEnumerator selectedObjects = getSelectedObjects();
            ArrayList selectedParts = getSelectedBooleans(selectedObjects);

            foreach (TSM.BooleanPart currentBoolean in selectedParts)
            {
                changeCut(currentBoolean);
            }

            myModel.CommitChanges();
        }
 public static void Run(Tekla.Technology.Akit.IScript akit)
 {
     Model myModel = new Model();
     PositionNumberToName.main();
     myModel.CommitChanges();
 }
 public static void Run(Tekla.Technology.Akit.IScript akit)
 {
     Model myModel = new Model();
     ScaleToDrawingTitle3.main();
     myModel.CommitChanges();
 }