Ejemplo n.º 1
0
        private List <_Db.Dimension> getAllDims()
        {
            List <_Db.Dimension> dims = new List <_Db.Dimension>();

            foreach (_Db.ObjectId btrId in _c.blockTable)
            {
                _Db.BlockTableRecord btr = _c.trans.GetObject(btrId, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

                if (!(btr.IsFromExternalReference))
                {
                    foreach (_Db.ObjectId bid in btr)
                    {
                        _Db.Entity currentEntity = _c.trans.GetObject(bid, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                        if (currentEntity == null)
                        {
                            continue;
                        }

                        if (currentEntity is _Db.Dimension)
                        {
                            _Db.Dimension dim = currentEntity as _Db.Dimension;
                            dims.Add(dim);
                        }
                    }
                }
            }

            return(dims);
        }
Ejemplo n.º 2
0
        private void getAllDims()
        {
            foreach (_Db.ObjectId btrId in _c.blockTable)
            {
                _Db.BlockTableRecord btr = _c.trans.GetObject(btrId, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

                if (!(btr.IsFromExternalReference))
                {
                    foreach (_Db.ObjectId bid in btr)
                    {
                        _Db.Entity currentEntity = _c.trans.GetObject(bid, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                        if (currentEntity == null)
                        {
                            continue;
                        }

                        if (currentEntity is _Db.Dimension)
                        {
                            _Db.Dimension dim = currentEntity as _Db.Dimension;
                            dims[dim] = btr;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void alfa(_Db.ObjectId id, ref List <_Db.Dimension> dims, ref List <_Db.BlockReference> blocks, ref List <_Db.MText> txts)
        {
            _Db.DBObject currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.DBObject;

            if (currentEntity == null)
            {
                return;
            }

            else if (currentEntity is _Db.BlockReference)
            {
                _Db.BlockReference blockRef = currentEntity as _Db.BlockReference;

                _Db.BlockTableRecord block = null;
                if (blockRef.IsDynamicBlock)
                {
                    block = _c.trans.GetObject(blockRef.DynamicBlockTableRecord, _Db.OpenMode.ForRead) as _Db.BlockTableRecord;
                }
                else
                {
                    block = _c.trans.GetObject(blockRef.BlockTableRecord, _Db.OpenMode.ForRead) as _Db.BlockTableRecord;
                }

                if (block != null)
                {
                    blocks.Add(blockRef);
                }
            }
            else if (currentEntity is _Db.Dimension)
            {
                _Db.Dimension dim = currentEntity as _Db.Dimension;
                dims.Add(dim);
            }
            else if (currentEntity is _Db.MText)
            {
                _Db.MText br = currentEntity as _Db.MText;
                txts.Add(br);
            }
            else if (currentEntity is _Db.DBText)
            {
                _Db.DBText br = currentEntity as _Db.DBText;

                _Db.MText myMtext = new _Db.MText();
                myMtext.Contents   = br.TextString;
                myMtext.Location   = br.Position;
                myMtext.TextHeight = br.Height;
                txts.Add(myMtext);
            }
            else if (currentEntity is _Db.MLeader)
            {
                _Db.MLeader br = currentEntity as _Db.MLeader;

                if (br.ContentType == _Db.ContentType.MTextContent)
                {
                    _Db.MText leaderText = br.MText;
                    txts.Add(leaderText);
                }
            }
        }
Ejemplo n.º 4
0
        private void logic()
        {
            List <_Db.Dimension> wrongDims = new List <_Db.Dimension>();
            Dictionary <_Ge.Point3d, _Db.Dimension> wrongPoints = new Dictionary <_Ge.Point3d, _Db.Dimension>();

            foreach (_Db.Dimension dim in dims.Keys)
            {
                _Db.BlockTableRecord btr    = dims[dim];
                List <_Ge.Point3d>   points = getBlockTableRecordPoints(btr);

                if (dim is _Db.RotatedDimension)
                {
                    _Db.RotatedDimension rdim = dim as _Db.RotatedDimension;
                    _Ge.Point3d          p1   = rdim.XLine1Point;
                    _Ge.Point3d          p2   = rdim.XLine2Point;

                    bool pp1 = matchPoints(p1, points);
                    bool pp2 = matchPoints(p2, points);

                    if (pp1 == false)
                    {
                        wrongPoints[p1] = dim;
                        if (!wrongDims.Contains(dim))
                        {
                            wrongDims.Add(dim);
                        }
                    }
                    if (pp2 == false)
                    {
                        wrongPoints[p2] = dim;
                        if (!wrongDims.Contains(dim))
                        {
                            wrongDims.Add(dim);
                        }
                    }
                }
            }

            write("Vigade arv: " + wrongDims.Count().ToString());

            if (wrongDims.Count > 0)
            {
                initLayer(kontrollLayer);
            }

            foreach (_Db.Dimension dim in wrongDims)
            {
                changeFillColor(dim, 1);
            }

            foreach (_Ge.Point3d pt in wrongPoints.Keys)
            {
                _Db.Dimension dim = wrongPoints[pt];

                createCircle(100, 1, pt, dims[dim]);
                createCircle(750, 1, pt, dims[dim]);
            }
        }
Ejemplo n.º 5
0
 private void changeFillColor(_Db.Dimension dim, short index)
 {
     dim.Dimtfill    = 2;
     dim.Dimtfillclr = _Cm.Color.FromColorIndex(_Cm.ColorMethod.None, index);
 }