请 王咣生斑竹 解惑!
void Myfa() { ads_name ents,ent; AcDbObjectId objId; AcDbEntity* pEnt=NULL; AcDbObjectIdArray dbObjIds; acedSSGet(NULL,NULL,NULL,NULL,ents); long len; acedSSLength(ents,&len);
AcDbHatch* pHatch = new AcDbHatch(); for(long i=0;i<len;i++){ acedSSName(ents,i,ent); acdbGetObjectId(objId, ent); dbObjIds.append(objId); } acedSSFree(ent); acedSSFree(ents);
AcGeVector3d normal(0.0, 0.0, 1.0); pHatch->setNormal(normal); pHatch->setElevation(0.0); pHatch->setColorIndex(3); pHatch->setPatternScale(2); pHatch->setPatternAngle(0.0); pHatch->setPattern(AcDbHatch::kPreDefined, "ANSI31"); pHatch->setHatchStyle(AcDbHatch::kNormal); pHatch->appendLoop(AcDbHatch::kExternal, dbObjIds); pHatch->draw(); //更新实体 pHatch->recordGraphicsModified(Adesk::kTrue); // Set Associativity // pHatch->setAssociative(Adesk::kFalse); pHatch->evaluateHatch(); acedUpdateDisplay();
AcDbBlockTable *pBlockTable=NULL; AcDbBlockTableRecord *pBlockTableRecord; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pBlockTable, AcDb::kForRead);
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite); pBlockTable->close();
AcDbObjectId HatchId; pBlockTableRecord->appendAcDbEntity(HatchId, pHatch); pBlockTableRecord->close(); pHatch->close(); }
在选择多个实体填充的时候还有问题,百思不得其解 |