示例#1
0
        //--------------------------------------------------------------------------------------------------

        public bool Start(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }

            _PointAction.EnablePointMerge     = false;
            _PointAction.AdditionalSnapPoints = new List <Pnt2d> {
                Pnt2d.Origin
            };
            _PointAction.Previewed += _PointAction_Previewed;
            _PointAction.Finished  += _PointAction_OnFinished;

            // Re-enable elements for snapping
            _SketchEditorTool.Elements.Activate(true, false, false);

            _SketchEditorTool.StatusText = "Select new workspace center position.";
            _SketchEditorTool.WorkspaceController.HudManager?.SetCursor(Cursors.WorkingPlane);

            _OriginMarker = new Marker(_SketchEditorTool.WorkspaceController, Marker.Styles.Bitmap | Marker.Styles.Topmost | Marker.Styles.Selectable, Marker.BallImage);
            _OriginMarker.Set(_SketchEditorTool.Sketch.Plane.Location);
            _OriginMarker.SetColor(Quantity_NameOfColor.Quantity_NOC_WHITE.ToColor());

            return(true);
        }
示例#2
0
        //--------------------------------------------------------------------------------------------------

        void _PointActionOnConstraintPoint(SketchPointAction sender, ref Pnt2d point)
        {
            if (_PointsCompleted == 2)
            {
                _CalcArcRimPoints(point);
                point = _Points[1];
            }
        }
示例#3
0
        //--------------------------------------------------------------------------------------------------

        public bool Start(SketchEditorTool sketchEditorTool)
        {
            _SketchEditorTool = sketchEditorTool;

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }
            _PointAction.Previewed += _OnActionPreview;
            _PointAction.Finished  += _OnActionFinished;

            _Coord2DHudElement = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <Coord2DHudElement>(this);

            _SketchEditorTool.StatusText = "Select first corner of the rectangle.";

            return(true);
        }
示例#4
0
        //--------------------------------------------------------------------------------------------------

        public bool Continue(int continueWithPoint)
        {
            // Start the next line with the first point already catched
            _Points[0]            = _SketchEditorTool.Sketch.Points[continueWithPoint];
            _MergePointIndices[0] = continueWithPoint;
            _Element?.Remove();

            _Segment  = null;
            _HintLine = new HintLine(_SketchEditorTool.WorkspaceController, HintStyle.ThinDashed | HintStyle.Topmost);
            _HintLine.Set(_Points[0], _Points[0], _SketchEditorTool.Sketch.Plane);

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }

            pointsFinished = 1;
            _SketchEditorTool.StatusText = "Select end point for line.";
            return(true);
        }
示例#5
0
        //--------------------------------------------------------------------------------------------------

        public bool Continue(int continueWithPoint)
        {
            // Start the next line with the first point already catched
            _Points[0]            = _SketchEditorTool.Sketch.Points[continueWithPoint];
            _MergePointIndices[0] = continueWithPoint;

            _Element?.Remove();

            _Segment            = new SketchSegmentLine(0, 1);
            _Element            = new SketchEditorSegmentElement(_SketchEditorTool, -1, _Segment, _SketchEditorTool.Transform, _SketchEditorTool.Sketch.Plane);
            _Element.IsCreating = true;
            _Element.OnPointsChanged(_Points, null);

            _PointAction = new SketchPointAction(_SketchEditorTool);
            if (!_SketchEditorTool.WorkspaceController.StartToolAction(_PointAction, false))
            {
                return(false);
            }
            _PointAction.Previewed += _OnActionPreview;
            _PointAction.Finished  += _OnActionFinished;
            return(true);
        }