查看单个帖子
旧 2009-05-04, 05:30 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】cannot update hatch loops

cannot update hatch loops
cannot update hatch loops
hi,
we want to replace spline edges in hatch loops with line edges (i.e. explode the spline edge and put back line segment edges.)
the problem is that the insertloopat seems not to work, in generates a catch... error.
simple example code that generates the error:
quote:
for (int i = 0; i < phatch->numloops(); i++) {
edgearray edges;
edges.clear();
looptype = phatch->looptypeat(i);
phatch->getloopat (i, edges);
phatch->removeloopat(i);
// attempt to put back the exact same edges array here fails, why?
phatch->insertloopat(i,looptype,edges);
}
the above example fails for a simple loop with just 4 line edges.
so am i expecting too much, or is there a glaring mistake in what we are trying to do?
any help appreciated!
thanks,
paul g
it may happen if hatch is solid fill and loop is not closed. non-closed loops may be read from file but are invalid actually.
what exception do you get?
vladimir
hi,
thanks for your reply.
quote:
it may happen if hatch is solid fill and loop is not closed.
it's not a solid hatch.
the ends all join correctly, and the loop is closed.
( dxf file is attached )
quote:
what exception do you get?
well i don't know. all i know is that the exception happens in the call to insertloopat. i have:
catch (oderror& e) {}
catch (std::exception& e) {}
catch (int i) {}
catch (long l) {}
catch (unsigned u) {}
catch (double d) {}
catch (float f) {}
catch (char *str) {}
catch (char c) {}
catch (...) {}
it only gets caught in catch (...) {}
thanks,
paul g
attached files (15.7 kb, 1 views)

getloopat() returns pointers to the edges that are used inside the hatch, not copies (rather dangerous function).
removeloopat() deletes these edges.
vladimir
yes, that solved the problem. thanks for your help.
paul g
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)