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()
242 buildTracksAndVias();
258int32_t PCB_BUILDER::designValue(
int aTypeA,
int aTypeB )
const
261 return m_spacings ? spacingValue( *m_spacings, aTypeA, aTypeB ) : -1;
264 return std::max( spacingValue( *m_spacings, aTypeA, aTypeB ), spacingValue( *m_spacings, aTypeB, aTypeA ) );
268void PCB_BUILDER::addRule(
const wxString& aName,
const wxString& aConstraint,
const wxString& aCondition )
270 if( m_customRules.IsEmpty() )
271 m_customRules = wxS(
"(version 1)\n" );
273 m_customRules += wxS(
"\n(rule " ) + quoteSexpr( aName ) + wxS(
"\n " ) + aConstraint + wxS(
"\n" );
274 m_customRules += wxS(
" (condition " ) + quoteSexpr( aCondition ) + wxS(
"))\n" );
278void PCB_BUILDER::buildRules()
295 auto param = [&](
int aId )
308 addRule( wxS(
"Easy-PC minimum pad annular ring" ),
309 wxS(
"(constraint annular_width (min " ) + mm( param(
DP_MIN_ANNULAR_RING ) ) + wxS(
"))" ),
310 wxS(
"A.Type == 'Pad'" ) );
315 addRule( wxS(
"Easy-PC minimum text size" ),
316 wxS(
"(constraint text_height (min " ) + mm( param(
DP_MIN_TEXT_SIZE ) ) + wxS(
"))" ),
317 wxS(
"A.Type == 'Text'" ) );
326 for(
size_t i = 0; i < std::size( COPPER_KINDS ); ++i )
328 for(
size_t j = i; j < std::size( COPPER_KINDS ); ++j )
330 const COPPER_KIND& a = COPPER_KINDS[i];
331 const COPPER_KIND& b = COPPER_KINDS[j];
333 addRule( wxString::Format( wxS(
"Easy-PC %s to %s" ), a.Name, b.Name ),
334 wxS(
"(constraint clearance (min " ) + mm( std::max( 0, designValue( a.Kind, b.Kind ) ) )
336 kindTest( a, wxS(
"A" ) ) + wxS(
" && " ) + kindTest( b, wxS(
"B" ) ) );
340 for(
const COPPER_KIND& kind : COPPER_KINDS )
342 addRule( wxString::Format( wxS(
"Easy-PC board to %s" ), kind.Name ),
343 wxS(
"(constraint edge_clearance (min " )
344 + mm( std::max( 0, designValue(
SPACING_BOARD, kind.Kind ) ) ) + wxS(
"))" ),
345 kindTest( kind, wxS(
"A" ) ) );
350void PCB_BUILDER::buildNetClasses()
366 for(
const SOURCE_TRACK_STYLE* style : { aSource->TrackStyle1, aSource->TrackStyle2 } )
369 nominal = std::max( nominal, style->Width );
378 if( aSource->ViaStyle )
382 if( aSource->ViaStyle->Drill > 0 )
387 if( aSource->DiffPairGap > 0 )
391 std::map<const OBJECT*, wxString> classNames;
393 wxString defaultName;
396 defaultName = defaults->NetClass;
400 if( !defaultName.IsEmpty() &&
source->Name.CmpNoCase( defaultName ) == 0 && !defaultSource )
406 std::shared_ptr<NETCLASS> netclass = std::make_shared<NETCLASS>(
name );
407 fill( *netclass,
source );
408 netSettings->SetNetclass(
name, netclass );
412 int32_t minimum = std::numeric_limits<int32_t>::max();
417 minimum = std::min( minimum, style->Width );
422 if( minimum != std::numeric_limits<int32_t>::max() && minimum > 0 && literal )
424 addRule( wxS(
"Easy-PC net class " ) +
source->Name + wxS(
" minimum width" ),
425 wxS(
"(constraint track_width (min " ) + mm( minimum ) + wxS(
"))" ),
426 wxS(
"A.NetClass == '" ) + *literal + wxS(
"'" ) );
430 fill( *netSettings->GetDefaultNetclass(), defaultSource );
432 for(
const auto& [net, kicadNet] : m_nets )
434 if(
auto it = classNames.find(
static_cast<const SOURCE_NET*
>( net )->
NetClass ); it != classNames.end() )
436 netSettings->SetNetclassPatternAssignment( kicadNet->GetNetname(), it->second );
437 kicadNet->SetNetClass( netSettings->GetNetClassByName( it->second ) );
460 int reach = std::max( aLand.x, aLand.y );
477 for(
int i = 0; i < 4; ++i )
479 VECTOR2I dir( reach + iso + spoke, 0 );
485 rect.
Append( aCentre + side );
486 rect.
Append( aCentre + dir + side );
487 rect.
Append( aCentre + dir - side );
488 rect.
Append( aCentre - side );
494 clear.Append( ring );
499 for(
PAD*
pad : fp->Pads() )
501 if( !
pad->IsOnLayer( aKiCadLayer ) )
509 thermal(
pad->GetPosition(), size,
512 pad->GetOrientation() );
517 if(
pad->GetNet() == aNet && !
pad->HasHole() )
535 if( !track->IsOnLayer( aKiCadLayer ) )
540 if(
via &&
via->GetNet() == aNet )
542 int width =
via->GetWidth( aKiCadLayer );
550 else if( track->GetNet() != aNet )
552 track->TransformShapeToPolygon(
clear, aKiCadLayer, iso, PLANE_MAX_ERROR,
ERROR_OUTSIDE );
567 clear.Append( region );
575void PCB_BUILDER::buildPlanes()
579 std::vector<ZONE*> planes;
580 std::optional<SHAPE_POLY_SET> outline;
585 auto netIt = m_nets.find( layer->Net );
588 || netIt == m_nets.end() )
605 + ( style ? m_frame.
Length( style->
Width ) / 2 : 0 ),
609 ( outline ? *outline : outline.emplace() ).
BooleanAdd( region );
612 if( !outline || outline->IsEmpty() )
617 zone->
SetNet( netIt->second );
627 planes.push_back( zone );
632 fill.
BooleanSubtract( planeClearances( *layer, kicadLayer, netIt->second ) );
645 for(
ZONE* zone : planes )
647 names += ( names.IsEmpty() ? wxString() : wxString( wxS(
", " ) ) ) + zone->GetZoneName();
648 planeLayers.
set( zone->GetLayer() );
653 m_reporter->
Report( wxString::Format(
_(
"Easy-PC power planes (%s) were imported with the copper the "
654 "program plots. KiCad cannot refill them the same way: a refill "
655 "makes via thermals solid and clears foreign through-hole lands "
656 "only around their holes." ),
667 for(
PAD*
pad : fp->Pads() )
674 for(
ZONE* zone : planes )
676 if(
pad->GetNet() == zone->GetNet() )
679 if(
pad->HasHole() &&
pad->IsOnLayer( zone->GetLayer() ) &&
pad->GetNet() == zone->GetNet() )
692 if( onlyPlanesInside )
695 for(
ZONE* zone : planes )
697 if(
via->IsOnLayer( zone->GetLayer() ) &&
via->GetNet() == zone->GetNet() )
704void PCB_BUILDER::buildGroups()
714 auto it = m_created.find( member );
716 if( it == m_created.end() )
729 m_board.
Add( kgroup );
734void PCB_BUILDER::buildLayers()
736 int copper = m_layers->CopperCount();
769 bds.m_SolderPasteMarginRatio = type->
Oversize / 100.0;
780 auto it = node ? m_nets.find( node->
Parent ) : m_nets.end();
782 return it == m_nets.end() ? nullptr : it->second;
786void PCB_BUILDER::buildFootprints()
798 if( si->Gate != -1 || !si->Placed || !symbol )
801 std::map<const SOURCE_FREE_PAD*, PAD*> padMap;
803 std::unique_ptr<FOOTPRINT> fp =
ConvertFootprint( *symbol, *m_layers,
id, pcb, &padMap );
805 fp->SetParent( &m_board );
814 auto it = padMap.find( freePad );
816 if( !exception || it == padMap.end() )
819 std::unique_ptr<PAD>
pad =
CreatePad( fp.get(), *freePad, *exception, symbolFrame, *m_layers );
820 pad->SetNumber( it->second->GetNumber() );
821 fp->Remove( it->second );
823 it->second =
pad.get();
824 fp->Add(
pad.release() );
827 fp->SetReference( ci->Name );
838 fp->SetPosition( m_frame.
ToKiCad( si->Position ) );
840 placeValueTexts( *fp, *ci, *si );
844 auto it = padMap.find(
dynamic_cast<const SOURCE_FREE_PAD*
>( pi->Pad ) );
847 if( it != padMap.end() && net )
848 it->second->SetNet( net );
851 m_board.
Add( fp.release() );
860 bool referencePlaced =
false;
861 bool valuePlaced =
false;
871 referencePlaced =
true;
881 std::unique_ptr<PCB_TEXT> item = std::make_unique<PCB_TEXT>( &aFootprint );
882 item->SetText( aInstance.
Name );
885 aFootprint.
Add( item.release() );
889 if( !referencePlaced )
897void PCB_BUILDER::buildFreeItems()
900 std::set<const SOURCE_FREE_COPPER*> poured;
904 if( becomesZone( *area ) )
907 poured.insert( piece );
913 if( poured.count( copper ) )
920 if( ( net = netOfNode( term->Node ) ) !=
nullptr )
927 shape->SetNet( net );
929 m_created[copper].push_back( shape );
936 m_created[
text].push_back( ktext );
952 std::unique_ptr<PAD>
pad =
CreatePad( fp, *freePad, *style,
FRAME{ freePad->Position }, *m_layers );
960 m_created[freePad].push_back( fp );
965void PCB_BUILDER::buildTracksAndVias()
967 std::set<const SOURCE_VIA*> vias;
978 if( !style || !vias.insert(
via ).second )
989 int rule = netClass ? netClass->
TentedVias : 2;
990 bool tented = rule == 1 || ( rule == 2 &&
via->Tented );
995 m_created[
via].push_back( kvia );
1006 std::vector<const SOURCE_TRACK_SEGMENT*> verts;
1011 verts.push_back( seg );
1014 auto add = [&](
PCB_TRACK* aItem,
int aWidth )
1019 m_board.
Add( aItem );
1020 m_created[conn].push_back( aItem );
1023 for(
size_t i = 0; i + 1 < verts.size(); ++i )
1030 int width = style ? m_frame.
Length( style->
Width ) : 0;
1033 int32_t angle = s->
X != e->
X || s->
Y != e->
Y ? s->
ArcAngle : 0;
1046 for(
size_t k = 1; k < form.
Points.size(); ++k )
1051 add( ktrack, width );
1059bool PCB_BUILDER::becomesZone(
const SOURCE_AREA& aArea )
const
1067void PCB_BUILDER::buildAreas()
1069 int routingAreas = 0;
1093 zone->
SetZoneName( area->Name.IsEmpty() ? wxString::Format( wxS(
"Easy-PC area %d" ), ruleAreas )
1102 m_board.
Add( zone );
1110 group->SetName( area->Name.IsEmpty() ? wxString( wxS(
"Easy-PC routing area" ) ) : area->Name );
1113 group->AddItem( outline );
1117 if(
group->GetItems().empty() )
1124 m_created[area].push_back(
group );
1128 if( !becomesZone( *area ) )
1136 if(
auto netIt = m_nets.find( area->Net ); netIt != m_nets.end() )
1137 zone->
SetNet( netIt->second );
1146 int32_t spacing = shapeSpacing( kind );
1177 m_board.
Add( zone );
1180 if( routingAreas && m_reporter )
1182 m_reporter->
Report( wxString::Format(
_(
"%d Easy-PC routing areas were imported as outlines on Cmts.User; "
1183 "the design does not run its routing area check, so they restrict "
1194 PCB_BUILDER builder( aDocument, aBoard, aReporter );
1197 builder.m_layers->ApplyUserMapping( aLayerMapping( builder.m_layers->Describe() ) );
1200 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)
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...
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,...
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
@ THERMAL
Use thermal relief for pads.