GenCAD exporter: added origin settings
Added an option to the exporter dialog allowing the user to choose either the absolute or the auxiliary origin. Also, the ORIGIN field in the exported file can be set to contain the information about the origin point or set to (0, 0) for compatibility with other CAD tools.
This commit is contained in:
parent
0b34d09bc0
commit
c9b791ca2a
|
@ -129,7 +129,9 @@ void DIALOG_GENCAD_EXPORT_OPTIONS::createOptCheckboxes()
|
||||||
{
|
{
|
||||||
{ FLIP_BOTTOM_PADS, _( "Flip bottom components padstacks" ) },
|
{ FLIP_BOTTOM_PADS, _( "Flip bottom components padstacks" ) },
|
||||||
{ UNIQUE_PIN_NAMES, _( "Generate unique pin names" ) },
|
{ UNIQUE_PIN_NAMES, _( "Generate unique pin names" ) },
|
||||||
{ INDIVIDUAL_SHAPES, _( "Generate a new shape for each component (do not reuse shapes)" ) }
|
{ INDIVIDUAL_SHAPES, _( "Generate a new shape for each component instance (do not reuse shapes)" ) },
|
||||||
|
{ USE_AUX_ORIGIN, _( "Use auxiliary axis as origin" ) },
|
||||||
|
{ STORE_ORIGIN_COORDS, _( "Save the origin coordinates in the file" ) }
|
||||||
};
|
};
|
||||||
|
|
||||||
for( const auto& option : opts )
|
for( const auto& option : opts )
|
||||||
|
|
|
@ -35,7 +35,9 @@ enum GENCAD_EXPORT_OPT
|
||||||
{
|
{
|
||||||
FLIP_BOTTOM_PADS, // flip bottom components padstacks geometry
|
FLIP_BOTTOM_PADS, // flip bottom components padstacks geometry
|
||||||
UNIQUE_PIN_NAMES, // generate unique pin names
|
UNIQUE_PIN_NAMES, // generate unique pin names
|
||||||
INDIVIDUAL_SHAPES // generate a shape for each component
|
INDIVIDUAL_SHAPES, // generate a shape for each component
|
||||||
|
USE_AUX_ORIGIN, // use auxiliary axis as origin
|
||||||
|
STORE_ORIGIN_COORDS // saves the origin point coordinates or (0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,7 @@ static std::string fmt_mask( LSET aSet )
|
||||||
static bool flipBottomPads;
|
static bool flipBottomPads;
|
||||||
static bool uniquePins;
|
static bool uniquePins;
|
||||||
static bool individualShapes;
|
static bool individualShapes;
|
||||||
|
static bool storeOriginCoords;
|
||||||
|
|
||||||
// These are the export origin (the auxiliary axis)
|
// These are the export origin (the auxiliary axis)
|
||||||
static int GencadOffsetX, GencadOffsetY;
|
static int GencadOffsetX, GencadOffsetY;
|
||||||
|
@ -292,6 +293,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
||||||
flipBottomPads = optionsDialog.GetOption( FLIP_BOTTOM_PADS );
|
flipBottomPads = optionsDialog.GetOption( FLIP_BOTTOM_PADS );
|
||||||
uniquePins = optionsDialog.GetOption( UNIQUE_PIN_NAMES );
|
uniquePins = optionsDialog.GetOption( UNIQUE_PIN_NAMES );
|
||||||
individualShapes = optionsDialog.GetOption( INDIVIDUAL_SHAPES );
|
individualShapes = optionsDialog.GetOption( INDIVIDUAL_SHAPES );
|
||||||
|
storeOriginCoords = optionsDialog.GetOption( STORE_ORIGIN_COORDS );
|
||||||
|
|
||||||
// Switch the locale to standard C (needed to print floating point numbers)
|
// Switch the locale to standard C (needed to print floating point numbers)
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
@ -300,8 +302,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
||||||
GetBoard()->ComputeBoundingBox();
|
GetBoard()->ComputeBoundingBox();
|
||||||
|
|
||||||
// Save the auxiliary origin for the rest of the module
|
// Save the auxiliary origin for the rest of the module
|
||||||
GencadOffsetX = GetAuxOrigin().x;
|
GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().x : 0;
|
||||||
GencadOffsetY = GetAuxOrigin().y;
|
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0;
|
||||||
|
|
||||||
// No idea on *why* this should be needed... maybe to fix net names?
|
// No idea on *why* this should be needed... maybe to fix net names?
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( NULL, true );
|
||||||
|
@ -999,9 +1001,10 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
|
||||||
fputs( TO_UTF8( msg ), aFile );
|
fputs( TO_UTF8( msg ), aFile );
|
||||||
fputs( "UNITS INCH\n", aFile );
|
fputs( "UNITS INCH\n", aFile );
|
||||||
|
|
||||||
|
// giving 0 as the argument to Map{X,Y}To returns the scaled origin point
|
||||||
msg.Printf( wxT( "ORIGIN %g %g\n" ),
|
msg.Printf( wxT( "ORIGIN %g %g\n" ),
|
||||||
MapXTo( aFrame->GetAuxOrigin().x ),
|
storeOriginCoords ? MapXTo( 0 ) : 0,
|
||||||
MapYTo( aFrame->GetAuxOrigin().y ) );
|
storeOriginCoords ? MapYTo( 0 ) : 0 );
|
||||||
fputs( TO_UTF8( msg ), aFile );
|
fputs( TO_UTF8( msg ), aFile );
|
||||||
|
|
||||||
fputs( "INTERTRACK 0\n", aFile );
|
fputs( "INTERTRACK 0\n", aFile );
|
||||||
|
|
Loading…
Reference in New Issue