コード例 #1
0
        private Tekla.Structures.Geometry3d.CoordinateSystem GetBasicViewsCoordinateSystemForEndView(Tekla.Structures.Geometry3d.CoordinateSystem objectCoordinateSystem)
        {
            Tekla.Structures.Geometry3d.CoordinateSystem result = new Tekla.Structures.Geometry3d.CoordinateSystem();

            result.Origin = new Tekla.Structures.Geometry3d.Point(objectCoordinateSystem.Origin);
            result.AxisX  = new Tekla.Structures.Geometry3d.Vector(objectCoordinateSystem.AxisX) * -1.0;

            result.AxisY = new Tekla.Structures.Geometry3d.Vector(objectCoordinateSystem.AxisY);
            Tekla.Structures.Geometry3d.Vector tempVector = (result.AxisX.Cross(UpDirection));

            if (tempVector == new Tekla.Structures.Geometry3d.Vector())
            {
                tempVector = (objectCoordinateSystem.AxisY.Cross(UpDirection));
            }

            result.AxisX = tempVector;
            result.AxisY = UpDirection;
            return(result);
        }
        private void RotateViewToNearestPlane()
        {
            try
            {
                var selectedViews = Tekla.Structures.Model.UI.ViewHandler.GetSelectedViews();

                if (selectedViews.Count == 0)
                {
                    selectedViews = Tekla.Structures.Model.UI.ViewHandler.GetVisibleViews();
                }

                while (selectedViews.MoveNext())
                {
                    var view = selectedViews.Current;

                    var Camera = new Tekla.Structures.Model.UI.ViewCamera();
                    Camera.View = view;

                    Camera.Select();

                    var directionVector = new Tekla.Structures.Geometry3d.Vector(
                        Math.Round(Camera.DirectionVector.X),
                        Math.Round(Camera.DirectionVector.Y),
                        Math.Round(Camera.DirectionVector.Z)
                        );
                    Camera.DirectionVector = directionVector;

                    var upVecor = new Tekla.Structures.Geometry3d.Vector(
                        Math.Round(Camera.UpVector.X),
                        Math.Round(Camera.UpVector.Y),
                        Math.Round(Camera.UpVector.Z)
                        );
                    Camera.UpVector = upVecor;
                    Camera.Modify();
                    Camera.ZoomFactor = 1.5 * Camera.ZoomFactor;
                    Camera.Modify();

                    RepairHidingTeklaWindows();
                }
            }
            catch (Exception) { }
        }