64 constexpr int PLANE_MAX_ERROR = 1000;
67 constexpr int PLANE_MIN_THICKNESS = 10000;
77 constexpr COPPER_KIND COPPER_KINDS[] = { {
SPACING_TRACK,
"track",
"'Track'" },
84 wxString kindTest(
const COPPER_KIND& aKind,
const wxString& aItem )
86 wxString
test = aItem + wxS(
".Type == " ) + aKind.Type;
89 return wxS(
"(" ) +
test + wxS(
" || " ) + aItem + wxS(
".Type == 'Zone')" );
96 wxString mm( int64_t aDsu )
98 uint64_t magnitude = aDsu < 0 ? 0 -
static_cast<uint64_t
>( aDsu ) :
static_cast<uint64_t
>( aDsu );
100 return wxString::Format( wxS(
"%s%llu.%04llumm" ), aDsu < 0 ? wxS(
"-" ) : wxS(
"" ),
101 static_cast<unsigned long long>( magnitude / 10000 ),
102 static_cast<unsigned long long>( magnitude % 10000 ) );
107 wxString exprLiteral(
const wxString& aText )
109 wxString
text = aText;
110 text.Replace( wxS(
"'" ), wxS(
"\\'" ) );
111 return wxS(
"'" ) +
text + wxS(
"'" );
116 wxString quoteSexpr(
const wxString& aText )
118 wxString
text = aText;
119 text.Replace( wxS(
"\\" ), wxS(
"\\\\" ) );
120 text.Replace( wxS(
"\"" ), wxS(
"\\\"" ) );
121 return wxS(
"\"" ) +
text + wxS(
"\"" );
126 int32_t spacingValue(
const SOURCE_SPACINGS& aSpacings,
int aTypeA,
int aTypeB )
129 std::swap( aTypeA, aTypeB );
131 auto it = aSpacings.
Values.find(
132 static_cast<int32_t
>( (
static_cast<uint32_t
>( aTypeA ) << 16 ) | ( aTypeB & 0xffff ) ) );
133 return it == aSpacings.
Values.end() ? -1 : it->second;
144 std::unique_ptr<LAYER_MAPPER> m_layers;
145 wxString m_customRules;
150 void buildNetClasses();
151 void buildFootprints();
152 void buildFreeItems();
153 void buildTracksAndVias();
163 bool becomesZone(
const SOURCE_AREA& aArea )
const;
169 int32_t designValue(
int aTypeA,
int aTypeB )
const;
171 int32_t shapeSpacing(
int aKind )
const
173 return m_spacings ? spacingValue( *m_spacings,
SPACING_SHAPE, aKind ) : -1;
176 void addRule(
const wxString& aName,
const wxString& aConstraint,
const wxString& aCondition );
186 std::map<const OBJECT*, NETINFO_ITEM*> m_nets;
187 std::map<const OBJECT*, std::vector<BOARD_ITEM*>> m_created;
188 bool m_viaMask[2] = {
false,
false };
197 m_spacings( m_design ?
dynamic_cast<const SOURCE_SPACINGS*
>( m_design->Spacings ) :
nullptr ),
199 m_reporter( aReporter )
220 m_frame.Origin.X =
any ? std::min( m_frame.Origin.X, seg->X ) : seg->X;
221 m_frame.Origin.Y =
any ? std::max( m_frame.Origin.Y, seg->Y ) : seg->Y;
227 m_frame.Offset =
VECTOR2I( 25400000, 25400000 );
231void PCB_BUILDER::Build()
250 buildTracksAndVias();
266int32_t PCB_BUILDER::designValue(
int aTypeA,
int aTypeB )
const
269 return m_spacings ? spacingValue( *m_spacings, aTypeA, aTypeB ) : -1;
272 return std::max( spacingValue( *m_spacings, aTypeA, aTypeB ), spacingValue( *m_spacings, aTypeB, aTypeA ) );
276void PCB_BUILDER::addRule(
const wxString& aName,
const wxString& aConstraint,
const wxString& aCondition )
278 if( m_customRules.IsEmpty() )
279 m_customRules = wxS(
"(version 1)\n" );
281 m_customRules += wxS(
"\n(rule " ) + quoteSexpr( aName ) + wxS(
"\n " ) + aConstraint + wxS(
"\n" );
282 m_customRules += wxS(
" (condition " ) + quoteSexpr( aCondition ) + wxS(
"))\n" );
286void PCB_BUILDER::buildRules()
303 auto param = [&](
int aId )
316 addRule( wxS(
"Easy-PC minimum pad annular ring" ),
317 wxS(
"(constraint annular_width (min " ) + mm( param(
DP_MIN_ANNULAR_RING ) ) + wxS(
"))" ),
318 wxS(
"A.Type == 'Pad'" ) );
323 addRule( wxS(
"Easy-PC minimum text size" ),
324 wxS(
"(constraint text_height (min " ) + mm( param(
DP_MIN_TEXT_SIZE ) ) + wxS(
"))" ),
325 wxS(
"A.Type == 'Text'" ) );
334 for(
size_t i = 0; i < std::size( COPPER_KINDS ); ++i )
336 for(
size_t j = i; j < std::size( COPPER_KINDS ); ++j )
338 const COPPER_KIND& a = COPPER_KINDS[i];
339 const COPPER_KIND& b = COPPER_KINDS[j];
341 addRule( wxString::Format( wxS(
"Easy-PC %s to %s" ), a.Name, b.Name ),
342 wxS(
"(constraint clearance (min " ) + mm( std::max( 0, designValue( a.Kind, b.Kind ) ) )
344 kindTest( a, wxS(
"A" ) ) + wxS(
" && " ) + kindTest( b, wxS(
"B" ) ) );
348 for(
const COPPER_KIND& kind : COPPER_KINDS )
350 addRule( wxString::Format( wxS(
"Easy-PC board to %s" ), kind.Name ),
351 wxS(
"(constraint edge_clearance (min " )
352 + mm( std::max( 0, designValue(
SPACING_BOARD, kind.Kind ) ) ) + wxS(
"))" ),
353 kindTest( kind, wxS(
"A" ) ) );
358void PCB_BUILDER::buildNetClasses()
374 for(
const SOURCE_TRACK_STYLE* style : { aSource->TrackStyle1, aSource->TrackStyle2 } )
377 nominal = std::max( nominal, style->Width );
386 if( aSource->ViaStyle )
390 if( aSource->ViaStyle->Drill > 0 )
395 if( aSource->DiffPairGap > 0 )
399 std::map<const OBJECT*, wxString> classNames;
401 wxString defaultName;
404 defaultName = defaults->NetClass;
408 if( !defaultName.IsEmpty() &&
source->Name.CmpNoCase( defaultName ) == 0 && !defaultSource )
414 std::shared_ptr<NETCLASS> netclass = std::make_shared<NETCLASS>(
name );
415 fill( *netclass,
source );
416 netSettings->SetNetclass(
name, netclass );
420 int32_t minimum = std::numeric_limits<int32_t>::max();
425 minimum = std::min( minimum, style->Width );
428 if( minimum != std::numeric_limits<int32_t>::max() && minimum > 0 && !
name.EndsWith( wxS(
"\\" ) ) )
430 addRule( wxS(
"Easy-PC net class " ) +
source->Name + wxS(
" minimum width" ),
431 wxS(
"(constraint track_width (min " ) + mm( minimum ) + wxS(
"))" ),
432 wxS(
"A.NetClass == " ) + exprLiteral(
name ) );
436 fill( *netSettings->GetDefaultNetclass(), defaultSource );
438 for(
const auto& [net, kicadNet] : m_nets )
440 if(
auto it = classNames.find(
static_cast<const SOURCE_NET*
>( net )->
NetClass ); it != classNames.end() )
442 netSettings->SetNetclassPatternAssignment( kicadNet->GetNetname(), it->second );
443 kicadNet->SetNetClass( netSettings->GetNetClassByName( it->second ) );
466 int reach = std::max( aLand.x, aLand.y );
483 for(
int i = 0; i < 4; ++i )
485 VECTOR2I dir( reach + iso + spoke, 0 );
491 rect.
Append( aCentre + side );
492 rect.
Append( aCentre + dir + side );
493 rect.
Append( aCentre + dir - side );
494 rect.
Append( aCentre - side );
500 clear.Append( ring );
505 for(
PAD*
pad : fp->Pads() )
507 if( !
pad->IsOnLayer( aKiCadLayer ) )
515 thermal(
pad->GetPosition(), size,
518 pad->GetOrientation() );
523 if(
pad->GetNet() == aNet && !
pad->HasHole() )
541 if( !track->IsOnLayer( aKiCadLayer ) )
546 if(
via &&
via->GetNet() == aNet )
548 int width =
via->GetWidth( aKiCadLayer );
556 else if( track->GetNet() != aNet )
558 track->TransformShapeToPolygon(
clear, aKiCadLayer, iso, PLANE_MAX_ERROR,
ERROR_OUTSIDE );
573 clear.Append( region );
581void PCB_BUILDER::buildPlanes()
585 std::vector<ZONE*> planes;
586 std::optional<SHAPE_POLY_SET> outline;
591 auto netIt = m_nets.find( layer->Net );
594 || netIt == m_nets.end() )
611 + ( style ? m_frame.
Length( style->
Width ) / 2 : 0 ),
615 ( outline ? *outline : outline.emplace() ).
BooleanAdd( region );
618 if( !outline || outline->IsEmpty() )
623 zone->
SetNet( netIt->second );
633 planes.push_back( zone );
638 fill.
BooleanSubtract( planeClearances( *layer, kicadLayer, netIt->second ) );
651 for(
ZONE* zone : planes )
653 names += ( names.IsEmpty() ? wxString() : wxString( wxS(
", " ) ) ) + zone->GetZoneName();
654 planeLayers.
set( zone->GetLayer() );
659 m_reporter->
Report( wxString::Format(
_(
"Easy-PC power planes (%s) were imported with the copper the "
660 "program plots. KiCad cannot refill them the same way: a refill "
661 "makes via thermals solid and clears foreign through-hole lands "
662 "only around their holes." ),
673 for(
PAD*
pad : fp->Pads() )
680 for(
ZONE* zone : planes )
682 if(
pad->GetNet() == zone->GetNet() )
685 if(
pad->HasHole() &&
pad->IsOnLayer( zone->GetLayer() ) &&
pad->GetNet() == zone->GetNet() )
698 if( onlyPlanesInside )
701 for(
ZONE* zone : planes )
703 if(
via->IsOnLayer( zone->GetLayer() ) &&
via->GetNet() == zone->GetNet() )
710void PCB_BUILDER::buildGroups()
720 auto it = m_created.find( member );
722 if( it == m_created.end() )
735 m_board.
Add( kgroup );
740void PCB_BUILDER::buildLayers()
742 int copper = m_layers->CopperCount();
775 bds.m_SolderPasteMarginRatio = type->
Oversize / 100.0;
786 auto it = node ? m_nets.find( node->
Parent ) : m_nets.end();
788 return it == m_nets.end() ? nullptr : it->second;
792void PCB_BUILDER::buildFootprints()
804 if( si->Gate != -1 || !si->Placed || !symbol )
807 std::map<const SOURCE_FREE_PAD*, PAD*> padMap;
809 std::unique_ptr<FOOTPRINT> fp =
ConvertFootprint( *symbol, *m_layers,
id, pcb, &padMap );
811 fp->SetParent( &m_board );
820 auto it = padMap.find( freePad );
822 if( !exception || it == padMap.end() )
825 std::unique_ptr<PAD>
pad =
CreatePad( fp.get(), *freePad, *exception, symbolFrame, *m_layers );
826 pad->SetNumber( it->second->GetNumber() );
827 fp->Remove( it->second );
829 it->second =
pad.get();
830 fp->Add(
pad.release() );
833 fp->SetReference( ci->Name );
844 fp->SetPosition( m_frame.
ToKiCad( si->Position ) );
846 placeValueTexts( *fp, *ci, *si );
850 auto it = padMap.find(
dynamic_cast<const SOURCE_FREE_PAD*
>( pi->Pad ) );
853 if( it != padMap.end() && net )
854 it->second->SetNet( net );
857 m_board.
Add( fp.release() );
866 bool referencePlaced =
false;
867 bool valuePlaced =
false;
877 referencePlaced =
true;
887 std::unique_ptr<PCB_TEXT> item = std::make_unique<PCB_TEXT>( &aFootprint );
888 item->SetText( aInstance.
Name );
891 aFootprint.
Add( item.release() );
895 if( !referencePlaced )
903void PCB_BUILDER::buildFreeItems()
906 std::set<const SOURCE_FREE_COPPER*> poured;
910 if( becomesZone( *area ) )
913 poured.insert( piece );
919 if( poured.count( copper ) )
926 if( ( net = netOfNode( term->Node ) ) !=
nullptr )
933 shape->SetNet( net );
935 m_created[copper].push_back( shape );
942 m_created[
text].push_back( ktext );
958 std::unique_ptr<PAD>
pad =
CreatePad( fp, *freePad, *style,
FRAME{ freePad->Position }, *m_layers );
966 m_created[freePad].push_back( fp );
971void PCB_BUILDER::buildTracksAndVias()
973 std::set<const SOURCE_VIA*> vias;
984 if( !style || !vias.insert(
via ).second )
995 int rule = netClass ? netClass->
TentedVias : 2;
996 bool tented = rule == 1 || ( rule == 2 &&
via->Tented );
1000 m_board.
Add( kvia );
1001 m_created[
via].push_back( kvia );
1012 std::vector<const SOURCE_TRACK_SEGMENT*> verts;
1017 verts.push_back( seg );
1020 auto add = [&](
PCB_TRACK* aItem,
int aWidth )
1025 m_board.
Add( aItem );
1026 m_created[conn].push_back( aItem );
1029 for(
size_t i = 0; i + 1 < verts.size(); ++i )
1036 int width = style ? m_frame.
Length( style->
Width ) : 0;
1039 int32_t angle = s->
X != e->
X || s->
Y != e->
Y ? s->
ArcAngle : 0;
1052 for(
size_t k = 1; k < form.
Points.size(); ++k )
1057 add( ktrack, width );
1065bool PCB_BUILDER::becomesZone(
const SOURCE_AREA& aArea )
const
1073void PCB_BUILDER::buildAreas()
1075 int routingAreas = 0;
1099 zone->
SetZoneName( area->Name.IsEmpty() ? wxString::Format( wxS(
"Easy-PC area %d" ), ruleAreas )
1108 m_board.
Add( zone );
1116 group->SetName( area->Name.IsEmpty() ? wxString( wxS(
"Easy-PC routing area" ) ) : area->Name );
1119 group->AddItem( outline );
1123 if(
group->GetItems().empty() )
1130 m_created[area].push_back(
group );
1134 if( !becomesZone( *area ) )
1142 if(
auto netIt = m_nets.find( area->Net ); netIt != m_nets.end() )
1143 zone->
SetNet( netIt->second );
1152 int32_t spacing = shapeSpacing( kind );
1183 m_board.
Add( zone );
1186 if( routingAreas && m_reporter )
1188 m_reporter->
Report( wxString::Format(
_(
"%d Easy-PC routing areas were imported as outlines on Cmts.User; "
1189 "the design does not run its routing area check, so they restrict "
1200 PCB_BUILDER builder( aDocument, aBoard, aReporter );
1203 builder.m_layers->ApplyUserMapping( aLayerMapping( builder.m_layers->Describe() ) );
1206 return builder.m_customRules;
BASE_SET & set(size_t pos)
virtual void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
int m_CopperEdgeClearance
int m_SolderMaskToCopperClearance
int m_ViasMinAnnularWidth
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
void SetPageSettings(const PAGE_INFO &aPageSettings)
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
void SetCopperLayerCount(int aCount)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
void SetName(const wxString &aName)
virtual EDA_GROUP * GetParentGroup() const
virtual void SetVisible(bool aVisible)
A logical library item identifier and consists of various portions much like a URI.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
A collection of nets and the parameters used to route or test these nets.
void SetViaDiameter(int aDia)
void SetViaDrill(int aSize)
static const char Default[]
the name of the default NETCLASS
void SetDiffPairWidth(int aSize)
void SetDiffPairGap(int aSize)
void SetClearance(int aClearance)
void SetTrackWidth(int aWidth)
Handle the data for a net.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool aIgnoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
void SetMid(const VECTOR2I &aMid)
A set of BOARD_ITEMs (i.e., without duplicates).
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
virtual void SetWidth(int aWidth)
void SetFrontTentingMode(TENTING_MODE aMode)
void SetDrill(int aDrill)
void SetBackTentingMode(TENTING_MODE aMode)
void SetPosition(const VECTOR2I &aPoint) override
void SetWidth(int aWidth) override
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
POLYGON & Polygon(int aIndex)
Return the aIndex-th subpolygon in the set.
int AddPolygon(const POLYGON &apolygon)
Adds a polygon to the set.
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
int OutlineCount() const
Return the number of outlines in the set.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Handle a list of polygons defining a copper zone.
void SetNeedRefill(bool aNeedRefill)
void SetDoNotAllowPads(bool aEnable)
void SetLocalClearance(std::optional< int > aClearance)
void SetMinThickness(int aMinThickness)
void SetThermalReliefSpokeWidth(int aThermalReliefSpokeWidth)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
SHAPE_POLY_SET * Outline()
void SetIsRuleArea(bool aEnable)
void SetDoNotAllowTracks(bool aEnable)
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Set the list of filled polygons.
void SetIsFilled(bool isFilled)
void SetLayerSet(const LSET &aLayerSet) override
void SetDoNotAllowVias(bool aEnable)
void SetNet(NETINFO_ITEM *aNetInfo) override
Override that drops aNetInfo when this zone is in copper-thieving fill mode.
void SetThermalReliefGap(int aThermalReliefGap)
void SetDoNotAllowFootprints(bool aEnable)
void SetDoNotAllowZoneFills(bool aEnable)
void SetPadConnection(ZONE_CONNECTION aPadConnection)
void SetZoneName(const wxString &aName)
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
A type-safe container of any type.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
void TransformTrapezoidToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aDeltaX, int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle or trapezoid to a polygon.
@ ROUND_ALL_CORNERS
All angles are rounded.
Placed instances and connectivity: component, symbol and pad instances, nets, nodes,...
Symbols, components and gates, embedded in designs or the single object of a library item stream.
The design document and the design parameter tables the importers use.
Title block and page size, shared by the board and schematic builders.
Loading designs, library items and projects.
Easy-PC / DesignSpark items to KiCad board items, shared by the board builder and the ....
Easy-PC's text measurement, so text lands where Easy-PC draws it.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_45
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
bool IsUserLayer(PCB_LAYER_ID aLayerId)
Test whether a layer is a non copper and a non tech layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
@ LEFT_RIGHT
Flip left to right (around the Y axis)
std::unique_ptr< FOOTPRINT > ConvertFootprint(const SOURCE_SYMBOL &aSymbol, const LAYER_MAPPER &aLayers, const LIB_ID &aId, const SOURCE_PCB_COMPONENT *aComponent, std::map< const SOURCE_FREE_PAD *, PAD * > *aPadMap)
A footprint in symbol coordinates.
SHAPE_POLY_SET ShapeToPolySet(const SOURCE_DESIGN_SHAPE &aShape, const FRAME &aFrame)
A closed shape and its cutouts as an outline with holes.
std::unique_ptr< PAD > CreatePad(FOOTPRINT *aParent, const SOURCE_FREE_PAD &aPad, const SOURCE_PAD_STYLE &aStyle, const FRAME &aFrame, const LAYER_MAPPER &aLayers)
A pad with its style's per-layer exceptions; a mask or paste exception becomes a separate opening on ...
PCB_TEXT * AddText(BOARD_ITEM_CONTAINER &aContainer, const SOURCE_TEXT_POSITION &aPosition, const wxString &aText, const FRAME &aFrame, const LAYER_MAPPER &aLayers)
ARC_FORM ArcForm(const POINT32 &aStart, const POINT32 &aEnd, int32_t aArcAngle, bool aAnticlockwise, const FRAME &aFrame)
std::vector< PCB_SHAPE * > AddShapeItem(BOARD_ITEM_CONTAINER &aContainer, const SOURCE_SHAPE_ITEM &aItem, const FRAME &aFrame, const LAYER_MAPPER &aLayers, PCB_LAYER_ID aLayer)
Add a shape item as one filled polygon, a circle, or one shape per span; aLayer overrides the item's ...
wxString BuildBoard(const DESIGN_DOCUMENT &aDocument, BOARD &aBoard, REPORTER *aReporter, const LAYER_MAPPING_HANDLER &aLayerMapping)
Fill aBoard from a loaded Easy-PC / DesignSpark PCB design.
SHAPE_POLY_SET ShapeItemArea(const SOURCE_SHAPE_ITEM &aItem, const FRAME &aFrame, int aMaxError)
The copper a shape item plots: its filled region and every span stroked at the line width with round ...
@ DP_MIN_VIA_ANNULAR_RING
@ DP_MIN_SOLDER_MASK_WIDTH
@ DP_MIN_SOLDER_MASK_TO_TRACK
PAGE_INFO PageForExtents(const BOX2L &aExtentsNm)
Easy-PC stores no page size, so the first of A4 to A0 then A to E, landscape before portrait,...
std::vector< T * > TypedItems(const OBJECT *aList)
The items of ListItems that are a T, in order.
@ FIXED
not ABSOLUTE, which wingdi.h defines
wxString ToKiCadMarkup(const wxString &aText)
A displayed string in KiCad's markup.
PAD_SHAPE
Pad style shape, also the drill and exception shape.
void ApplyTextPosition(EDA_TEXT &aText, const SOURCE_TEXT_POSITION &aPos, const SCH_FRAME &aFrame, bool aKeepUpright, const wxString &aMeasured)
Place any KiCad text as the source position says: anchor, angle, mirror, justification and style.
constexpr int64_t DsuToNm(int64_t aDsu)
void FillTitleBlock(const DESIGN_DOCUMENT &aDoc, TITLE_BLOCK &aTitleBlock)
Fill a title block from the design's SummaryInformation property set: title from Title,...
@ PTH
Plated through hole pad.
@ REMOVE_EXCEPT_START_AND_END
Class to handle a set of BOARD_ITEMs.
std::function< std::map< wxString, PCB_LAYER_ID >(const std::vector< INPUT_LAYER_DESC > &)> LAYER_MAPPING_HANDLER
Pointer to a function that takes a map of source and KiCad layers and returns a re-mapped version.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
std::unique_ptr< OBJECT > Design
design root, not in the load array
Root of every deserialized object.
A point read as two int32 values.
wxString Name
reference designator
SOURCE_SCM_COMPONENT * Schematic
SOURCE_PCB_COMPONENT * Board
OBJECT * Parent
null is the document in a design, nothing in a library item
int32_t Param(int aIndex, int32_t aDefault=0) const
The value at aIndex, or aDefault where the stored array is shorter, as the accessors do.
The document: OLE items, then the design.
SOURCE_DESIGN_PARAMETERS DesignParameters
after 8000
SOURCE_DEFAULTS * Defaults
OBJECT * ComponentInstances
Every drawn shape, pour and dimension part.
A pad of a symbol definition.
Also the start of a dimension.
Layer type names determine silk, mask and paste roles.
LAYER_OVERSIZE_TYPE OversizeType
int32_t TentedVias
0 none, 1 all, 2 per via
OBJECT * NetClass
the design's first class when the file stores none
The package half of a component.
int32_t ArcAngle
swept angle, 0 for a straight span
OBJECT * Shape
design shape
bool IsClosed() const
The last vertex links back to the first (formats 1 and 2) or the closed byte is set (format 3)
std::vector< OBJECT * > Segments
the vertex list as read
values maps (a << 16) | b of SPACING_ITEM bits to a clearance
std::map< int32_t, int32_t > Values
A placed footprint (gate -1) or a placed schematic gate.
OBJECT * ValuePositions
below 10003 built from the stored symbol name
Footprints and schematic symbols alike.
OBJECT * Style
track style of the span leaving this vertex
OBJECT * Layer
null in a schematic
Native to KiCad coordinates: scale by 100 nm, flip Y and move the native origin to the KiCad offset.
static EDA_ANGLE Angle(int32_t aMilliDegrees)
VECTOR2I ToKiCad(int32_t aX, int32_t aY) const
int Length(int64_t aLength) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I
VECTOR2< int64_t > VECTOR2L
@ THERMAL
Use thermal relief for pads.