//-------------------------------------------------------------------------------------------------- public override bool Start() { if (_TargetShape != _TargetBody?.Shape) { _OverriddenVisualShape = WorkspaceController.VisualShapes.GetVisualShape(_TargetBody); if (_OverriddenVisualShape != null) { _OverriddenVisualShape.OverrideBrep = _TargetShape.GetTransformedBRep(); WorkspaceController.Invalidate(); } } var toolAction = new SelectSubshapeAction(this, SubshapeTypeHelper.GetTypes(_SubshapeType), _TargetBody, _SelectionFilter); if (!WorkspaceController.StartToolAction(toolAction)) { return(false); } toolAction.Finished += _OnActionFinished; StatusText = _StatusText; switch (_SubshapeType) { case SubshapeType.Vertex: WorkspaceController.HudManager?.SetCursor(Cursors.SelectVertex); break; case SubshapeType.Edge: WorkspaceController.HudManager?.SetCursor(Cursors.SelectEdge); break; case SubshapeType.Wire: WorkspaceController.HudManager?.SetCursor(Cursors.SelectWire); break; case SubshapeType.Face: WorkspaceController.HudManager?.SetCursor(Cursors.SelectFace); break; } return(true); }
//-------------------------------------------------------------------------------------------------- public override bool Start() { var selectionFilters = new List <ISelectionFilter>(); var allowedTypes = SubshapeTypes.None; if (_Mode.HasFlag(AlignWorkingPlaneModes.AlignToFace)) { allowedTypes |= SubshapeTypes.Face; selectionFilters.Add(new FaceSelectionFilter(FaceSelectionFilter.FaceType.Plane)); } if (_Mode.HasFlag(AlignWorkingPlaneModes.AlignToEdge)) { allowedTypes |= SubshapeTypes.Edge; selectionFilters.Add(new EdgeSelectionFilter(EdgeSelectionFilter.EdgeType.Any)); } if (_Mode.HasFlag(AlignWorkingPlaneModes.AlignToVertex)) { allowedTypes |= SubshapeTypes.Vertex; selectionFilters.Add(new VertexSelectionFilter(VertexSelectionFilter.VertexType.All)); } if (_Mode.HasFlag(AlignWorkingPlaneModes.AlignToDatum)) { selectionFilters.Add(new SignatureSelectionFilter(VisualPlane.SelectionSignature)); } var toolAction = new SelectSubshapeAction(this, allowedTypes, null, selectionFilters.Count > 0 ? new OrSelectionFilter(selectionFilters.ToArray()) : null); if (!WorkspaceController.StartToolAction(toolAction)) { return(false); } toolAction.Finished += _OnActionFinished; StatusText = "Select compnent to align to, or select X / Y / Z for default direction."; WorkspaceController.HudManager?.SetCursor(Cursors.WorkingPlane); return(true); }
//-------------------------------------------------------------------------------------------------- void _RestartAction() { _ComputeCoordinateSystem(); if ((_TranslateAction != null) && !_TranslateAction.IsFinished) { _TranslateAction.Stop(); } if ((_RotateAction != null) && !_RotateAction.IsFinished) { _RotateAction.Stop(); } if (_Mode == Mode.Translate) { _TranslateAction = new TranslateAction(this, _CoordinateSystem); if (!WorkspaceController.StartToolAction(_TranslateAction, false)) { return; } StatusText = "Move body using gizmo, press 'CTRL' to round to grid stepping. Press 'T' for rotation."; _TranslateAction.Previewed += _OnActionPreview; _TranslateAction.Finished += _OnActionFinished; } else if (_Mode == Mode.Rotate) { _RotateAction = new RotateAction(this, _CoordinateSystem); if (!WorkspaceController.StartToolAction(_RotateAction, false)) { return; } StatusText = "Rotate body using gizmo, press 'CTRL' to round to 5°. Press 'T' for translation."; _RotateAction.Previewed += _OnActionPreview; _RotateAction.Finished += _OnActionFinished; } WorkspaceController.Invalidate(); }