コード例 #1
0
ファイル: SketchEditorTool.cs プロジェクト: lanicon/Macad3D
        //--------------------------------------------------------------------------------------------------

        public void EnableClipPlane(bool enable)
        {
            if (enable)
            {
                if (_ClipPlane != null)
                {
                    return;
                }

                var sketchPlane   = Sketch.Plane;
                var reversedPlane = new Pln(new Ax3(sketchPlane.Location, sketchPlane.Axis.Direction.Reversed()));
                reversedPlane.Translate(reversedPlane.Axis.Direction.Reversed().ToVec().Scaled(0.0001));
                _ClipPlane = new ClipPlane(reversedPlane);
                _ClipPlane.AddViewport(WorkspaceController.ActiveViewport);
                WorkspaceController.Invalidate();
                RaisePropertyChanged(nameof(ClipPlaneEnabled));
            }
            else
            {
                if (_ClipPlane == null)
                {
                    return;
                }

                _ClipPlane.Remove();
                _ClipPlane = null;
                WorkspaceController.Invalidate();
                RaisePropertyChanged(nameof(ClipPlaneEnabled));
            }
        }
コード例 #2
0
        public void ClipPlane()
        {
            var ctx = Context.Current;

            // The imprint we want to edit
            var imprint = TestGeomGenerator.CreateImprint();
            var sketch  = imprint.Sketch;

            imprint.Make(Shape.MakeFlags.None);

            ctx.ViewportController.ZoomFitAll();

            var plane = sketch.Plane;

            plane.UReverse();
            var clipPlane = new ClipPlane(plane);

            clipPlane.AddViewport(ctx.Viewport);
            AssertHelper.IsSameViewport(Path.Combine(_BasePath, "ClipPlane01"));

            clipPlane.Remove();
            AssertHelper.IsSameViewport(Path.Combine(_BasePath, "ClipPlane02"));
        }