65 constexpr int PLANE_MAX_ERROR = 1000;
68 constexpr int PLANE_MIN_THICKNESS = 10000;
78 constexpr COPPER_KIND COPPER_KINDS[] = { {
SPACING_TRACK,
"track",
"'Track'" },
85 wxString kindTest(
const COPPER_KIND& aKind,
const wxString& aItem )
87 wxString
test = aItem + wxS(
".Type == " ) + aKind.Type;
90 return wxS(
"(" ) +
test + wxS(
" || " ) + aItem + wxS(
".Type == 'Zone')" );
97 wxString mm( int64_t aDsu )
99 uint64_t magnitude = aDsu < 0 ? 0 -
static_cast<uint64_t
>( aDsu ) :
static_cast<uint64_t
>( aDsu );
101 return wxString::Format( wxS(
"%s%llu.%04llumm" ), aDsu < 0 ? wxS(
"-" ) : wxS(
"" ),
102 static_cast<unsigned long long>( magnitude / 10000 ),
103 static_cast<unsigned long long>( magnitude % 10000 ) );
108 wxString quoteSexpr(
const wxString& aText )
110 wxString
text = aText;
111 text.Replace( wxS(
"\\" ), wxS(
"\\\\" ) );
112 text.Replace( wxS(
"\"" ), wxS(
"\\\"" ) );
113 return wxS(
"\"" ) +
text + wxS(
"\"" );
118 int32_t spacingValue(
const SOURCE_SPACINGS& aSpacings,
int aTypeA,
int aTypeB )
121 std::swap( aTypeA, aTypeB );
123 auto it = aSpacings.
Values.find(
124 static_cast<int32_t
>( (
static_cast<uint32_t
>( aTypeA ) << 16 ) | ( aTypeB & 0xffff ) ) );
125 return it == aSpacings.
Values.end() ? -1 : it->second;
136 std::unique_ptr<LAYER_MAPPER> m_layers;
137 wxString m_customRules;
142 void buildNetClasses();
143 void buildFootprints();
144 void buildFreeItems();
145 void buildTracksAndVias();
155 bool becomesZone(
const SOURCE_AREA& aArea )
const;
161 int32_t designValue(
int aTypeA,
int aTypeB )
const;
163 int32_t shapeSpacing(
int aKind )
const
165 return m_spacings ? spacingValue( *m_spacings,
SPACING_SHAPE, aKind ) : -1;
168 void addRule(
const wxString& aName,
const wxString& aConstraint,
const wxString& aCondition );
178 std::map<const OBJECT*, NETINFO_ITEM*> m_nets;
179 std::map<const OBJECT*, std::vector<BOARD_ITEM*>> m_created;
180 bool m_viaMask[2] = {
false,
false };
189 m_spacings( m_design ?
dynamic_cast<const SOURCE_SPACINGS*
>( m_design->Spacings ) :
nullptr ),
191 m_reporter( aReporter )
212 m_frame.Origin.X =
any ? std::min( m_frame.Origin.X, seg->X ) : seg->X;
213 m_frame.Origin.Y =
any ? std::max( m_frame.Origin.Y, seg->Y ) : seg->Y;
219 m_frame.Offset =
VECTOR2I( 25400000, 25400000 );
223void PCB_BUILDER::Build()
240 buildTracksAndVias();
256int32_t PCB_BUILDER::designValue(
int aTypeA,
int aTypeB )
const
259 return m_spacings ? spacingValue( *m_spacings, aTypeA, aTypeB ) : -1;
262 return std::max( spacingValue( *m_spacings, aTypeA, aTypeB ), spacingValue( *m_spacings, aTypeB, aTypeA ) );
266void PCB_BUILDER::addRule(
const wxString& aName,
const wxString& aConstraint,
const wxString& aCondition )
268 if( m_customRules.IsEmpty() )
269 m_customRules = wxS(
"(version 1)\n" );
271 m_customRules += wxS(
"\n(rule " ) + quoteSexpr( aName ) + wxS(
"\n " ) + aConstraint + wxS(
"\n" );
272 m_customRules += wxS(
" (condition " ) + quoteSexpr( aCondition ) + wxS(
"))\n" );
276void PCB_BUILDER::buildRules()
293 auto param = [&](
int aId )
306 addRule( wxS(
"Easy-PC minimum pad annular ring" ),
307 wxS(
"(constraint annular_width (min " ) + mm( param(
DP_MIN_ANNULAR_RING ) ) + wxS(
"))" ),
308 wxS(
"A.Type == 'Pad'" ) );
313 addRule( wxS(
"Easy-PC minimum text size" ),
314 wxS(
"(constraint text_height (min " ) + mm( param(
DP_MIN_TEXT_SIZE ) ) + wxS(
"))" ),
315 wxS(
"A.Type == 'Text'" ) );
324 for(
size_t i = 0; i < std::size( COPPER_KINDS ); ++i )
326 for(
size_t j = i; j < std::size( COPPER_KINDS ); ++j )
328 const COPPER_KIND& a = COPPER_KINDS[i];
329 const COPPER_KIND& b = COPPER_KINDS[j];
331 addRule( wxString::Format( wxS(
"Easy-PC %s to %s" ), a.Name, b.Name ),
332 wxS(
"(constraint clearance (min " ) + mm( std::max( 0, designValue( a.Kind, b.Kind ) ) )
334 kindTest( a, wxS(
"A" ) ) + wxS(
" && " ) + kindTest( b, wxS(
"B" ) ) );
338 for(
const COPPER_KIND& kind : COPPER_KINDS )
340 addRule( wxString::Format( wxS(
"Easy-PC board to %s" ), kind.Name ),
341 wxS(
"(constraint edge_clearance (min " )
342 + mm( std::max( 0, designValue(
SPACING_BOARD, kind.Kind ) ) ) + wxS(
"))" ),
343 kindTest( kind, wxS(
"A" ) ) );
348void PCB_BUILDER::buildNetClasses()
364 for(
const SOURCE_TRACK_STYLE* style : { aSource->TrackStyle1, aSource->TrackStyle2 } )
367 nominal = std::max( nominal, style->Width );
376 if( aSource->ViaStyle )
380 if( aSource->ViaStyle->Drill > 0 )
385 if( aSource->DiffPairGap > 0 )
389 std::map<const OBJECT*, wxString> classNames;
391 wxString defaultName;
394 defaultName = defaults->NetClass;
398 if( !defaultName.IsEmpty() &&
source->Name.CmpNoCase( defaultName ) == 0 && !defaultSource )
404 std::shared_ptr<NETCLASS> netclass = std::make_shared<NETCLASS>(
name );
405 fill( *netclass,
source );
406 netSettings->SetNetclass(
name, netclass );
410 int32_t minimum = std::numeric_limits<int32_t>::max();
415 minimum = std::min( minimum, style->Width );
420 if( minimum != std::numeric_limits<int32_t>::max() && minimum > 0 && literal )
422 addRule( wxS(
"Easy-PC net class " ) +
source->Name + wxS(
" minimum width" ),
423 wxS(
"(constraint track_width (min " ) + mm( minimum ) + wxS(
"))" ),
424 wxS(
"A.NetClass == '" ) + *literal + wxS(
"'" ) );
428 fill( *netSettings->GetDefaultNetclass(), defaultSource );
430 for(
const auto& [net, kicadNet] : m_nets )
432 if(
auto it = classNames.find(
static_cast<const SOURCE_NET*
>( net )->
NetClass ); it != classNames.end() )
434 netSettings->SetNetclassPatternAssignment( kicadNet->GetNetname(), it->second );
435 kicadNet->SetNetClass( netSettings->GetNetClassByName( it->second ) );
458 int reach = std::max( aLand.x, aLand.y );
475 for(
int i = 0; i < 4; ++i )
477 VECTOR2I dir( reach + iso + spoke, 0 );
483 rect.Append( aCentre + side );
484 rect.Append( aCentre + dir + side );
485 rect.Append( aCentre + dir - side );
486 rect.Append( aCentre - side );
487 rect.SetClosed(
true );
492 clear.Append( ring );
497 for(
PAD*
pad : fp->Pads() )
499 if( !
pad->IsOnLayer( aKiCadLayer ) )
507 thermal(
pad->GetPosition(), size,
510 pad->GetOrientation() );
515 if(
pad->GetNet() == aNet && !
pad->HasHole() )
533 if( !track->IsOnLayer( aKiCadLayer ) )
538 if(
via &&
via->GetNet() == aNet )
540 int width =
via->GetWidth( aKiCadLayer );
548 else if( track->GetNet() != aNet )
550 track->TransformShapeToPolygon(
clear, aKiCadLayer, iso, PLANE_MAX_ERROR,
ERROR_OUTSIDE );
565 clear.Append( region );
573void PCB_BUILDER::buildPlanes()
577 std::vector<ZONE*> planes;
578 std::optional<SHAPE_POLY_SET> outline;
583 auto netIt = m_nets.find( layer->Net );
586 || netIt == m_nets.end() )
603 + ( style ? m_frame.
Length( style->
Width ) / 2 : 0 ),
607 ( outline ? *outline : outline.emplace() ).
BooleanAdd( region );
610 if( !outline || outline->IsEmpty() )
615 zone->
SetNet( netIt->second );
625 planes.push_back( zone );
630 fill.
BooleanSubtract( planeClearances( *layer, kicadLayer, netIt->second ) );
643 for(
ZONE* zone : planes )
645 names += ( names.IsEmpty() ? wxString() : wxString( wxS(
", " ) ) ) + zone->GetZoneName();
646 planeLayers.
set( zone->GetLayer() );
651 m_reporter->
Report( wxString::Format(
_(
"Easy-PC power planes (%s) were imported with the copper the "
652 "program plots. KiCad cannot refill them the same way: a refill "
653 "makes via thermals solid and clears foreign through-hole lands "
654 "only around their holes." ),
665 for(
PAD*
pad : fp->Pads() )
672 for(
ZONE* zone : planes )
674 if(
pad->GetNet() == zone->GetNet() )
677 if(
pad->HasHole() &&
pad->IsOnLayer( zone->GetLayer() ) &&
pad->GetNet() == zone->GetNet() )
690 if( onlyPlanesInside )
693 for(
ZONE* zone : planes )
695 if(
via->IsOnLayer( zone->GetLayer() ) &&
via->GetNet() == zone->GetNet() )
702void PCB_BUILDER::buildGroups()
712 auto it = m_created.find( member );
714 if( it == m_created.end() )
727 m_board.
Add( kgroup );
732void PCB_BUILDER::buildLayers()
734 int copper = m_layers->CopperCount();
767 bds.m_SolderPasteMarginRatio = type->
Oversize / 100.0;
778 auto it = node ? m_nets.find( node->
Parent ) : m_nets.end();
780 return it == m_nets.end() ? nullptr : it->second;
784void PCB_BUILDER::buildFootprints()
796 if( si->Gate != -1 || !si->Placed || !symbol )
799 std::map<const SOURCE_FREE_PAD*, PAD*> padMap;
801 std::unique_ptr<FOOTPRINT> fp =
ConvertFootprint( *symbol, *m_layers,
id, pcb, &padMap );
803 fp->SetParent( &m_board );
812 auto it = padMap.find( freePad );
814 if( !exception || it == padMap.end() )
817 std::unique_ptr<PAD>
pad =
CreatePad( fp.get(), *freePad, *exception, symbolFrame, *m_layers );
818 pad->SetNumber( it->second->GetNumber() );
819 fp->Remove( it->second );
821 it->second =
pad.get();
822 fp->Add(
pad.release() );
825 fp->SetReference( ci->Name );
836 fp->SetPosition( m_frame.
ToKiCad( si->Position ) );
838 placeValueTexts( *fp, *ci, *si );
842 auto it = padMap.find(
dynamic_cast<const SOURCE_FREE_PAD*
>( pi->Pad ) );
845 if( it != padMap.end() && net )
846 it->second->SetNet( net );
849 m_board.
Add( fp.release() );
858 bool referencePlaced =
false;
859 bool valuePlaced =
false;
869 referencePlaced =
true;
879 std::unique_ptr<PCB_TEXT> item = std::make_unique<PCB_TEXT>( &aFootprint );
880 item->SetText( aInstance.
Name );
883 aFootprint.
Add( item.release() );
887 if( !referencePlaced )
895void PCB_BUILDER::buildFreeItems()
898 std::set<const SOURCE_FREE_COPPER*> poured;
902 if( becomesZone( *area ) )
905 poured.insert( piece );
911 if( poured.count( copper ) )
918 if( ( net = netOfNode( term->Node ) ) !=
nullptr )
925 shape->SetNet( net );
927 m_created[copper].push_back( shape );
934 m_created[
text].push_back( ktext );
950 std::unique_ptr<PAD>
pad =
CreatePad( fp, *freePad, *style,
FRAME{ freePad->Position }, *m_layers );
958 m_created[freePad].push_back( fp );
963void PCB_BUILDER::buildTracksAndVias()
965 std::set<const SOURCE_VIA*> vias;
976 if( !style || !vias.insert(
via ).second )
987 int rule = netClass ? netClass->
TentedVias : 2;
988 bool tented = rule == 1 || ( rule == 2 &&
via->Tented );
993 m_created[
via].push_back( kvia );
1004 std::vector<const SOURCE_TRACK_SEGMENT*> verts;
1009 verts.push_back( seg );
1012 auto add = [&](
PCB_TRACK* aItem,
int aWidth )
1017 m_board.
Add( aItem );
1018 m_created[conn].push_back( aItem );
1021 for(
size_t i = 0; i + 1 < verts.size(); ++i )
1028 int width = style ? m_frame.
Length( style->
Width ) : 0;
1031 int32_t angle = s->
X != e->
X || s->
Y != e->
Y ? s->
ArcAngle : 0;
1044 for(
size_t k = 1; k < form.
Points.size(); ++k )
1049 add( ktrack, width );
1057bool PCB_BUILDER::becomesZone(
const SOURCE_AREA& aArea )
const
1065void PCB_BUILDER::buildAreas()
1067 int routingAreas = 0;
1091 zone->
SetZoneName( area->Name.IsEmpty() ? wxString::Format( wxS(
"Easy-PC area %d" ), ruleAreas )
1100 m_board.
Add( zone );
1108 group->SetName( area->Name.IsEmpty() ? wxString( wxS(
"Easy-PC routing area" ) ) : area->Name );
1111 group->AddItem( outline );
1115 if(
group->GetItems().empty() )
1122 m_created[area].push_back(
group );
1126 if( !becomesZone( *area ) )
1134 if(
auto netIt = m_nets.find( area->Net ); netIt != m_nets.end() )
1135 zone->
SetNet( netIt->second );
1144 int32_t spacing = shapeSpacing( kind );
1175 m_board.
Add( zone );
1178 if( routingAreas && m_reporter )
1180 m_reporter->
Report( wxString::Format(
_(
"%d Easy-PC routing areas were imported as outlines on Cmts.User; "
1181 "the design does not run its routing area check, so they restrict "
1192 PCB_BUILDER builder( aDocument, aBoard, aReporter );
1195 builder.m_layers->ApplyUserMapping( aLayerMapping( builder.m_layers->Describe() ) );
1198 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.
NETINFO_ITEM * FindOrAddNet(const wxString &aNetName, int aNetCode=-1, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false)
Return the net with the given name, adding it to the board if there is none.
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)
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)
BOARD_DESIGN_SETTINGS & GetDesignSettings()
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...
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,...
std::optional< wxString > EscapeStringLiteral(const wxString &aText)
Escape text for use between the quotes of an expression string.
@ 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
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)
@ THERMAL
Use thermal relief for pads.