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

Builds a KiCad board from a parsed TARGET 3001! More...

#include <target3001_pcb_builder.h>

Classes

struct  POUR_AREA
 

Public Member Functions

 TARGET3001_PCB_BUILDER (BOARD *aBoard, const TARGET3001::PROJECT &aProject, REPORTER *aReporter)
 
void Build ()
 
const wxString & DesignRules () const
 Custom rules that carry what KiCad cannot store on the items themselves, empty when none apply.
 
TARGET3001::LAYER_FUNCTION LayerFunction (int aLayer) const
 Function of a TARGET 3001! board layer in this project.
 

Private Member Functions

void buildLayerMap ()
 
void buildNets ()
 
void buildComponents ()
 
void buildSignalCopper ()
 
void buildAreaSpokes (const std::vector< const TARGET3001::ELEMENT * > &aSpokes)
 Turn the spokes an old style area stores into thermal reliefs on the pads they start in.
 
void buildFreeItems ()
 
void buildPourAreas ()
 
void buildPolygonPours ()
 
void buildThermalGaps ()
 Thermal gaps the stored fill leaves around spoked pads, as zone defaults and pad or footprint overrides.
 
void addFootprint (const TARGET3001::ELEMENT &aComponent)
 
void addItem (const TARGET3001::ELEMENT &aElem, BOARD_ITEM_CONTAINER *aParent, FOOTPRINT *aFootprint, bool aIsTrack)
 Add one board element to aParent; footprint items are passed with their footprint.
 
void addShape (const TARGET3001::ELEMENT &aElem, BOARD_ITEM_CONTAINER *aParent, FOOTPRINT *aFootprint, bool aIsTrack, PCB_LAYER_ID aLayer)
 Add the graphic or track form of aElem on one KiCad layer.
 
std::vector< std::unique_ptr< PCB_SHAPE > > fiducialShapes (const TARGET3001::ELEMENT &aElem, BOARD_ITEM_CONTAINER *aParent) const
 Strokes and discs that draw a fiducial mark, not yet assigned a layer.
 
void addPad (const TARGET3001::ELEMENT &aElem, FOOTPRINT *aFootprint)
 
void addVia (const TARGET3001::ELEMENT &aElem)
 
void addText (const TARGET3001::ELEMENT &aElem, BOARD_ITEM_CONTAINER *aParent, FOOTPRINT *aFootprint, PCB_LAYER_ID aLayer)
 
void configureText (PCB_TEXT *aText, const TARGET3001::ELEMENT &aElem, PCB_LAYER_ID aLayer)
 
std::optional< PCB_LAYER_ID > mapLayer (int aLayer) const
 Copper or graphic layer for a board element, if KiCad has a place for it.
 
std::optional< PCB_LAYER_ID > pourCopperLayer (int aLayer) const
 Copper layer that an area or deletion layer applies to.
 
std::optional< PCB_LAYER_ID > polygonLayer (const TARGET3001::POLYGON_POUR &aPoly) const
 Copper layer of a signal polygon that can become a zone.
 
bool isCopper (int aLayer) const
 
void buildAreaClearanceRules ()
 Clearance rules between copper areas and each signal's tracks and vias.
 
void buildAuraRules ()
 Rules that keep areas the aura distance from pads and vias, except on their NO_AURA layers.
 
void buildPolygonRules ()
 Rules for the board contour and foreign polygon distances each signal polygon keeps.
 
void tagAura (BOARD_CONNECTED_ITEM &aItem, const TARGET3001::ELEMENT_BASE &aBase, int aAura)
 Tag a pad or via with its aura so the aura rules can match it.
 
NETINFO_ITEM * net (uint16_t aSignal) const
 
VECTOR2I toKi (int32_t aX, int32_t aY) const
 
bool elementOutline (const TARGET3001::ELEMENT &aElem, SHAPE_POLY_SET &aOut) const
 Outline of a filled element (rectangle, triangle, disc, stroked line or arc) in KiCad coordinates.
 
void noteContour (const TARGET3001::ELEMENT &aElem)
 Record whether a board contour stroke carries a clearance.
 
std::optional< LSET > padstackLayers (int aLayer) const
 Copper, mask and paste layers of the padstack a pad layer >= 101 selects.
 
void addPadstackCuts (const BOARD_ITEM &aItem, int aPadstack)
 Cut aItem, grown per layer, from the pours of the deletion layers padstack aPadstack lists.
 

Private Attributes

BOARD * m_board
 
const TARGET3001::PROJECT & m_project
 
REPORTER * m_reporter
 
std::map< int, PCB_LAYER_ID > m_layerMap
 
std::vector< int > m_copperStack
 TARGET layers, top to bottom.
 
std::map< uint16_t, NETINFO_ITEM * > m_nets
 by signal ID
 
int m_freePadCount = 0
 
std::map< std::pair< int, int >, SHAPE_POLY_SET > m_copperFills
 (net, KiCad layer) -> filled copper
 
std::vector< POUR_AREA > m_pourAreas
 
std::optional< int > m_contourLayer
 first TARGET layer holding the contour
 
bool m_contourCarvesNothing = false
 a contour stroke has no clearance
 
std::map< int, SHAPE_POLY_SET > m_pourKeepouts
 KiCad layer -> pour keepout.
 
std::map< int64_t, SHAPE_POLY_SET > m_polygonFills
 POLYGONID -> stored fill without spokes.
 
std::map< int64_t, SHAPE_POLY_SET > m_polygonSpokes
 POLYGONID -> stored thermal spokes.
 
std::vector< std::pair< ZONE *, int64_t > > m_polygonZones
 thermal polygon zones and their POLYGONID
 
std::set< int > m_polygonEdgeClearances
 
std::set< int > m_polygonAuras
 
bool m_hasPolygonPours = false
 
std::map< uint16_t, std::map< int, int > > m_signalClearances
 Track and via clearances counted per signal, then per clearance value.
 
std::set< int > m_auraValues
 distinct aura distances above zero
 
std::set< PCB_LAYER_ID > m_noAuraLayers
 copper layers some NO_AURA list names
 
std::set< std::pair< uint16_t, PCB_LAYER_ID > > m_pourLayers
 (signal, KiCad layer) holding an area
 
wxString m_designRules
 
TARGET3001::FONTS m_fonts
 

Detailed Description

Builds a KiCad board from a parsed TARGET 3001!

project.

Board items are stored in absolute board coordinates in the project, including the pads and graphics that belong to a footprint, so footprints are placed first and their items added at their stored positions.

Definition at line 59 of file target3001_pcb_builder.h.

Constructor & Destructor Documentation

◆ TARGET3001_PCB_BUILDER()

TARGET3001_PCB_BUILDER::TARGET3001_PCB_BUILDER ( BOARD * aBoard,
const TARGET3001::PROJECT & aProject,
REPORTER * aReporter )

Definition at line 156 of file target3001_pcb_builder.cpp.

References m_board, m_project, and m_reporter.

Member Function Documentation

◆ addFootprint()

◆ addItem()

◆ addPad()

◆ addPadstackCuts()

void TARGET3001_PCB_BUILDER::addPadstackCuts ( const BOARD_ITEM & aItem,
int aPadstack )
private

Cut aItem, grown per layer, from the pours of the deletion layers padstack aPadstack lists.

Definition at line 1687 of file target3001_pcb_builder.cpp.

References ARC_HIGH_DEF, TARGET3001::BOARD_LAYER_COUNT, ERROR_OUTSIDE, LayerFunction(), m_pourKeepouts, m_project, TARGET3001::PADSTACK_DEF::onLayer, TARGET3001::PADSTACK_DEF::oversize, pourCopperLayer(), and BOARD_ITEM::TransformShapeToPolygon().

Referenced by addPad(), and addVia().

◆ addShape()

void TARGET3001_PCB_BUILDER::addShape ( const TARGET3001::ELEMENT & aElem,
BOARD_ITEM_CONTAINER * aParent,
FOOTPRINT * aFootprint,
bool aIsTrack,
PCB_LAYER_ID aLayer )
private

Add the graphic or track form of aElem on one KiCad layer.

Definition at line 1260 of file target3001_pcb_builder.cpp.

References BOARD_ITEM_CONTAINER::Add(), APPEND, ARC, TARGET3001::ELEMENT::arc, ARC_HIGH_DEF, TARGET3001::ELEMENT::base, BEZIER, center, TARGET3001::ARC::centerX, TARGET3001::ARC::centerY, CIRCLE, clearance, TARGET3001::ARC::clearance, TARGET3001::LINE::clearance, TARGET3001::SPLINE::clearance, TARGET3001::SPLINE::controlX, TARGET3001::SPLINE::controlY, TARGET3001::LINE::dashStyle, DEG2RAD(), TARGET3001::ELEMENT::disc, elementOutline(), end, TARGET3001::SPLINE::endX, TARGET3001::SPLINE::endY, fiducialShapes(), IsCopperLayer(), KiROUND(), TARGET3001::ELEMENT::line, m_board, m_copperFills, m_signalClearances, net(), POLY, TARGET3001::ARC::radius, TARGET3001::DISC::radius, EDA_SHAPE::RebuildBezierToSegmentsPointsList(), SEGMENT, PCB_SHAPE::SetArcGeometry(), PCB_SHAPE::SetBezierC1(), PCB_SHAPE::SetBezierC2(), PCB_SHAPE::SetCenter(), PCB_SHAPE::SetEnd(), PCB_TRACK::SetEnd(), EDA_SHAPE::SetFilled(), BOARD_CONNECTED_ITEM::SetLayer(), PCB_SHAPE::SetLayer(), PCB_ARC::SetMid(), BOARD_CONNECTED_ITEM::SetNet(), PCB_SHAPE::SetPolyShape(), EDA_SHAPE::SetRadius(), PCB_SHAPE::SetStart(), PCB_TRACK::SetStart(), PCB_SHAPE::SetStroke(), PCB_TRACK::SetWidth(), TARGET3001::ELEMENT_BASE::signal, SOLID, TARGET3001::ELEMENT::spline, TARGET3001::ARC::startAngle, TARGET3001::ARC::Sweep(), sweep(), toKi(), TARGET3001::ELEMENT::type, TARGET3001::ARC::width, TARGET3001::LINE::width, TARGET3001::SPLINE::width, TARGET3001::ELEMENT_BASE::x, TARGET3001::LINE::x2, TARGET3001::ELEMENT_BASE::y, and TARGET3001::LINE::y2.

Referenced by addItem().

◆ addText()

◆ addVia()

◆ Build()

◆ buildAreaClearanceRules()

void TARGET3001_PCB_BUILDER::buildAreaClearanceRules ( )
private

Clearance rules between copper areas and each signal's tracks and vias.

Definition at line 232 of file target3001_pcb_builder.cpp.

References clearance, NETINFO_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), m_designRules, m_hasPolygonPours, m_pourLayers, m_signalClearances, name, net(), ruleLiteral(), and ruleMm().

Referenced by Build().

◆ buildAreaSpokes()

void TARGET3001_PCB_BUILDER::buildAreaSpokes ( const std::vector< const TARGET3001::ELEMENT * > & aSpokes)
private

◆ buildAuraRules()

void TARGET3001_PCB_BUILDER::buildAuraRules ( )
private

Rules that keep areas the aura distance from pads and vias, except on their NO_AURA layers.

Definition at line 289 of file target3001_pcb_builder.cpp.

References m_auraValues, m_designRules, m_noAuraLayers, m_pourLayers, LSET::Name(), name, and ruleMm().

Referenced by Build().

◆ buildComponents()

void TARGET3001_PCB_BUILDER::buildComponents ( )
private

◆ buildFreeItems()

void TARGET3001_PCB_BUILDER::buildFreeItems ( )
private

Definition at line 792 of file target3001_pcb_builder.cpp.

References addItem(), m_board, and m_project.

Referenced by Build().

◆ buildLayerMap()

◆ buildNets()

void TARGET3001_PCB_BUILDER::buildNets ( )
private

◆ buildPolygonPours()

◆ buildPolygonRules()

void TARGET3001_PCB_BUILDER::buildPolygonRules ( )
private

Rules for the board contour and foreign polygon distances each signal polygon keeps.

Definition at line 1058 of file target3001_pcb_builder.cpp.

References clearance, m_designRules, m_polygonAuras, m_polygonEdgeClearances, and ruleMm().

Referenced by Build().

◆ buildPourAreas()

◆ buildSignalCopper()

◆ buildThermalGaps()

void TARGET3001_PCB_BUILDER::buildThermalGaps ( )
private

Thermal gaps the stored fill leaves around spoked pads, as zone defaults and pad or footprint overrides.

Definition at line 930 of file target3001_pcb_builder.cpp.

References SHAPE_POLY_SET::Collide(), KiROUND(), m_board, m_designRules, m_polygonFills, m_polygonSpokes, m_polygonZones, pad, pcbIUScale, ruleLiteral(), and ruleMm().

Referenced by Build().

◆ configureText()

◆ DesignRules()

const wxString & TARGET3001_PCB_BUILDER::DesignRules ( ) const
inline

Custom rules that carry what KiCad cannot store on the items themselves, empty when none apply.

Definition at line 67 of file target3001_pcb_builder.h.

References m_designRules.

Referenced by PCB_IO_TARGET3001::loadBoard().

◆ elementOutline()

◆ fiducialShapes()

std::vector< std::unique_ptr< PCB_SHAPE > > TARGET3001_PCB_BUILDER::fiducialShapes ( const TARGET3001::ELEMENT & aElem,
BOARD_ITEM_CONTAINER * aParent ) const
private

◆ isCopper()

bool TARGET3001_PCB_BUILDER::isCopper ( int aLayer) const
private

Definition at line 206 of file target3001_pcb_builder.cpp.

References LayerFunction().

Referenced by pourCopperLayer(), and tagAura().

◆ LayerFunction()

LAYER_FUNCTION TARGET3001_PCB_BUILDER::LayerFunction ( int aLayer) const

Function of a TARGET 3001! board layer in this project.

Definition at line 197 of file target3001_pcb_builder.cpp.

References BOARD_LAYER_COUNT, and m_project.

Referenced by addFootprint(), addItem(), addPadstackCuts(), buildLayerMap(), isCopper(), and pourCopperLayer().

◆ mapLayer()

std::optional< PCB_LAYER_ID > TARGET3001_PCB_BUILDER::mapLayer ( int aLayer) const
private

Copper or graphic layer for a board element, if KiCad has a place for it.

Definition at line 493 of file target3001_pcb_builder.cpp.

References m_layerMap.

Referenced by addItem(), addPad(), buildAreaSpokes(), padstackLayers(), polygonLayer(), pourCopperLayer(), and tagAura().

◆ net()

NETINFO_ITEM * TARGET3001_PCB_BUILDER::net ( uint16_t aSignal) const
private

◆ noteContour()

void TARGET3001_PCB_BUILDER::noteContour ( const TARGET3001::ELEMENT & aElem)
private

◆ padstackLayers()

std::optional< LSET > TARGET3001_PCB_BUILDER::padstackLayers ( int aLayer) const
private

Copper, mask and paste layers of the padstack a pad layer >= 101 selects.

Definition at line 1712 of file target3001_pcb_builder.cpp.

References B_Paste, TARGET3001::BOARD_LAYER_COUNT, F_Paste, TARGET3001::FIRST_PADSTACK_LAYER, index, IsCopperLayer(), IsSolderMaskLayer(), m_project, mapLayer(), and BASE_SET::set().

Referenced by addPad(), and addVia().

◆ polygonLayer()

std::optional< PCB_LAYER_ID > TARGET3001_PCB_BUILDER::polygonLayer ( const TARGET3001::POLYGON_POUR & aPoly) const
private

Copper layer of a signal polygon that can become a zone.

Definition at line 539 of file target3001_pcb_builder.cpp.

References IsCopperLayer(), TARGET3001::POLYGON_POUR::layer, mapLayer(), and TARGET3001::POLYGON_POUR::outline.

Referenced by buildPolygonPours(), and buildSignalCopper().

◆ pourCopperLayer()

std::optional< PCB_LAYER_ID > TARGET3001_PCB_BUILDER::pourCopperLayer ( int aLayer) const
private

Copper layer that an area or deletion layer applies to.

Definition at line 504 of file target3001_pcb_builder.cpp.

References BOARD_LAYER_COUNT, isCopper(), LayerFunction(), m_project, mapLayer(), and NO_ASSOCIATION.

Referenced by addItem(), and addPadstackCuts().

◆ tagAura()

void TARGET3001_PCB_BUILDER::tagAura ( BOARD_CONNECTED_ITEM & aItem,
const TARGET3001::ELEMENT_BASE & aBase,
int aAura )
private

Tag a pad or via with its aura so the aura rules can match it.

Definition at line 333 of file target3001_pcb_builder.cpp.

References TARGET3001::ELEMENT_BASE::FindProp(), isCopper(), m_auraValues, m_noAuraLayers, mapLayer(), LSET::Name(), and EDA_ITEM::SetCustomProperty().

Referenced by addPad(), and addVia().

◆ toKi()

VECTOR2I TARGET3001_PCB_BUILDER::toKi ( int32_t aX,
int32_t aY ) const
inlineprivate

Member Data Documentation

◆ m_auraValues

std::set<int> TARGET3001_PCB_BUILDER::m_auraValues
private

distinct aura distances above zero

Definition at line 176 of file target3001_pcb_builder.h.

Referenced by buildAuraRules(), and tagAura().

◆ m_board

◆ m_contourCarvesNothing

bool TARGET3001_PCB_BUILDER::m_contourCarvesNothing = false
private

a contour stroke has no clearance

Definition at line 165 of file target3001_pcb_builder.h.

Referenced by Build(), and noteContour().

◆ m_contourLayer

std::optional<int> TARGET3001_PCB_BUILDER::m_contourLayer
private

first TARGET layer holding the contour

Definition at line 164 of file target3001_pcb_builder.h.

Referenced by addItem(), and buildLayerMap().

◆ m_copperFills

std::map<std::pair<int, int>, SHAPE_POLY_SET> TARGET3001_PCB_BUILDER::m_copperFills
private

(net, KiCad layer) -> filled copper

Definition at line 162 of file target3001_pcb_builder.h.

Referenced by addShape(), and buildSignalCopper().

◆ m_copperStack

std::vector<int> TARGET3001_PCB_BUILDER::m_copperStack
private

TARGET layers, top to bottom.

Definition at line 159 of file target3001_pcb_builder.h.

Referenced by buildLayerMap().

◆ m_designRules

wxString TARGET3001_PCB_BUILDER::m_designRules
private

◆ m_fonts

TARGET3001::FONTS TARGET3001_PCB_BUILDER::m_fonts
private

Definition at line 180 of file target3001_pcb_builder.h.

Referenced by configureText().

◆ m_freePadCount

int TARGET3001_PCB_BUILDER::m_freePadCount = 0
private

Definition at line 161 of file target3001_pcb_builder.h.

Referenced by addPad().

◆ m_hasPolygonPours

bool TARGET3001_PCB_BUILDER::m_hasPolygonPours = false
private

Definition at line 172 of file target3001_pcb_builder.h.

Referenced by buildAreaClearanceRules(), and buildPolygonPours().

◆ m_layerMap

std::map<int, PCB_LAYER_ID> TARGET3001_PCB_BUILDER::m_layerMap
private

Definition at line 158 of file target3001_pcb_builder.h.

Referenced by buildLayerMap(), and mapLayer().

◆ m_nets

std::map<uint16_t, NETINFO_ITEM*> TARGET3001_PCB_BUILDER::m_nets
private

by signal ID

Definition at line 160 of file target3001_pcb_builder.h.

Referenced by buildNets(), and net().

◆ m_noAuraLayers

std::set<PCB_LAYER_ID> TARGET3001_PCB_BUILDER::m_noAuraLayers
private

copper layers some NO_AURA list names

Definition at line 177 of file target3001_pcb_builder.h.

Referenced by buildAuraRules(), and tagAura().

◆ m_polygonAuras

std::set<int> TARGET3001_PCB_BUILDER::m_polygonAuras
private

Definition at line 171 of file target3001_pcb_builder.h.

Referenced by buildPolygonPours(), and buildPolygonRules().

◆ m_polygonEdgeClearances

std::set<int> TARGET3001_PCB_BUILDER::m_polygonEdgeClearances
private

Definition at line 170 of file target3001_pcb_builder.h.

Referenced by buildPolygonPours(), and buildPolygonRules().

◆ m_polygonFills

std::map<int64_t, SHAPE_POLY_SET> TARGET3001_PCB_BUILDER::m_polygonFills
private

POLYGONID -> stored fill without spokes.

Definition at line 167 of file target3001_pcb_builder.h.

Referenced by buildPolygonPours(), buildSignalCopper(), and buildThermalGaps().

◆ m_polygonSpokes

std::map<int64_t, SHAPE_POLY_SET> TARGET3001_PCB_BUILDER::m_polygonSpokes
private

POLYGONID -> stored thermal spokes.

Definition at line 168 of file target3001_pcb_builder.h.

Referenced by buildPolygonPours(), buildSignalCopper(), and buildThermalGaps().

◆ m_polygonZones

std::vector<std::pair<ZONE*, int64_t> > TARGET3001_PCB_BUILDER::m_polygonZones
private

thermal polygon zones and their POLYGONID

Definition at line 169 of file target3001_pcb_builder.h.

Referenced by buildPolygonPours(), and buildThermalGaps().

◆ m_pourAreas

std::vector<POUR_AREA> TARGET3001_PCB_BUILDER::m_pourAreas
private

Definition at line 163 of file target3001_pcb_builder.h.

Referenced by addItem(), buildAreaSpokes(), and buildPourAreas().

◆ m_pourKeepouts

std::map<int, SHAPE_POLY_SET> TARGET3001_PCB_BUILDER::m_pourKeepouts
private

KiCad layer -> pour keepout.

Definition at line 166 of file target3001_pcb_builder.h.

Referenced by addItem(), addPadstackCuts(), and buildPourAreas().

◆ m_pourLayers

std::set<std::pair<uint16_t, PCB_LAYER_ID> > TARGET3001_PCB_BUILDER::m_pourLayers
private

(signal, KiCad layer) holding an area

Definition at line 178 of file target3001_pcb_builder.h.

Referenced by buildAreaClearanceRules(), buildAuraRules(), and buildPourAreas().

◆ m_project

◆ m_reporter

REPORTER* TARGET3001_PCB_BUILDER::m_reporter
private

Definition at line 156 of file target3001_pcb_builder.h.

Referenced by TARGET3001_PCB_BUILDER().

◆ m_signalClearances

std::map<uint16_t, std::map<int, int> > TARGET3001_PCB_BUILDER::m_signalClearances
private

Track and via clearances counted per signal, then per clearance value.

Definition at line 175 of file target3001_pcb_builder.h.

Referenced by addShape(), addVia(), and buildAreaClearanceRules().


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