kicad2step: limit small segment add/remove

The addition of very small segments in OCE triggers sliver
removal/cleanup in the BREP generation that can get stuck in a very long
loop during STEP export of boards.  These were introduced to ensure
closure of boards with small gaps that were too big for OCE to consider
joined.

Removing the small segments allows STEP export to proceed in a
reasonable time.  This also decreases the default minimum gap size that
kicad2step uses to determine curve matching.  This prevents mis-matching
small curves

Fixes: lp:1784626
* https://bugs.launchpad.net/kicad/+bug/1784626
This commit is contained in:
Seth Hillbrand 2018-09-06 18:27:52 -07:00
parent e3924c12ee
commit d3c82b0b57
2 changed files with 1 additions and 28 deletions

View File

@ -31,7 +31,7 @@
#define KICADBASE_H #define KICADBASE_H
///> Minimum distance between points to treat them as separate ones (mm) ///> Minimum distance between points to treat them as separate ones (mm)
static constexpr double MIN_DISTANCE = 0.01; static constexpr double MIN_DISTANCE = 0.001;
namespace SEXPR namespace SEXPR
{ {

View File

@ -1464,33 +1464,6 @@ bool OUTLINE::addEdge( BRepBuilderAPI_MakeWire* aWire, KICADCURVE& aCurve, DOUBL
case CURVE_ARC: case CURVE_ARC:
{ {
// Arcs are particularly tricky to be used in contiguous outlines.
// If an arc is not precisely aligned with the previous segment end point
// (aLastPoint != aCurve.m_end), then it might be impossible to request an arc
// passing through aLastPoint and the other arc end. To fix this, a small segment
// is added, joining aLastPoint and aCurve.m_end, but only if the distance
// is small.
double dx = aLastPoint.x - aCurve.m_end.x;
double dy = aLastPoint.y - aCurve.m_end.y;
double distance = dx * dx + dy * dy;
if( distance > 0 && distance < m_minDistance2 )
{
std::ostringstream ostr;
#ifdef __WXDEBUG__
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
#endif /* __WXDEBUG */
ostr << " * added an auxiliary segment from "
<< aLastPoint << " to " << aCurve.m_end << "\n";
wxLogMessage( "%s", ostr.str().c_str() );
edge = BRepBuilderAPI_MakeEdge( gp_Pnt( aLastPoint.x, aLastPoint.y, 0.0 ),
gp_Pnt( aCurve.m_end.x, aCurve.m_end.y, 0.0 ) );
aWire->Add( edge );
aLastPoint = aCurve.m_end;
}
gp_Circ arc( gp_Ax2( gp_Pnt( aCurve.m_start.x, aCurve.m_start.y, 0.0 ), gp_Circ arc( gp_Ax2( gp_Pnt( aCurve.m_start.x, aCurve.m_start.y, 0.0 ),
gp_Dir( 0.0, 0.0, 1.0 ) ), aCurve.m_radius ); gp_Dir( 0.0, 0.0, 1.0 ) ), aCurve.m_radius );