本人想做一个CAD填充的程序,比较复杂,
希望可以对不同的图层\线型填充不同的STYLE,想做成自动遍历多个DWG的
希望朋友指点,希望有兴趣的朋友来讨论下,或留qq
如有需要,本人以RMB酬谢(想做个复杂点的)
这是个屏选的,随便写的
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(); }
在选择多个实体填充的时候还有问题,百思不得其解 |