KiCad PCB EDA Suite
zone_filler.cpp File Reference
#include <thread>
#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_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 "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 345 of file zone_filler.cpp.

346 {
347  // Rejects non-standard pads with tht-only thermal reliefs
349  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
350  {
351  return false;
352  }
354  if( aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THERMAL
355  && aZone->GetPadConnection( pad ) != ZONE_CONNECTION::THT_THERMAL )
356  {
357  return false;
358  }
360  if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0 )
361  return false;
363  EDA_RECT item_boundingbox = pad->GetBoundingBox();
364  int thermalGap = aZone->GetThermalReliefGap( pad );
365  item_boundingbox.Inflate( thermalGap, thermalGap );
367  return item_boundingbox.Intersects( aZone->GetBoundingBox() );
368 }
int GetNetCode() const
Function GetNetCode.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:506
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:533
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:449
ZONE_CONNECTION GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:879
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 returns the orthogonal, bounding box of this object for display purposes.
Definition: class_pad.cpp:229
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 375 of file zone_filler.cpp.

376 {
377  aDummyPad.SetNetCode( aPad->GetNetCode() );
378  aDummyPad.SetSize( aPad->GetDrillSize() );
379  aDummyPad.SetOrientation( aPad->GetOrientation() );
382  aDummyPad.SetPosition( aPad->GetPosition() );
383 }
int GetNetCode() const
Function GetNetCode.
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:240
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:432
void SetSize(const wxSize &aSize)
Definition: class_pad.h:299
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:426
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:238
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:438
const wxPoint GetPosition() const override
Definition: class_pad.h:241

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

Referenced by ZONE_FILLER::computeRawFilledArea().

◆ s_RoundPadThermalSpokeAngle

const double s_RoundPadThermalSpokeAngle = 450

Definition at line 73 of file zone_filler.cpp.

Referenced by ZONE_FILLER::buildThermalSpokes().