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 <convert_to_biu.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 346 of file zone_filler.cpp.

347 {
348  // Rejects non-standard pads with tht-only thermal reliefs
349  if( aZone->GetPadConnection( pad ) == PAD_ZONE_CONN_THT_THERMAL
350  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
351  {
352  return false;
353  }
355  if( aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THERMAL
356  && aZone->GetPadConnection( pad ) != PAD_ZONE_CONN_THT_THERMAL )
357  {
358  return false;
359  }
361  if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0 )
362  return false;
364  EDA_RECT item_boundingbox = pad->GetBoundingBox();
365  int thermalGap = aZone->GetThermalReliefGap( pad );
366  item_boundingbox.Inflate( thermalGap, thermalGap );
368  return item_boundingbox.Intersects( aZone->GetBoundingBox() );
369 }
int GetNetCode() const
Function GetNetCode.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:496
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:523
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:883
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 376 of file zone_filler.cpp.

377 {
378  aDummyPad.SetNetCode( aPad->GetNetCode() );
379  aDummyPad.SetSize( aPad->GetDrillSize() );
380  aDummyPad.SetOrientation( aPad->GetOrientation() );
383  aDummyPad.SetPosition( aPad->GetPosition() );
384 }
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 80 of file zone_filler.cpp.

Referenced by ZONE_FILLER::computeRawFilledArea().

◆ s_RoundPadThermalSpokeAngle

const double s_RoundPadThermalSpokeAngle = 450

Definition at line 79 of file zone_filler.cpp.

Referenced by ZONE_FILLER::buildThermalSpokes().