KiCad PCB EDA Suite
ar_autoplacer.cpp File Reference
#include <confirm.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <widgets/msgpanel.h>
#include <board.h>
#include <footprint.h>
#include <track.h>
#include <pcb_shape.h>
#include <pad.h>
#include <board_commit.h>
#include <connectivity/connectivity_data.h>
#include <widgets/progress_reporter.h>
#include "ar_autoplacer.h"
#include "ar_matrix.h"
#include <memory>
#include <ratsnest/ratsnest_data.h>

Go to the source code of this file.

Macros

#define AR_GAIN   16
 
#define AR_KEEPOUT_MARGIN   500
 
#define AR_ABORT_PLACEMENT   -1
 
#define STEP_AR_MM   1.0
 
#define CELL_IS_EMPTY   0x00
 
#define CELL_IS_HOLE   0x01 /* a conducting hole or obstacle */
 
#define CELL_IS_MODULE   0x02 /* auto placement occupied by a footprint */
 
#define CELL_IS_EDGE   0x20 /* Area and auto-placement: limiting cell contour (Board, Zone) */
 
#define CELL_IS_FRIEND   0x40 /* Area and auto-placement: cell part of the net */
 
#define CELL_IS_ZONE   0x80 /* Area and auto-placement: cell available */
 

Functions

static bool sortFootprintsByComplexity (FOOTPRINT *ref, FOOTPRINT *compare)
 
static bool sortFootprintsByRatsnestSize (FOOTPRINT *ref, FOOTPRINT *compare)
 

Variables

static const double OrientationPenalty [11]
 

Macro Definition Documentation

◆ AR_ABORT_PLACEMENT

#define AR_ABORT_PLACEMENT   -1

Definition at line 48 of file ar_autoplacer.cpp.

◆ AR_GAIN

#define AR_GAIN   16

Definition at line 46 of file ar_autoplacer.cpp.

◆ AR_KEEPOUT_MARGIN

#define AR_KEEPOUT_MARGIN   500

Definition at line 47 of file ar_autoplacer.cpp.

◆ CELL_IS_EDGE

#define CELL_IS_EDGE   0x20 /* Area and auto-placement: limiting cell contour (Board, Zone) */

Definition at line 56 of file ar_autoplacer.cpp.

◆ CELL_IS_EMPTY

#define CELL_IS_EMPTY   0x00

Definition at line 53 of file ar_autoplacer.cpp.

◆ CELL_IS_FRIEND

#define CELL_IS_FRIEND   0x40 /* Area and auto-placement: cell part of the net */

Definition at line 57 of file ar_autoplacer.cpp.

◆ CELL_IS_HOLE

#define CELL_IS_HOLE   0x01 /* a conducting hole or obstacle */

Definition at line 54 of file ar_autoplacer.cpp.

◆ CELL_IS_MODULE

#define CELL_IS_MODULE   0x02 /* auto placement occupied by a footprint */

Definition at line 55 of file ar_autoplacer.cpp.

◆ CELL_IS_ZONE

#define CELL_IS_ZONE   0x80 /* Area and auto-placement: cell available */

Definition at line 58 of file ar_autoplacer.cpp.

◆ STEP_AR_MM

#define STEP_AR_MM   1.0

Definition at line 50 of file ar_autoplacer.cpp.

Function Documentation

◆ sortFootprintsByComplexity()

static bool sortFootprintsByComplexity ( FOOTPRINT ref,
FOOTPRINT compare 
)
static

Definition at line 761 of file ar_autoplacer.cpp.

762 {
763  double ff1, ff2;
764 
765  ff1 = ref->GetArea() * ref->GetPadCount();
766  ff2 = compare->GetArea() * compare->GetPadCount();
767 
768  return ff2 < ff1;
769 }
double GetArea(int aPadding=0) const
Definition: footprint.cpp:571
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
GetPadCount returns the number of pads.
Definition: footprint.cpp:893

References FOOTPRINT::GetArea(), and FOOTPRINT::GetPadCount().

Referenced by AR_AUTOPLACER::pickFootprint().

◆ sortFootprintsByRatsnestSize()

static bool sortFootprintsByRatsnestSize ( FOOTPRINT ref,
FOOTPRINT compare 
)
static

Definition at line 772 of file ar_autoplacer.cpp.

773 {
774  double ff1, ff2;
775 
776  ff1 = ref->GetArea() * ref->GetFlag();
777  ff2 = compare->GetArea() * compare->GetFlag();
778  return ff2 < ff1;
779 }
double GetArea(int aPadding=0) const
Definition: footprint.cpp:571
int GetFlag() const
Definition: footprint.h:254

References FOOTPRINT::GetArea(), and FOOTPRINT::GetFlag().

Referenced by AR_AUTOPLACER::pickFootprint().

Variable Documentation

◆ OrientationPenalty

const double OrientationPenalty[11]
static
Initial value:
=
{
2.0,
1.9,
1.8,
1.7,
1.6,
1.5,
1.4,
1.3,
1.2,
1.1,
1.0
}

Definition at line 64 of file ar_autoplacer.cpp.

Referenced by AR_AUTOPLACER::AutoplaceFootprints().