用arx创建尺寸
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
AcDbDatabase *pcurdb=acdbHostApplicationServices()->workingDatabase();
AcDbDimStyleTable *pnewdimtable;
pcurdb->getSymbolTable(pnewdimtable,AcDb::kForWrite);
AcDbDimStyleTableRecord *pnewdimrecord=new AcDbDimStyleTableRecord();
pnewdimrecord->setDimasz(20);//设置箭头大小
pnewdimrecord->setDimzin(8);//十进制小数显示时,抑制后续零
pnewdimrecord->setDimexe(30);//设置尺寸界线超出尺寸线距离为
pnewdimrecord->setDimexo(0);//设置尺寸界线的起点偏移量为
pnewdimrecord->setDimtxt(30);//设置文字高度
pnewdimrecord->setDimtad(1);//设置文字位置-垂直为上方,水平默认为居中,不用设置
pnewdimrecord->setDimgap(10);//设置文字位置-从尺寸线的偏移量
pnewdimrecord->setDimtih(0);
pnewdimrecord->setDimtix(1);//设置标注文字始终绘制在尺寸界线之间
pnewdimrecord->setDimtofl(1);//即使箭头放置于测量点之外,尺寸线也将绘制在测量点之间// pnewdimrecord->setDimgap(0.5);
/*color.setColorIndex(iDimColor);
pnewdimrecord->setDimclrd(color); //尺寸线颜色
pnewdimrecord->setDimclre(color); //尺寸边界线颜色
color.setColorIndex(iTextColor);
pnewdimrecord->setDimclrt(color); //文字颜色*/
AcDbObjectId dimrecordid;
pnewdimtable->add(dimrecordid,pnewdimrecord);
pnewdimtable->close();
pnewdimrecord->close();
AcGePoint3d Pt1(0,0,0);
AcGePoint3d Pt2(20,0,0);
AcGePoint3d Pt3(0,20,0);
AcDbBlockTable *pBlockTable;//定义块表指针
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
AcDbAlignedDimension *pDim1 = new AcDbAlignedDimension(Pt1, Pt2,Pt3,NULL,dimrecordid);
AcDbObjectId Id;
pBlockTableRecord->appendAcDbEntity(Id, pDim1);
pBlockTableRecord->close(); pDim1->close();。