KiCad PCB EDA Suite
zone_filler.cpp File Reference
#include <thread>
#include <algorithm>
#include <future>
#include <advanced_config.h>
#include <class_board.h>
#include <class_zone.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_drawsegment.h>
#include <class_pcb_text.h>
#include <class_pcb_target.h>
#include <class_track.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 <math/util.h>
#include <convert_basic_shapes_to_polygon.h>
#include "zone_filler.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 435 of file zone_filler.cpp.

436 {
437  // Rejects non-standard pads with tht-only thermal reliefs
439  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
440  {
441  return false;
442  }
444  if( aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THERMAL
445  && aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THT_THERMAL )
446  {
447  return false;
448  }
450  if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0 )
451  return false;
453  EDA_RECT item_boundingbox = pad->GetBoundingBox();
454  int thermalGap = aZone->GetThermalReliefGap( pad );
455  item_boundingbox.Inflate( thermalGap, thermalGap );
457  return item_boundingbox.Intersects( aZone->GetBoundingBox() );
458 }
int GetNetCode() const
Function GetNetCode.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:311
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:321
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:338
ZONE_CONNECTION GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:818
Thermal relief only for THT pads.
Use thermal relief for pads.
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.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox The bounding box is cached, so this will be efficient most of the time.
Definition: class_pad.cpp:426
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, THERMAL, and 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 465 of file zone_filler.cpp.

466 {
467  aDummyPad.SetNetCode( aPad->GetNetCode() );
468  aDummyPad.SetSize( aPad->GetDrillSize() );
469  aDummyPad.SetOrientation( aPad->GetOrientation() );
472  aDummyPad.SetPosition( aPad->GetPosition() );
473 }
int GetNetCode() const
Function GetNetCode.
wxPoint GetPosition() const override
Definition: class_pad.h:165
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:330
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:325
const wxSize & GetDrillSize() const
Definition: class_pad.h:230
void SetShape(PAD_SHAPE_T aShape)
Set the new shape of this pad.
Definition: class_pad.h:148
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:485

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

Referenced by ZONE_FILLER::computeRawFilledArea().

◆ s_RoundPadThermalSpokeAngle

const double s_RoundPadThermalSpokeAngle = 450

Definition at line 75 of file zone_filler.cpp.

Referenced by ZONE_FILLER::buildThermalSpokes().