c++偏移块内曲线
static AcDbObjectIdOffsetEnty(AcDbObjectId idBlock, AcDbObjectId entId, double OfsValue){
AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
AcDbEntity* pEnt;
AcDbCurve* pCurv;
AcDbVoidPtrArray offCurvs;
AcDbBlockTableRecord* pBlkTableRecord;
Acad::ErrorStatus es;
AcDbObjectId objctid;
es = acdbOpenObject(pEnt, entId, AcDb::kForRead);
if ((pCurv = AcDbCurve::cast(pEnt)) == NULL) {
pEnt->close();
return NULL;
}
es = pCurv->getOffsetCurves(OfsValue, offCurvs);
if (es != Acad::eOk) {
pEnt->close();
return AcDbObjectId::kNull;
}
pEnt->close();
if ((es = acdbOpenObject(pBlkTableRecord, idBlock, AcDb::kForWrite)) == Acad::eOk)
{
for (int i = 0; i < offCurvs.length(); i++) {
pEnt = (AcDbEntity*)offCurvs.at(i);
es = pBlkTableRecord->appendAcDbEntity(objctid, pEnt);
if (es)
delete pEnt;
else
pEnt->close();
}
pBlkTableRecord->close();
}
return objctid;
}
页:
[1]