Message 1 of 1
How to rename the dynamic block name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I would like to know how to change the dynamic block name.
The below code is good for static block but for the dynamic block, it does not work as i expected.
Please, give me a clue or solution to get dynamic block name changed.
- [CommandMethod("RENBLK")]
- public void Test()
- {
- Document doc = AcAp.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = doc.Editor;
- using (Transaction tr = db.TransactionManager.StartTransaction())
- {
- BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
- if (bt.Has("BAT-10"))
- {
- BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt["BAT-10"], OpenMode.ForWrite);
- btr.Name = "VUU-10";
- }
- tr.Commit();
- }
- }