实现代码:
static void qxzyAddDimStyle_AddDimStyle(void) { ACHAR styleName[50]; if(acedGetString(Adesk::kFalse, _T("请输入样式名称:"), styleName) != RTNORM) { return; } AcDbDimStyleTable *pDimStyleTbl; acdbHostApplicationServices()->workingDatabase() ->getDimStyleTable(pDimStyleTbl, AcDb::kForWrite); if(pDimStyleTbl->has(styleName)) { pDimStyleTbl->close(); return; } AcDbDimStyleTableRecord *pDimStyleTblRcd; pDimStyleTblRcd = new AcDbDimStyleTableRecord(); pDimStyleTblRcd->setName(styleName);//样式名称 pDimStyleTblRcd->setDimasz(3);//箭头长度 pDimStyleTblRcd->setDimexe(3);//尺寸界线与标注 pDimStyleTblRcd->setDimtad(1);//文字位于标注线的上方 pDimStyleTblRcd->setDimtxt(3);//标注文字的高度 pDimStyleTbl->add(pDimStyleTblRcd); pDimStyleTblRcd->close(); pDimStyleTbl->close(); }
加载生成的arx文件,输入命令AddDimStyle,输入想要创建的样式名,选择“格式|标注样式”可以看到如下结果:
转载:http://blog.csdn.net/foreverling/article/details/28268811