7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-05 00:15:30 +00:00

Combine Iu2Millimeter & remove PcbMm2iu

This commit is contained in:
Marek Roszko 2022-09-16 07:33:56 -04:00
parent 45c6ab5f8b
commit a8613ee80f
80 changed files with 364 additions and 374 deletions
3d-viewer
3d_canvas
3d_rendering/opengl
common
eeschema
gerbview
include
pagelayout_editor
pcbnew
qa/unittests
eeschema
libs/kimath/geometry

View File

@ -40,13 +40,13 @@
#include <advanced_config.h>
#define DEFAULT_BOARD_THICKNESS Millimeter2iu( 1.6 )
#define DEFAULT_COPPER_THICKNESS Millimeter2iu( 0.035 ) // for 35 um
#define DEFAULT_BOARD_THICKNESS pcbIUScale.mmToIU( 1.6 )
#define DEFAULT_COPPER_THICKNESS pcbIUScale.mmToIU( 0.035 ) // for 35 um
// The solder mask layer (and silkscreen) thickness
#define DEFAULT_TECH_LAYER_THICKNESS Millimeter2iu( 0.025 )
#define DEFAULT_TECH_LAYER_THICKNESS pcbIUScale.mmToIU( 0.025 )
// The solder paste thickness is chosen bigger than the solder mask layer
// to be sure is covers the mask when overlapping.
#define SOLDERPASTE_LAYER_THICKNESS Millimeter2iu( 0.04 )
#define SOLDERPASTE_LAYER_THICKNESS pcbIUScale.mmToIU( 0.04 )
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_SilkscreenColors;
@ -331,7 +331,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
// Gives a non null size to avoid issues in zoom / scale calculations
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
bbbox.Inflate( Millimeter2iu( 10 ) );
bbbox.Inflate( pcbIUScale.mmToIU( 10 ) );
m_boardSize = bbbox.GetSize();
m_boardPos = bbbox.Centre();
@ -356,7 +356,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits;
g_BevelThickness3DU = Millimeter2iu( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 ) * m_biuTo3Dunits;
g_BevelThickness3DU = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 ) * m_biuTo3Dunits;
if( m_board )
{
@ -667,7 +667,7 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
return false;
}
int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
int chainingEpsilon = pcbIUScale.mmToIU( 0.02 ); // max dist from one endPt to next startPt
success = BuildFootprintPolygonOutlines( m_board, m_board_poly,
m_board->GetDesignSettings().m_MaxError,

View File

@ -1364,16 +1364,16 @@ void RENDER_3D_OPENGL::generate3dGrid( GRID3D_TYPE aGridType )
brd_center_pos.y = -brd_center_pos.y;
const int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
const int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
const int xsize = std::max( brd_size.x, pcbIUScale.mmToIU( 100 ) ) * 1.2;
const int ysize = std::max( brd_size.y, pcbIUScale.mmToIU( 100 ) ) * 1.2;
// Grid limits, in 3D units
double xmin = ( brd_center_pos.x - xsize / 2 ) * scale;
double xmax = ( brd_center_pos.x + xsize / 2 ) * scale;
double ymin = ( brd_center_pos.y - ysize / 2 ) * scale;
double ymax = ( brd_center_pos.y + ysize / 2 ) * scale;
double zmin = Millimeter2iu( -50 ) * scale;
double zmax = Millimeter2iu( 100 ) * scale;
double zmin = pcbIUScale.mmToIU( -50 ) * scale;
double zmax = pcbIUScale.mmToIU( 100 ) * scale;
// Set rasterised line width (min value = 1)
glLineWidth( 1 );

View File

@ -31,15 +31,15 @@
const char NETCLASS::Default[] = "Default";
// Initial values for netclass initialization
const int DEFAULT_CLEARANCE = PcbMm2iu( 0.2 ); // track to track and track to pads clearance
const int DEFAULT_VIA_DIAMETER = PcbMm2iu( 0.8 );
const int DEFAULT_VIA_DRILL = PcbMm2iu( 0.4 );
const int DEFAULT_UVIA_DIAMETER = PcbMm2iu( 0.3 );
const int DEFAULT_UVIA_DRILL = PcbMm2iu( 0.1 );
const int DEFAULT_TRACK_WIDTH = PcbMm2iu( 0.25 );
const int DEFAULT_DIFF_PAIR_WIDTH = PcbMm2iu( 0.2 );
const int DEFAULT_DIFF_PAIR_GAP = PcbMm2iu( 0.25 );
const int DEFAULT_DIFF_PAIR_VIAGAP = PcbMm2iu( 0.25 );
const int DEFAULT_CLEARANCE = pcbIUScale.mmToIU( 0.2 ); // track to track and track to pads clearance
const int DEFAULT_VIA_DIAMETER = pcbIUScale.mmToIU( 0.8 );
const int DEFAULT_VIA_DRILL = pcbIUScale.mmToIU( 0.4 );
const int DEFAULT_UVIA_DIAMETER = pcbIUScale.mmToIU( 0.3 );
const int DEFAULT_UVIA_DRILL = pcbIUScale.mmToIU( 0.1 );
const int DEFAULT_TRACK_WIDTH = pcbIUScale.mmToIU( 0.25 );
const int DEFAULT_DIFF_PAIR_WIDTH = pcbIUScale.mmToIU( 0.2 );
const int DEFAULT_DIFF_PAIR_GAP = pcbIUScale.mmToIU( 0.25 );
const int DEFAULT_DIFF_PAIR_VIAGAP = pcbIUScale.mmToIU( 0.25 );
const int DEFAULT_WIRE_WIDTH = SchMils2iu( 6 );
const int DEFAULT_BUS_WIDTH = SchMils2iu( 12 );

View File

@ -220,7 +220,7 @@ wxString PGPROPERTY_DISTANCE::DistanceToString( wxVariant& aVariant, int aArgFla
return wxString::Format( wxT( "%g mils" ), Iu2Mils( aVariant.GetLong() ) );
case EDA_UNITS::MILLIMETRES:
return wxString::Format( wxT( "%g mm" ), Iu2Millimeter( aVariant.GetLong() ) );
return wxString::Format( wxT( "%g mm" ), pcbIUScale.IUTomm( aVariant.GetLong() ) );
case EDA_UNITS::UNSCALED:
return wxString::Format( wxT( "%li" ), aVariant.GetLong() );

View File

@ -39,7 +39,7 @@ static std::optional<int> getInPcbUnits( const nlohmann::json& aObj, const std::
std::optional<int> aDefault = std::optional<int>() )
{
if( aObj.contains( aKey ) && aObj[aKey].is_number() )
return PcbMm2iu( aObj[aKey].get<double>() );
return pcbIUScale.mmToIU( aObj[aKey].get<double>() );
else
return aDefault;
};
@ -77,7 +77,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
auto saveInPcbUnits =
[]( nlohmann::json& json, const std::string& aKey, int aValue )
{
json.push_back( { aKey, PcbIu2mm( aValue ) } );
json.push_back( { aKey, pcbIUScale.IUTomm( aValue ) } );
};
if( nc->HasClearance() )

View File

@ -599,11 +599,11 @@ void DIALOG_PLOT_SCHEMATIC::setHpglPenWidth()
{
m_HPGLPenSize = m_penWidth.GetValue();
if( m_HPGLPenSize > Millimeter2iu( 2 ) )
m_HPGLPenSize = Millimeter2iu( 2 );
if( m_HPGLPenSize > schIUScale.mmToIU( 2 ) )
m_HPGLPenSize = schIUScale.mmToIU( 2 );
if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
m_HPGLPenSize = Millimeter2iu( 0.01 );
if( m_HPGLPenSize < schIUScale.mmToIU( 0.01 ) )
m_HPGLPenSize = schIUScale.mmToIU( 0.01 );
}
@ -728,7 +728,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
// TODO this could be configurable
plotter->SetTargetChordLength( Millimeter2iu( 0.6 ) );
plotter->SetTargetChordLength( schIUScale.mmToIU( 0.6 ) );
switch( aOriginAndUnits )
{

View File

@ -550,7 +550,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
// Use a reasonable (small) size to draw the text
int textSize = ( m_nameTextSize * 3 ) / 4;
#define ETXT_MAX_SIZE Millimeter2iu( 0.7 )
#define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
if( textSize > ETXT_MAX_SIZE )
textSize = ETXT_MAX_SIZE;
@ -572,7 +572,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECT
color = color.Mix( bg, 0.5f );
VECTOR2I txtpos = aPosition;
int offset = Millimeter2iu( 0.4 );
int offset = schIUScale.mmToIU( 0.4 );
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT;
EDA_ANGLE orient = ANGLE_HORIZONTAL;
@ -1242,7 +1242,7 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
if( includeType )
{
double fontSize = std::max( m_nameTextSize * 3 / 4, Millimeter2iu( 0.7 ) );
double fontSize = std::max( m_nameTextSize * 3 / 4, schIUScale.mmToIU( 0.7 ) );
VECTOR2I typeTextSize = font->StringBoundaryLimits( GetElectricalTypeName(),
VECTOR2D( fontSize, fontSize ),
fontSize / 8.0, false, false );

View File

@ -37,7 +37,7 @@
#include <erc_item.h>
/// Factor to convert the maker unit shape to internal units:
#define SCALING_FACTOR Millimeter2iu( 0.15 )
#define SCALING_FACTOR schIUScale.mmToIU( 0.15 )
SCH_MARKER::SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos ) :

View File

@ -1437,7 +1437,7 @@ void SCH_PAINTER::draw( const LIB_PIN *aPin, int aLayer, bool aDimmed )
if( m_schSettings.m_ShowPinsElectricalType )
{
size [OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, Millimeter2iu( 0.7 ) );
size[OUTSIDE] = std::max( aPin->GetNameTextSize() * 3 / 4, schIUScale.mmToIU( 0.7 ) );
thickness[OUTSIDE] = float( size[OUTSIDE] ) / 8.0F;
colour [OUTSIDE] = getRenderColor( aPin, LAYER_PRIVATE_NOTES, drawingShadows );
text [OUTSIDE] = aPin->GetElectricalTypeName();

View File

@ -2095,7 +2095,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
// TODO: Load as arc...
SHAPE_ARC tempArc( centerPoint, startPoint, arcAngle );
SHAPE_LINE_CHAIN arcSegments = tempArc.ConvertToPolyline( Millimeter2iu( 0.1 ) );
SHAPE_LINE_CHAIN arcSegments = tempArc.ConvertToPolyline( schIUScale.mmToIU( 0.1 ) );
// Load the arc as a series of piece-wise segments

View File

@ -233,8 +233,8 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Set the working/draw area size to display a symbol to a reasonable value:
// A 600mm x 600mm with a origin at the area center looks like a large working area
double max_size_x = Millimeter2iu( 600 );
double max_size_y = Millimeter2iu( 600 );
double max_size_x = schIUScale.mmToIU( 600 );
double max_size_y = schIUScale.mmToIU( 600 );
BOX2D bbox;
bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
bbox.SetSize( max_size_x, max_size_y );
@ -1300,8 +1300,8 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
if( !m_symbol )
{
// Gives a reasonable drawing area size
int width = Millimeter2iu( 50 );
int height = Millimeter2iu( 30 );
int width = schIUScale.mmToIU( 50 );
int height = schIUScale.mmToIU( 30 );
return BOX2I( VECTOR2I( -width/2, -height/2 ),
VECTOR2I( width, height ) );

View File

@ -280,8 +280,8 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
// Set the working/draw area size to display a symbol to a reasonable value:
// A 450mm x 450mm with a origin at the area center looks like a large working area
double max_size_x = Millimeter2iu( 450 );
double max_size_y = Millimeter2iu( 450 );
double max_size_x = schIUScale.mmToIU( 450 );
double max_size_y = schIUScale.mmToIU( 450 );
BOX2D bbox;
bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
bbox.SetSize( max_size_x, max_size_y );

View File

@ -34,7 +34,7 @@
#include <convert_to_biu.h>
#include <convert_basic_shapes_to_polygon.h>
#define DCODE_DEFAULT_SIZE Millimeter2iu( 0.1 )
#define DCODE_DEFAULT_SIZE gerbIUScale.mmToIU( 0.1 )
/* Format Gerber: NOTES:
* Tools and D_CODES

View File

@ -777,7 +777,7 @@ BITMAPS GERBER_DRAW_ITEM::GetMenuImage() const
bool GERBER_DRAW_ITEM::HitTest( const VECTOR2I& aRefPos, int aAccuracy ) const
{
// In case the item has a very tiny width defined, allow it to be selected
const int MIN_HIT_TEST_RADIUS = Millimeter2iu( 0.01 );
const int MIN_HIT_TEST_RADIUS = gerbIUScale.mmToIU( 0.01 );
// calculate aRefPos in XY Gerber axis:
VECTOR2I ref_pos = GetXYPosition( aRefPos );
@ -968,7 +968,7 @@ double GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
// the level of details is chosen experimentally, to show
// only a readable text:
double level = (double)Millimeter2iu( 3 );
double level = (double) gerbIUScale.mmToIU( 3 );
return level / ( size + 1 );
}

View File

@ -359,8 +359,8 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame )
break;
case EDA_UNITS::MILLIMETRES:
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Millimeter( m_ImageJustifyOffset.x ),
Iu2Millimeter( m_ImageJustifyOffset.y ) );
msg.Printf( wxT( "X=%f Y=%f" ), gerbIUScale.IUTomm( m_ImageJustifyOffset.x ),
gerbIUScale.IUTomm( m_ImageJustifyOffset.y ) );
break;
default:

View File

@ -579,4 +579,4 @@ void GERBVIEW_PAINTER::drawApertureMacro( GERBER_DRAW_ITEM* aParent, bool aFille
}
const double GERBVIEW_RENDER_SETTINGS::MAX_FONT_SIZE = Millimeter2iu( 10.0 );
const double GERBVIEW_RENDER_SETTINGS::MAX_FONT_SIZE = gerbIUScale.mmToIU( 10.0 );

View File

@ -81,6 +81,13 @@ struct EDA_IU_SCALE
IU_PER_MM( aIUPerMM ), IU_PER_MILS( aIUPerMM * 0.0254 )
{
}
constexpr inline double IUTomm( int iu ) const { return iu / IU_PER_MM; }
constexpr inline int mmToIU( double mm ) const
{
return (int) ( mm < 0 ? ( mm * IU_PER_MM - 0.5 ) : ( mm * IU_PER_MM + 0.5 ) );
}
};
constexpr EDA_IU_SCALE gerbIUScale = EDA_IU_SCALE( GERB_IU_PER_MM );
@ -135,12 +142,6 @@ constexpr inline int Millimeter2iu( double mm )
return (int) ( mm < 0 ? mm * IU_PER_MM - 0.5 : mm * IU_PER_MM + 0.5 );
}
/// Convert mm to internal units (iu).
constexpr inline double Iu2Millimeter( int iu )
{
return iu / IU_PER_MM;
}
/// Convert mm to internal units (iu).
// constexpr inline double Iu2Mils( int iu )
// {
@ -169,13 +170,4 @@ constexpr inline double SchIu2Mils( int iu )
return iu / SCH_IU_PER_MILS;
}
constexpr inline int PcbMm2iu( double mm )
{
return (int) ( mm < 0 ? mm * PCB_IU_PER_MM - 0.5 : mm * PCB_IU_PER_MM + 0.5 );
}
constexpr inline double PcbIu2mm( int iu )
{
return iu / PCB_IU_PER_MM;
}
#endif

View File

@ -225,7 +225,8 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
GetGridList()->SetCellValue( row, COL_REPEAT_NUMBER, "-" );
wxSize page_sizeIU = m_editorFrame->GetPageSizeIU();
GetGridList()->SetCellValue( row, COL_TEXTSTRING, wxString::Format( _( "Size: %.1fx%.1fmm" ),
Iu2Millimeter( page_sizeIU.x ), Iu2Millimeter( page_sizeIU.y ) ) );
drawSheetIUScale.IUTomm( page_sizeIU.x ),
drawSheetIUScale.IUTomm( page_sizeIU.y ) ) );
GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( root_xpm ) );
GetGridList()->SetReadOnly( row, COL_BITMAP );
m_itemsList.push_back( nullptr ); // this item is not a DS_DATA_ITEM, just a pseudo item

View File

@ -110,7 +110,7 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet()
// of the selected corner for coord origin of new items
// Not also this item has no peer in DS_DATA_MODEL list.
const int penWidth = 0; // This value is to use the default thickness line
constexpr double markerSize = Millimeter2iu( 5 );
constexpr double markerSize = drawSheetIUScale.mmToIU( 5 );
m_pageDrawItem = std::make_unique<DS_DRAW_ITEM_PAGE>( penWidth, markerSize );
m_view->Add( m_pageDrawItem.get() );

View File

@ -65,7 +65,7 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard )
for( FOOTPRINT* footprint : m_board->Footprints() )
m_connectivity->Add( footprint );
m_gridSize = Millimeter2iu( STEP_AR_MM );
m_gridSize = pcbIUScale.mmToIU( STEP_AR_MM );
m_progressReporter = nullptr;
m_refreshCallback = nullptr;
m_minCost = 0.0;
@ -838,8 +838,8 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<FOOTPRINT*>& aFootprin
m_matrix.m_GridRouting = m_gridSize; //(int) m_frame->GetScreen()->GetGridSize().x;
// Ensure Board.m_GridRouting has a reasonable value:
if( m_matrix.m_GridRouting < Millimeter2iu( 0.25 ) )
m_matrix.m_GridRouting = Millimeter2iu( 0.25 );
if( m_matrix.m_GridRouting < pcbIUScale.mmToIU( 0.25 ) )
m_matrix.m_GridRouting = pcbIUScale.mmToIU( 0.25 );
// Compute footprint parameters used in autoplace
if( genPlacementRoutingMatrix( ) == 0 )

View File

@ -276,7 +276,7 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aSpreadAre
sub_area.SetWidth( placementArea.GetW()*scale );
sub_area.SetHeight( placementArea.GetH()*scale );
// Add a margin around the sheet placement area:
sub_area.Inflate( Millimeter2iu( 1.5 ) );
sub_area.Inflate( pcbIUScale.mmToIU( 1.5 ) );
placementSheetAreas.push_back( sub_area );

View File

@ -94,7 +94,7 @@ BOARD::BOARD() :
m_SolderMask = new ZONE( this );
m_SolderMask->SetLayerSet( LSET().set( F_Mask ).set( B_Mask ) );
m_SolderMask->SetOutline( new SHAPE_POLY_SET() );
int infinity = ( std::numeric_limits<int>::max() / 2 ) - Millimeter2iu( 1 );
int infinity = ( std::numeric_limits<int>::max() / 2 ) - pcbIUScale.mmToIU( 1 );
m_SolderMask->Outline()->NewOutline();
m_SolderMask->Outline()->Append( VECTOR2I( -infinity, -infinity ) );
m_SolderMask->Outline()->Append( VECTOR2I( -infinity, +infinity ) );
@ -1882,7 +1882,7 @@ ZONE* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_
bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines,
OUTLINE_ERROR_HANDLER* aErrorHandler )
{
int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
int chainingEpsilon = pcbIUScale.mmToIU( 0.02 ); // max dist from one endPt to next startPt
bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
chainingEpsilon, aErrorHandler );

View File

@ -73,47 +73,47 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
// Any following ones are freebies
m_DefaultFPTextItems.emplace_back( wxT( "${REFERENCE}" ), true, F_Fab );
m_LineThickness[ LAYER_CLASS_SILK ] = Millimeter2iu( DEFAULT_SILK_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_SILK ] = wxSize( Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_SILK ] = Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_SILK ] = wxSize( pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_SILK ] = pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_SILK ] = false;
m_TextUpright[ LAYER_CLASS_SILK ] = false;
m_LineThickness[ LAYER_CLASS_COPPER ] = Millimeter2iu( DEFAULT_COPPER_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_COPPER ] = Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_COPPER ] = pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_COPPER ] = false;
m_TextUpright[ LAYER_CLASS_COPPER ] = false;
// Edges & Courtyards; text properties aren't used but better to have them holding
// reasonable values than not.
m_LineThickness[ LAYER_CLASS_EDGES ] = Millimeter2iu( DEFAULT_EDGE_WIDTH );
m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_EDGES ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH );
m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_EDGES ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_EDGES ] = false;
m_TextUpright[ LAYER_CLASS_EDGES ] = false;
m_LineThickness[ LAYER_CLASS_COURTYARD ] = Millimeter2iu( DEFAULT_COURTYARD_WIDTH );
m_TextSize[ LAYER_CLASS_COURTYARD ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_COURTYARD ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH );
m_TextSize[ LAYER_CLASS_COURTYARD ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_COURTYARD ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_COURTYARD ] = false;
m_TextUpright[ LAYER_CLASS_COURTYARD ] = false;
m_LineThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_FAB ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_FAB ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_FAB ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_FAB ] = false;
m_TextUpright[ LAYER_CLASS_FAB ] = false;
m_LineThickness[ LAYER_CLASS_OTHERS ] = Millimeter2iu( DEFAULT_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_OTHERS ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_LineThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_OTHERS ] = pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
m_TextUpright[ LAYER_CLASS_OTHERS ] = false;
@ -124,33 +124,33 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_DimensionTextPosition = DIM_TEXT_POSITION::OUTSIDE;
m_DimensionKeepTextAligned = true;
m_DimensionArrowLength = Mils2iu( DEFAULT_DIMENSION_ARROW_LENGTH );
m_DimensionExtensionOffset = Millimeter2iu( DEFAULT_DIMENSION_EXTENSION_OFFSET );
m_DimensionExtensionOffset = pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET );
m_useCustomTrackVia = false;
m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
m_customViaSize.m_Diameter = Millimeter2iu( DEFAULT_VIASMINSIZE );
m_customViaSize.m_Drill = Millimeter2iu( DEFAULT_MINTHROUGHDRILL );
m_customTrackWidth = pcbIUScale.mmToIU( DEFAULT_CUSTOMTRACKWIDTH );
m_customViaSize.m_Diameter = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE );
m_customViaSize.m_Drill = pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL );
m_useCustomDiffPair = false;
m_customDiffPair.m_Width = Millimeter2iu( DEFAULT_CUSTOMDPAIRWIDTH );
m_customDiffPair.m_Gap = Millimeter2iu( DEFAULT_CUSTOMDPAIRGAP );
m_customDiffPair.m_ViaGap = Millimeter2iu( DEFAULT_CUSTOMDPAIRVIAGAP );
m_customDiffPair.m_Width = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRWIDTH );
m_customDiffPair.m_Gap = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRGAP );
m_customDiffPair.m_ViaGap = pcbIUScale.mmToIU( DEFAULT_CUSTOMDPAIRVIAGAP );
m_MinClearance = Millimeter2iu( DEFAULT_MINCLEARANCE );
m_MinConn = Millimeter2iu( DEFAULT_MINCONNECTION );
m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH );
m_ViasMinAnnularWidth = Millimeter2iu( DEFAULT_VIASMINSIZE - DEFAULT_MINTHROUGHDRILL ) / 2;
m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE );
m_MinThroughDrill = Millimeter2iu( DEFAULT_MINTHROUGHDRILL );
m_MicroViasMinSize = Millimeter2iu( DEFAULT_MICROVIASMINSIZE );
m_MicroViasMinDrill = Millimeter2iu( DEFAULT_MICROVIASMINDRILL );
m_CopperEdgeClearance = Millimeter2iu( DEFAULT_COPPEREDGECLEARANCE );
m_HoleClearance = Millimeter2iu( DEFAULT_HOLECLEARANCE );
m_HoleToHoleMin = Millimeter2iu( DEFAULT_HOLETOHOLEMIN );
m_SilkClearance = Millimeter2iu( DEFAULT_SILKCLEARANCE );
m_MinClearance = pcbIUScale.mmToIU( DEFAULT_MINCLEARANCE );
m_MinConn = pcbIUScale.mmToIU( DEFAULT_MINCONNECTION );
m_TrackMinWidth = pcbIUScale.mmToIU( DEFAULT_TRACKMINWIDTH );
m_ViasMinAnnularWidth = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE - DEFAULT_MINTHROUGHDRILL ) / 2;
m_ViasMinSize = pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE );
m_MinThroughDrill = pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL );
m_MicroViasMinSize = pcbIUScale.mmToIU( DEFAULT_MICROVIASMINSIZE );
m_MicroViasMinDrill = pcbIUScale.mmToIU( DEFAULT_MICROVIASMINDRILL );
m_CopperEdgeClearance = pcbIUScale.mmToIU( DEFAULT_COPPEREDGECLEARANCE );
m_HoleClearance = pcbIUScale.mmToIU( DEFAULT_HOLECLEARANCE );
m_HoleToHoleMin = pcbIUScale.mmToIU( DEFAULT_HOLETOHOLEMIN );
m_SilkClearance = pcbIUScale.mmToIU( DEFAULT_SILKCLEARANCE );
m_MinResolvedSpokes = DEFAULT_MINRESOLVEDSPOKES;
m_MinSilkTextHeight = Millimeter2iu( DEFAULT_SILK_TEXT_SIZE * 0.8 );
m_MinSilkTextThickness= Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH * 0.8 );
m_MinSilkTextHeight = pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE * 0.8 );
m_MinSilkTextThickness= pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH * 0.8 );
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
@ -193,12 +193,12 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_UseHeightForLengthCalcs = true;
// Global mask margins:
m_SolderMaskExpansion = Millimeter2iu( DEFAULT_SOLDERMASK_EXPANSION );
m_SolderMaskMinWidth = Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH );
m_SolderMaskToCopperClearance = Millimeter2iu( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE );
m_SolderMaskExpansion = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_EXPANSION );
m_SolderMaskMinWidth = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_MIN_WIDTH );
m_SolderMaskToCopperClearance = pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE );
// Solder paste margin absolute value
m_SolderPasteMargin = Millimeter2iu( DEFAULT_SOLDERPASTE_CLEARANCE );
m_SolderPasteMargin = pcbIUScale.mmToIU( DEFAULT_SOLDERPASTE_CLEARANCE );
// Solder paste margin as a ratio of pad size
// The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad
@ -207,7 +207,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_AllowSoldermaskBridgesInFPs = false;
// Layer thickness for 3D viewer
m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
m_boardThickness = pcbIUScale.mmToIU( DEFAULT_BOARD_THICKNESS_MM );
m_viaSizeIndex = 0;
m_trackWidthIndex = 0;
@ -226,48 +226,48 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_UseHeightForLengthCalcs, true ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_clearance",
&m_MinClearance, Millimeter2iu( DEFAULT_MINCLEARANCE ),
Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_MinClearance, pcbIUScale.mmToIU( DEFAULT_MINCLEARANCE ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_connection",
&m_MinConn, Millimeter2iu( DEFAULT_MINCONNECTION ),
Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) );
&m_MinConn, pcbIUScale.mmToIU( DEFAULT_MINCONNECTION ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_track_width",
&m_TrackMinWidth, Millimeter2iu( DEFAULT_TRACKMINWIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_TrackMinWidth, pcbIUScale.mmToIU( DEFAULT_TRACKMINWIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_annular_width",
&m_ViasMinAnnularWidth, Millimeter2iu( DEFAULT_VIASMINSIZE ),
Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_ViasMinAnnularWidth, pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_diameter",
&m_ViasMinSize, Millimeter2iu( DEFAULT_VIASMINSIZE ),
Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_ViasMinSize, pcbIUScale.mmToIU( DEFAULT_VIASMINSIZE ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_through_hole_diameter",
&m_MinThroughDrill, Millimeter2iu( DEFAULT_MINTHROUGHDRILL ),
Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_MinThroughDrill, pcbIUScale.mmToIU( DEFAULT_MINTHROUGHDRILL ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_diameter",
&m_MicroViasMinSize, Millimeter2iu( DEFAULT_MICROVIASMINSIZE ),
Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), MM_PER_IU ) );
&m_MicroViasMinSize, pcbIUScale.mmToIU( DEFAULT_MICROVIASMINSIZE ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 10.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_drill",
&m_MicroViasMinDrill, Millimeter2iu( DEFAULT_MICROVIASMINDRILL ),
Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), MM_PER_IU ) );
&m_MicroViasMinDrill, pcbIUScale.mmToIU( DEFAULT_MICROVIASMINDRILL ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 10.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_to_hole",
&m_HoleToHoleMin, Millimeter2iu( DEFAULT_HOLETOHOLEMIN ),
Millimeter2iu( 0.00 ), Millimeter2iu( 10.0 ), MM_PER_IU ) );
&m_HoleToHoleMin, pcbIUScale.mmToIU( DEFAULT_HOLETOHOLEMIN ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 10.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_clearance",
&m_HoleClearance, Millimeter2iu( DEFAULT_HOLECLEARANCE ),
Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) );
&m_HoleClearance, pcbIUScale.mmToIU( DEFAULT_HOLECLEARANCE ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_silk_clearance",
&m_SilkClearance, Millimeter2iu( DEFAULT_SILKCLEARANCE ),
Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) );
&m_SilkClearance, pcbIUScale.mmToIU( DEFAULT_SILKCLEARANCE ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), MM_PER_IU ) );
// While the maximum *effective* value is 4, we've had users interpret this as the count on
// all layers, and enter something like 10. They'll figure it out soon enough *unless* we
@ -277,18 +277,18 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_MinResolvedSpokes, DEFAULT_MINRESOLVEDSPOKES, 0, 99 ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_height",
&m_MinSilkTextHeight, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE * 0.8 ),
Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) );
&m_MinSilkTextHeight, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE * 0.8 ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 100.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_text_thickness",
&m_MinSilkTextThickness, Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH * 0.8 ),
Millimeter2iu( 0.00 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_MinSilkTextThickness, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH * 0.8 ),
pcbIUScale.mmToIU( 0.00 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
// Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
// based on the edge cut thicknesses.
m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_copper_edge_clearance",
&m_CopperEdgeClearance, Millimeter2iu( LEGACY_COPPEREDGECLEARANCE ),
Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_CopperEdgeClearance, pcbIUScale.mmToIU( LEGACY_COPPEREDGECLEARANCE ),
pcbIUScale.mmToIU( -0.01 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
[&]() -> nlohmann::json
@ -356,7 +356,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
nlohmann::json js = nlohmann::json::array();
for( const int& width : m_TrackWidthList )
js.push_back( Iu2Millimeter( width ) );
js.push_back( pcbIUScale.IUTomm( width ) );
return js;
},
@ -372,7 +372,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
if( entry.empty() )
continue;
m_TrackWidthList.emplace_back( Millimeter2iu( entry.get<double>() ) );
m_TrackWidthList.emplace_back( pcbIUScale.mmToIU( entry.get<double>() ) );
}
},
{} ) );
@ -386,8 +386,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
{
nlohmann::json entry = {};
entry["diameter"] = Iu2Millimeter( via.m_Diameter );
entry["drill"] = Iu2Millimeter( via.m_Drill );
entry["diameter"] = pcbIUScale.IUTomm( via.m_Diameter );
entry["drill"] = pcbIUScale.IUTomm( via.m_Drill );
js.push_back( entry );
}
@ -409,8 +409,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
if( !entry.contains( "diameter" ) || !entry.contains( "drill" ) )
continue;
int diameter = Millimeter2iu( entry["diameter"].get<double>() );
int drill = Millimeter2iu( entry["drill"].get<double>() );
int diameter = pcbIUScale.mmToIU( entry["diameter"].get<double>() );
int drill = pcbIUScale.mmToIU( entry["drill"].get<double>() );
m_ViasDimensionsList.emplace_back( VIA_DIMENSION( diameter, drill ) );
}
@ -426,9 +426,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
{
nlohmann::json entry = {};
entry["width"] = Iu2Millimeter( pair.m_Width );
entry["gap"] = Iu2Millimeter( pair.m_Gap );
entry["via_gap"] = Iu2Millimeter( pair.m_ViaGap );
entry["width"] = pcbIUScale.IUTomm( pair.m_Width );
entry["gap"] = pcbIUScale.IUTomm( pair.m_Gap );
entry["via_gap"] = pcbIUScale.IUTomm( pair.m_ViaGap );
js.push_back( entry );
}
@ -451,9 +451,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|| !entry.contains( "via_gap" ) )
continue;
int width = Millimeter2iu( entry["width"].get<double>() );
int gap = Millimeter2iu( entry["gap"].get<double>() );
int via_gap = Millimeter2iu( entry["via_gap"].get<double>() );
int width = pcbIUScale.mmToIU( entry["width"].get<double>() );
int gap = pcbIUScale.mmToIU( entry["gap"].get<double>() );
int via_gap = pcbIUScale.mmToIU( entry["via_gap"].get<double>() );
m_DiffPairDimensionsList.emplace_back(
DIFF_PAIR_DIMENSION( width, gap, via_gap ) );
@ -526,8 +526,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
TEARDROP_PARAMETERS* td_prm = m_TeardropParamsList.GetParameters( (TARGET_TD)ii );
entry["td_target_name"] = GetTeardropTargetCanonicalName( (TARGET_TD)ii );
entry["td_maxlen"] = Iu2Millimeter( td_prm->m_TdMaxLen );
entry["td_maxheight"] = Iu2Millimeter( td_prm->m_TdMaxHeight );
entry["td_maxlen"] = pcbIUScale.IUTomm( td_prm->m_TdMaxLen );
entry["td_maxheight"] = pcbIUScale.IUTomm( td_prm->m_TdMaxHeight );
entry["td_length_ratio"] = td_prm->m_LengthRatio;
entry["td_height_ratio"] = td_prm->m_HeightRatio;
entry["td_curve_segcount"] = td_prm->m_CurveSegCount;
@ -558,10 +558,10 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
TEARDROP_PARAMETERS* td_prm = m_TeardropParamsList.GetParameters( (TARGET_TD)idx );
if( entry.contains( "td_maxlen" ) )
td_prm->m_TdMaxLen = Millimeter2iu( entry["td_maxlen"].get<double>() );
td_prm->m_TdMaxLen = pcbIUScale.mmToIU( entry["td_maxlen"].get<double>() );
if( entry.contains( "td_maxheight" ) )
td_prm->m_TdMaxHeight = Millimeter2iu( entry["td_maxheight"].get<double>() );
td_prm->m_TdMaxHeight = pcbIUScale.mmToIU( entry["td_maxheight"].get<double>() );
if( entry.contains( "td_length_ratio" ) )
td_prm->m_LengthRatio = entry["td_length_ratio"].get<double>();
@ -580,19 +580,19 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
{} ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_line_width",
&m_LineThickness[LAYER_CLASS_SILK], Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_SILK], pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_v",
&m_TextSize[LAYER_CLASS_SILK].y, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_SILK].y, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_h",
&m_TextSize[LAYER_CLASS_SILK].x, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_SILK].x, pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_thickness",
&m_TextThickness[LAYER_CLASS_SILK], Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1,
&m_TextThickness[LAYER_CLASS_SILK], pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_WIDTH ), 1,
TEXTS_MAX_WIDTH, MM_PER_IU ) );
m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_italic",
@ -602,20 +602,20 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_TextUpright[ LAYER_CLASS_SILK ], true ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_line_width",
&m_LineThickness[LAYER_CLASS_COPPER], Millimeter2iu( DEFAULT_COPPER_LINE_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_COPPER], pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_v",
&m_TextSize[LAYER_CLASS_COPPER].y, Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_COPPER].y, pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_h",
&m_TextSize[LAYER_CLASS_COPPER].x, Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_COPPER].x, pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_thickness",
&m_TextThickness[LAYER_CLASS_COPPER], Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_TextThickness[LAYER_CLASS_COPPER], pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_italic",
&m_TextItalic[LAYER_CLASS_COPPER], false ) );
@ -624,28 +624,28 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_TextUpright[LAYER_CLASS_COPPER], true ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.board_outline_line_width",
&m_LineThickness[LAYER_CLASS_EDGES], Millimeter2iu( DEFAULT_EDGE_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_EDGES], pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.courtyard_line_width",
&m_LineThickness[LAYER_CLASS_COURTYARD], Millimeter2iu( DEFAULT_COURTYARD_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_COURTYARD], pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_line_width",
&m_LineThickness[LAYER_CLASS_FAB], Millimeter2iu( DEFAULT_LINE_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_FAB], pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_v",
&m_TextSize[LAYER_CLASS_FAB].y, Millimeter2iu( DEFAULT_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_FAB].y, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_h",
&m_TextSize[LAYER_CLASS_FAB].x, Millimeter2iu( DEFAULT_TEXT_SIZE ),
&m_TextSize[LAYER_CLASS_FAB].x, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ),
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_thickness",
&m_TextThickness[LAYER_CLASS_FAB], Millimeter2iu( DEFAULT_TEXT_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_TextThickness[LAYER_CLASS_FAB], pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_italic",
&m_TextItalic[LAYER_CLASS_FAB], false ) );
@ -654,20 +654,20 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_TextUpright[LAYER_CLASS_FAB], true ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_line_width",
&m_LineThickness[LAYER_CLASS_OTHERS], Millimeter2iu( DEFAULT_LINE_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_LineThickness[LAYER_CLASS_OTHERS], pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_v",
&m_TextSize[LAYER_CLASS_OTHERS].y, Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE,
&m_TextSize[LAYER_CLASS_OTHERS].y, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE,
TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_h",
&m_TextSize[LAYER_CLASS_OTHERS].x, Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE,
&m_TextSize[LAYER_CLASS_OTHERS].x, pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE,
TEXTS_MAX_SIZE, MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_thickness",
&m_TextThickness[LAYER_CLASS_OTHERS], Millimeter2iu( DEFAULT_TEXT_WIDTH ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
&m_TextThickness[LAYER_CLASS_OTHERS], pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ),
pcbIUScale.mmToIU( 0.01 ), pcbIUScale.mmToIU( 5.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM<bool>( "defaults.other_text_italic",
&m_TextItalic[LAYER_CLASS_OTHERS], false ) );
@ -703,20 +703,20 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
m_params.emplace_back( new PARAM<int>( "defaults.dimensions.extension_offset",
&m_DimensionExtensionOffset,
Millimeter2iu( DEFAULT_DIMENSION_EXTENSION_OFFSET ) ) );
pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET ) ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
&m_defaultZoneSettings.m_ZoneClearance, Mils2iu( ZONE_CLEARANCE_MIL ),
Millimeter2iu( 0.0 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",
[&]() -> nlohmann::json
{
nlohmann::json ret =
{
{ "width", Iu2Millimeter( m_Pad_Master->GetSize().x ) },
{ "height", Iu2Millimeter( m_Pad_Master->GetSize().y ) },
{ "drill", Iu2Millimeter( m_Pad_Master->GetDrillSize().x ) }
{ "width", pcbIUScale.IUTomm( m_Pad_Master->GetSize().x ) },
{ "height", pcbIUScale.IUTomm( m_Pad_Master->GetSize().y ) },
{ "drill", pcbIUScale.IUTomm( m_Pad_Master->GetDrillSize().x ) }
};
return ret;
@ -727,23 +727,23 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&& aJson.contains( "drill" ) )
{
wxSize sz;
sz.SetWidth( Millimeter2iu( aJson["width"].get<double>() ) );
sz.SetHeight( Millimeter2iu( aJson["height"].get<double>() ) );
sz.SetWidth( pcbIUScale.mmToIU( aJson["width"].get<double>() ) );
sz.SetHeight( pcbIUScale.mmToIU( aJson["height"].get<double>() ) );
m_Pad_Master->SetSize( sz );
int drill = Millimeter2iu( aJson["drill"].get<double>() );
int drill = pcbIUScale.mmToIU( aJson["drill"].get<double>() );
m_Pad_Master->SetDrillSize( wxSize( drill, drill ) );
}
}, {} ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.max_error",
&m_MaxError, ARC_HIGH_DEF, Millimeter2iu( 0.0001 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
&m_MaxError, ARC_HIGH_DEF, pcbIUScale.mmToIU( 0.0001 ), pcbIUScale.mmToIU( 1.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_to_copper_clearance",
&m_SolderMaskToCopperClearance, Millimeter2iu( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE ),
Millimeter2iu( 0.0 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
&m_SolderMaskToCopperClearance, pcbIUScale.mmToIU( DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE ),
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), MM_PER_IU ) );
m_params.emplace_back( new PARAM<bool>( "zones_allow_external_fillets",
&m_ZoneKeepExternalFillets, false ) );
@ -1221,13 +1221,13 @@ int BOARD_DESIGN_SETTINGS::GetLayerClass( PCB_LAYER_ID aLayer ) const
int BOARD_DESIGN_SETTINGS::GetDRCEpsilon() const
{
return Millimeter2iu( ADVANCED_CFG::GetCfg().m_DRCEpsilon );
return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_DRCEpsilon );
}
int BOARD_DESIGN_SETTINGS::GetHolePlatingThickness() const
{
return Millimeter2iu( ADVANCED_CFG::GetCfg().m_HoleWallThickness );
return pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_HoleWallThickness );
}

View File

@ -75,7 +75,7 @@ bool BOARD_ITEM::IsLocked() const
STROKE_PARAMS BOARD_ITEM::GetStroke() const
{
wxCHECK( false, STROKE_PARAMS( Millimeter2iu( DEFAULT_LINE_WIDTH ) ) );
wxCHECK( false, STROKE_PARAMS( pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ) ) );
}

View File

@ -120,14 +120,14 @@ void BOARD_STACKUP_ITEM::RemoveDielectricPrms( int aDielectricPrmsIdx )
int BOARD_STACKUP_ITEM::GetCopperDefaultThickness()
{
// A reasonable thickness for copper layers:
return Millimeter2iu( 0.035 );
return pcbIUScale.mmToIU( 0.035 );
}
int BOARD_STACKUP_ITEM::GetMaskDefaultThickness()
{
// A reasonable thickness for solder mask:
return Millimeter2iu( 0.01 );
return pcbIUScale.mmToIU( 0.01 );
}
@ -500,7 +500,7 @@ void BOARD_STACKUP::BuildDefaultStackupList( const BOARD_DESIGN_SETTINGS* aSetti
if( aSettings == nullptr && aActiveCopperLayersCount > 0 )
activeCuLayerCount = aActiveCopperLayersCount;
int brd__thickness = aSettings ? aSettings->GetBoardThickness() : Millimeter2iu( 1.6 );
int brd__thickness = aSettings ? aSettings->GetBoardThickness() : pcbIUScale.mmToIU( 1.6 );
int diel_thickness = brd__thickness -
( BOARD_STACKUP_ITEM::GetCopperDefaultThickness() * activeCuLayerCount );

Some files were not shown because too many files have changed in this diff Show More