几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】how select items by bo (http://www.dimcax.com/hust/showthread.php?t=16594)

yang686526 2009-05-05 12:33 PM

【转帖】how select items by bo
 
how select items by box?
how select items by box?
hello, all.
i want to select items in drawing using rectangular box.
was reading help, examples but still can not figure out what is the right way to accomplish.
one approach is to use viewport:
oddbselectionset::select(const oddbobjectid& vpid, ...)
i'm reading dwg pdb from the file. is it enogh just to call pdb->activeviewportid() for default viewport or i should created it somehow?
another way could be to use oddbselectionfilter but again can not find how to use it. please, somebody give me a sample.
ddwg220.
thanks in advance,
gok
life would be so much easier if we could just look at the source codefff">fff">

a bit experimenting and found that schema below works fine. on input pgon is a odgepolyline2d polygon drawn by some viewer. pdb is oddbdatabase readed from dxf file.
code:
const odgepoint2darray points = pgon.getvertices();
odgepoint3d *pts = new odgepoint3d[(int) points.size()];
for ( int i = 0; i < (int) points.size(); ++i ) {
odgepoint3d thispoint(points[i].x, points[i].y, 0.0);
pts[i] = thispoint;
}
oddbselectionsetptr psset = oddbselectionset::select(
pdb->activeviewportid(),
(int) points.size(),
pts,
oddbvisualselection::kcrossing);
delete [] pts;
for(; !pssiter->done(); pssiter->next()) {
oddbobjectid idss = pssiter->objectid();
}
life would be so much easier if we could just look at the source codefff">fff">


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