Пример #1
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions prOpt = new JigPromptPointOptions("\nУкажите точку");
             prOpt.Keywords.Add("Плитка" + Options.LenTile);
             prOpt.Keywords.Add("Шов" + Options.LenSeam);
             prOpt.UserInputControls = UserInputControls.AcceptOtherInputString;
             if (_allVertex.Count>0)
             {
            prOpt.BasePoint = _allVertex[_allVertex.Count - 1];
            prOpt.UseBasePoint = true;
             }

             PromptPointResult prRes = prompts.AcquirePoint(prOpt);
             if (prRes.Status == PromptStatus.Error || prRes.Status == PromptStatus.Cancel)
             {
            return SamplerStatus.Cancel;
             }
             else if (prRes.Status == PromptStatus.Keyword)
             {
            if (prRes.StringResult.StartsWith("Tile"))
               Options.LenTile = GetLenPrompt(prRes.StringResult, Options.LenTile);
            else if (prRes.StringResult.StartsWith("Seam"))
               Options.LenSeam = GetLenPrompt(prRes.StringResult, Options.LenSeam);
             }
             else
             {
            _lastVertex = prRes.Value.TransformBy(UCS.Inverse());
             }
             return SamplerStatus.OK;
        }
Пример #2
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            SamplerStatus state = SamplerStatus.NoChange;
             JigPromptPointOptions prOpt = new JigPromptPointOptions("\nУкажите точку");

             prOpt.BasePoint = _ptFirst;
             prOpt.UseBasePoint = true;

             PromptPointResult prRes = prompts.AcquirePoint(prOpt);
             if (prRes.Status == PromptStatus.Error || prRes.Status == PromptStatus.Cancel)
             {
            state = SamplerStatus.Cancel;
             }
             else
             {
            var ptNew = prRes.Value.TransformBy(UCS);
            if (_ptLast.DistanceTo(ptNew) <= _equalPoint)
            {
               state = SamplerStatus.NoChange;
            }
            else
            {
               _ptLast = ptNew;
               state = SamplerStatus.OK;
            }
             }
             return state;
        }
Пример #3
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions prPntOpts = new JigPromptPointOptions("\nPick Corner 2: ");

            prPntOpts.UseBasePoint = false;

            PromptPointResult prResult = prompts.AcquirePoint(prPntOpts);

            if (prResult.Status == PromptStatus.Cancel || prResult.Status == PromptStatus.Error)
            {
                return(SamplerStatus.Cancel);
            }

            Point3d pnt3dTmp = prResult.Value;

            pnt3dTmp = Db.wcsToUcs(pnt3dTmp);
            //.TransformBy(UCS.Inverse());
            //Point3d pnt3dTmp = prResult.Value;
            if (!pnt3dRes.IsEqualTo(pnt3dTmp, new Tolerance(1E-09, 1E-09)))
            {
                pnt3dRes = pnt3dTmp;
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.NoChange);
            }
        }
Пример #4
0
 /// <summary>简便快捷执行Jig拖动</summary>
 /// <param name="options">选项</param>
 /// <param name="callFun">回调函数</param>
 public static PromptResult StartDrag(JigPromptOptions options, Action <Result> callFun)
 {
     if (options is JigPromptPointOptions)
     {
         _PointOptions = options as JigPromptPointOptions;
         _acquireMod   = GetPoint;
     }
     else if (options is JigPromptDistanceOptions)
     {
         _DistanceOptions = options as JigPromptDistanceOptions;
         _acquireMod      = GetDistance;
     }
     else if (options is JigPromptAngleOptions)
     {
         _AngleOptions = options as JigPromptAngleOptions;
         _acquireMod   = GetAngle;
     }
     else if (options is JigPromptStringOptions)
     {
         _StringOptions = options as JigPromptStringOptions;
         _acquireMod    = GetString;
     }
     _callBack = callFun;
     Autodesk.AutoCAD.ApplicationServices.Application.
     DocumentManager.MdiActiveDocument.Editor.Drag(new JigDrag());
     _callBack(new Result(_rst, null));
     return(_rst);
 }
Пример #5
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jppo = new JigPromptPointOptions("\n指定位置");

            jppo.Keywords.Add(""); // mod 20140527
            jppo.Cursor            = CursorType.EntitySelect;
            jppo.UseBasePoint      = false;
            jppo.UserInputControls = UserInputControls.NullResponseAccepted;
            Point3d pos = prompts.AcquirePoint(jppo).Value;

            if (pos.IsNull())
            {
                return(SamplerStatus.Cancel);
            }
            else if (pos != _pos)
            {
                _move = pos - _pos;
                _pos  = pos;
                return(SamplerStatus.OK);
            }
            else
            {
                _move = pos - _pos;
                return(SamplerStatus.NoChange);
            }
        }
Пример #6
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppintOp = new JigPromptPointOptions();

            jppintOp.UserInputControls =
                UserInputControls.NoZeroResponseAccepted
                | UserInputControls.NoNegativeResponseAccepted
                | UserInputControls.NullResponseAccepted
            ;
            if (Arc.NumberOfVertices == 0)
            {
                jppintOp.Message = "\n指定圆弧的起点";
            }
            else if (Arc.NumberOfVertices == 1)
            {
                jppintOp.Message = "\n指定圆弧的第二个点";
            }
            else
            {
                jppintOp.Message = "\n指定圆弧的端点";
            }
            PromptPointResult pntres = prompts.AcquirePoint(jppintOp);

            if (pntres.Status == PromptStatus.OK)
            {
                TempPoint = pntres.Value.ToPoint2d();
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.Cancel);
        }
Пример #7
0
        // Need to override this method.
        // Updating the current position of the block.
        //--------------------------------------------------------------
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jigOpts = new JigPromptPointOptions();

            jigOpts.UserInputControls =
                (UserInputControls.Accept3dCoordinates |
                 UserInputControls.NullResponseAccepted);
            jigOpts.Message = "Select a point:";
            PromptPointResult jigRes = prompts.AcquirePoint(jigOpts);

            Point3d pt = jigRes.Value;

            if (pt == _point)
            {
                return(SamplerStatus.NoChange);
            }

            _point = pt;
            if (jigRes.Status == PromptStatus.OK)
            {
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.Cancel);
        }
Пример #8
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions prPntOpts = new JigPromptPointOptions("\nSelect new Basepoint: ");

            prPntOpts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted;

            prPntOpts.BasePoint    = pnt3dBase;
            prPntOpts.UseBasePoint = true;

            PromptPointResult prResult = prompts.AcquirePoint(prPntOpts);

            pnt3dRes = prResult.Value;

            if (prResult.Status == PromptStatus.Cancel || prResult.Status == PromptStatus.Error)
            {
                return(SamplerStatus.Cancel);
            }

            if (pnt3dRes == pnt3dBase)
            {
                return(SamplerStatus.NoChange);
            }

            if (prResult.Status == PromptStatus.OK)
            {
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.Cancel);
        }
Пример #9
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppintOp = new JigPromptPointOptions();

            jppintOp.UserInputControls =
                UserInputControls.NoZeroResponseAccepted
                | UserInputControls.NoNegativeResponseAccepted
                | UserInputControls.NullResponseAccepted
            ;
            //jppintOp.UseBasePoint = false;
            //jppintOp.DefaultValue = new Point3d();
            jppintOp.Keywords.Add("U", "U", "放弃(U)");
            if (NumberOfVertices == 0)
            {
                jppintOp.Message = "\n选择起点";
            }
            else
            {
                jppintOp.Message = "\n选择下一点";
            }

            if (NumberOfVertices > 2)
            {
                jppintOp.Keywords.Add("C", "C", "闭合(C)");
            }
            PromptPointResult pntres = prompts.AcquirePoint(jppintOp);
            PromptStatus      ss     = pntres.Status;

            if (pntres.Status == PromptStatus.OK)
            {
                TemPoint2d = pntres.Value.ToPoint2d();
                return(SamplerStatus.OK);
            }
            return(SamplerStatus.Cancel);
        }
Пример #10
0
        // Sampler函数用于检测用户的输入.
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            // 定义一个点拖动交互类.
            JigPromptPointOptions optJigPoint = new JigPromptPointOptions("\n请指定五角星的一个角点:");

            // 设置拖拽光标类型.
            optJigPoint.Cursor = CursorType.RubberBand;
            // 设置拖动光标基点.
            optJigPoint.BasePoint    = mCenterPt;
            optJigPoint.UseBasePoint = true;
            // 用AcquirePoint函数得到用户输入的点.
            PromptPointResult resJigPoint1 = prompts.AcquirePoint(optJigPoint);
            Point3d           curPt        = resJigPoint1.Value;

            if (curPt != peakPt)
            {
                // 重新设置椭圆参数--------------------------------------------.
                // 五角星的中心.
                Point2d p0 = new Point2d(mCenterPt.X, mCenterPt.Y);

                // 计算五角星的第一个顶点坐标.
                Point2d p1 = new Point2d(curPt[0], curPt[1]);

                // 为计算其他9个顶点的坐标进行准备.
                double   d1  = p1.GetDistanceTo(p0);
                double   d2  = d1 * Math.Sin(Rad2Ang(18)) / Math.Sin(Rad2Ang(54));
                Vector2d vec = p1 - p0;
                double   ang = vec.Angle;

                // 计算五角星另外9个顶点的坐标.
                Point2d p2  = PolarPoint(p0, ang + Rad2Ang(36), d2);
                Point2d p3  = PolarPoint(p0, ang + Rad2Ang(72), d1);
                Point2d p4  = PolarPoint(p0, ang + Rad2Ang(108), d2);
                Point2d p5  = PolarPoint(p0, ang + Rad2Ang(144), d1);
                Point2d p6  = PolarPoint(p0, ang + Rad2Ang(180), d2);
                Point2d p7  = PolarPoint(p0, ang + Rad2Ang(216), d1);
                Point2d p8  = PolarPoint(p0, ang + Rad2Ang(252), d2);
                Point2d p9  = PolarPoint(p0, ang + Rad2Ang(288), d1);
                Point2d p10 = PolarPoint(p0, ang + Rad2Ang(324), d2);

                // 更新五角星各个顶点的坐标.
                ent.SetPointAt(0, p1);
                ent.SetPointAt(1, p2);
                ent.SetPointAt(2, p3);
                ent.SetPointAt(3, p4);
                ent.SetPointAt(4, p5);
                ent.SetPointAt(5, p6);
                ent.SetPointAt(6, p7);
                ent.SetPointAt(7, p8);
                ent.SetPointAt(8, p9);
                ent.SetPointAt(9, p10);
                peakPt = curPt;
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.NoChange);
            }
        }
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                var jpo = new JigPromptPointOptions
                {
                    BasePoint         = FirstPoint,
                    UseBasePoint      = true,
                    UserInputControls = UserInputControls.Accept3dCoordinates |
                                        UserInputControls.GovernedByUCSDetect,
                    Message = $"\n{Language.GetItem(LangItem, "msg8")}"
                };

                var res = prompts.AcquirePoint(jpo);

                _secondPoint = res.Value;
                if (res.Status != PromptStatus.OK)
                {
                    return(SamplerStatus.Cancel);
                }
                if (CursorHasMoved())
                {
                    _prevPoint = _secondPoint;
                    return(SamplerStatus.OK);
                }

                return(SamplerStatus.NoChange);
            }
Пример #12
0
            protected override Autodesk.AutoCAD.EditorInput.SamplerStatus Sampler(Autodesk.AutoCAD.EditorInput.JigPrompts prompts)
            {
                JigPromptPointOptions ppo = new JigPromptPointOptions("\nSelect point");

                ppo.UseBasePoint = true;
                ppo.BasePoint    = _text.Position;

                ppo.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted;

                PromptPointResult ppr = prompts.AcquirePoint(ppo);

                if (ppr.Status != PromptStatus.OK)
                {
                    return(SamplerStatus.Cancel);
                }

                if (_position == ppr.Value)
                {
                    return(SamplerStatus.NoChange);
                }

                _position = ppr.Value;

                return(SamplerStatus.OK);
            }
Пример #13
0
        protected override Autodesk.AutoCAD.EditorInput.SamplerStatus Sampler(Autodesk.AutoCAD.EditorInput.JigPrompts prompts)
        {
            JigPromptPointOptions ppo = new JigPromptPointOptions("\nУкажите точку");

            ppo.UseBasePoint = true;
            ppo.BasePoint    = this.Origin;

            ppo.UserInputControls = UserInputControls.NoZeroResponseAccepted;

            PromptPointResult ppr = prompts.AcquirePoint(ppo);

            if (ppr.Status != PromptStatus.OK)
            {
                return(SamplerStatus.Cancel);
            }

            if (_jigPosition == ppr.Value.TransformBy(_ucs.Inverse()))
            {
                return(SamplerStatus.NoChange);
            }

            _jigPosition = ppr.Value.TransformBy(_ucs.Inverse());

            lock (Entities)
            {
                _createGrid(_jigPosition);
            }

            return(SamplerStatus.OK);
        }
Пример #14
0
            /// <summary>
            /// Samplers the specified prompts.
            /// </summary>
            /// <param name="prompts">The prompts.</param>
            /// <returns></returns>
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions jigOpts = new JigPromptPointOptions();

                jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates |
                                             UserInputControls.NullResponseAccepted |
                                             UserInputControls.NoNegativeResponseAccepted);
                if (pnts3d.Count == 0)
                {
                    jigOpts.Message = "\nPick start point of polyline: ";
                }
                else if (pnts3d.Count > 0)
                {
                    jigOpts.BasePoint    = pnts3d.lastPoint();
                    jigOpts.UseBasePoint = true;
                    jigOpts.Message      = "\nPick next vertex: ";
                }
                else
                {
                    return(SamplerStatus.Cancel);
                }

                PromptPointResult res = prompts.AcquirePoint(jigOpts);

                if (pnt3dTmp == res.Value)
                {
                    return(SamplerStatus.NoChange);
                }
                else if (res.Status == PromptStatus.OK)
                {
                    pnt3dTmp = res.Value;
                    return(SamplerStatus.OK);
                }
                return(SamplerStatus.Cancel);
            }
Пример #15
0
            public SamplerStatus Acquire(JigPrompts prompts, JigPromptPointOptions options, Action <Point3d> updater)
            {
                PromptPointResult promptPointResult = prompts.AcquirePoint(options);

                if (promptPointResult.Status != PromptStatus.OK)
                {
                    if (promptPointResult.Status == PromptStatus.Other)
                    {
                        return(SamplerStatus.OK);
                    }

                    return(SamplerStatus.Cancel);
                }

                if (Value.IsEqualTo(promptPointResult.Value, Tolerance))
                {
                    return(SamplerStatus.NoChange);
                }

                var value   = promptPointResult.Value;
                var point3D = value;

                Value = value;
                updater(point3D);
                return(SamplerStatus.OK);
            }
Пример #16
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions optJig = new JigPromptPointOptions("\n请指定等边三角形的一个顶点")
            {
                Cursor            = CursorType.RubberBand,
                UserInputControls = UserInputControls.Accept3dCoordinates,
                BasePoint         = m_CenterPt.TransformBy(m_mt),
                UseBasePoint      = true
            };
            PromptPointResult resJig = prompts.AcquirePoint(optJig);
            Point3d           curPt  = resJig.Value;

            if (resJig.Status == PromptStatus.Cancel)
            {
                return(SamplerStatus.Cancel);
            }
            if (m_peakPt != curPt)
            {
                m_peakPt = curPt;
                Point2d cenPt = new Point2d(m_CenterPt.X, m_CenterPt.Y);
                m_pts[0] = new Point2d(m_CenterPt.TransformBy(m_mt.Inverse()).X, m_peakPt.TransformBy(m_mt.Inverse()).Y);
                double   dis = m_pts[0].GetDistanceTo(cenPt);
                Vector2d vec = m_pts[0] - cenPt;
                double   ang = vec.Angle;
                m_pts[1] = PolarPoint(cenPt, ang + Rad2Ang(120.0), dis);
                m_pts[2] = PolarPoint(cenPt, ang + Rad2Ang(240.0), dis);
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.NoChange);
            }
        }
Пример #17
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            Editor   ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Matrix3d mt = ed.CurrentUserCoordinateSystem;
            JigPromptPointOptions optJigPoint = new JigPromptPointOptions(message);

            optJigPoint.Cursor            = CursorType.Crosshair;
            optJigPoint.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted | UserInputControls.NullResponseAccepted;
            optJigPoint.BasePoint         = basePoint.TransformBy(mt);//将wcs 转为ucs坐标
            optJigPoint.UseBasePoint      = true;
            PromptPointResult result = prompts.AcquirePoint(optJigPoint);
            Point3d           tempPt = result.Value;

            if (result.Status == PromptStatus.Cancel)
            {
                return(SamplerStatus.Cancel);
            }
            Point3d temp = result.Value;

            temp = temp.TransformBy(mt.Inverse()); // 将选择点 转化为当前的用户坐标

            if (basePoint != result.Value)         // 如果坐标发生了变化 重新绘制当前的图形
            {
                list = mOption.Invoke(temp.TransformBy(mt));
                //basePoint = temp;
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.NoChange);
            }
        }
Пример #18
0
        protected override SamplerStatus Sampler(JigPrompts _prompts)
        {
            JigPromptPointOptions jigOpt = new JigPromptPointOptions("Wskaż punkt wstawienia:")
            {
                UserInputControls = UserInputControls.Accept3dCoordinates,
            };

            jigOpt.BasePoint    = basePoint;
            jigOpt.UseBasePoint = true;

            PromptPointResult res = _prompts.AcquirePoint(jigOpt);

            switch (res.Status)
            {
            case PromptStatus.OK:
                currentPoint = res.Value;
                return(SamplerStatus.OK);

            case PromptStatus.Cancel:
                throw new OperationCanceledException();

            default:
                throw new Exception("Nie rozpoznany PromptPoint ResultStatus");
            }
        }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppo = new JigPromptPointOptions("\n" + Language.GetItem(LangItem, "msg4"))
            {
                BasePoint         = _line.StartPoint,
                UseBasePoint      = true,
                UserInputControls = UserInputControls.Accept3dCoordinates
                                    | UserInputControls.NoZeroResponseAccepted
                                    | UserInputControls.AcceptOtherInputString
                                    | UserInputControls.NoNegativeResponseAccepted
            };
            var rs = prompts.AcquirePoint(jppo);

            _currentPoint = rs.Value;
            if (rs.Status != PromptStatus.OK)
            {
                return(SamplerStatus.Cancel);
            }
            if (CursorHasMoved())
            {
                _prevPoint = _currentPoint;
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.NoChange);
        }
Пример #20
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppo = new JigPromptPointOptions(this._message)
            {
                Cursor            = CursorType.EntitySelect,
                UseBasePoint      = false,
                UserInputControls = UserInputControls.NullResponseAccepted
            };

            jppo.Keywords.Add(""); // mod 20140527
            var pos = prompts.AcquirePoint(jppo).Value;

            if (pos.IsNull())
            {
                return(SamplerStatus.Cancel);
            }
            else if (pos != _pos)
            {
                _move = pos - _pos;
                _pos  = pos;
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.NoChange);
        }
Пример #21
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions ppo = new JigPromptPointOptions("\nУкажите точку определяющую положение");

            ppo.UseBasePoint = true;
            ppo.BasePoint    = _insertPointUcs.TransformBy(_ucs);

            ppo.UserInputControls = UserInputControls.NoZeroResponseAccepted;

            PromptPointResult ppr = prompts.AcquirePoint(ppo);

            if (ppr.Status != PromptStatus.OK)
            {
                return(SamplerStatus.Cancel);
            }
            //Tools.GetAcadEditor().DrawVector(ppo.BasePoint, ppr.Value, 1, true);

            /*if (_position == ppr.Value)
             *  return SamplerStatus.NoChange;*/

            _jigPoint = ppr.Value.TransformBy(_ucs.Inverse());



            return(SamplerStatus.OK);
        }
Пример #22
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions ppo = new JigPromptPointOptions("\nSelect WeekJackPanel:");
                PromptPointResult     ppr = prompts.AcquirePoint(ppo);

                if (ppr.Status == PromptStatus.OK)
                {
                    if (ppr.Value == CenterPoint)
                    {
                        return(SamplerStatus.NoChange);
                    }
                    else
                    {
                        if (Atend.Global.Acad.UAcad.IsInsideCurve((Curve)ContainerEntity, ppr.Value) == true)
                        {
                            CenterPoint = ppr.Value;
                            return(SamplerStatus.OK);
                        }
                        else
                        {
                            return(SamplerStatus.NoChange);
                        }
                    }
                }
                else
                {
                    return(SamplerStatus.Cancel);
                }
            }
Пример #23
0
        public void PrapareForNextInput(JigPromptPointOptions opt, string message)
        {
            inputFunc = (prompts) =>
            {
                opt.Message = message;

                var res = prompts.AcquirePoint(opt);
                if (res.Value != Point)
                {
                    Point = res.Value;
                }
                else
                {
                    return(SamplerStatus.NoChange);
                }

                if (res.Status == PromptStatus.OK)
                {
                    return(SamplerStatus.OK);
                }
                else
                {
                    return(SamplerStatus.Cancel);
                }
            };
        }
Пример #24
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions opts = new JigPromptPointOptions("\nTarget Point Location (XY): (ESC to exit) ");
            Point3d pnt3dStartPoint    = gc.calcBasePnt3d(_mTempPoint, p3d, vtx);

            opts.BasePoint         = pnt3dStartPoint;
            opts.UseBasePoint      = true;
            opts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.AnyBlankTerminatesInput |
                                     UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect |
                                     UserInputControls.UseBasePointElevation | UserInputControls.InitialBlankTerminatesInput |
                                     UserInputControls.NullResponseAccepted;

            PromptPointResult res = prompts.AcquirePoint(opts);

            if (res.Status == PromptStatus.Cancel)
            {
                return(SamplerStatus.Cancel);
            }

            if (res.Value.Equals(_mTempPoint))
            {
                return(SamplerStatus.NoChange);
            }
            else
            {
                _mTempPoint = res.Value;
                return(SamplerStatus.OK);
            }
        }
Пример #25
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions opts = new JigPromptPointOptions("\nNext point: ");

            opts.BasePoint         = (Entity as Line).StartPoint;
            opts.UseBasePoint      = true;
            opts.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.AnyBlankTerminatesInput |
                                     UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect |
                                     UserInputControls.UseBasePointElevation | UserInputControls.InitialBlankTerminatesInput |
                                     UserInputControls.NullResponseAccepted;

            PromptPointResult res = prompts.AcquirePoint(opts);

            if (res.Status == PromptStatus.Cancel)
            {
                return(SamplerStatus.Cancel);
            }

            if (res.Value.Equals(_mTempPoint))
            {
                return(SamplerStatus.NoChange);
            }
            else
            {
                _mTempPoint = res.Value;
                return(SamplerStatus.OK);
            }
        }
Пример #26
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppo = new JigPromptPointOptions(this._message)
            {
                Cursor            = CursorType.EntitySelect,
                BasePoint         = _center,
                UseBasePoint      = true,
                UserInputControls = UserInputControls.NullResponseAccepted
            };

            jppo.Keywords.Add(""); // mod 20140527
            var end = prompts.AcquirePoint(jppo).Value;

            if (end.IsNull())
            {
                return(SamplerStatus.Cancel);
            }
            else if (end != _end)
            {
                this._end = end;
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.NoChange);
        }
Пример #27
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                //throw new System.Exception("The method or operation is not implemented.");

                JigPromptPointOptions ppo = new JigPromptPointOptions("\nCell Position:");

                PromptPointResult ppr = prompts.AcquirePoint(ppo);

                if (ppr.Status == PromptStatus.OK)
                {
                    if (ppr.Value == CenterPoint)
                    {
                        return(SamplerStatus.NoChange);
                    }
                    else
                    {
                        CenterPoint = ppr.Value;
                        return(SamplerStatus.OK);
                    }
                }
                else
                {
                    return(SamplerStatus.Cancel);
                }
            }
Пример #28
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                var jigPromptPointOptions = new JigPromptPointOptions(
                    $"\n{Language.GetItem(PlinesEditFunction.LangItem, "k22")}:")
                {
                    UserInputControls = UserInputControls.Accept3dCoordinates
                                        | UserInputControls.NoNegativeResponseAccepted
                                        | UserInputControls.NullResponseAccepted,
                    BasePoint    = _sPoint,
                    UseBasePoint = true,
                    Cursor       = CursorType.RubberBand
                };

                var ppr = prompts.AcquirePoint(jigPromptPointOptions);

                if (ppr.Status != PromptStatus.OK)
                {
                    return(SamplerStatus.Cancel);
                }

                if (ppr.Status == PromptStatus.OK)
                {
                    _currPoint = ppr.Value;

                    if (CursorHasMoved())
                    {
                        _prevPoint = _currPoint;
                        return(SamplerStatus.OK);
                    }

                    return(SamplerStatus.NoChange);
                }

                return(SamplerStatus.NoChange);
            }
Пример #29
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jigPointOpts = new JigPromptPointOptions("\nSpecify other corner point");

            jigPointOpts.UseBasePoint      = true;
            jigPointOpts.BasePoint         = corner1;
            jigPointOpts.UserInputControls = (UserInputControls.Accept3dCoordinates) | UserInputControls.NullResponseAccepted;
            pres = prompts.AcquirePoint(jigPointOpts);
            Point3d endPointTemp = pres.Value;

            if (endPointTemp != corner2)
            {
                corner2 = endPointTemp;
            }
            else
            {
                return(SamplerStatus.NoChange);
            }

            if (pres.Status == PromptStatus.Cancel)
            {
                return(SamplerStatus.Cancel);
            }
            else
            {
                return(SamplerStatus.OK);
            }
        }
Пример #30
0
            public static JigPromptPointOptions GetDefaultOptions(string message)
            {
                var jigPromptPointOption = new JigPromptPointOptions(message);

                jigPromptPointOption.UserInputControls = (UserInputControls)2272;
                return(jigPromptPointOption);
            }
Пример #31
0
        // Update position of the block.
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var options = new JigPromptPointOptions()
            {
                UserInputControls = (UserInputControls.Accept3dCoordinates |
                                     UserInputControls.NullResponseAccepted)
            };

            options.Message = "Select a point:";
            PromptPointResult result = prompts.AcquirePoint(options);

            Point3d currentPoint = result.Value;

            if (currentPoint == point)
            {
                return(SamplerStatus.NoChange);
            }

            point = currentPoint;
            if (result.Status == PromptStatus.OK)
            {
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.Cancel);
        }
Пример #32
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jppo = new JigPromptPointOptions("\nУкажите точку: ");

            jppo.UseBasePoint = true;
            jppo.BasePoint    = _position;

            _jigPoint = prompts.AcquirePoint(jppo).Value;
            if (_jigPoint.IsEqualTo(_jigBasePoint))
            {
                return(SamplerStatus.NoChange);
            }
            else
            {
                //Matrix3d mat = Matrix3d.Displacement(_jigBasePoint.GetVectorTo(_jigPoint));
                //Entity.TransformBy(mat);
                _transformProcessor(_jigPoint);

                _br.Position = _jigPoint;
                _br.RecordGraphicsModified(true);

                _jigBasePoint = _jigPoint;

                return(SamplerStatus.OK);
            }
        }
Пример #33
0
        private PromptPointResult GetJigPosition(JigPrompts prompts)
        {
            JigPromptPointOptions jigPositionOptions = new JigPromptPointOptions();
            jigPositionOptions.UserInputControls = (UserInputControls.Accept3dCoordinates |
                    UserInputControls.NullResponseAccepted |
                    UserInputControls.NoNegativeResponseAccepted |
                    UserInputControls.GovernedByOrthoMode);
            jigPositionOptions.SetMessageAndKeywords(Environment.NewLine + "Upuść znak lub obróc [Vertical/Horizontal/KEnd]", "Vertical Horizontal KEnd");
            jigPositionOptions.Keywords.Default = (angle == 0) ? "Vertical" : "Horizontal";

            PromptPointResult jigPositionPromptResult = prompts.AcquirePoint(jigPositionOptions);
            return jigPositionPromptResult;
        }
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                Matrix3d mt = ed.CurrentUserCoordinateSystem;

                JigPromptPointOptions optJigPoint = new JigPromptPointOptions
                    ("\n请指定矩形的另一角点");
                optJigPoint.UserInputControls =
                    UserInputControls.Accept3dCoordinates
                    | UserInputControls.NoZeroResponseAccepted
                    | UserInputControls.NoNegativeResponseAccepted;

                optJigPoint.BasePoint = m_Pt1.TransformBy(mt);
                optJigPoint.UseBasePoint = true;

                PromptPointResult resJigPoint = prompts.AcquirePoint(optJigPoint);
                Point3d tempPt = resJigPoint.Value;

                if (resJigPoint.Status == PromptStatus.Cancel)
                {
                    return SamplerStatus.Cancel;
                }

                if (m_Pt2 != tempPt)
                {
                    m_Pt2 = tempPt;
                    Point3d ucsPt2 = m_Pt2.TransformBy(mt.Inverse());
                    try
                    {
                        m_PolyLine2.Normal = Vector3d.ZAxis;
                        m_PolyLine2.Elevation = 0;
                        m_PolyLine2.SetPointAt(0, new Point2d(m_Pt1.X, m_Pt1.Y));
                        m_PolyLine2.SetPointAt(1, new Point2d(ucsPt2.X, m_Pt1.Y));
                        m_PolyLine2.SetPointAt(2, new Point2d(ucsPt2.X, ucsPt2.Y));
                        m_PolyLine2.SetPointAt(3, new Point2d(m_Pt1.X, ucsPt2.Y));
                        m_PolyLine2.TransformBy(mt);
                    }
                    catch { }

                    return SamplerStatus.OK;
                }
                else
                {
                    return SamplerStatus.NoChange;
                }
            }
Пример #35
0
 protected override SamplerStatus Sampler(JigPrompts prompts)
 {
     var jigOpts = new JigPromptPointOptions();
      jigOpts.Message = "\n" + _msg;
      var res = prompts.AcquirePoint(jigOpts);
      if (res.Status == PromptStatus.OK)
      {
     Point3d curPoint = res.Value;
     if (_position.DistanceTo(curPoint) > 1.0e-2)
        _position = curPoint;
     else
        return SamplerStatus.NoChange;
      }
      if (res.Status == PromptStatus.Cancel)
     return SamplerStatus.Cancel;
      else
     return SamplerStatus.OK;
 }
Пример #36
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions opts =
                  new JigPromptPointOptions("\nSelect insertion point:");
                opts.BasePoint = new Point3d(0, 0, 0);
                opts.UserInputControls =
                  UserInputControls.NoZeroResponseAccepted;

                PromptPointResult ppr = prompts.AcquirePoint(opts);

                if (_pos == ppr.Value)
                {
                    return SamplerStatus.NoChange;
                }

                _pos = ppr.Value;

                return SamplerStatus.OK;
            }
Пример #37
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions opts = new JigPromptPointOptions();

                // Not all options accept null response
                opts.UserInputControls =
                  (UserInputControls.Accept3dCoordinates |
                  UserInputControls.NoNegativeResponseAccepted
                  );

                // Get the first point
                if (m_pts.Count == 0)
                {
                    opts.UserInputControls |= UserInputControls.NullResponseAccepted;
                    opts.Message = "\nStart point of multileader: ";
                    opts.UseBasePoint = false;
                }
                // And the second
                else if (m_pts.Count == 1)
                {
                    opts.BasePoint = m_pts[m_pts.Count - 1];
                    opts.UseBasePoint = true;
                    opts.Message = "\nSpecify multileader vertex: ";
                }
                // And subsequent points
                else if (m_pts.Count > 1)
                {
                    opts.UserInputControls |= UserInputControls.NullResponseAccepted;
                    opts.BasePoint = m_pts[m_pts.Count - 1];
                    opts.UseBasePoint = true;
                    opts.SetMessageAndKeywords(
                      "\nSpecify multileader vertex or [End]: ",
                      "End"
                    );
                }
                else // Should never happen
                    return SamplerStatus.Cancel;

                PromptPointResult res = prompts.AcquirePoint(opts);

                if (res.Status == PromptStatus.Keyword)
                {
                    if (res.StringResult == "End")
                    {
                        return SamplerStatus.Cancel;
                    }
                }

                if (m_tempPoint == res.Value)
                {
                    return SamplerStatus.NoChange;
                }
                else if (res.Status == PromptStatus.OK)
                {
                    m_tempPoint = res.Value;
                    return SamplerStatus.OK;
                }
                return SamplerStatus.Cancel;
            }
        protected override Autodesk.AutoCAD.EditorInput.SamplerStatus Sampler(Autodesk.AutoCAD.EditorInput.JigPrompts prompts)
        {
            JigPromptPointOptions jigOpts = new JigPromptPointOptions();
            jigOpts.UserInputControls = UserInputControls.GovernedByOrthoMode |  UserInputControls.NullResponseAccepted;
            jigOpts.UseBasePoint = true;
            jigOpts.BasePoint = (Point3d)this.startPoint;
            jigOpts.Message = "\n 选择下一点或者Enter结束";
            PromptPointResult res = prompts.AcquirePoint(jigOpts);
            Point3d positionTemp = res.Value;
            this.endPoint = positionTemp;

            if (res.Status == PromptStatus.Cancel || res.Status == PromptStatus.None)
                return SamplerStatus.Cancel;
            else
                return SamplerStatus.OK;
        }
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions jigOpts = new JigPromptPointOptions();
                jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted);

                if(mPromptCounter == 0)
                {
                    jigOpts.Message = "\nEllipse Major axis:";
                    PromptPointResult dres = prompts.AcquirePoint(jigOpts);

                    Point3d axisPointTemp = dres.Value;
                    if(axisPointTemp != mAxisPt)
                    {
                        mAxisPt = axisPointTemp;
                    }
                    else
                        return SamplerStatus.NoChange;

                    if(dres.Status == PromptStatus.Cancel)
                        return SamplerStatus.Cancel;
                    else
                        return SamplerStatus.OK;

                }
                else if (mPromptCounter == 1)
                {
                    jigOpts.BasePoint = mCenterPt;
                    jigOpts.UseBasePoint = true;
                    jigOpts.Message = "\nEllipse Minor axis:";
                    double radiusRatioTemp = -1;
                    PromptPointResult res = prompts.AcquirePoint(jigOpts);
                    acquiredPoint = res.Value;
                    radiusRatioTemp = mCenterPt.DistanceTo(acquiredPoint);

                    // Ensure the radiusRatio is kept within the expected range.
                    if (radiusRatioTemp > 1.0)
                        radiusRatioTemp = 1.0;

                    if (radiusRatioTemp != mRadiusRatio)
                        mRadiusRatio = radiusRatioTemp;
                    else
                        return SamplerStatus.NoChange;

                    if(res.Status == PromptStatus.Cancel)
                        return SamplerStatus.Cancel;
                    else
                        return SamplerStatus.OK;

                }
                else
                {
                    return SamplerStatus.NoChange;
                }
            }