- 积分
- 457
- 明经币
- 个
- 注册时间
- 2004-5-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我是一个初学者,请各位帮我看一下,下面是画一个园,然后填充,程序编译通过,但运行时没有填充出来。
void test() { ads_point pt1; if(ads_getpoint(NULL,"\n请输入插入点:",pt1)!=RTNORM) return;
AcGePoint3d basePoint(pt1[0],pt1[1],pt1[2]); AcDbCircle *pCircle=new AcDbCircle; pCircle->setCenter(basePoint); pCircle->setRadius(1.5); pCircle->setColorIndex(1);
AcDbHatch* pHatch = new AcDbHatch(); AcGeVector3d normal(0.0, 0.0, 1.0); pHatch->setNormal(normal); pHatch->setElevation(0.0); pHatch->setAssociative(Adesk::kTrue); pHatch->setPattern(AcDbHatch::kPreDefined, "SOLID"); pHatch->setHatchStyle(AcDbHatch::kNormal);
AcDbBlockTable *pBlockTable; acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead); AcDbBlockTableRecord *pBlockTableRecord; pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite); pBlockTable->close(); AcDbObjectId circleId; AcDbObjectId hatchId;
AcDbObjectIdArray dbObjIds;
pBlockTableRecord->appendAcDbEntity(circleId,pCircle); dbObjIds.setLogicalLength(0); dbObjIds.append(circleId); pHatch->appendLoop(AcDbHatch::kDefault, dbObjIds); pHatch->evaluateHatch();
dbObjIds.setLogicalLength(0); pHatch->getAssocObjIds(dbObjIds); pBlockTableRecord->appendAcDbEntity(hatchId,pHatch);
pBlockTableRecord->close();
AcDbEntity *pEnt; int numObjs = dbObjIds.length(); Acad::ErrorStatus es; int i; for (i = 0; i < numObjs; i++) { es = acdbOpenAcDbEntity(pEnt, dbObjIds, AcDb::kForWrite); if (es == Acad::eOk) { pEnt->addPersistentReactor(hatchId); pEnt->close(); } }
pCircle->close(); pHatch->close();
} |
|