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  AURA_PAD
 
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 buildFreeItems ()
 
void buildPourAreas ()
 
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.
 
bool isCopper (int aLayer) const
 
void buildAreaClearanceRules ()
 Clearance rules between copper areas and each signal's tracks and vias.
 
void connectAuraPads ()
 Connect pads to areas of their own signal the way their aura and NO_AURA layers do.
 
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 mergeContour (const TARGET3001::ELEMENT &aElem)
 Grow the board contour box by the defining points of an element, ignoring line widths.
 
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
 
BOX2I m_contourBox
 
bool m_contourCarvesNothing = false
 a contour stroke has no clearance
 
std::map< int, SHAPE_POLY_SET > m_pourKeepouts
 KiCad layer -> pour keepout.
 
std::map< uint16_t, std::map< int, int > > m_signalClearances
 Track and via clearances counted per signal, then per clearance value.
 
std::vector< AURA_PAD > m_auraPads
 
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 57 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 111 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 1308 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 855 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 178 of file target3001_pcb_builder.cpp.

References clearance, EDA_UNIT_UTILS::FormatInternalUnits(), NETINFO_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), m_designRules, m_pourLayers, m_signalClearances, name, net(), pcbIUScale, and ruleNetLiteral().

Referenced by Build().

◆ buildComponents()

void TARGET3001_PCB_BUILDER::buildComponents ( )
private

◆ buildFreeItems()

void TARGET3001_PCB_BUILDER::buildFreeItems ( )
private

Definition at line 565 of file target3001_pcb_builder.cpp.

References addItem(), m_board, and m_project.

Referenced by Build().

◆ buildLayerMap()

◆ buildNets()

void TARGET3001_PCB_BUILDER::buildNets ( )
private

◆ buildPourAreas()

◆ buildSignalCopper()

◆ configureText()

◆ connectAuraPads()

void TARGET3001_PCB_BUILDER::connectAuraPads ( )
private

Connect pads to areas of their own signal the way their aura and NO_AURA layers do.

Definition at line 249 of file target3001_pcb_builder.cpp.

References FULL, m_auraPads, m_pourLayers, and NONE.

Referenced by Build().

◆ 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 65 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 158 of file target3001_pcb_builder.cpp.

References LayerFunction().

Referenced by addPad(), and pourCopperLayer().

◆ LayerFunction()

LAYER_FUNCTION TARGET3001_PCB_BUILDER::LayerFunction ( int aLayer) const

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

Definition at line 149 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 397 of file target3001_pcb_builder.cpp.

References m_layerMap.

Referenced by addItem(), addPad(), padstackLayers(), and pourCopperLayer().

◆ mergeContour()

◆ net()

NETINFO_ITEM * TARGET3001_PCB_BUILDER::net ( uint16_t aSignal) const
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 1333 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().

◆ 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 408 of file target3001_pcb_builder.cpp.

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

Referenced by addItem(), and addPadstackCuts().

◆ toKi()

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

Member Data Documentation

◆ m_auraPads

std::vector<AURA_PAD> TARGET3001_PCB_BUILDER::m_auraPads
private

Definition at line 160 of file target3001_pcb_builder.h.

Referenced by addPad(), and connectAuraPads().

◆ m_board

◆ m_contourBox

BOX2I TARGET3001_PCB_BUILDER::m_contourBox
private

Definition at line 154 of file target3001_pcb_builder.h.

Referenced by buildPourAreas(), and mergeContour().

◆ m_contourCarvesNothing

bool TARGET3001_PCB_BUILDER::m_contourCarvesNothing = false
private

a contour stroke has no clearance

Definition at line 155 of file target3001_pcb_builder.h.

Referenced by Build(), and mergeContour().

◆ m_contourLayer

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

first TARGET layer holding the contour

Definition at line 153 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 151 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 148 of file target3001_pcb_builder.h.

Referenced by buildLayerMap().

◆ m_designRules

wxString TARGET3001_PCB_BUILDER::m_designRules
private

Definition at line 162 of file target3001_pcb_builder.h.

Referenced by buildAreaClearanceRules(), and DesignRules().

◆ m_fonts

TARGET3001::FONTS TARGET3001_PCB_BUILDER::m_fonts
private

Definition at line 163 of file target3001_pcb_builder.h.

Referenced by configureText().

◆ m_freePadCount

int TARGET3001_PCB_BUILDER::m_freePadCount = 0
private

Definition at line 150 of file target3001_pcb_builder.h.

Referenced by addPad().

◆ m_layerMap

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

Definition at line 147 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 149 of file target3001_pcb_builder.h.

Referenced by buildNets(), and net().

◆ m_pourAreas

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

Definition at line 152 of file target3001_pcb_builder.h.

Referenced by addItem(), and buildPourAreas().

◆ m_pourKeepouts

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

KiCad layer -> pour keepout.

Definition at line 156 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 161 of file target3001_pcb_builder.h.

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

◆ m_project

◆ m_reporter

REPORTER* TARGET3001_PCB_BUILDER::m_reporter
private

Definition at line 145 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 159 of file target3001_pcb_builder.h.

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


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