Example #1
0
        //--------------------------------------------------------------------------------------------------

        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);
        }
Example #2
0
        //--------------------------------------------------------------------------------------------------

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