//-------------------------------------------------------------------------------------------------- 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)); } }
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")); }