查看单个帖子
旧 2009-05-05, 12:33 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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">
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)