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

yang686526 2009-05-04 05:30 PM

【转帖】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


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