KiCad PCB EDA Suite
Loading...
Searching...
No Matches
AR_AUTOPLACER Class Reference

#include <ar_autoplacer.h>

Public Member Functions

 AR_AUTOPLACER (BOARD *aBoard)
 
AR_RESULT AutoplaceFootprints (std::vector< FOOTPRINT * > &aFootprints, BOARD_COMMIT *aCommit, bool aPlaceOffboardModules=false)
 
void SetOverlay (std::shared_ptr< KIGFX::VIEW_OVERLAY > aOverlay)
 Set a VIEW overlay to draw items during a autoplace session.
 
void SetRefreshCallback (std::function< int(FOOTPRINT *aFootprint)> aCallback)
 Callback to redraw on screen the view after changes, for instance after moving a footprint.
 
void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 

Private Member Functions

void drawPlacementRoutingMatrix ()
 
int genPlacementRoutingMatrix ()
 
bool fillMatrix ()
 Fill m_matrix cells from m_boardShape.
 
void genModuleOnRoutingMatrix (FOOTPRINT *aFootprint)
 
int testRectangle (const BOX2I &aRect, int side)
 
unsigned int calculateKeepOutArea (const BOX2I &aRect, int side)
 
int testFootprintOnBoard (FOOTPRINT *aFootprint, bool TstOtherSide, const VECTOR2I &aOffset)
 
int getOptimalFPPlacement (FOOTPRINT *aFootprint)
 
double computePlacementRatsnestCost (FOOTPRINT *aFootprint, const VECTOR2I &aOffset)
 
FOOTPRINTpickFootprint ()
 Find the "best" footprint place.
 
void placeFootprint (FOOTPRINT *aFootprint, bool aDoNotRecreateRatsnest, const VECTOR2I &aPos)
 
const PADnearestPad (FOOTPRINT *aRefFP, PAD *aRefPad, const VECTOR2I &aOffset)
 
void addFpBody (const VECTOR2I &aStart, const VECTOR2I &aEnd, LSET aLayerMask)
 
void addPad (PAD *aPad, int aClearance)
 
void buildFpAreas (FOOTPRINT *aFootprint, int aFpClearance)
 

Private Attributes

AR_MATRIX m_matrix
 
SHAPE_POLY_SET m_topFreeArea
 
SHAPE_POLY_SET m_bottomFreeArea
 
SHAPE_POLY_SET m_boardShape
 
SHAPE_POLY_SET m_fpAreaTop
 
SHAPE_POLY_SET m_fpAreaBottom
 
BOARDm_board
 
VECTOR2I m_curPosition
 
double m_minCost
 
int m_gridSize
 
std::shared_ptr< KIGFX::VIEW_OVERLAYm_overlay
 
std::unique_ptr< CONNECTIVITY_DATAm_connectivity
 
std::function< int(FOOTPRINT *aFootprint)> m_refreshCallback
 
PROGRESS_REPORTERm_progressReporter
 

Detailed Description

Definition at line 57 of file ar_autoplacer.h.

Constructor & Destructor Documentation

◆ AR_AUTOPLACER()

AR_AUTOPLACER::AR_AUTOPLACER ( BOARD aBoard)

Member Function Documentation

◆ addFpBody()

void AR_AUTOPLACER::addFpBody ( const VECTOR2I aStart,
const VECTOR2I aEnd,
LSET  aLayerMask 
)
private

◆ addPad()

◆ AutoplaceFootprints()

◆ buildFpAreas()

◆ calculateKeepOutArea()

unsigned int AR_AUTOPLACER::calculateKeepOutArea ( const BOX2I aRect,
int  side 
)
private

◆ computePlacementRatsnestCost()

double AR_AUTOPLACER::computePlacementRatsnestCost ( FOOTPRINT aFootprint,
const VECTOR2I aOffset 
)
private

◆ drawPlacementRoutingMatrix()

void AR_AUTOPLACER::drawPlacementRoutingMatrix ( )
private

◆ fillMatrix()

◆ genModuleOnRoutingMatrix()

◆ genPlacementRoutingMatrix()

◆ getOptimalFPPlacement()

◆ nearestPad()

const PAD * AR_AUTOPLACER::nearestPad ( FOOTPRINT aRefFP,
PAD aRefPad,
const VECTOR2I aOffset 
)
private

◆ pickFootprint()

FOOTPRINT * AR_AUTOPLACER::pickFootprint ( )
private

Find the "best" footprint place.

The criteria are:

  • Maximum ratsnest with footprints already placed
  • Max size, and number of pads max

Definition at line 735 of file ar_autoplacer.cpp.

References BOARD::Footprints(), FOOTPRINT::GetFlag(), m_board, m_connectivity, FOOTPRINT::NeedsPlaced(), FOOTPRINT::SetFlag(), sortFootprintsByComplexity(), and sortFootprintsByRatsnestSize().

Referenced by AutoplaceFootprints().

◆ placeFootprint()

void AR_AUTOPLACER::placeFootprint ( FOOTPRINT aFootprint,
bool  aDoNotRecreateRatsnest,
const VECTOR2I aPos 
)
private

Definition at line 74 of file ar_autoplacer.cpp.

References m_connectivity, and FOOTPRINT::SetPosition().

Referenced by AutoplaceFootprints().

◆ SetOverlay()

void AR_AUTOPLACER::SetOverlay ( std::shared_ptr< KIGFX::VIEW_OVERLAY aOverlay)
inline

Set a VIEW overlay to draw items during a autoplace session.

Definition at line 68 of file ar_autoplacer.h.

References m_overlay.

Referenced by AUTOPLACE_TOOL::autoplace().

◆ SetProgressReporter()

void AR_AUTOPLACER::SetProgressReporter ( PROGRESS_REPORTER aReporter)
inline

Definition at line 81 of file ar_autoplacer.h.

References m_progressReporter.

Referenced by AUTOPLACE_TOOL::autoplace().

◆ SetRefreshCallback()

void AR_AUTOPLACER::SetRefreshCallback ( std::function< int(FOOTPRINT *aFootprint)>  aCallback)
inline

Callback to redraw on screen the view after changes, for instance after moving a footprint.

Definition at line 76 of file ar_autoplacer.h.

References m_refreshCallback.

Referenced by AUTOPLACE_TOOL::autoplace().

◆ testFootprintOnBoard()

int AR_AUTOPLACER::testFootprintOnBoard ( FOOTPRINT aFootprint,
bool  TstOtherSide,
const VECTOR2I aOffset 
)
private

◆ testRectangle()

Member Data Documentation

◆ m_board

BOARD* AR_AUTOPLACER::m_board
private

◆ m_boardShape

SHAPE_POLY_SET AR_AUTOPLACER::m_boardShape
private

Definition at line 128 of file ar_autoplacer.h.

Referenced by fillMatrix(), and genPlacementRoutingMatrix().

◆ m_bottomFreeArea

SHAPE_POLY_SET AR_AUTOPLACER::m_bottomFreeArea
private

◆ m_connectivity

std::unique_ptr<CONNECTIVITY_DATA> AR_AUTOPLACER::m_connectivity
private

Definition at line 141 of file ar_autoplacer.h.

Referenced by AR_AUTOPLACER(), pickFootprint(), and placeFootprint().

◆ m_curPosition

VECTOR2I AR_AUTOPLACER::m_curPosition
private

Definition at line 136 of file ar_autoplacer.h.

Referenced by AutoplaceFootprints(), and getOptimalFPPlacement().

◆ m_fpAreaBottom

SHAPE_POLY_SET AR_AUTOPLACER::m_fpAreaBottom
private

Definition at line 131 of file ar_autoplacer.h.

Referenced by addFpBody(), addPad(), buildFpAreas(), and genModuleOnRoutingMatrix().

◆ m_fpAreaTop

SHAPE_POLY_SET AR_AUTOPLACER::m_fpAreaTop
private

Definition at line 129 of file ar_autoplacer.h.

Referenced by addFpBody(), addPad(), buildFpAreas(), and genModuleOnRoutingMatrix().

◆ m_gridSize

int AR_AUTOPLACER::m_gridSize
private

Definition at line 138 of file ar_autoplacer.h.

Referenced by AR_AUTOPLACER(), and AutoplaceFootprints().

◆ m_matrix

◆ m_minCost

double AR_AUTOPLACER::m_minCost
private

Definition at line 137 of file ar_autoplacer.h.

Referenced by AR_AUTOPLACER(), and getOptimalFPPlacement().

◆ m_overlay

std::shared_ptr<KIGFX::VIEW_OVERLAY> AR_AUTOPLACER::m_overlay
private

Definition at line 140 of file ar_autoplacer.h.

Referenced by drawPlacementRoutingMatrix(), and SetOverlay().

◆ m_progressReporter

PROGRESS_REPORTER* AR_AUTOPLACER::m_progressReporter
private

Definition at line 143 of file ar_autoplacer.h.

Referenced by AR_AUTOPLACER(), AutoplaceFootprints(), and SetProgressReporter().

◆ m_refreshCallback

std::function<int( FOOTPRINT* aFootprint )> AR_AUTOPLACER::m_refreshCallback
private

Definition at line 142 of file ar_autoplacer.h.

Referenced by AR_AUTOPLACER(), AutoplaceFootprints(), and SetRefreshCallback().

◆ m_topFreeArea

SHAPE_POLY_SET AR_AUTOPLACER::m_topFreeArea
private

The documentation for this class was generated from the following files: