Example #1
0
        private List <_Db.RotatedDimension> getAllDims()
        {
            List <_Db.RotatedDimension> dims = new List <_Db.RotatedDimension>();

            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.RotatedDimension)
                        {
                            _Db.RotatedDimension dim = currentEntity as _Db.RotatedDimension;
                            dims.Add(dim);
                        }
                    }
                }
            }

            return(dims);
        }
Example #2
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]);
            }
        }
Example #3
0
        private void insertDimLine(_Ge.Point3d ptStart, _Ge.Point3d ptEnd, _Ge.Point3d ptPos, double rotation)
        {
            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

            using (_Db.RotatedDimension rotDim = new _Db.RotatedDimension())
            {
                rotDim.XLine1Point    = ptStart;
                rotDim.XLine2Point    = ptEnd;
                rotDim.Rotation       = rotation;
                rotDim.DimLinePoint   = ptPos;
                rotDim.DimensionStyle = _c.db.Dimstyle;

                btr.AppendEntity(rotDim);
                _c.trans.AddNewlyCreatedDBObject(rotDim, true);
            }
        }
Example #4
0
        private List <_Db.RotatedDimension> getDimsInArea(_Area_v2 area, List <_Db.RotatedDimension> allDims)
        {
            List <_Db.RotatedDimension> dims = new List <_Db.RotatedDimension>();

            for (int i = allDims.Count - 1; i >= 0; i--)
            {
                _Db.RotatedDimension dim = allDims[i];
                _Ge.Point3d          p1  = dim.XLine1Point;

                if (area.isPointInArea(p1))
                {
                    dims.Add(dim);
                    allDims.RemoveAt(i);
                }
            }

            return(dims);
        }