|
[code] static void MyGroupMyCommand() {
Put your command code here
AcArray< AcDbEntity *> crossCurvesArr;
AcArray< AcDbEntity *> guideCuvesArr;
AcDbEntity *pPathEntity = NULL;
AcDbLoftOptions loftOption;
double y = 0.0;
for (int i = 0; i < 300; i++)
{
y = i * 1.0;
AcDbLine *pLine1 = new AcDbLine(AcGePoint3d(0.0, y, 0.0), AcGePoint3d(0.0, y, 0.15));
AcDbLine *pLine2 = new AcDbLine(AcGePoint3d(0.0, y, 0.15), AcGePoint3d(0.03, y, 0.30));
AcDbLine *pLine3 = new AcDbLine(AcGePoint3d(0.03, y, 0.30), AcGePoint3d(0.18, y, 0.30));
AcDbLine *pLine4 = new AcDbLine(AcGePoint3d(0.18, y, 0.30), AcGePoint3d(0.18, y, 0.0));
AcDbLine *pLine5 = new AcDbLine(AcGePoint3d(0.18, y, 0.0), AcGePoint3d(0.0, y, 0.0));
AcDbVoidPtrArray curveArray1;
curveArray1.append(pLine1);
curveArray1.append(pLine2);
curveArray1.append(pLine3);
curveArray1.append(pLine4);
curveArray1.append(pLine5);
AcDbVoidPtrArray regArr1;
Acad::ErrorStatus aEs = AcDbRegion::createFromCurves(curveArray1, regArr1);
delete pLine1;
delete pLine2;
delete pLine3;
delete pLine4;
delete pLine5;
if (aEs !=Acad::eOk)
return;
AcDbRegion *pRegion1 = (AcDbRegion *)regArr1.at(0);
crossCurvesArr.append(pRegion1);
}
AcDb3dSolid *pLoftedSolid = new AcDb3dSolid;
Acad::ErrorStatus aEs = pLoftedSolid->createLoftedSolid(crossCurvesArr, guideCuvesArr, pPathEntity, loftOption);
if (aEs !=Acad::eOk) {
delete pLoftedSolid;
return;
}
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId objectId;
pBlockTableRecord->appendAcDbEntity(objectId, pLoftedSolid);
pBlockTableRecord->close();
pLoftedSolid->close();
}[/code] |
|