[每日一码] HATCH添加LOOP环代码
void AddLoopsToHatches(std::map<AcDbObjectId, AcDbObjectIdArray> &mapHatchToText){
Acad::ErrorStatus es;
std::map<AcDbObjectId, AcDbObjectIdArray>::const采用iterator iter;
AcDbHatch *pHatch = 0;
AcDbEntity *pTextBound = 0;
for (iter = mapHatchToText.begin(); iter != mapHatchToText.end(); iter++)
{
AcDbObjectId objIdHatch = iter->first;
if ((es = acdbOpenObject(pHatch, objIdHatch, AcDb::kForWrite)) == Acad::eOk)
{
// es = pHatch->setAssociative(true); //caused "solid-black-effect" here!!
const AcDbObjectIdArray &idArr = iter->second;
int iOb = 0;
for (iOb = idArr.length() - 1; iOb >= 0; iOb--)
{
AcDbObjectIdArray idLoops;
idLoops.append(idArr);
es = pHatch->appendLoop(AcDbHatch::kDefault, idLoops);
}
es = pHatch->setAssociative(true); //No "solid-black-effect" here.
es = pHatch->evaluateHatch();
pHatch->close();
}
}
}
页:
[1]