[每日一码] 插入外部参照的代码
void AttachXref(CString xrefpath){
ACHAR* xrefname = NULL;
acedXrefCreateBlockname(xrefpath,xrefname);//创建附着文件的块引用名
assert(xrefname);
if(!xrefname) return;
CString strName = xrefname;
acutDelString(xrefname);
xrefname = NULL;
AcDbObjectId xrefBTRid = AcDbObjectId::kNull;
AcDbObjectId xrefRefid = AcDbObjectId::kNull;
Acad::ErrorStatus es = acedXrefAttach(xrefpath,strName,&xrefBTRid,&xrefRefid);
//参数:(附着文件路径,<系统分配的>块引用名,<OUT>块表记录ID,<OUT>引用ID,插入点,比例因子,旋转角)
assert(Acad::eOk==es);
if(Acad::eOk!=es) return;
AcDbEntity *pEntXref = NULL;
es = acdbOpenAcDbEntity(pEntXref, xrefRefid, AcDb::kForWrite);
assert(Acad::eOk==es);
if(Acad::eOk!=es) return;
es = pEntXref->setLayer(采用T("0"));// 值参照图与层
assert(Acad::eOk==es);
es = pEntXref->close();
if(Acad::eOk!=es) return;
return;
}
页:
[1]