コード例 #1
0
        public static void DrawArrows()
        {
            AnchorArrow mainBlock = new AnchorArrow();

            mainBlock._ucs = CoordinateSystem.CoordinateTools.GetCurrentUcs();
            PromptPointOptions ppo = new PromptPointOptions("\nУкажите проектное положение");

            ppo.Keywords.Add("Exit", "ВЫХод", "ВЫХод", true, true);
            ppo.AllowArbitraryInput = true;
            ppo.AllowNone           = false;

            PromptPointResult ppr = null;

            while ((ppr = Tools.GetAcadEditor().GetPoint(ppo)).Status == PromptStatus.OK ||
                   ppr.Status == PromptStatus.Keyword)
            {
                if (ppr.Status == PromptStatus.Keyword)
                {
                    switch (ppr.StringResult)
                    {
                    case "Exit":
                    {
                        return;
                    }
                    }
                }

                /*if (ppr.Status != PromptStatus.OK)
                 *  return;*/

                mainBlock._insertPoint = ppr.Value;
                mainBlock._arrow       = new Arrow(ppr.Value, mainBlock._ucs);
                if (mainBlock.JigDraw() == PromptStatus.OK)
                {
                    mainBlock.SaveToDatabase();
                }
            }
        }
コード例 #2
0
        public static void DrawArrowsRandom()
        {
            AnchorArrow mainBlock = new AnchorArrow();

            mainBlock._ucs       = CoordinateSystem.CoordinateTools.GetCurrentUcs();
            mainBlock._tolerance = _dataHost.Read("tolerance", mainBlock._tolerance);
            PromptPointOptions ppo = new PromptPointOptions("\nУкажите проектное положение");

            ppo.Keywords.Add("Exit", "ВЫХод", "ВЫХод", true, true);
            ppo.Keywords.Add("Tolerance", "ДОПуск", "ДОПуск", true, true);
            ppo.AllowArbitraryInput = true;
            ppo.AllowNone           = false;

            List <Point3d> points = new List <Point3d>();

            PromptPointResult ppr = null;

            while ((ppr = Tools.GetAcadEditor().GetPoint(ppo)).Status == PromptStatus.OK ||
                   ppr.Status == PromptStatus.Keyword)
            {
                if (ppr.Status == PromptStatus.Keyword)
                {
                    switch (ppr.StringResult)
                    {
                    case "Exit":
                    {
                        return;
                    }

                    case "Tolerance":
                    {
                        PromptDoubleOptions pdo = new PromptDoubleOptions("\nУкажите допуск в плане, м: ");
                        pdo.AllowArbitraryInput = false;
                        pdo.AllowNegative       = false;
                        pdo.AllowNone           = false;
                        pdo.UseDefaultValue     = true;
                        pdo.DefaultValue        = mainBlock._tolerance;

                        PromptDoubleResult pdr = Tools.GetAcadEditor().GetDouble(pdo);
                        if (pdr.Status != PromptStatus.OK)
                        {
                            return;
                        }

                        mainBlock._tolerance = pdr.Value;
                        _dataHost.Write("tolerance", mainBlock._tolerance);

                        ppr = Tools.GetAcadEditor().GetPoint(ppo);
                        if (ppr.Status != PromptStatus.OK)
                        {
                            return;
                        }
                        break;
                    }
                    }
                }

                mainBlock._insertPoint = ppr.Value;
                Point3d destPoint = mainBlock._insertPoint.CreateRandomCirclePoints(1, mainBlock._tolerance).First();
                mainBlock._arrow = new Arrow(ppr.Value, mainBlock._ucs);

                mainBlock._arrow.Calculate(destPoint);
                mainBlock._jigSelected = true;
                mainBlock._destPoint   = destPoint;
                if (mainBlock.JigDraw(mainBlock._jigSelected) == PromptStatus.OK)
                {
                    mainBlock.SaveToDatabase();
                }
            }
        }