ObjectARX, AutoCAD. Среда программирования библиотеки C++




Пример вложенных транзакций - часть 4


mat.setCoordSystem(moveBy, x, y, z);

pOtherHalf->transformBy(mat);

AcDbObjectId otherHalfId;

addToDb(pOtherHalf, otherHalfId);

actrTransactionManager->addNewlyCreatedDBRObject(pOtherHalf);

pOtherHalf->draw();

pExtrusion->draw();

acutPrintf("\nSliced the resulting solid into half"

" and moved one piece.");

// Now abort transaction three, to return to the hole in

// the extrusion.

//

Adesk::Boolean yes = Adesk::kTrue;

if (getYOrN("\nLet’s abort transaction three, yes?"

" [Y] : ", Adesk::kTrue, yes,interrupted) == Acad::eOk

&& yes == Adesk::kTrue)

{

acutPrintf("\n\n$$$$$$ Aborting transaction"

" three. $$$$$$\n");

actrTransactionManager->abortTransaction();

acutPrintf("\nBack to the un-sliced solid.");

pExtrusion->draw();

char option[256];

acedGetKword("\nHit any key to continue.", option);

} else {

acutPrintf("\n\n>>>>>> Ending transaction three."

" <<<<<<\n");

actrTransactionManager->endTransaction();

}

// Start another transaction (three again). This time,

// slice the solid along a plane that is perpendicular

// to the plane we used last time: that is the slice

// we really wanted.

//

pTrans = actrTransactionManager->startTransaction();

assert(pTrans != NULL);

acutPrintf("\n\n##### Started transaction three."

" ######\n");

moveBy.set(normal[0] * 3.0, normal[1] * 3.0,

normal[2] * 3.0);

normal = vec;

normal.normalize();

sectionPlane.set(center, normal);

pOtherHalf = NULL;

pExtrusion->getSlice(sectionPlane, Adesk::kTrue,

pOtherHalf);

assert(pOtherHalf != NULL);

mat.setCoordSystem(moveBy, x, y, z);

pOtherHalf->transformBy(mat);

addToDb(pOtherHalf, otherHalfId);

actrTransactionManager

->addNewlyCreatedDBRObject(pOtherHalf);

pOtherHalf->draw();

pExtrusion->draw();

acutPrintf("\nSliced the resulting solid into half"




Содержание  Назад  Вперед