高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】vectorization Control With Odvectorizee
vectorization control with odvectorizeex
vectorization control with odvectorizeex
hi!
i have an app that needs random-access deterministic chunks of autocad vector data as input. phase 1 was a text only version and i accomplished that by choosing entities as a boundary and maintaining 2 counts - one each associated with the layout iterator and the underlying entity interator. i could then traverse to the correct starting point each time based upon the 2 stored values. this approach could be expanded for full vectorization using worlddraw( ) and viewportdraw( ) however from reading previous threads it appears that the vectorization pipeline approach of odvectorizeex would simplify things.
the problem i have is i need the ability to pause and resume the vectorization process at stored points. access to the underlying entity iterator would accomplish that, however short of trying to manipulate sortents and completely restart each time i don't see how to do that. is there a way that i am missing? i have access to the oda source code also if there exists a concise modification.
i also tried iterating the entities and calling dodraw( ) for each, but paperspace viewport entities (of the model space) have an unknown exception. this worked for model and paperspace layout entities that weren't viewport.
i tried 2 approaches, one that used
exsimpleview* pview = (exsimpleview*)pdevice->viewat(0);
and one that used
exsimpleview* pview = (exsimpleview*)((sppaperhelper->overallview()).detach());
the 1st had a problem that the paperspace layout with the model viewport returned 2 views, not 1, neither of which worked.
pdevice->numviews();
the 2nd approach threw an unknown exception in gilinetyper.cpp here:
odgidrawableptr pdrawable = drawcontext()->gicontext().opendrawable(id);
i had a problem with drawableflags also, since i am calling that directly so i chose '1' since that was what odvectorizeex showed in the debugger.
code:
if (!pdb.isnull())
{
odgicontextfordbdatabaseptr pdwgcontext = odgicontextfordbdatabase::createobject();
odgsdeviceptr pdevice = exgssimpledevice::createobject(output, exgssimpledevice::k3ddevice);
pdwgcontext->setdatabase(pdb);
odgslayouthelperptr splayouthelper =
oddbgsmanager::setupactivelayoutviews(pdevice, pdwgcontext);
nv = pdevice->numviews();
// 1st approach
//exsimpleview* pview = (exsimpleview*)pdevice->viewat(1);
// 2nd approach
// get the paper layout for overall view
odgspaperlayouthelperptr sppaperhelper =
odgspaperlayouthelper::cast( splayouthelper );
exsimpleview* pview = (exsimpleview*)((sppaperhelper->overallview()).detach());
oduint32 drawableflags = 1;
odgsdcrect screenrect(odgsdcpoint(0, 0), odgsdcpoint(1000, 1000));
pdevice->onsize(screenrect);
// open the block from the db
oddbblocktablerecordptr spblock = pdb->getactivelayoutbtrid().safeopenobject();
// get an entity iterator
oddbobjectiteratorptr spentiter = spblock->newiterator();
spentiter->start();
while( true != spentiter->done() )
{
oddbentityptr spent = spentiter->objectid().safeopenobject();
odstring tmp = spent->isa()->name();
pview->dodraw(drawableflags,spent);
spentiter->step();
}
ugh. ok, thanks for reading all that. please advise on a simple approach for interruptability/resume of the vectorization pipeline or how to get past that exception for my single entity iterator approach.
many thanks!
|