KiCad PCB EDA Suite
zone_filler.cpp File Reference
#include <cstdint>
#include <thread>
#include <mutex>
#include <algorithm>
#include <future>
#include <class_board.h>
#include <class_zone.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_drawsegment.h>
#include <class_track.h>
#include <class_pcb_text.h>
#include <class_pcb_target.h>
#include <connectivity/connectivity_data.h>
#include <board_commit.h>
#include <widgets/progress_reporter.h>
#include <geometry/shape_poly_set.h>
#include <geometry/shape_file_io.h>
#include <geometry/convex_hull.h>
#include <geometry/geometry_utils.h>
#include <confirm.h>
#include "zone_filler.h"
#include <advanced_config.h>

Go to the source code of this file.




#define SMOOTH_MIN_VAL_MM   0.02
#define SMOOTH_SMALL_VAL_MM   0.04


bool hasThermalConnection (D_PAD *pad, const ZONE_CONTAINER *aZone)
 Return true if the given pad has a thermal connection with the given zone. More...
static void setupDummyPadForHole (const D_PAD *aPad, D_PAD &aDummyPad)
 Setup aDummyPad to have the same size and shape of aPad's hole. More...


static const double s_RoundPadThermalSpokeAngle = 450
static const bool s_DumpZonesWhenFilling = false

Macro Definition Documentation


#define SMOOTH_MIN_VAL_MM   0.02


#define SMOOTH_SMALL_VAL_MM   0.04

Function Documentation

◆ hasThermalConnection()

bool hasThermalConnection ( D_PAD pad,

Return true if the given pad has a thermal connection with the given zone.

Definition at line 348 of file zone_filler.cpp.

349 {
350  // Rejects non-standard pads with tht-only thermal reliefs
351  if( aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL
352  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
353  {
354  return false;
355  }
357  if( aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THERMAL
358  && aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THT_THERMAL )
359  {
360  return false;
361  }
363  if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0 )
364  return false;
366  EDA_RECT item_boundingbox = pad->GetBoundingBox();
367  int thermalGap = aZone->GetThermalReliefGap( pad );
368  item_boundingbox.Inflate( thermalGap, thermalGap );
370  return item_boundingbox.Intersects( aZone->GetBoundingBox() );
371 }
int GetNetCode() const
Function GetNetCode.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:463
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:490
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
Thermal relief only for THT pads.
Definition: zones.h:55
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:852
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Use thermal relief for pads.
Definition: zones.h:53
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:227
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References D_PAD::GetAttribute(), ZONE_CONTAINER::GetBoundingBox(), D_PAD::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPadConnection(), ZONE_CONTAINER::GetThermalReliefGap(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), PAD_ATTRIB_STANDARD, PAD_ZONE_CONN_THERMAL, and PAD_ZONE_CONN_THT_THERMAL.

Referenced by ZONE_FILLER::buildThermalSpokes(), and ZONE_FILLER::knockoutThermalReliefs().

◆ setupDummyPadForHole()

static void setupDummyPadForHole ( const D_PAD aPad,
D_PAD aDummyPad 

Setup aDummyPad to have the same size and shape of aPad's hole.

This allows us to create thermal reliefs and clearances for holes using the pad code.

Definition at line 378 of file zone_filler.cpp.

379 {
380  aDummyPad.SetNetCode( aPad->GetNetCode() );
381  aDummyPad.SetSize( aPad->GetDrillSize() );
382  aDummyPad.SetOrientation( aPad->GetOrientation() );
385  aDummyPad.SetPosition( aPad->GetPosition() );
386 }
int GetNetCode() const
Function GetNetCode.
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:224
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:412
void SetSize(const wxSize &aSize)
Definition: class_pad.h:283
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:222
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
const wxPoint GetPosition() const override
Definition: class_pad.h:225

References D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), BOARD_CONNECTED_ITEM::GetNetCode(), D_PAD::GetOrientation(), D_PAD::GetPosition(), PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOrientation(), D_PAD::SetPosition(), D_PAD::SetShape(), and D_PAD::SetSize().

Referenced by ZONE_FILLER::buildCopperItemClearances(), and ZONE_FILLER::knockoutThermalReliefs().

Variable Documentation

◆ s_DumpZonesWhenFilling

const bool s_DumpZonesWhenFilling = false

Definition at line 79 of file zone_filler.cpp.

Referenced by ZONE_FILLER::computeRawFilledArea().

◆ s_RoundPadThermalSpokeAngle

const double s_RoundPadThermalSpokeAngle = 450

Definition at line 78 of file zone_filler.cpp.

Referenced by ZONE_FILLER::buildThermalSpokes().