Beispiel #1
0
        public override Line EnterLine(string startPointPrompt = "Enter start of line", string endPointPrompt = "Enter end of line", Vector?startPoint = null)
        {
            /*GetLine gL = new GetLine();
             * gL.FirstPointPrompt = startPointPrompt;
             * gL.SecondPointPrompt = endPointPrompt;
             * if (startPoint != null) gL.SetFirstPoint(FBtoRC.Convert(startPoint ?? Vector.Unset));
             * RC.Line output;
             * if (gL.Get(out output) == Result.Cancel) throw new OperationCanceledException("Operation cancelled by user");
             * return RCtoFB.Convert(output);*/
            GetPoint gP = new GetPoint();

            gP.SetCommandPrompt(startPointPrompt);
            if (gP.Get() == GetResult.Cancel)
            {
                throw new OperationCanceledException("Operation cancelled by user");
            }
            GetPoint gP2 = new GetPointDynamic();

            gP2.SetCommandPrompt(endPointPrompt);
            gP2.SetBasePoint(gP.Point(), true);
            gP2.EnableDrawLineFromPoint(true);
            gP2.DrawLineFromPoint(gP.Point(), true);
            if (gP2.Get() == GetResult.Cancel)
            {
                throw new OperationCanceledException("Operation cancelled by user");
            }
            return(new Line(FromRC.Convert(gP.Point()), FromRC.Convert(gP2.Point())));
        }
Beispiel #2
0
        public override Vector EnterPoint(string prompt = "Enter Point")
        {
            GetPoint gP = new GetPointDynamic();

            gP.SetCommandPrompt(prompt);
            if (gP.Get() == GetResult.Cancel)
            {
                throw new OperationCanceledException("Operation cancelled by user");
            }
            return(FromRC.Convert(gP.Point()));
        }
Beispiel #3
0
        public override Vector[] EnterPoints(string prompt = "Enter points")
        {
            var result = new List <Vector>();

            while (true)
            {
                GetPointDynamic gP = new GetPointDynamic();
                gP.SelectionPoints = result;
                gP.SetCommandPrompt(prompt);
                gP.AcceptNothing(true);
                GetResult gR = gP.Get();
                if (gR == GetResult.Cancel)
                {
                    throw new OperationCanceledException("Operation cancelled by user");
                }
                else if (gR == GetResult.Nothing)
                {
                    break;
                }
                result.Add(FromRC.Convert(gP.Point()));
            }

            return(result.ToArray());
        }