Use standard KiCad abbreviations for TH and NPTH.

This commit is contained in:
Jeff Young 2023-09-20 14:27:57 +01:00
parent 7e70ceaa03
commit c0ce543464
5 changed files with 95 additions and 119 deletions

View File

@ -104,9 +104,9 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_boardBoundingBox.Reset();
m_throughHoleIds.Clear();
m_throughHoleOds.Clear();
m_throughHoleAnnularRings.Clear();
m_TH_IDs.Clear();
m_TH_ODs.Clear();
m_THAnnularRings.Clear();
m_copperLayersCount = 2;

View File

@ -247,8 +247,8 @@ public:
const BVH_CONTAINER_2D* GetPlatedPadsBack() const noexcept { return m_platedPadsBack; }
const MAP_CONTAINER_2D_BASE& GetLayerHoleMap() const noexcept { return m_layerHoleMap; }
const BVH_CONTAINER_2D& GetThroughHoleIds() const noexcept { return m_throughHoleIds; }
const BVH_CONTAINER_2D& GetThroughHoleOds() const noexcept { return m_throughHoleOds; }
const BVH_CONTAINER_2D& GetTH_IDs() const noexcept { return m_TH_IDs; }
const BVH_CONTAINER_2D& GetTH_ODs() const noexcept { return m_TH_ODs; }
/**
* Get through hole outside diameter 2D polygons.
@ -257,37 +257,37 @@ public:
*
* @return a container with through hold outside diameter 2D polygons.
*/
const SHAPE_POLY_SET& GetThroughHoleOdPolys() const noexcept
const SHAPE_POLY_SET& GetTH_ODPolys() const noexcept
{
return m_throughHoleOdPolys;
return m_TH_ODPolys;
}
const BVH_CONTAINER_2D& GetThroughHoleAnnularRings() const noexcept
const BVH_CONTAINER_2D& GetTHAnnularRings() const noexcept
{
return m_throughHoleAnnularRings;
return m_THAnnularRings;
}
const SHAPE_POLY_SET& GetThroughHoleAnnularRingPolys() const noexcept
const SHAPE_POLY_SET& GetTHAnnularRingPolys() const noexcept
{
return m_throughHoleAnnularRingPolys;
return m_THAnnularRingPolys;
}
const SHAPE_POLY_SET& GetOuterNonPlatedThroughHolePoly() const noexcept
const SHAPE_POLY_SET& GetNPTH_ODPolys() const noexcept
{
return m_nonPlatedThroughHoleOdPolys;
return m_NPTH_ODPolys;
}
/**
* @return a container with through hole via hole outside diameters.
*/
const BVH_CONTAINER_2D& GetThroughHoleViaOds() const noexcept
const BVH_CONTAINER_2D& GetViaTH_ODs() const noexcept
{
return m_throughHoleViaOds;
return m_viaTH_ODs;
}
const SHAPE_POLY_SET& GetThroughHoleViaOdPolys() const noexcept
const SHAPE_POLY_SET& GetViaTH_ODPolys() const noexcept
{
return m_throughHoleViaOdPolys;
return m_viaTH_ODPolys;
}
unsigned int GetViaCount() const noexcept { return m_viaCount; }
@ -444,10 +444,10 @@ private:
MAP_POLY m_layerHoleOdPolys; ///< Hole outer diameters (per layer)
MAP_POLY m_layerHoleIdPolys; ///< Hole inner diameters (per layer)
SHAPE_POLY_SET m_nonPlatedThroughHoleOdPolys; ///< NPTH outer diameters
SHAPE_POLY_SET m_throughHoleOdPolys; ///< PTH outer diameters
SHAPE_POLY_SET m_throughHoleViaOdPolys; ///< Via hole outer diameters
SHAPE_POLY_SET m_throughHoleAnnularRingPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_NPTH_ODPolys; ///< NPTH outer diameters
SHAPE_POLY_SET m_TH_ODPolys; ///< PTH outer diameters
SHAPE_POLY_SET m_viaTH_ODPolys; ///< Via hole outer diameters
SHAPE_POLY_SET m_THAnnularRingPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
@ -457,10 +457,10 @@ private:
BVH_CONTAINER_2D* m_platedPadsFront;
BVH_CONTAINER_2D* m_platedPadsBack;
BVH_CONTAINER_2D m_throughHoleOds; ///< List of PTH outer diameters
BVH_CONTAINER_2D m_throughHoleIds; ///< List of PTH inner diameters
BVH_CONTAINER_2D m_throughHoleAnnularRings; ///< List of via annular rings
BVH_CONTAINER_2D m_throughHoleViaOds; ///< List of via hole outer diameters
BVH_CONTAINER_2D m_TH_ODs; ///< List of PTH outer diameters
BVH_CONTAINER_2D m_TH_IDs; ///< List of PTH inner diameters
BVH_CONTAINER_2D m_THAnnularRings; ///< List of via annular rings
BVH_CONTAINER_2D m_viaTH_ODs; ///< List of via hole outer diameters
BVH_CONTAINER_2D m_throughHoleViaIds; ///< List of via hole inner diameters
unsigned int m_copperLayersCount;

View File

@ -109,16 +109,16 @@ void BOARD_ADAPTER::destroyLayers()
m_layerHoleMap.clear();
}
m_throughHoleIds.Clear();
m_throughHoleOds.Clear();
m_throughHoleAnnularRings.Clear();
m_throughHoleViaOds.Clear();
m_TH_IDs.Clear();
m_TH_ODs.Clear();
m_THAnnularRings.Clear();
m_viaTH_ODs.Clear();
m_throughHoleViaIds.Clear();
m_nonPlatedThroughHoleOdPolys.RemoveAllContours();
m_throughHoleOdPolys.RemoveAllContours();
m_NPTH_ODPolys.RemoveAllContours();
m_TH_ODPolys.RemoveAllContours();
m_throughHoleViaOdPolys.RemoveAllContours();
m_throughHoleAnnularRingPolys.RemoveAllContours();
m_viaTH_ODPolys.RemoveAllContours();
m_THAnnularRingPolys.RemoveAllContours();
}
@ -307,25 +307,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
else if( layer == layer_ids[0] ) // it only adds once the THT holes
{
// Add through hole object
m_throughHoleOds.Add( new FILLED_CIRCLE_2D( via_center,
hole_inner_radius + thickness,
m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
*track ) );
m_throughHoleViaOds.Add( new FILLED_CIRCLE_2D( via_center,
hole_inner_radius + thickness,
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
*track ) );
if( m_Cfg->m_Render.clip_silk_on_via_annulus && ring_radius > 0.0 )
{
m_throughHoleAnnularRings.Add( new FILLED_CIRCLE_2D( via_center,
ring_radius,
m_THAnnularRings.Add( new FILLED_CIRCLE_2D( via_center, ring_radius,
*track ) );
}
if( hole_inner_radius > 0.0 )
{
m_throughHoleIds.Add( new FILLED_CIRCLE_2D( via_center,
hole_inner_radius,
*track ) );
m_TH_IDs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius, *track ) );
}
}
}
@ -397,16 +392,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
const int hole_outer_ring_radius = via->GetWidth() / 2.0f;
// Add through hole contours
TransformCircleToPolygon( m_throughHoleOdPolys, via->GetStart(),
hole_outer_radius, maxError, ERROR_INSIDE );
TransformCircleToPolygon( m_TH_ODPolys, via->GetStart(), hole_outer_radius,
maxError, ERROR_INSIDE );
// Add same thing for vias only
TransformCircleToPolygon( m_throughHoleViaOdPolys, via->GetStart(),
hole_outer_radius, maxError, ERROR_INSIDE );
TransformCircleToPolygon( m_viaTH_ODPolys, via->GetStart(), hole_outer_radius,
maxError, ERROR_INSIDE );
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
{
TransformCircleToPolygon( m_throughHoleAnnularRingPolys, via->GetStart(),
TransformCircleToPolygon( m_THAnnularRingPolys, via->GetStart(),
hole_outer_ring_radius, maxError, ERROR_INSIDE );
}
}
@ -464,12 +459,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_averageHoleDiameter += ( ( pad->GetDrillSize().x +
pad->GetDrillSize().y ) / 2.0f ) * m_biuTo3Dunits;
createPadWithHole( pad, &m_throughHoleOds, inflate );
createPadWithHole( pad, &m_TH_ODs, inflate );
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
createPadWithHole( pad, &m_throughHoleAnnularRings, inflate );
createPadWithHole( pad, &m_THAnnularRings, inflate );
createPadWithHole( pad, &m_throughHoleIds, 0 );
createPadWithHole( pad, &m_TH_IDs, 0 );
}
}
@ -492,25 +487,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( pad->GetAttribute () != PAD_ATTRIB::NPTH )
{
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
{
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, inflate, maxError,
ERROR_INSIDE );
}
pad->TransformHoleToPolygon( m_THAnnularRingPolys, inflate, maxError, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_throughHoleOdPolys, inflate, maxError,
ERROR_INSIDE );
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, maxError, ERROR_INSIDE );
}
else
{
// If not plated, no copper.
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
{
pad->TransformHoleToPolygon( m_throughHoleAnnularRingPolys, 0, maxError,
ERROR_INSIDE );
}
pad->TransformHoleToPolygon( m_THAnnularRingPolys, 0, maxError, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_nonPlatedThroughHoleOdPolys, 0, maxError,
ERROR_INSIDE );
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, maxError, ERROR_INSIDE );
}
}
}
@ -852,10 +839,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// End Build Copper layers
// This will make a union of all added contours
m_throughHoleOdPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_nonPlatedThroughHoleOdPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_throughHoleViaOdPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_throughHoleAnnularRingPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_TH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_NPTH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_viaTH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_THAnnularRingPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
// Build Tech layers
// Based on:
@ -1089,9 +1076,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( aStatusReporter )
aStatusReporter->Report( _( "Build BVH for holes and vias" ) );
m_throughHoleIds.BuildBVH();
m_throughHoleOds.BuildBVH();
m_throughHoleAnnularRings.BuildBVH();
m_TH_IDs.BuildBVH();
m_TH_ODs.BuildBVH();
m_THAnnularRings.BuildBVH();
if( !m_layerHoleMap.empty() )
{

View File

@ -464,7 +464,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
aStatusReporter->Report( _( "Load OpenGL: board" ) );
// Create Board
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetThroughHoleIds() );
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetTH_IDs() );
m_antiBoardPolys.RemoveAllContours();
m_antiBoardPolys.NewOutline();
@ -479,10 +479,8 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
m_antiBoard = createBoard( m_antiBoardPolys );
SHAPE_POLY_SET board_poly_with_holes = m_boardAdapter.GetBoardPoly().CloneDropTriangulation();
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
m_boardWithHoles = createBoard( board_poly_with_holes );
@ -493,24 +491,22 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( aStatusReporter )
aStatusReporter->Report( _( "Load OpenGL: holes and vias" ) );
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetThroughHoleOdPolys().CloneDropTriangulation();
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetTH_ODPolys().CloneDropTriangulation();
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_outerThroughHoles = generateHoles( m_boardAdapter.GetThroughHoleOds().GetList(),
outerPolyTHT, 1.0f, 0.0f, false,
&m_boardAdapter.GetThroughHoleIds() );
m_outerThroughHoles = generateHoles( m_boardAdapter.GetTH_ODs().GetList(), outerPolyTHT,
1.0f, 0.0f, false, &m_boardAdapter.GetTH_IDs() );
m_outerViaThroughHoles = generateHoles(
m_boardAdapter.GetThroughHoleViaOds().GetList(),
m_boardAdapter.GetThroughHoleViaOdPolys(), 1.0f, 0.0f, false );
m_outerViaThroughHoles = generateHoles( m_boardAdapter.GetViaTH_ODs().GetList(),
m_boardAdapter.GetViaTH_ODPolys(), 1.0f, 0.0f, false );
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus )
{
m_outerThroughHoleRings = generateHoles(
m_boardAdapter.GetThroughHoleAnnularRings().GetList(),
m_boardAdapter.GetThroughHoleAnnularRingPolys(), 1.0f, 0.0f, false );
m_outerThroughHoleRings = generateHoles( m_boardAdapter.GetTHAnnularRings().GetList(),
m_boardAdapter.GetTHAnnularRingPolys(),
1.0f, 0.0f, false );
}
const MAP_POLY& innerMapHoles = m_boardAdapter.GetHoleIdPolysMap();
@ -592,9 +588,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( layer_id != B_Mask && layer_id != F_Mask )
{
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(),
SHAPE_POLY_SET::PM_FAST );
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(),
SHAPE_POLY_SET::PM_FAST );
}
@ -616,7 +612,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
}
OPENGL_RENDER_LIST* oglList = generateLayerList( container2d, polyList, layer_id,
&m_boardAdapter.GetThroughHoleIds() );
&m_boardAdapter.GetTH_IDs() );
if( oglList != nullptr )
m_layers[layer_id] = oglList;
@ -631,12 +627,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( frontPlatedPadPolys )
{
SHAPE_POLY_SET polySubtracted = frontPlatedPadPolys->CloneDropTriangulation();
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(),
&polySubtracted, F_Cu );
@ -649,12 +642,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( backPlatedPadPolys )
{
SHAPE_POLY_SET polySubtracted = backPlatedPadPolys->CloneDropTriangulation();
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
polySubtracted.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
m_platedPadsBack = generateLayerList( m_boardAdapter.GetPlatedPadsBack(),
&polySubtracted, B_Cu );

View File

@ -276,8 +276,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
const BVH_CONTAINER_2D& throughHoleOuter =
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& ( aLayer_id == B_SilkS || aLayer_id == F_SilkS ) ?
m_boardAdapter.GetThroughHoleAnnularRings() :
m_boardAdapter.GetThroughHoleOds();
m_boardAdapter.GetTHAnnularRings() :
m_boardAdapter.GetTH_ODs();
if( !throughHoleOuter.GetList().empty() )
{
@ -444,9 +444,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
// Check if there are any THT that intersects this outline object part
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
{
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
CONST_LIST_OBJECT2D intersecting;
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
@ -510,9 +510,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
// a polygon or dummy block) it will cut also the render of the hole.
// So this will add a full hole.
// In fact, that is not need if the hole have copper.
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
{
const LIST_OBJECT2D& holeList = m_boardAdapter.GetThroughHoleOds().GetList();
const LIST_OBJECT2D& holeList = m_boardAdapter.GetTH_ODs().GetList();
for( const OBJECT_2D* hole2d : holeList )
{
@ -702,9 +702,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
// Check if there are any THT that intersects this outline object part
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
{
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
CONST_LIST_OBJECT2D intersecting;
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
@ -1115,12 +1115,11 @@ void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
// Check if there are any other THT that intersects this hole
// It will use the non inflated holes
if( !m_boardAdapter.GetThroughHoleIds().GetList().empty() )
if( !m_boardAdapter.GetTH_IDs().GetList().empty() )
{
CONST_LIST_OBJECT2D intersecting;
m_boardAdapter.GetThroughHoleIds().GetIntersectingObjects( object2d_A->GetBBox(),
intersecting );
m_boardAdapter.GetTH_IDs().GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
for( const OBJECT_2D* hole2d : intersecting )
{