Esempio n. 1
1
        public void TestDrawRec()
        {
            Matrix3d ucs = CoordinateSystem.CoordinateTools.GetCurrentUcs();

            PromptPointOptions ppo = new PromptPointOptions("\nУкажите начальную точку");

            PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo);

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

            Drawing.PolyGrid grid = new Drawing.PolyGrid(ppr.Value, 100, 50, ucs);

            /*ppo = new PromptPointOptions("\nУкажите конечную точку");
             * ppo.UseBasePoint = true;
             * ppo.BasePoint = grid.Origin;
             * ppo.UseDashedLine = true;
             *
             * ppr = Tools.GetAcadEditor().GetPoint(ppo);
             * if (ppr.Status != PromptStatus.OK)
             *  return;*/

            //grid.Display(ppr.Value);

            if (grid.JigDraw() == PromptStatus.OK)
            {
                return;
            }
        }
        public static Point3d?GetInsertPoint(Vector3d axisVector, Matrix3d ucs)
        {
            PromptPointOptions ppo = new PromptPointOptions("\nУкажите точку вставки/проектное положение");

            ppo.Keywords.Add("Perpendicular", "Перпендикуляр", "Перпендикуляр", true, true);
            ppo.Keywords.Add("Exit", "Выход", "Выход", true, true);
            ppo.AllowArbitraryInput = true;
            PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo);

            if (ppr.Status == PromptStatus.Keyword)
            {
                if (ppr.StringResult == "Exit")
                {
                    return(null);
                }
                if (ppr.StringResult == "Perpendicular")
                {
                    if (DrawWallArrows(_calculateVector(axisVector, ucs, true), ucs, true) == PromptStatus.OK)
                    {
                        ppr = Tools.GetAcadEditor().GetPoint(ppo);
                    }
                }
            }
            if (ppr.Status != PromptStatus.OK)
            {
                return(null);
            }
            return(ppr.Value);
        }
        public static Point3d[] GetAxisVectorCmd(CoordinateSystem3d ucs)
        {
            PromptPointOptions ppo = new PromptPointOptions("\nУкажите первую точку положения оси/грани");

            ppo.Keywords.Add("Xaxis", "ОсьХ", "Ось Х", true, true);
            PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo);

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

            ppo = new PromptPointOptions("\nУкажите вторую точку положения оси/грани");
            ppo.UseBasePoint  = true;
            ppo.BasePoint     = ppr.Value;
            ppo.UseDashedLine = true;
            ppr = Tools.GetAcadEditor().GetPoint(ppo);
            if (ppr.Status != PromptStatus.OK)
            {
                return(null);
            }

            var res = new[] { ppo.BasePoint, ppr.Value };

            return(res);
        }
Esempio n. 4
0
File: Misc.cs Progetto: 15831944/EM
        getCorners(out Point3d corner1, out Point3d corner2)
        {
            Editor ed = BaseObjs._editor;

            PromptPointResult prRes = ed.GetPoint("\nSelect one corner");

            if (prRes.Status != PromptStatus.OK)
            {
                corner1 = prRes.Value;
                corner2 = prRes.Value;
                return(false);
            }

            corner1 = prRes.Value;
            PromptCornerOptions prOpts = new PromptCornerOptions(string.Format("\n{0}", "Select another corner"), corner1);

            prOpts.AllowNone     = true;
            prOpts.UseDashedLine = true;

            prRes = ed.GetCorner(prOpts);
            if (prRes.Status != PromptStatus.OK)
            {
                corner2 = prRes.Value;
                return(false);
            }
            corner2 = prRes.Value;

            return(true);
        }
Esempio n. 5
0
        static public void DoIt()
        {
            Editor             ed   = Application.DocumentManager.MdiActiveDocument.Editor;
            PromptPointOptions opts = new PromptPointOptions("\nEnter Ellipse Center Point:");
            PromptPointResult  res  = ed.GetPoint(opts);

            Vector3d x         = Application.DocumentManager.MdiActiveDocument.Database.Ucsxdir;
            Vector3d y         = Application.DocumentManager.MdiActiveDocument.Database.Ucsydir;
            Vector3d NormalVec = x.CrossProduct(y);


            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;

            //Create Ellipsejig
            EllipseJig jig = new EllipseJig(res.Value, NormalVec.GetNormal());

            //first call drag to get the major axis
            jig.setPromptCounter(0);
            Application.DocumentManager.MdiActiveDocument.Editor.Drag(jig);
            // Again call drag to get minor axis
            jig.setPromptCounter(1);
            Application.DocumentManager.MdiActiveDocument.Editor.Drag(jig);

            //Append entity.
            using (Transaction myT = tm.StartTransaction())
            {
                BlockTable       bt  = (BlockTable)tm.GetObject(db.BlockTableId, OpenMode.ForRead, false);
                BlockTableRecord btr = (BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                btr.AppendEntity(jig.GetEntity());
                tm.AddNewlyCreatedDBObject(jig.GetEntity(), true);
                myT.Commit();
            }
        }
Esempio n. 6
0
        /// <summary> 在界面中选择一行点或者一列点,用来进行表格的单元格划分 </summary>
        private Point3d GetPointsFromUI(DocumentModifier docMdf, bool forRow, out bool continueSelect)
        {
            continueSelect = false;
            // 创建一个 TypedValue 数组,用于定义过滤条件
            TypedValue[] acTypValAr = new TypedValue[]
            {
                new TypedValue((int)DxfCode.Start, "TEXT"),
            };

            // 将过滤条件赋值给SelectionFilter对象
            SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);

            //获取当前文档编辑器
            Editor ed  = docMdf.acActiveDocument.Editor;
            string msg = forRow ? "选择作为 行 分隔的点(至少2个) " : "选择作为 列 分隔的点(至少2个) ";

            var pao = new PromptPointOptions(message: $"\n{msg}");

            pao.AllowNone = true; // 允许用户直接按下回车或者右键,以退出 GetPoint() 方法,此时返回的 PromptPointResult.Status 为 None。

            // 请求在图形区域选择对象。 GetSelection() 会阻塞线程,直到用户在AutoCAD界面中选择对象完成、取消或者出错。
            PromptPointResult psr = ed.GetPoint(pao);

            // 输出文本所对应的数据
            if (psr.Status == PromptStatus.OK)
            {
                continueSelect = true;
                return(psr.Value);
            }
            else
            {
                continueSelect = false;
                return(default(Point3d));
            }
        }
Esempio n. 7
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);
        }
        /// <summary>
        /// Gets the window selection.
        /// </summary>
        /// <returns></returns>
        public static Point3d[] GetWindowSelection()
        {
            Point3d[] selectedPoints = null;
            Document  currentDoc     = Active.MdiDocument;
            Editor    editor         = currentDoc.Editor;

            PromptPointResult ppr1 = editor.GetPoint("\nSelect first corner of window: ");

            if (ppr1.Status != PromptStatus.OK)
            {
                return(null);
            }

            PromptPointResult ppr2 = editor.GetCorner("\nSelect opposite corner of window: ", ppr1.Value);

            if (ppr2.Status != PromptStatus.OK)
            {
                return(null);
            }

            selectedPoints    = new Point3d[2];
            selectedPoints[0] = ppr1.Value;
            selectedPoints[1] = ppr2.Value;

            return(selectedPoints);
        }
Esempio n. 9
0
        public Polyline3d GetRegion(string firstMessage = "请选择区域", string secondMessage = "请选择区域")
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

            using (DocumentLock acLckDoc = doc.LockDocument())
            {
                Editor  editor     = doc.Editor;
                Point3d firstPoint = GetPoint(firstMessage);
                if (firstPoint == Point3d.Origin)
                {
                    //用户取消操作
                    return(null);
                }
                Point3d             secondPoint;
                PromptCornerOptions options = new PromptCornerOptions(secondMessage, firstPoint);
                PromptPointResult   i       = editor.GetCorner(options);
                if (i.Status == PromptStatus.OK)
                {
                    secondPoint = i.Value;
                }
                else
                {
                    return(null);
                }
                Point3dCollection points = new Point3dCollection();
                points.Add(firstPoint);
                points.Add(new Point3d(secondPoint.X, firstPoint.Y, 0));
                points.Add(secondPoint);
                points.Add(new Point3d(firstPoint.X, secondPoint.Y, 0));
                return(new Polyline3d(Poly3dType.SimplePoly, points, true));
            }
        }
Esempio n. 10
0
        GetCorners(out Point3d corner1, out Point3d corner2)
        {
            Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor;

            PromptPointResult prRes = ed.GetPoint("\nSelect one corner");

            if (prRes.Status != PromptStatus.OK)
            {
                corner1 = prRes.Value;
                corner2 = prRes.Value;
                return(false);
            }

            corner1 = prRes.Value;
            PromptCornerOptions prOpts = new PromptCornerOptions(string.Format("\n{0}", "Select another corner"), corner1);

            prOpts.AllowNone     = true;
            prOpts.UseDashedLine = true;

            prRes = ed.GetCorner(prOpts);
            if (prRes.Status != PromptStatus.OK)
            {
                corner2 = prRes.Value;
                return(false);
            }
            corner2 = prRes.Value;

            return(true);
        }
Esempio n. 11
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);
        }
Esempio n. 12
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);
        }
Esempio n. 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);
        }
Esempio n. 14
0
        XformScale()
        {
            ObjectIdCollection selSet = null;

            if (Utils.AcadUi.GetSelSetFromUser(out selSet) == false)
            {
                return;
            }

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            PromptPointResult prBasePtRes = ed.GetPoint("\nBase point");

            if (prBasePtRes.Status == PromptStatus.OK)
            {
                PromptDistanceOptions prScaleOpts = new PromptDistanceOptions("\nScale factor");
                prScaleOpts.AllowZero     = false;
                prScaleOpts.AllowNegative = false;

                PromptDoubleResult prScaleRes = ed.GetDistance(prScaleOpts);

                if (prScaleRes.Status == PromptStatus.OK)
                {
                    DoXform(selSet, Matrix3d.Scaling(prScaleRes.Value, Utils.Db.UcsToWcs(prBasePtRes.Value)));
                }
            }
        }
Esempio n. 15
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);
            }
        }
Esempio n. 16
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);
            }
Esempio n. 17
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);
            }
        }
Esempio n. 18
0
        //[Autodesk.AutoCAD.Runtime.CommandMethod("iCmd_DrawArrows", Autodesk.AutoCAD.Runtime.CommandFlags.UsePickSet)]
        public void DrawArrowsEx()
        {
            _ucs = CoordinateSystem.CoordinateTools.GetCurrentUcs();
            PromptPointOptions ppo = new PromptPointOptions("\nУкажите проектное положение");

            PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo);

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

            /*Arrow arrow = new Arrow(ppr.Value, _ucs);
             * if (arrow.DrawJig() == PromptStatus.OK)
             * {
             *  var entities = arrow.Explode();
             *  foreach (Entity ent in entities)
             *  {
             *      Tools.AppendEntity(ent);
             *  }
             * }*/

            _insertPoint = ppr.Value;
            _arrow       = new Arrow(ppr.Value, _ucs);
            if (JigDraw() == PromptStatus.OK)
            {
                SaveToDatabase();
            }
        }
        private void getYAxis_button_Click(object sender, EventArgs e)
        {
            this.Hide();

            PromptPointOptions ppo = new PromptPointOptions("\nУкажите первую точку определяющую ось Y");
            PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo);
            if (ppr.Status != PromptStatus.OK)
                return;
            Point3d firstYAxisPoint = ppr.Value;

            ppo = new PromptPointOptions("\nУкажите вторую точку определяющую ось Y");
            ppo.UseBasePoint = true;
            ppo.BasePoint = firstYAxisPoint;
            ppo.UseDashedLine = true;

            ppr = Tools.GetAcadEditor().GetPoint(ppo);
            if (ppr.Status != PromptStatus.OK)
                return;
            Point3d secondYAxisPoint = ppr.Value;

            _angle = CoordinateSystem.CoordinateTools.GetAngleFromUcsYAxis(secondYAxisPoint - firstYAxisPoint);

            Tools.GetActiveAcadDocument().Editor.UpdateScreen();

            this.Show();
        }
Esempio n. 20
0
        public void FDOSelectCrossingPoint()
        {
            Core.ClearImpliedSelection();

            PromptPointOptions pnt_opts = new PromptPointOptions("Укажите точку для выбора объктов карты (FDO) (Esc или Enter чтобы отказаться):");

            pnt_opts.AllowNone = true;

            PromptPointResult point_result = Core.current_editor.GetPoint(pnt_opts);             // выбор точки

            if (point_result.Status == PromptStatus.OK)
            {
                PromptSelectionResult sel_result = Core.current_editor.SelectCrossingWindow(point_result.Value, point_result.Value);                 // выбор объектов
                if (sel_result.Status == PromptStatus.OK)
                {
                    // преобразование SelectionSet'а AutoCAD'а в выборку MgSelectionBase (только объекты FDO)
                    MgSelectionBase selection_base = AcMapFeatureEntityService.GetSelection(sel_result.Value);

                    // установка активной выборки
                    SelectionSet new_sel_set = AcMapFeatureEntityService.AddFeaturesToSelectionSet(null, selection_base);
                    Core.current_editor.SetImpliedSelection(new_sel_set);
                }
            }
            Core.WriteMessage("\n");
        }
        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);
        }
Esempio n. 22
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);
            }
        }
Esempio n. 23
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);
            }
        }
            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                JigPromptPointOptions ppo = new JigPromptPointOptions("\nSelect MiddlejackPanel position");
                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);
                }
            }
Esempio n. 25
0
        private PromptStatus GetDistance(string message1, string message2, out double length, bool allowEmpty)
        {
            Editor             ed   = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            PromptPointOptions opt1 = new PromptPointOptions(message1);

            opt1.AllowNone = allowEmpty;
            PromptPointResult res1 = ed.GetPoint(opt1);

            if (res1.Status == PromptStatus.OK)
            {
                PromptDistanceOptions opt2 = new PromptDistanceOptions(message2);
                opt2.AllowNone    = allowEmpty;
                opt2.BasePoint    = res1.Value;
                opt2.UseBasePoint = true;
                PromptDoubleResult res2 = ed.GetDistance(opt2);
                if (res2.Status == PromptStatus.OK)
                {
                    length = res2.Value;
                    return(PromptStatus.OK);
                }
            }

            length = 0;
            return(PromptStatus.Cancel);
        }
Esempio n. 26
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);
            }
        }
Esempio n. 27
0
        protected override SamplerStatus Sampler(JigPrompts Prompts)
        {
            PromptPointResult promptPointResult = Prompts.AcquirePoint(new JigPromptPointOptions("\r\n请指定下一点:")
            {
                Cursor       = 3,
                BasePoint    = this.point3d_0,
                UseBasePoint = true
            });
            Point3d       value = promptPointResult.Value;
            SamplerStatus result;

            if (value != this.point3d_1)
            {
                Point3d point3d  = this.point3d_0;
                Point3d point3d2 = value;
                if (point3d.X > point3d2.X)
                {
                    Point3d point3d3 = point3d;
                    point3d  = point3d2;
                    point3d2 = point3d3;
                }
                else if (point3d.X == point3d2.X & point3d.Y > point3d2.Y)
                {
                    Point3d point3d4 = point3d;
                    point3d  = point3d2;
                    point3d2 = point3d4;
                }
                double   num         = CAD.P2P_Angle(point3d, point3d2);
                Point3d  pointAngle  = CAD.GetPointAngle(point3d, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 45.0);
                Point3d  pointAngle2 = CAD.GetPointAngle(point3d2, 200.0 * this.double_0, num * 180.0 / 3.1415926535897931 + 135.0);
                Polyline polyline    = new Polyline();
                polyline.SetDatabaseDefaults();
                Polyline polyline2 = polyline;
                int      num2      = 0;
                Point2d  point2d;
                point2d..ctor(pointAngle.get_Coordinate(0), pointAngle.get_Coordinate(1));
                polyline2.AddVertexAt(num2, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline3 = polyline;
                int      num3      = 1;
                point2d..ctor(point3d.get_Coordinate(0), point3d.get_Coordinate(1));
                polyline3.AddVertexAt(num3, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline4 = polyline;
                int      num4      = 2;
                point2d..ctor(point3d2.get_Coordinate(0), point3d2.get_Coordinate(1));
                polyline4.AddVertexAt(num4, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                Polyline polyline5 = polyline;
                int      num5      = 3;
                point2d..ctor(pointAngle2.get_Coordinate(0), pointAngle2.get_Coordinate(1));
                polyline5.AddVertexAt(num5, point2d, 0.0, 45.0 * this.double_0, 45.0 * this.double_0);
                polyline.Layer   = "正筋";
                this.entity_0[0] = polyline;
                this.point3d_1   = value;
                result           = 0;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
Esempio n. 28
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);
            }
Esempio n. 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);
            }
        }
Esempio n. 30
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);
                }
            }
Esempio n. 31
0
            public void start_DIMline()
            {
                CurrPoint = tr.AC_Doc.Editor.GetPoint("Pick a Point");
                preview.beginDraw_PreviewLine(CurrPoint.Value);

                Points.Add(CurrPoint.Value);

                Polyline PLine = new Polyline();
                PLine.AddVertexAt(0, new Point2d(CurrPoint.Value.X, CurrPoint.Value.Y), 0, 0, 0);
                DIMline = tr.addObject(PLine);
            }
Esempio n. 32
0
 public bool askforPoint()
 {
     CurrPoint = tr.AC_Doc.Editor.GetPoint("Pick a Point");
     Points.Add(CurrPoint.Value);
     preview.update_PreviewLine(CurrPoint.Value, acMath.totalDistance(Points, DIMset.DimUnit_Precision));
     if (CurrPoint.Status == PromptStatus.Cancel)
     {
         preview.endDraw_PreviewLine();
         return false;
     }
     tr.AC_Doc.Editor.WriteMessage(CurrPoint.Value.ToString() + "\n");
     return true;
 }
Esempio n. 33
0
 private static void handle_promptPointResult(object sender, PromptPointResultEventArgs e)
 {
     useThisPointResult = e.Result;
 }