CADSTAR PCB Archive Loader: Fix loading of zero sized pads

Some CADSTAR designs use zero sized pads because CADSTAR did not allow
arbitrarily assigning pad numbers: they had to be sequential. The
workaround to this was to use zero sized pads. However this causes DRC
errors in KiCad, so we load them just in a mask layer.
This commit is contained in:
Roberto Fernandez Bautista 2021-02-08 20:30:57 +00:00 committed by Wayne Stambaugh
parent aabe9c063f
commit 19d786852a
1 changed files with 16 additions and 1 deletions

View File

@ -780,7 +780,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
break;
case PAD_SIDE::THROUGH_HOLE:
if( csPadcode.Plated )
pad->SetAttribute( PAD_ATTR_T::PAD_ATTRIB_PTH );
else
@ -799,8 +798,20 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
aCadstarPad.Identifier );
if( csPadcode.Shape.Size == 0 )
{
if( csPadcode.DrillDiameter == UNDEFINED_VALUE
&& aCadstarPad.Side == PAD_SIDE::THROUGH_HOLE )
{
// Through-hole, zero sized pad?. Lets load this just on the F_Mask for now to
// prevent DRC errors.
// TODO: This could be a custom padstack, update when KiCad supports padstacks
pad->SetAttribute( PAD_ATTR_T::PAD_ATTRIB_SMD );
pad->SetLayerSet( LSET( 1, F_Mask ) );
}
// zero sized pads seems to break KiCad so lets make it very small instead
csPadcode.Shape.Size = 1;
}
wxPoint padOffset = { 0, 0 }; // offset of the pad origin (before rotating)
wxPoint drillOffset = { 0, 0 }; // offset of the drill origin w.r.t. the pad (before rotating)
@ -928,6 +939,10 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
drillOffset.x = -getKiCadLength( csPadcode.DrillXoffset );
drillOffset.y = getKiCadLength( csPadcode.DrillYoffset );
}
else
{
pad->SetDrillSize( { 0, 0 } );
}
if( csPadcode.SlotOrientation != 0 )