Hi Gat,
Here is a simplest example using createRevolvedSolid.
It creates a cylinder by revolving a line about the Z axis. Hope this provides you a starting point.
AcGePoint3d sp(10.0, 0.0, 0.0);
AcGePoint3d ep(10.0, 0.0, 10.0);
AcDbLine *pRevEnt = new AcDbLine(sp, ep);
Acad::ErrorStatus es;
AcDb3dSolid* pShapeSld = new AcDb3dSolid ();
AcDbRevolveOptions revolveOptions;
revolveOptions.setDraftAngle(0.0);
if((es = pShapeSld->createRevolvedSolid(
pRevEnt,
AcGePoint3d::kOrigin,
AcGeVector3d::kZAxis,
6.28318530718,
0.0,
revolveOptions
)) != Acad::eOk)
{
acutPrintf(L"\nSolid creation failed...\n");
delete pShapeSld;
return;
}
pShapeSld->setColorIndex(2);
AcDbObjectId id;
postToDb(pShapeSld, id);
Here is the postToDb method :
static Acad::ErrorStatus postToDb(AcDbEntity* ent, AcDbObjectId& objId)
{
Acad::ErrorStatus es;
AcDbBlockTable* pBlockTable;
AcDbBlockTableRecord* pSpaceRecord;
if ((es = acdbHostApplicationServices()->workingDatabase()->
getSymbolTable(pBlockTable, AcDb::kForRead))
!= Acad::eOk) {
return es;
}
if ((es = pBlockTable->getAt(ACDB_MODEL_SPACE,
pSpaceRecord,
AcDb::kForWrite)) != Acad::eOk) {
return es;
}
if ((es = pBlockTable->close()) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->appendAcDbEntity(objId, ent)) != Acad::eOk) {
return es;
}
if ((es = pSpaceRecord->close()) != Acad::eOk) {
return es;
}
return ent->close();
}
Balaji
Developer Technical Services
Autodesk Developer Network