明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2144|回复: 4

如何更改当前标注样式中的文字样式而不生成标注样式替代.

  [复制链接]
发表于 2011-12-18 19:23 | 显示全部楼层 |阅读模式
1.如何更改当前标注样式中的文字样式而不生成标注样式替代.
2.如何删除已有的标注样式替代.

该贴已经同步到 namezg的微博
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2011-12-18 19:31 | 显示全部楼层
1.(command "_.DIMSTYLE" "_SAVE")
2.标注样式替代是因为相关系统变量被修改但又为保存到当前样式,当当前样式被修改即不现实样式替代,无需删除也无法删除
发表于 2011-12-18 19:37 | 显示全部楼层
标注样式替代是作为扩展数据写入标注图元的,应该可以通过删除图元扩展数据恢复成默认的标注样式。
发表于 2018-1-19 15:30 | 显示全部楼层
第一个问题
public static void SetDimStyleCurrent(string DimStyleName)  
{  
    // Establish connections to the document and its database  
    Document doc = Application.DocumentManager.MdiActiveDocument;  
    Database db = doc.Database;  
  
    // Establish a transaction  
    using (Transaction tr = doc.TransactionManager.StartTransaction())  
    {  
        DimStyleTable dst = (DimStyleTable)tr.GetObject(db.DimStyleTableId, OpenMode.ForRead);  
        ObjectId dimId = ObjectId.Null;  
  
        string message = string.Empty;  
        if (!dst.Has(DimStyleName))  
        {  
            CreateModifyDimStyle(DimStyleName, out message);  
            dimId = dst[DimStyleName];  
        }  
        else  
            dimId = dst[DimStyleName];  
  
        DimStyleTableRecord dstr = (DimStyleTableRecord)tr.GetObject(dimId, OpenMode.ForRead);  
  
        /* NOTE:
         * If this code is used, and the updated style is current,
         * an override is created for that style.
         * This is not what I wanted.
         */  
        //if (dstr.ObjectId != db.Dimstyle)  
        //{  
        //    db.Dimstyle = dstr.ObjectId;  
        //    db.SetDimstyleData(dstr);  
        //}  
  
        /* Simply by running these two lines all the time, any overrides to updated dimstyles get  
         * cleared away as happens when you select the parent dimstyle in AutoCAD.
         */  
        db.Dimstyle = dstr.ObjectId;  
        db.SetDimstyleData(dstr);  
  
        tr.Commit();  
    }  
}

关键在于
db.Dimstyle = dstr.ObjectId;  
db.SetDimstyleData(dstr);  
要两句一起用,我之前也是只用一句,总是有个替代
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-28 19:34 , Processed in 0.228469 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表