- UID
- 155830
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-7-9
- 最后登录
- 1970-1-1
|
发表于 2006-3-13 21:32:00
|
显示全部楼层
AcDbCircle *OCircle = new AcDbCircle(AcGePoint3d(0,0,0),AcGeVector3d(1,0,0),80);
AcDbVoidPtrArray OArr,OgnArr;
OArr.append(OCircle);
OgnArr.setPhysicalLength(1);
Acad::ErrorStatus eError = AcDbRegion::createFromCurves(OArr,OgnArr);
AcDbRegion *oRegion=AcDbRegion::cast((AcRxObject*)OgnArr[0]);
AcDbLine *line = new AcDbLine(AcGePoint3d(0,0,0),AcGePoint3d(100,0,0));
AcDbObjectId id_line;
postToDatabase1(line,id_line);
AcDb3dSolid *OSolid = new AcDb3dSolid();
AcDbObjectId OSolidId;
eError=OSolid->extrudeAlongPath(oRegion,line);
postToDatabase1(OSolid,OSolidId);
AcDbEntity* pEntity = NULL;
Acad::ErrorStatus err = acdbOpenObject(pEntity, id_line, AcDb::kForWrite);
pEntity->erase();
pEntity->close();
delete OCircle;
Acad::ErrorStatus
postToDatabase1(/*[in]*/AcDbEntity* pEnt,/*[out]*/AcDbObjectId& idObj)
//Purpose:
// Adds an entity to the MODEL_SPACE of the CURRENT database.
//Note:
// It could be generalized to add it to any block table record of
// any database, but why complicate it...
//
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
if (acdbHostApplicationServices()->workingDatabase()==NULL)
return Acad::eNoDatabase;
//Get a pointer to the current drawing
//and get the drawing's block table. Open it for read.
if ((es = acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead))==Acad::eOk){
//Get the Model Space record and open it for write. This will be the owner of the new line.
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite))==Acad::eOk){
//Append pEnt to Model Space, then close it and the Model Space record.
if ((es = pSpaceRecord->appendAcDbEntity(idObj, pEnt))==Acad::eOk)
pEnt->close();
pSpaceRecord->close();
}
pBlockTable->close();
}
//it is good programming practice to return an error status
return es;
} |
|