设置标注样式,这里就不再废话了,网上一大堆教程,你也可以参考CAD开发手册
这里只讲述将标注样式置为当前的办法,因为当前能在网上找到的置前方法,只能将我们新建的标注样式,加入到数据库中,但不能置前
1、先取得新建标注样式块表记录的 Id
AcDbObjectId DimStyleId;
pDimStyleTab->add(DimStyleId, pDimStyleTabRec);
2、复制标注样式数据,到当前数据库中。这一步很重要,如果直接调用 setDimstyle() 函数,咋们自己创建的标注样式,会加载到数据库中,但是置为当前的,是新建标注样式的替代样式,并且这个替代样式,并不是咋们新建的标注样式
AcDbDatabase* pDataBase = acdbHostApplicationServices()->workingDatabase();
Acad::ErrorStatus es = Acad::eOk;
es = pDataBase->setDimstyleData(pDimStyleTabRec);
3、设置标注样式。此时就需要之前取得的,新建标注样式块表记录的 Id
es = pDataBase->setDimstyle(DimStyleId);
4、点赞收藏
若有错误、遗漏,请评论区指正