几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】incomplete acis convertion in odamfcapp (http://www.dimcax.com/hust/showthread.php?t=16862)

yang686526 2009-05-06 03:47 PM

【转帖】incomplete acis convertion in odamfcapp
 
incomplete acis convertion in odamfcapp
incomplete acis convertion in odamfcapp
try this :
build a dwg with a 3dsolid in the model space bloc, and put another 3dsolid in a new bloc (foo for example). the tree in odamfcapp should looks like that :
db
|-blocktable
...|-foo
......|-3dsolid
...|-modelspace
......|-3dsolid
code:
oddbblocktablerecordptr pms = pdb->getmodelspaceid().openobject();this line explicitly show that only modelspace is decomposed. the 3dsolid into foo will still be here.
i tried to process the whole block table with this code
code:
oddbblocktableptr pbtp = pdb->getblocktableid().openobject();
oddbsymboltableiteratorptr pstiter = pbtp->newiterator();
while(!pstiter->done())
{
oddbblocktablerecordptr pms = (oddbblocktablerecordptr) pstiter->getrecord();
oddbobjectiteratorptr pentiter = pms->newiterator();
while(!pentiter->done())
...original code...but it seems to loop.
do i miss something ?
hi,
please, publish the full code.
hi,
just replace the original function with this code
code:
void cdwgview::oneditacisconversion()
{
// todo: add your command handler code here
oddbdatabase* pdb = getdocument()->m_pdb;
pdb->startundorecord();
oddbblocktableptr pbtp = pdb->getblocktableid().openobject();
oddbsymboltableiteratorptr pstiter = pbtp->newiterator();
while(!pstiter->done())
{
oddbblocktablerecordptr pms = (oddbblocktablerecordptr) pstiter->getrecord();//pdb->getmodelspaceid().openobject();
oddbobjectiteratorptr pentiter = pms->newiterator();
while(!pentiter->done())
{
oddbentityptr pent = pentiter->entity(oddb::kforwrite);
pentiter->step();
if (!pent.isnull()
&& (pent->iskindof(oddbregion::desc())
|| pent->iskindof(oddbbody::desc())
|| pent->iskindof(oddb3dsolid::desc())))
{
bool exchangexdata;
oddbobjectid replaceid;
oddbobjectptr pnewobj = pent->decomposeforsave(oddb::vac12, replaceid, exchangexdata);
if (!pnewobj.isnull())
{
pent->handoverto(pnewobj);
}
}
}
}
filltree();
}it maybe come from the fact that decomposeforsave modifies the blocktable, so the iterator becomes invalid ?
did you forget pstiter->step ?
..........
i need more sleep.... thanks for showing me how tired i am....!
about odamfcapp::convertacis, would not it be more "correct" to convert the whole tree instead of only modelspace ?
huh, do you work at two jobs too ?
it is just sample code... answer to faq about 3dsolid tessalation. "how to ?" - see oneditacisconversion.
no, just one, but apparently, it's already too much !
let's hope my futures topics won't be so lame...


所有的时间均为北京时间。 现在的时间是 04:31 PM.