Fix incorrect comparison in CADSTAR PCB Archive Importer
Also avoid use of magic numbers in case KiCad internal units ever change
This commit is contained in:
parent
514838dbbf
commit
5467729611
|
@ -51,8 +51,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::Load( ::BOARD* aBoard )
|
|||
long long designSizeXkicad = (long long) designLimit.x * KiCadUnitMultiplier;
|
||||
long long designSizeYkicad = (long long) designLimit.y * KiCadUnitMultiplier;
|
||||
|
||||
// Max size limited by the positive dimention of wxPoint
|
||||
double maxDesignSizekicad = Iu2Millimeter( std::numeric_limits<int>::max() );
|
||||
// Max size limited by the positive dimension of wxPoint (which is an int)
|
||||
long long maxDesignSizekicad = std::numeric_limits<int>::max();
|
||||
|
||||
if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
|
@ -63,7 +63,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::Load( ::BOARD* aBoard )
|
|||
"Maximum permitted design size: %.2f, %.2f millimeters.\n" ),
|
||||
(double) designSizeXkicad / PCB_IU_PER_MM,
|
||||
(double) designSizeYkicad / PCB_IU_PER_MM,
|
||||
maxDesignSizekicad, maxDesignSizekicad ) );
|
||||
(double) maxDesignSizekicad / PCB_IU_PER_MM,
|
||||
(double) maxDesignSizekicad / PCB_IU_PER_MM ) );
|
||||
|
||||
mDesignCenter =
|
||||
( Assignments.Technology.DesignArea.first + Assignments.Technology.DesignArea.second )
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <cadstar_pcb_archive_parser.h>
|
||||
#include <cmath> // pow()
|
||||
#include <convert_to_biu.h> // PCB_IU_PER_MM
|
||||
|
||||
|
||||
void CADSTAR_PCB_ARCHIVE_PARSER::Parse()
|
||||
|
@ -45,7 +46,7 @@ void CADSTAR_PCB_ARCHIVE_PARSER::Parse()
|
|||
switch( Header.Resolution )
|
||||
{
|
||||
case RESOLUTION::HUNDREDTH_MICRON:
|
||||
KiCadUnitMultiplier = 10;
|
||||
KiCadUnitMultiplier = PCB_IU_PER_MM / 1e5;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue