Exemple #1
0
        public CylinderTunnelJig(Point3d firstPt) : base(new CylinderTunnel())
        {
            mPoints = new List <Point3d>();
            mPoints.Add(firstPt);
            mPromptCounter = 0;

            m_dims = new DynamicDimensionDataCollection();
            Dimension dim1 = new AlignedDimension();

            dim1.SetDatabaseDefaults();
            m_dims.Add(new DynamicDimensionData(dim1, true, true));
            dim1.DynamicDimension = true;
        }
Exemple #2
0
        public RoadwayJig(Point3d spt, Point3d ept) : base(new RoadwayWrapper())
        {
            mStartPt       = spt;
            mEndPt         = ept;
            mPromptCounter = 0;

            m_dims = new DynamicDimensionDataCollection();
            Dimension dim1 = new AlignedDimension();

            dim1.SetDatabaseDefaults();
            m_dims.Add(new DynamicDimensionData(dim1, true, true));
            dim1.DynamicDimension = true;
        }
Exemple #3
0
        private static void AddRegDescrDimLine(Complex c1, Complex c2, double k, string dimstyle)
        {
            var db = Application.DocumentManager.MdiActiveDocument.Database;

            using (var acTrans = db.TransactionManager.StartTransaction())
            {
                // Open the Block table for read
                var acBlkTbl = (BlockTable)acTrans.GetObject(db.BlockTableId, OpenMode.ForRead);

                // Open the Block table record Model space for write
                var acBlkTblRec = (BlockTableRecord)acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

                // Create the  dimension

                var qq = new Complex((c2 - c1) * Complex.polar(1.0, Math.PI / 2.0));
                qq /= qq.abs();
                qq *= k;
                qq += (c2 + c1) / 2.0;

                var acRotDim = new AlignedDimension();
                acRotDim.SetDatabaseDefaults();
                acRotDim.XLine1Point  = new Point3d(c1.real(), c1.imag(), 0);
                acRotDim.XLine2Point  = new Point3d(c2.real(), c2.imag(), 0);
                acRotDim.DimLinePoint = new Point3d(qq.real(), qq.imag(), 0);

                try
                {
                    // Open the DimStyle table for read
                    var acDimStyleTbl = (DimStyleTable)acTrans.GetObject(db.DimStyleTableId, OpenMode.ForRead);

                    var acDimStyleTblRec1 =
                        (DimStyleTableRecord)acTrans.GetObject(acDimStyleTbl[dimstyle], OpenMode.ForWrite);
                    acRotDim.SetDimstyleData(acDimStyleTblRec1);
                    acRotDim.DimensionStyle = acDimStyleTbl[dimstyle];
                }
                catch
                {
                    acRotDim.DimensionStyle = db.Dimstyle;
                }


                acRotDim.LayerId = DrawingHelper.LayerManipulator.CreateLayer("DIM", System.Drawing.Color.Red);

                // Add the new object to Model space and the transaction
                acBlkTblRec.AppendEntity(acRotDim);
                acTrans.AddNewlyCreatedDBObject(acRotDim, true);

                // Commit the changes and dispose of the transaction
                acTrans.Commit();
            }
        }
Exemple #4
0
        public static ObjectId AddDimAligned1(Point3d pt1, Point3d pt2, Point3d ptText, string text, ObjectId style)
        {
            AlignedDimension alignedDimension = new AlignedDimension();

            alignedDimension.SetDatabaseDefaults();
            alignedDimension.XLine1Point    = pt1;
            alignedDimension.XLine2Point    = pt2;
            alignedDimension.DimLinePoint   = ptText;
            alignedDimension.Dimlfac        = 1.0;
            alignedDimension.DimensionStyle = style;
            if (Operators.CompareString(text, "", false) != 0)
            {
                alignedDimension.DimensionText = text;
            }
            return(ModelSpace.AddEnt(alignedDimension));
        }
Exemple #5
0
            public EllipseJig(Point3d center, Vector3d vec) : base(new Ellipse())
            {
                mCenterPt      = center;
                mNormal        = vec;
                mRadiusRatio   = 0.00001;
                mPromptCounter = 0;

                m_dims = new DynamicDimensionDataCollection();
                Dimension dim1 = new AlignedDimension();

                dim1.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(dim1, true, true));

                Dimension dim2 = new AlignedDimension();

                dim2.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(dim2, true, true));
            }
Exemple #6
0
        private void UpdataDimension()
        {
            CylinderTunnel Tunnel = (CylinderTunnel)Entity;

            if (m_dims.Count <= mPromptCounter)
            {
                Dimension _dim = new AlignedDimension();
                _dim.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(_dim, true, true));
                _dim.DynamicDimension = true;
            }

            AlignedDimension dim = (AlignedDimension)m_dims[mPromptCounter].Dimension;

            dim.XLine1Point  = Tunnel.BasePoints[mPromptCounter];
            dim.XLine2Point  = mPoints[mPromptCounter + 1];
            dim.DimLinePoint = Tunnel.BasePoints[mPromptCounter];
        }
Exemple #7
0
        public TagJig(Point3d spt, Point3d ipt, Point3d ept) : base(new Tag())
        {
            mStartPt       = spt;
            mInflectionPt  = ipt;
            mEndPt         = ept;
            mPromptCounter = 0;

            m_dims = new DynamicDimensionDataCollection();
            Dimension dim1 = new AlignedDimension();

            dim1.SetDatabaseDefaults();
            m_dims.Add(new DynamicDimensionData(dim1, true, true));
            dim1.DynamicDimension = true;
            Dimension dim2 = new AlignedDimension();

            dim2.SetDatabaseDefaults();
            m_dims.Add(new DynamicDimensionData(dim2, true, true));
            dim2.DynamicDimension = true;
        }
        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);
        }
Exemple #9
0
        private static AlignedDimension AddDim(Complex c1, Complex c2, double k, string layer,
                                               System.Drawing.Color color, string dimstyle, Transaction acTrans)
        {
            var db = Application.DocumentManager.MdiActiveDocument.Database;
            // Open the Block table for read
            var acBlkTbl = (BlockTable)acTrans.GetObject(db.BlockTableId, OpenMode.ForRead);

            // Open the Block table record Model space for write
            var acBlkTblRec =
                (BlockTableRecord)acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

            var acLyrTbl = (LayerTable)acTrans.GetObject(db.LayerTableId, OpenMode.ForRead);


            // Create the  dimension

            var qq = new Complex((c2 - c1) * Complex.polar(1.0, Math.PI / 2.0));

            qq /= qq.abs();
            qq *= k;
            qq += (c2 + c1) / 2.0;

            var acRotDim = new AlignedDimension();

            acRotDim.SetDatabaseDefaults();
            acRotDim.XLine1Point  = new Point3d(c1.real(), c1.imag(), 0);
            acRotDim.XLine2Point  = new Point3d(c2.real(), c2.imag(), 0);
            acRotDim.DimLinePoint = new Point3d(qq.real(), qq.imag(), 0);
            try
            {
                if (layer.Contains("Current") && layer.Contains("Layer"))
                {
                    throw new ArgumentNullException();
                }
                acRotDim.Layer = layer;
            }
            catch
            {
                var acLyrTblRec = (LayerTableRecord)acTrans.GetObject(db.Clayer, OpenMode.ForWrite);
                acRotDim.Layer = acLyrTblRec.Name;
            }
            try
            {
                //MessageBox.Show("U2d Dim color =" + color.Name);
                if (color.Name.Contains("ByL"))
                {
                    throw new ArgumentNullException();
                }
                acRotDim.Color = Color.FromColor(color);
            }
            catch
            {
                try
                {
                    if (layer.Contains("Current") && layer.Contains("Layer"))
                    {
                        throw new ArgumentNullException();
                    }
                    var acLyrTblRec =
                        (LayerTableRecord)acTrans.GetObject(acLyrTbl[layer], OpenMode.ForWrite);
                    acRotDim.Color = acLyrTblRec.Color;
                }
                catch
                {
                    var acLyrTblRec = (LayerTableRecord)acTrans.GetObject(db.Clayer, OpenMode.ForWrite);
                    acRotDim.Color = acLyrTblRec.Color;
                }
            }

            try
            {
                // Open the DimStyle table for read
                var acDimStyleTbl     = (DimStyleTable)acTrans.GetObject(db.DimStyleTableId, OpenMode.ForRead);
                var acDimStyleTblRec1 =
                    (DimStyleTableRecord)acTrans.GetObject(acDimStyleTbl[dimstyle], OpenMode.ForWrite);
                acRotDim.SetDimstyleData(acDimStyleTblRec1);
            }
            catch
            {
                acRotDim.DimensionStyle = db.Dimstyle;
            }


            // Add the new object to Model space and the transaction
            acBlkTblRec.AppendEntity(acRotDim);
            acTrans.AddNewlyCreatedDBObject(acRotDim, true);

            return(acRotDim);
        }
            public EllipseJig(Point3d center,Vector3d vec)
                : base(new Ellipse())
            {
                mCenterPt = center;
                mNormal = vec;
                mRadiusRatio = 0.00001;
                mPromptCounter = 0;

                m_dims = new DynamicDimensionDataCollection();
                Dimension dim1 = new AlignedDimension();
                dim1.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(dim1,true,true));
                dim1.DynamicDimension = true;
                Dimension dim2 = new AlignedDimension();
                dim2.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(dim2,true,true));
                dim2.DynamicDimension = true;
            }