示例#1
0
        private void insertReinforcmentMark(string mark, G.Point IP)
        {
            string layerName = "K023TL";
            string styleName = "dmt_M" + (int)Math.Round(L._V_.Z_DRAWING_SCALE);

            textStyleHandler();
            blockHandler();
            leaderStyleHandler(styleName, (int)Math.Round(L._V_.Z_DRAWING_SCALE));

            _Db.DBDictionary mleaderStyleTable = _c.trans.GetObject(_c.db.MLeaderStyleDictionaryId, _Db.OpenMode.ForWrite) as _Db.DBDictionary;

            _Ge.Point3d insertPointLeader = new _Ge.Point3d(IP.X, IP.Y, 0);
            _Ge.Point3d insertPointText   = new _Ge.Point3d(IP.X + 7.5 * L._V_.Z_DRAWING_SCALE, IP.Y + 7.5 * L._V_.Z_DRAWING_SCALE, 0);

            _Db.MText mText = new _Db.MText();
            mText.SetDatabaseDefaults();
            mText.Contents = mark;

            _Db.MLeader leader = new _Db.MLeader();
            leader.SetDatabaseDefaults();
            leader.ContentType = _Db.ContentType.MTextContent;
            leader.MText       = mText;
            leader.AddLeaderLine(insertPointLeader);
            leader.TextLocation = insertPointText;
            leader.MLeaderStyle = mleaderStyleTable.GetAt(styleName);

            leader.Layer = layerName;

            _c.modelSpace.AppendEntity(leader);
            _c.trans.AddNewlyCreatedDBObject(leader, true);
        }
示例#2
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);
                }
            }
        }
示例#3
0
        private List <_Db.MText> getAllText(string layer)
        {
            List <_Db.MText> txt = new List <_Db.MText>();

            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

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

                if (currentEntity != null)
                {
                    if (currentEntity is _Db.MText)
                    {
                        _Db.MText br = currentEntity as _Db.MText;
                        if (br.Layer == layer)
                        {
                            txt.Add(br);
                        }
                    }

                    if (currentEntity is _Db.DBText)
                    {
                        _Db.DBText br = currentEntity as _Db.DBText;
                        if (br.Layer == layer)
                        {
                            _Db.MText myMtext = new _Db.MText();
                            myMtext.Contents = br.TextString;
                            myMtext.Location = br.Position;
                            txt.Add(myMtext);
                        }
                    }

                    if (currentEntity is _Db.MLeader)
                    {
                        _Db.MLeader br = currentEntity as _Db.MLeader;
                        if (br.Layer == layer)
                        {
                            if (br.ContentType == _Db.ContentType.MTextContent)
                            {
                                _Db.MText leaderText = br.MText;
                                txt.Add(leaderText);
                            }
                        }
                    }
                }
            }

            return(txt);
        }
示例#4
0
        private List <_Db.MText> getSelectedText()
        {
            List <_Db.MText> txt = new List <_Db.MText>();

            _Ed.PromptSelectionResult selection = _c.ed.GetSelection();
            if (selection.Status == _Ed.PromptStatus.OK)
            {
                _Db.ObjectId[] objIds = selection.Value.GetObjectIds();

                foreach (_Db.ObjectId objId in objIds)
                {
                    _Db.Entity currentEntity = _c.trans.GetObject(objId, _Db.OpenMode.ForRead) as _Db.Entity;

                    if (currentEntity == null)
                    {
                        continue;
                    }

                    if (currentEntity is _Db.MText)
                    {
                        _Db.MText br = currentEntity as _Db.MText;
                        txt.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.Layer    = br.Layer;
                        myMtext.Location = br.Position;
                        txt.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;
                            leaderText.Layer = br.Layer;
                            txt.Add(leaderText);
                        }
                    }
                }
            }

            return(txt);
        }
示例#5
0
        private List <_Db.MText> getAllText(string layer)
        {
            List <_Db.MText> txts = new List <_Db.MText>();

            foreach (_Db.ObjectId id in _c.modelSpace)
            {
                _Db.Entity currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                if (currentEntity == null)
                {
                    continue;
                }

                if (currentEntity is _Db.MText)
                {
                    _Db.MText mtxt = currentEntity as _Db.MText;

                    if (mtxt.Layer == layer)
                    {
                        txts.Add(mtxt);
                    }
                }
                else if (currentEntity is _Db.DBText)
                {
                    _Db.DBText dbt = currentEntity as _Db.DBText;
                    if (dbt.Layer == layer)
                    {
                        _Db.MText mtxt = new _Db.MText();
                        mtxt.Contents = dbt.TextString;
                        mtxt.Location = dbt.Position;
                        txts.Add(mtxt);
                    }
                }
                else if (currentEntity is _Db.MLeader)
                {
                    _Db.MLeader ml = currentEntity as _Db.MLeader;
                    if (ml.Layer == layer)
                    {
                        if (ml.ContentType == _Db.ContentType.MTextContent)
                        {
                            _Db.MText mtxt = ml.MText;
                            txts.Add(mtxt);
                        }
                    }
                }
            }

            return(txts);
        }