Exemplo n.º 1
0
        private double getScale()
        {
            _Ed.PromptDoubleOptions pDoubleOpts = new _Ed.PromptDoubleOptions("\nEnter scale: ");
            _Ed.PromptDoubleResult  pDoubleRes  = _c.ed.GetDouble(pDoubleOpts);

            if (pDoubleRes.Status != _Ed.PromptStatus.OK)
            {
                throw new DMTException("no scale");
            }

            return(pDoubleRes.Value);
        }
Exemplo n.º 2
0
        protected override AcEd.SamplerStatus Sampler(AcEd.JigPrompts prompts)
        {
            System.Windows.Forms.Keys mods = System.Windows.Forms.Control.ModifierKeys;
            if ((mods & System.Windows.Forms.Keys.Control) > 0)
            {
                AcEd.JigPromptAngleOptions jpao = new AcEd.JigPromptAngleOptions("\nВкажіть обертання: ")
                {
                    UseBasePoint      = true,
                    BasePoint         = blockReference.Position,
                    Cursor            = AcEd.CursorType.RubberBand,
                    UserInputControls = (AcEd.UserInputControls.Accept3dCoordinates /*|
                                                                                     * UserInputControls.UseBasePointElevation*/)
                };
                AcEd.PromptDoubleResult pdr = prompts.AcquireAngle(jpao);

                if (rotation == pdr.Value)
                {
                    return(AcEd.SamplerStatus.NoChange);
                }
                else
                {
                    rotation = pdr.Value;
                    return(AcEd.SamplerStatus.OK);
                }
            }
            else
            {
                AcEd.JigPromptPointOptions jppo =
                    new AcEd.JigPromptPointOptions("\nВкажіть точку вставки (або натисніть 'Ctrl' для  обертання): ")
                {
                    UserInputControls = (AcEd.UserInputControls.Accept3dCoordinates | AcEd.UserInputControls.NullResponseAccepted)
                };
                AcEd.PromptPointResult ppr = prompts.AcquirePoint(jppo);
                if (position.DistanceTo(ppr.Value) < AcGe.Tolerance.Global.EqualPoint)
                {
                    return(AcEd.SamplerStatus.NoChange);
                }
                else
                {
                    position = ppr.Value;
                }
                return(AcEd.SamplerStatus.OK);
            }
        }
Exemplo n.º 3
0
        protected override AcEd.SamplerStatus Sampler(AcEd.JigPrompts prompts)
        {
            System.Windows.Forms.Keys mods = System.Windows.Forms.Control.ModifierKeys;
            if ((mods & System.Windows.Forms.Keys.Control) > 0)
            {
                AcEd.JigPromptAngleOptions jpao =
                    new AcEd.JigPromptAngleOptions("\nSpecify the rotation: ");
                jpao.UseBasePoint      = true;
                jpao.BasePoint         = _br.Position;
                jpao.Cursor            = AcEd.CursorType.RubberBand;
                jpao.UserInputControls = (
                    AcEd.UserInputControls.Accept3dCoordinates /*|
                                                                * AcEd.UserInputControls.UseBasePointElevation*/);
                AcEd.PromptDoubleResult pdr = prompts.AcquireAngle(jpao);

                if (_rot == pdr.Value)
                {
                    return(AcEd.SamplerStatus.NoChange);
                }
                else
                {
                    _rot = pdr.Value;
                    return(AcEd.SamplerStatus.OK);
                }
            }
            else
            {
                AcEd.JigPromptPointOptions jppo =
                    new AcEd.JigPromptPointOptions("\nSpecify insertion point (or press Ctrl for rotation): ");
                jppo.UserInputControls =
                    (AcEd.UserInputControls.Accept3dCoordinates | AcEd.UserInputControls.NullResponseAccepted);
                AcEd.PromptPointResult ppr = prompts.AcquirePoint(jppo);
                if (_pos.DistanceTo(ppr.Value) < AcGe.Tolerance.Global.EqualPoint)
                {
                    return(AcEd.SamplerStatus.NoChange);
                }
                else
                {
                    _pos = ppr.Value;
                }
                return(AcEd.SamplerStatus.OK);
            }
        }
Exemplo n.º 4
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);
                    }
                }
            }
        }