STEP export: don't fail when can't construct a wire.

This can happen with very small shapes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17774
This commit is contained in:
Alex Shvartzkop 2024-04-17 01:34:57 +03:00
parent 9af12e60d2
commit 481c1592ae
1 changed files with 18 additions and 4 deletions

View File

@ -851,18 +851,32 @@ bool STEP_PCB_MODEL::MakeShapes( std::vector<TopoDS_Shape>& aShapes, const SHAPE
if( !makeWireFromChain( mkWire, contour ) )
continue;
wxASSERT( mkWire.IsDone() );
if( !mkWire.IsDone() )
{
ReportMessage( wxString::Format(
_( "Wire not done (contour %d, points %d): OCC error %d\n" ),
static_cast<int>( contId ), static_cast<int>( contour.PointCount() ),
static_cast<int>( mkWire.Error() ) ) );
}
if( contId == 0 ) // Outline
mkFace = BRepBuilderAPI_MakeFace( mkWire.Wire() );
{
if( mkWire.IsDone() )
mkFace = BRepBuilderAPI_MakeFace( mkWire.Wire() );
else
continue;
}
else // Hole
mkFace.Add( mkWire );
{
if( mkWire.IsDone() )
mkFace.Add( mkWire );
}
}
catch( const Standard_Failure& e )
{
ReportMessage(
wxString::Format( wxT( "MakeShapes (contour %d): OCC exception: %s\n" ),
contId, e.GetMessageString() ) );
static_cast<int>( contId ), e.GetMessageString() ) );
return false;
}
}