使用ObjectARX事务功能做小动画处理
使用ObjectARX事务功能做小动画处理,可以用于几何算法调试等void CmdFun::Test()
{
if (true)
{
ads采用point pt;
ads采用name en;
if (RTNORM != acedEntSel(采用T("\n选中对象 : "), en, pt))
return;
AcDbObjectId id;
if (Acad::eOk != acdbGetObjectId(id, en))
return;
AcTransaction* pTransaction = actrTransactionManager->startTransaction();
do
{
AcDbEntity* pEnt = NULL;
actrTransactionManager->getObject((AcDbObject*&)pEnt, id, AcDb::kForWrite);
AcDbPolyline* poly = NULL;
AcGePoint2d ptStart;
if (pEnt->isKindOf(AcDbPolyline::desc()))
{
poly = AcDbPolyline::cast(pEnt);
poly->getPointAt(0, ptStart);
unsigned int vertexCount = poly->numVerts();
for (unsigned int i = 0; i < vertexCount; i++)
{
poly->removeVertexAt(i);
}
}
else
{
break;
}
poly->addVertexAt(0, ptStart);
poly->addVertexAt(1, ptStart);
poly->setWidthsAt(0, 100.0, 100.0);
for (size采用t i = 0; i < 1000; i++)
{
AcGePoint2d ptEnd = ptStart + AcGeVector2d::kXAxis * i * 10.0;
poly->setPointAt(1, ptEnd);
poly->setColorIndex(i % 256);
Sleep(1);
poly->draw();
acedUpdateDisplay();
}
} while (0);
actrTransactionManager->abortTransaction();
return;
}
}
页:
[1]