示例#1
0
        //Shows the beam's extremes in the coordinates of the reference model object
        private void ShowExtremesInOtherObjectCoordinates(ModelObject ReferenceObject, Beam Beam)
        {
            //Set the transformation plane to use the beam's coordinate system in order to get the beam's extremes in the local coordinate system
            TransformationPlane CurrentTP = _Model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

            _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(Beam.GetCoordinateSystem()));

            //Update the beam's extremes to the new transformation plane
            Beam.Select();
            T3D.Point LocalStartPoint = Beam.StartPoint;
            T3D.Point LocalEndPoint   = Beam.EndPoint;

            //Get the beam's extremes in the reference object's coordinates
            Matrix TransformationMatrix = MatrixFactory.ByCoordinateSystems(Beam.GetCoordinateSystem(), ReferenceObject.GetCoordinateSystem());

            //Transform the extreme points to the new coordinate system
            T3D.Point BeamStartPoint = TransformationMatrix.Transform(LocalStartPoint);
            T3D.Point BeamEndPoint   = TransformationMatrix.Transform(LocalEndPoint);

            _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentTP);

            //Transform the points where to show the texts to current work plane coordinate system
            Matrix TransformationToCurrent = MatrixFactory.FromCoordinateSystem(ReferenceObject.GetCoordinateSystem());

            T3D.Point BeamStartPointInCurrent = TransformationToCurrent.Transform(BeamStartPoint);
            T3D.Point BeamEndPointInCurrent   = TransformationToCurrent.Transform(BeamEndPoint);

            //Display results
            DrawCoordinateSytem(ReferenceObject.GetCoordinateSystem());
            GraphicsDrawer.DrawText(BeamStartPointInCurrent, FormatPointCoordinates(BeamStartPoint), TextColor);
            GraphicsDrawer.DrawText(BeamEndPointInCurrent, FormatPointCoordinates(BeamEndPoint), TextColor);
        }
        private void btnPickPart_Click(object sender, EventArgs e)
        {
            // declaration for object user will select
            ModelObject pickedObject = null;

            // New picker for user interface
            TSMUI.Picker picker = new TSMUI.Picker();

            try
            {
                // if user picks an object
                pickedObject = picker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_OBJECT);
            }
            catch
            {
                // if user interrupts
                pickedObject = null;
                MessageBox.Show("No object was selected.");
            }
            finally
            {
                if (pickedObject != null)
                {
                    // get coordinate system for object
                    T3D.CoordinateSystem objectSystem = pickedObject.GetCoordinateSystem();

                    // set transformation plane to picked object coordinate system
                    Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(objectSystem));

                    Model.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();
        }
示例#4
0
 public void AddChildrenToClipBoard(Identifier selectedID)
 {
     _sourceModelObject = _tsModel.SelectModelObject(selectedID);
     _sourceCoordsys    = _sourceModelObject.GetCoordinateSystem();
     _childrenOnly      = true;
 }