【思路】首先导入系统默认块,打开DIMSAH开关,设置DIMBLK1为“_NONE”。

[CommandMethod("LSRADIALDIMSTYLE")]
public void LSRADIALDIMSTYLE()
{
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);//块表
DimStyleTable dst = (DimStyleTable)db.DimStyleTableId.GetObject(OpenMode.ForRead); //标注样式表
DimStyleTableRecord dstr = new DimStyleTableRecord();//标注样式记录
dstr.Name = "我的标注样式";//记录名
dst.UpgradeOpen(); //获取表修改权限
dst.Add(dstr);//把记录添加到表里
db.TransactionManager.AddNewlyCreatedDBObject(dstr, true);//加载到事务处理
dst.DowngradeOpen();
dstr.UpgradeOpen();//获取记录修改权限
Application.SetSystemVariable("DIMSAH", 1);
Application.SetSystemVariable("Dimblk1", "_NONE");
Application.SetSystemVariable("Dimblk2", "");
dstr.Dimsah = true;
ObjectId arrId = ObjectId.Null;//存储箭头符号的ObjectId
if (bt.Has("_NONE")) arrId = bt["_NONE"];//搜索箭头Id
dstr.Dimblk1 = arrId;
dstr.UpgradeOpen();
trans.Commit();
}
}
本文介绍如何通过C#编程在AutoCAD中创建自定义径向尺寸标注样式。主要步骤包括:设置DIMSAH系统变量,定义新的标注样式记录,并指定默认箭头样式为_NONE。此方法适用于需要定制化标注显示的应用场景。
1429

被折叠的 条评论
为什么被折叠?



