Exemplo n.º 1
0
        static public void ZoomWindow()
        {
            _AcAp.Document doc =

                _AcAp.Application.DocumentManager.MdiActiveDocument;

            _AcDb.Database db = doc.Database;

            _AcEd.Editor ed = doc.Editor;


            // Get the window coordinates


            _AcEd.PromptPointOptions ppo =

                new _AcEd.PromptPointOptions(

                    "\nSpecify first corner:"

                    );


            _AcEd.PromptPointResult ppr =

                ed.GetPoint(ppo);


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


            _AcGe.Point3d min = ppr.Value;


            _AcEd.PromptCornerOptions pco =

                new _AcEd.PromptCornerOptions(

                    "\nSpecify opposite corner: ",

                    ppr.Value

                    );


            ppr = ed.GetCorner(pco);


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


            _AcGe.Point3d max = ppr.Value;


            // Call out helper function

            // [Change this to ZoomWin2 or WoomWin3 to

            // use different zoom techniques]


            //ZoomWin(ed, min, max);
            Plan2Ext.Globs.Zoom(new _AcGe.Point3d(min.X, min.Y, 0.0), new _AcGe.Point3d(max.X, max.Y, 0), new _AcGe.Point3d(), 1.0);
        }
Exemplo n.º 2
0
        public static void DisplayIntersectionGridLines()
        {
            string strMsg = "Побудова перетину ліній координатної сітки > Масштаб креслення (1:1000 - 1.0, 1:500 - 0.5 ...) :";

            AcEd.PromptDoubleOptions pdo =
                new AcEd.PromptDoubleOptions(strMsg)
            {
                AllowNegative = false,
                AllowZero     = false,
                AllowNone     = false
            };


            AcEd.PromptDoubleResult pdr = CurrentCAD.Editor.GetDouble(pdo);

            if (pdr.Status == AcEd.PromptStatus.OK)
            {
                double scaleDrawing = pdr.Value;

                AcEd.PromptPointResult ppr = CurrentCAD.Editor.GetPoint("Побудова перетину ліній координатної сітки > Вкажіть першу точку:");

                if (ppr.Status == AcEd.PromptStatus.OK)
                {
                    AcGe.Point3d basePoint = ppr.Value;

                    AcEd.PromptCornerOptions pco = new AcEd.PromptCornerOptions("Побудова перетину ліній координатної сітки > Вкажіть другу точку:", basePoint);

                    ppr = CurrentCAD.Editor.GetCorner(pco);
                    if (ppr.Status == AcEd.PromptStatus.OK)
                    {
                        AcGe.Point3d сornerPoint = ppr.Value;

                        double stepGrid = scaleDrawing * 100;

                        double newX = (double)((int)(basePoint.X / stepGrid)) * stepGrid;
                        double newY = (double)((int)(basePoint.Y / stepGrid)) * stepGrid;

                        if ((сornerPoint.X - basePoint.X) > 0)
                        {
                            newX += stepGrid;
                        }
                        if ((сornerPoint.Y - basePoint.Y) > 0)
                        {
                            newY += stepGrid;
                        }

                        AcGe.Point3d startPoint = new AcGe.Point3d(newX, newY, 0);

                        int numCol = (int)((сornerPoint.Y - startPoint.Y) / stepGrid);
                        int numRow = (int)((сornerPoint.X - startPoint.X) / stepGrid);

                        double stepCol = stepGrid;
                        double stepRow = stepGrid;

                        if (numCol < 0)
                        {
                            stepCol *= -1;
                        }
                        if (numRow < 0)
                        {
                            stepRow *= -1;
                        }

                        ArraysBlocks arrBlock = new ArraysBlocks("11", scaleDrawing, 0, startPoint);
                        arrBlock.DisplayArrays(Math.Abs(numCol) + 1, Math.Abs(numRow) + 1, stepCol, stepRow);
                    }
                }
            }
        }