//-------------------------------------------------------------------------------------------------- void _OnActionFinished(ToolAction toolAction) { bool finished = false; var selectAction = toolAction as SelectSubshapeAction; Debug.Assert(selectAction != null); if (selectAction.SelectedSubshapeType == SubshapeTypes.Face) { var face = TopoDS.Face(selectAction.SelectedSubshape); var brepAdaptor = new BRepAdaptor_Surface(face, true); if (brepAdaptor.GetGeomType() != GeomAbs_SurfaceType.GeomAbs_Plane) { StatusText = "Selected face is not a plane type surface."; } else { selectAction.Stop(); Stop(); finished = true; var faceRef = _TargetShape.GetSubshapeReference(_TargetBrep, face); if (faceRef == null) { Messages.Error("A subshape reference could not be produced for this face."); return; } if (_Mode == ToolMode.CreateNew) { // Create new var sketch = new Sketch { Body = _TargetBody, }; var imprint = Imprint.Create(_TargetBody, faceRef, sketch); if (imprint != null) { imprint.Mode = _ImprintMode; InteractiveContext.Current.UndoHandler.Commit(); InteractiveContext.Current.WorkspaceController.Selection.SelectEntity(_TargetBody); WorkspaceController.StartTool(new SketchEditorTool(sketch)); } } else if (_Mode == ToolMode.ReselectFace) { // Reselected face _ImprintToChange.Face = faceRef; _ImprintToChange.Invalidate(); InteractiveContext.Current.UndoHandler.Commit(); } } } if (!finished) { selectAction.Reset(); } WorkspaceController.Invalidate(); }