Re-implementation of 8b3ac316
Update GenCAD export to handle arbitrary outline Fixes https://gitlab.com/kicad/code/kicad/-/issues/15961
This commit is contained in:
parent
69a1a4611b
commit
12fdeac31c
|
@ -47,6 +47,7 @@
|
||||||
#include <pcbnew_settings.h>
|
#include <pcbnew_settings.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <project/project_file.h> // LAST_PATH_TYPE
|
#include <project/project_file.h> // LAST_PATH_TYPE
|
||||||
|
#include <geometry/shape_poly_set.h>
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
|
@ -1140,21 +1141,15 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
|
||||||
{
|
{
|
||||||
fputs( "$BOARD\n", aFile );
|
fputs( "$BOARD\n", aFile );
|
||||||
|
|
||||||
// Extract the board edges
|
SHAPE_POLY_SET outline;
|
||||||
for( BOARD_ITEM* drawing : aPcb->Drawings() )
|
aPcb->GetBoardPolygonOutlines( outline );
|
||||||
{
|
|
||||||
if( drawing->Type() == PCB_SHAPE_T )
|
|
||||||
{
|
|
||||||
PCB_SHAPE* drawseg = static_cast<PCB_SHAPE*>( drawing );
|
|
||||||
|
|
||||||
if( drawseg->GetLayer() == Edge_Cuts )
|
for( auto seg1 = outline.IterateSegmentsWithHoles(); seg1; seg1++ )
|
||||||
{
|
{
|
||||||
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them
|
SEG seg = *seg1;
|
||||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||||
MapXTo( drawseg->GetStart().x ), MapYTo( drawseg->GetStart().y ),
|
MapXTo( seg.A.x ), MapYTo( seg.A.y ),
|
||||||
MapXTo( drawseg->GetEnd().x ), MapYTo( drawseg->GetEnd().y ) );
|
MapXTo( seg.B.x ), MapYTo( seg.B.y ) );
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs( "$ENDBOARD\n\n", aFile );
|
fputs( "$ENDBOARD\n\n", aFile );
|
||||||
|
|
Loading…
Reference in New Issue