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;
        }
    protected override SamplerStatus Sampler(JigPrompts prompts)
    {
      // We don't really need a point, but we do need some
      // user input event to allow us to loop, processing
      // for the Kinect input

      PromptPointResult ppr =
        prompts.AcquirePoint("\nClick to finish: ");
      if (ppr.Status == PromptStatus.OK)
      {
        // Let's move the mouse slightly to avoid having
        // to do it manually to keep the input coming

        System.Drawing.Point pt =
          System.Windows.Forms.Cursor.Position;
        System.Windows.Forms.Cursor.Position =
          new System.Drawing.Point(
            pt.X, pt.Y + _offset
          );
        _offset = -_offset;

        return SamplerStatus.OK;
      }
      return SamplerStatus.Cancel;
    }
Beispiel #3
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;
        }
Beispiel #4
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var res = prompts.AcquirePoint("\nТочка вставки:");
            if (res.Status != PromptStatus.OK)
                throw new Exception(General.CanceledByUser);

            SamplerStatus status = SamplerStatus.NoChange;
            if (!Position.IsEqualTo(res.Value, Tolerance.Global))
            {
                status = SamplerStatus.OK;
            }
            Position = res.Value; //TransformBy(ed.CurrentUserCoordinateSystem);
            return status;
        }
            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;
                }
            }
Beispiel #6
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;
 }
Beispiel #7
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);
            }
Beispiel #8
0
        /// <inheritdoc />
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jigOpts = new JigPromptPointOptions
            {
                UserInputControls =
                    UserInputControls.Accept3dCoordinates |
                    UserInputControls.NoZeroResponseAccepted |
                    UserInputControls.AcceptOtherInputString |
                    UserInputControls.NoNegativeResponseAccepted,
                Message = "\n" + Language.GetItem(LangItem, "msg11")
            };
            var acquirePoint = prompts.AcquirePoint(jigOpts);

            if (_mActualPoint == acquirePoint.Value)
            {
                return(SamplerStatus.NoChange);
            }
            _mActualPoint = acquirePoint.Value;
            return(SamplerStatus.OK);
        }
Beispiel #9
0
        // Shows the block until the user clicks a point.
        // The 1st parameter is the Id of the block definition.
        // The 2nd is the clicked point.
        //---------------------------------------------------------------
        // Need to override this method.
        // Updating the current position of the block.
        //--------------------------------------------------------------
        //单击屏幕的时候会运行一下
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions JipOpts   = new JigPromptPointOptions("\n拾取放置位置:");
            PromptPointResult     prResult1 = prompts.AcquirePoint(JipOpts);

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

            if (prResult1.Value.Equals(_basePt))
            {
                return(SamplerStatus.NoChange);
            }
            else
            {
                _basePt = prResult1.Value;
                return(SamplerStatus.OK);
            }
        }
Beispiel #10
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            string jigResultValue = null;

            if (this.Options is JigPromptPointOptions pointOptions)
            {
                var result = prompts.AcquirePoint(pointOptions);
                this.JigResult = result;
                jigResultValue = result.Value.ToString();
            }
            else if (this.Options is JigPromptDistanceOptions distanceOptions)
            {
                var result = prompts.AcquireDistance(distanceOptions);
                this.JigResult = result;
                jigResultValue = result.Value.ToString();
            }
            else if (this.Options is JigPromptAngleOptions angleOptions)
            {
                var result = prompts.AcquireAngle(angleOptions);
                this.JigResult = result;
                jigResultValue = result.Value.ToString();
            }
            else if (this.Options is JigPromptStringOptions stringOptions)
            {
                var result = prompts.AcquireString(stringOptions);
                this.JigResult = result;
                jigResultValue = result.StringResult;
            }

            if (jigResultValue == null)
            {
                return(SamplerStatus.Cancel);
            }
            else if (jigResultValue != this.JigResultValue)
            {
                this.JigResultValue = jigResultValue;
                return(SamplerStatus.OK);
            }

            return(SamplerStatus.NoChange);
        }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppo = new JigPromptPointOptions(_message)
            {
                Cursor            = CursorType.EntitySelect,
                UseBasePoint      = false,
                UserInputControls = UserInputControls.NullResponseAccepted
            };

            jppo.Keywords.Add(""); // mod 20140527
            var    corner  = prompts.AcquirePoint(jppo).Value;
            var    pos     = Point3d.Origin + 0.5 * (_basePoint.GetAsVector() + corner.GetAsVector());
            var    extents = Ent.GeometricExtents;
            double scale   = Math.Min(
                Math.Abs(corner.X - _basePoint.X) / (extents.MaxPoint.X - extents.MinPoint.X),
                Math.Abs(corner.Y - _basePoint.Y) / (extents.MaxPoint.Y - extents.MinPoint.Y));

            // NOTE: the scale is likely small at the beginning. Too small a scale leads to non-proportional scaling for matrix operation, and thus gets rejected by AutoCAD and causes exception.
            if (scale < Consts.Epsilon)
            {
                scale = Consts.Epsilon;
            }
            if (pos.IsNull())
            {
                return(SamplerStatus.Cancel);
            }
            else if (pos != _pos)
            {
                _move = pos - _pos;
                _pos  = pos;
                //_mag = scale / _scale;
                //_scale = scale;
                _mag = scale;
                return(SamplerStatus.OK);
            }
            else
            {
                _move = pos - _pos;
                return(SamplerStatus.NoChange);
            }
        }
Beispiel #12
0
        protected override SamplerStatus Sampler([NotNull] JigPrompts prompts)
        {
            var jigOpts = new JigPromptPointOptions
            {
                Message = "\n" + _msg
            };

            if (_keywords?.Any() == true)
            {
                foreach (var keyword in _keywords)
                {
                    jigOpts.Keywords.Add(keyword);
                }
            }
            var res = prompts.AcquirePoint(jigOpts);

            switch (res.Status)
            {
            case PromptStatus.OK:
            {
                var curPoint = res.Value;
                if (_position.DistanceTo(curPoint) > 1.0e-2)
                {
                    _position = curPoint;
                }
                else
                {
                    return(SamplerStatus.NoChange);
                }
                break;
            }

            case PromptStatus.Keyword:
            {
                _keywordInput(res.StringResult);
                return(SamplerStatus.OK);
            }
            }

            return(res.Status == PromptStatus.Cancel ? SamplerStatus.Cancel : SamplerStatus.OK);
        }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions prOptions1 = new JigPromptPointOptions("\n 选择下一点");

            prOptions1.UseBasePoint      = false;
            prOptions1.UserInputControls =
                UserInputControls.NullResponseAccepted | UserInputControls.Accept3dCoordinates |
                UserInputControls.GovernedByUCSDetect | UserInputControls.GovernedByOrthoMode |
                UserInputControls.AcceptMouseUpAsPoint;

            PromptPointResult prResult1 = prompts.AcquirePoint(prOptions1);

            if (prResult1.Status == PromptStatus.Cancel || prResult1.Status == PromptStatus.Error)
            {
                return(SamplerStatus.Cancel);
            }
            Point3d tempPt = prResult1.Value.TransformBy(UCS.Inverse());

            mLastVertex = tempPt;
            return(SamplerStatus.OK);
        }
Beispiel #14
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions p2Opts = new JigPromptPointOptions("\nEnd Point: ");

                p2Opts.UserInputControls = UserInputControls.GovernedByUCSDetect | UserInputControls.UseBasePointElevation | UserInputControls.Accept3dCoordinates;
                p2Opts.BasePoint         = mp2;
                p2Opts.UseBasePoint      = true;
                PromptPointResult p2Res = prompts.AcquirePoint(p2Opts);

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

                Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                Matrix3d wcs2ucs = AcadUtility.AcadGraphics.WcsToUcs;

                mp2 = p2Res.Value.TransformBy(wcs2ucs);

                return(SamplerStatus.OK);
            }
Beispiel #15
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions pointOpts = new JigPromptPointOptions();

            pointOpts.Keywords.Add("Insertion");
            pointOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted);
            pointOpts.Message           = "\nSelect start point";
            PromptPointResult jigRes = prompts.AcquirePoint(pointOpts);
            Point3d           pt     = jigRes.Value;

            if (pt == startPt)
            {
                return(SamplerStatus.NoChange);
            }
            startPt = pt;
            if (jigRes.Status == PromptStatus.OK || jigRes.Status == PromptStatus.Keyword)
            {
                return(SamplerStatus.OK);
            }
            return(SamplerStatus.Cancel);
        }
Beispiel #16
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jigOpts = new JigPromptPointOptions();

            jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates
                                         | UserInputControls.NoZeroResponseAccepted
                                         | UserInputControls.NoNegativeResponseAccepted
                                         | UserInputControls.NullResponseAccepted
                                         );

            if (mPromptCounter == 0)
            {
                jigOpts.Message = "\nEnter Roadway End Point";
                PromptPointResult dres = prompts.AcquirePoint(jigOpts);

                Point3d endPointTemp = dres.Value;

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

                if (dres.Status == PromptStatus.Cancel)
                {
                    return(SamplerStatus.Cancel);
                }
                else
                {
                    return(SamplerStatus.OK);
                }
            }
            else
            {
                return(SamplerStatus.NoChange);
            }
        }
Beispiel #17
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jigOpts = new JigPromptPointOptions();

            jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates)
                                        | UserInputControls.NoZeroResponseAccepted
                                        | UserInputControls.NoNegativeResponseAccepted;
            jigOpts.SetMessageAndKeywords("\nSurround plot area: " + "\nTab to rotate window [ROtate90]:", "ROtate90");

            PromptPointResult ppr = prompts.AcquirePoint(jigOpts);

            if (ppr.Status == PromptStatus.Keyword)
            {
                if (ppr.StringResult == "ROtate90")
                {
                    //CW subtract 90 deg & normalize the angle between 0 & 360
                    _angle -= Math.PI / 2;
                    while (_angle < Math.PI * 2)
                    {
                        _angle += Math.PI * 2;
                    }
                }
                return(SamplerStatus.OK);
            }
            else if (ppr.Status == PromptStatus.OK)
            {
                if (mActualPoint == ppr.Value)
                {
                    return(SamplerStatus.NoChange);
                }
                else
                {
                    mActualPoint = ppr.Value;
                }

                return(SamplerStatus.OK);
            }

            return(SamplerStatus.Cancel);
        }
Beispiel #18
0
        protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                UserInputControls = 2,
                Cursor            = 2,
                BasePoint         = this.point3d_2,
                UseBasePoint      = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_3)
            {
                AlignedDimension alignedDimension = new AlignedDimension();
                alignedDimension.SetDatabaseDefaults();
                if (this.short_0 == 1)
                {
                    alignedDimension.XLine1Point = this.point3d_2;
                    alignedDimension.XLine2Point = value;
                    double  num        = this.point3d_2.GetVectorTo(value).AngleOnPlane(new Plane());
                    Point3d pointAngle = CAD.GetPointAngle(this.point3d_2, 600.0, num * 180.0 / 3.1415926535897931 + 90.0);
                    alignedDimension.DimLinePoint = pointAngle;
                }
                else if (this.short_0 == 2)
                {
                    alignedDimension.XLine1Point  = this.point3d_2;
                    alignedDimension.XLine2Point  = this.point3d_0[1];
                    alignedDimension.DimLinePoint = value;
                }
                this.entity_0[0] = alignedDimension;
                this.point3d_3   = value;
                result           = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
Beispiel #19
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jppo = new JigPromptPointOptions("\nУкажите точку: ");

            jppo.UseBasePoint = true;
            jppo.BasePoint    = _jigBasePoint;

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

                _jigBasePoint = _jigPoint;

                return(SamplerStatus.OK);
            }
        }
Beispiel #20
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 leader: ";
            }
            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);
            }
            else
            {
                return(SamplerStatus.Cancel);
            }
        }
Beispiel #21
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            // get the center point of circle.
            JigPromptPointOptions jigPrptPointOpt = new JigPromptPointOptions("Pick the center point of circle: ");
            PromptPointResult     ptPointRes      = prompts.AcquirePoint(jigPrptPointOpt);

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

            _circle.Center = ptPointRes.Value;
            _circle.Radius = DefaultSize;

            // calculate the end point of line.
            Vector3d vec = _line.StartPoint - _circle.Center;

            vec            = vec.GetNormal();
            _line.EndPoint = _circle.Center + vec * DefaultSize;

            return(SamplerStatus.OK);
        }
Beispiel #22
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jigOpts =
                new JigPromptPointOptions();

            jigOpts.UserInputControls =
                (UserInputControls.Accept3dCoordinates |
                 UserInputControls.NullResponseAccepted |
                 UserInputControls.NoNegativeResponseAccepted
                );
            if (m_pts.Count == 0)
            {
                jigOpts.Message =
                    "\n选择第一个点: ";
            }
            else if (m_pts.Count > 0)
            {
                jigOpts.UseBasePoint = true;
                jigOpts.Cursor       = CursorType.RubberBand;
                jigOpts.BasePoint    = m_pts[m_pts.Count - 1];
                jigOpts.Message      = "\n下一个点: ";
                jigOpts.SetMessageAndKeywords(
                    "\n下一个点[Undo]: ",
                    "放弃"
                    );
            }
            PromptPointResult res = prompts.AcquirePoint(jigOpts);

            if (res.Value == m_tempPoint)
            {
                return(SamplerStatus.NoChange);
            }
            if (res.Status == PromptStatus.OK)
            {
                m_tempPoint = res.Value;
                return(SamplerStatus.OK);
            }
            return(SamplerStatus.Cancel);
        }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jppo = new JigPromptPointOptions("\nУкажите точку вставки изображения:");

            jppo.UserInputControls = UserInputControls.GovernedByUCSDetect | UserInputControls.Accept3dCoordinates;

            PromptPointResult res = prompts.AcquirePoint(jppo);

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

            if (res.Value.IsEqualTo(this.insertPoint, tolerance))
            {
                return(SamplerStatus.NoChange);
            }

            this.insertPoint = res.Value;

            return(SamplerStatus.OK);
        }
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions ppo = new JigPromptPointOptions("\nBusCouplerSecsionerCell 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);
                }
            }
Beispiel #25
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions jppo = new JigPromptPointOptions(
                    "\nSpecify the new vertex: ");

                jppo.UserInputControls = UserInputControls.Accept3dCoordinates;
                var ppr = prompts.AcquirePoint(jppo);

                if (ppr.Status == PromptStatus.OK)
                {
                    if (ppr.Value.IsEqualTo(point))
                    {
                        return(SamplerStatus.NoChange);
                    }
                    else
                    {
                        point = ppr.Value;
                        return(SamplerStatus.OK);
                    }
                }
                return(SamplerStatus.Cancel);
            }
Beispiel #26
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions ppo = new JigPromptPointOptions("\nStreetBox Position:\n");
                PromptPointResult     ppr = prompts.AcquirePoint(ppo);

                if (ppr.Status == PromptStatus.OK)
                {
                    if (ppr.Value == BasePoint)
                    {
                        return(SamplerStatus.NoChange);
                    }
                    else
                    {
                        BasePoint = ppr.Value;
                        return(SamplerStatus.OK);
                    }
                }
                else
                {
                    return(SamplerStatus.Cancel);
                }
            }
Beispiel #27
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            if (!String.IsNullOrEmpty(_word))
            {
                var doc =
                    Application.DocumentManager.MdiActiveDocument;
                if (doc != null)
                {
                    doc.Editor.WriteMessage("\nWord recognised: {0}", _word);
                    _word = "";
                }
            }

            // We don't really need a point, but we do need some
            // user input event to allow us to loop, processing
            // for the Kinect input

            var opts = new JigPromptPointOptions("\nClick to capture: ");

            opts.UserInputControls =
                UserInputControls.NullResponseAccepted;

            opts.Cursor = CursorType.Invisible;

            var ppr = prompts.AcquirePoint(opts);

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

                return(SamplerData());
            }
            return(SamplerStatus.Cancel);
        }
Beispiel #28
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jppo = new JigPromptPointOptions(_message);

            jppo.Keywords.Add(""); // mod 20140527
            jppo.Cursor            = CursorType.EntitySelect;
            jppo.UseBasePoint      = false;
            jppo.UserInputControls = UserInputControls.NullResponseAccepted;
            Point3d corner  = prompts.AcquirePoint(jppo).Value;
            Point3d pos     = Point3d.Origin + 0.5 * (_basePoint.GetAsVector() + corner.GetAsVector());
            var     extents = _ent.GeometricExtents;
            double  scale   = Math.Min(
                Math.Abs(corner.X - _basePoint.X) / (extents.MaxPoint.X - extents.MinPoint.X),
                Math.Abs(corner.Y - _basePoint.Y) / (extents.MaxPoint.Y - extents.MinPoint.Y));

            if (scale < Consts.Epsilon) // 在一开始scale势必很小。过小的scale会导致矩阵运算出现非等比缩放变换,从而被CAD拒绝,导致异常。
            {
                scale = Consts.Epsilon;
            }
            if (pos.IsNull())
            {
                return(SamplerStatus.Cancel);
            }
            else if (pos != _pos)
            {
                _move = pos - _pos;
                _pos  = pos;
                //_mag = scale / _scale;
                //_scale = scale;
                _mag = scale;
                return(SamplerStatus.OK);
            }
            else
            {
                _move = pos - _pos;
                return(SamplerStatus.NoChange);
            }
        }
Beispiel #29
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions jigOpts = new JigPromptPointOptions();

            jigOpts.UserInputControls = (
                UserInputControls.Accept3dCoordinates |
                UserInputControls.UseBasePointElevation
                );

            jigOpts.Message = "\nSpecify second point: ";

            PromptPointResult promptPointResult = prompts.AcquirePoint(jigOpts);

            if (promptPointResult.Status == PromptStatus.OK)
            {
                secondPoint = promptPointResult.Value;
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.Cancel);
            }
        }
Beispiel #30
0
        /// <summary>
        /// 選択した円の現在の場所を更新する
        /// (このメソッドをオーバーライドする必要があります)
        /// </summary>
        /// <param name="prompts"></param>
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jigOpts = new JigPromptPointOptions
            {
                UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted),
                Message           = "挿入位置を指定"
            };
            var jigRes = prompts.AcquirePoint(jigOpts);
            var pt     = jigRes.Value;

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

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

            return(SamplerStatus.Cancel);
        }
Beispiel #31
0
        protected override SamplerStatus Sampler([NotNull] JigPrompts prompts)
        {
            var jigOpts = new JigPromptPointOptions
            {
                Message = "\n" + _msg
            };
            var res = prompts.AcquirePoint(jigOpts);

            if (res.Status == PromptStatus.OK)
            {
                var curPoint = res.Value;
                if (_position.DistanceTo(curPoint) > 1.0e-2)
                {
                    _position = curPoint;
                }
                else
                {
                    return(SamplerStatus.NoChange);
                }
            }

            return(res.Status == PromptStatus.Cancel ? SamplerStatus.Cancel : SamplerStatus.OK);
        }
Beispiel #32
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor   ed  = doc.Editor;

            //ed.PointFilter += new PointFilterEventHandler(m_GetMousePoint);
            JigPromptPointOptions ppo = new JigPromptPointOptions("\n 请指定下一点");

            ppo.Keywords.Add(" ", " ", "空格下一个");
            ppo.Keywords.Default = " ";
            ppo.UseBasePoint     = true;
            ppo.BasePoint        = ptlast;
            PromptPointResult ppr = prompts.AcquirePoint(ppo);

            ptlast = ppr.Value;
            if (ppr.Status == PromptStatus.Keyword)
            {
                if (ppr.StringResult == " ")
                {
                    count++;
                }
                else
                {
                    return(SamplerStatus.OK);
                }
            }
            if (ppr.Status == PromptStatus.OK)
            {
                //count++;
                return(SamplerStatus.OK);
            }



            return(SamplerStatus.NoChange);
            // throw new NotImplementedException();
        }
Beispiel #33
0
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions jigOpts = new JigPromptPointOptions();

                jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates |
                                             UserInputControls.NullResponseAccepted |
                                             UserInputControls.NoNegativeResponseAccepted);
                if (_Point3dCollection.Count == 0)
                {
                    // For the first vertex, just ask for the point
                    jigOpts.Message = "\nStart point of polyline: ";
                }
                else if (_Point3dCollection.Count > 0)
                {
                    // For subsequent vertices, use a base point
                    jigOpts.BasePoint    = _Point3dCollection[_Point3dCollection.Count - 1];
                    jigOpts.UseBasePoint = true;
                    jigOpts.Message      = "\nPolyline vertex: ";
                }
                else // should never happen
                {
                    return(SamplerStatus.Cancel);
                }
                PromptPointResult res = prompts.AcquirePoint(jigOpts);

                if (m_tempPoint == res.Value)
                {
                    return(SamplerStatus.NoChange);
                }
                else if (res.Status == PromptStatus.OK)
                {
                    m_tempPoint = res.Value;
                    return(SamplerStatus.OK);
                }
                return(SamplerStatus.Cancel);
            }
Beispiel #34
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var jppo = new JigPromptPointOptions(_message)
            {
                Cursor       = CursorType.RubberBand,
                BasePoint    = _startPoint,
                UseBasePoint = true
            };

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

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

            return(SamplerStatus.NoChange);
        }
Beispiel #35
0
        protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                UserInputControls = 2,
                Cursor            = 3,
                BasePoint         = this.point3d_1,
                UseBasePoint      = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_2)
            {
                Polyline polyline = new Polyline();
                polyline.SetDatabaseDefaults();
                Polyline polyline2 = polyline;
                int      num       = 0;
                Point2d  point2d;
                point2d..ctor(this.point3d_1.get_Coordinate(0), this.point3d_1.get_Coordinate(1));
                polyline2.AddVertexAt(num, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline3 = polyline;
                int      num2      = 1;
                point2d..ctor(value.get_Coordinate(0), value.get_Coordinate(1));
                polyline3.AddVertexAt(num2, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                polyline.Layer   = "钢筋";
                this.entity_0[0] = polyline;
                this.point3d_2   = value;
                result           = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
Beispiel #36
0
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions pointOp = new JigPromptPointOptions("\nSpecify second point: ");

            pointOp.UserInputControls = (
                UserInputControls.Accept3dCoordinates |
                UserInputControls.UseBasePointElevation
                );

            pointOp.BasePoint    = basePoint;
            pointOp.UseBasePoint = true;

            PromptPointResult result = prompts.AcquirePoint(pointOp);

            if (result.Status == PromptStatus.OK)
            {
                secondPoint = result.Value;
                return(SamplerStatus.OK);
            }
            else
            {
                return(SamplerStatus.Cancel);
            }
        }
Beispiel #37
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;
            }
Beispiel #38
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;
        }
    protected override SamplerStatus Sampler(JigPrompts prompts)
    {
      // We don't really need a point, but we do need some
      // user input event to allow us to loop, processing
      // for the Kinect input

      PromptPointResult ppr =
        prompts.AcquirePoint("\nClick to capture: ");
      if (ppr.Status == PromptStatus.OK)
      {
        if (Finished)
        {
          CancelJig();
          return SamplerStatus.Cancel;
        }

        // Generate a point cloud

        try
        {
          // Use a user-defined sampling the points for the jig

          _vecs = GeneratePointCloud(Sampling);

          // Extract the points for display in the jig

          _points.Clear();

          foreach (ColoredPoint3d vec in _vecs)
          {
            _points.Add(
              new Point3d(vec.X, vec.Y, vec.Z)
            );
          }

          ForceMessage();
        }
        catch { }

        return SamplerStatus.OK;
      }
      return SamplerStatus.Cancel;
    }
Beispiel #40
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 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;
                }
            }
Beispiel #42
0
    protected override SamplerStatus Sampler(JigPrompts prompts)
    {
      if (!String.IsNullOrEmpty(_word))
      {
        Document doc =
          Application.DocumentManager.MdiActiveDocument;
        if (doc != null)
        {
          doc.Editor.WriteMessage("\nWord recognised: {0}", _word);
          _word = "";
        }
      }

      // We don't really need a point, but we do need some
      // user input event to allow us to loop, processing
      // for the Kinect input

      PromptPointResult ppr =
        prompts.AcquirePoint("\nClick to capture: ");
      if (ppr.Status == PromptStatus.OK)
      {
        if (_finished)
        {
          CancelJig();
          return SamplerStatus.Cancel;
        }

        if (_tilt != 0)
        {
          int elev = _kinect.ElevationAngle + (_tilt * 5);
          if (
            elev <= _kinect.MaxElevationAngle &&
            elev >= _kinect.MinElevationAngle)
          {
            _kinect.ElevationAngle = elev;
            _tilt = 0;
          }
        }

        return SamplerData();
      }
      return SamplerStatus.Cancel;
    }