73 #define EXPORT_CUSTOM_PADS_CONVEX_HULL 102 errorText = ioe.
What();
113 SetStatusText( wxString(
_(
"BOARD exported OK." ) ) );
134 wxLogWarning(
_(
"Board outline is malformed. Run DRC for a full analysis." ) );
171 static inline double scale(
int kicadDist )
174 return kicadDist / (
IU_PER_MM / 1000.0 );
179 static inline double IU2um(
int kicadDist )
185 static inline double mapX(
int x )
191 static inline double mapY(
int y )
207 ret.
x =
mapX( pt.x );
208 ret.
y =
mapY( pt.y );
239 path->AppendPoint( aStart );
240 path->AppendPoint( aEnd );
241 path->SetLayerId( aLayerName.c_str() );
255 std::string uniqifier;
262 int reportedLayers = 0;
269 bool onAllCopperLayers = ( (aPad->
GetLayerSet() & all_cu) == all_cu );
271 if( onAllCopperLayers )
276 for(
int layer=0; layer<copperCount; ++layer )
280 if( onAllCopperLayers || aPad->
IsOnLayer( kilayer ) )
282 layerName[reportedLayers++] =
m_layerIds[layer].c_str();
284 if( !onAllCopperLayers )
288 else if( layer == copperCount - 1 )
291 uniqifier += char(
'0' + layer);
306 dsnOffset =
mapPt( offset );
310 sprintf( offsetTxt,
"[%.6g,%.6g]", dsnOffset.x, dsnOffset.y );
312 uniqifier += offsetTxt;
321 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
325 padstack->
Append( shape );
336 snprintf(
name,
sizeof(
name),
"Round%sPad_%.6g_um",
350 POINT lowerLeft( -dx, -dy );
351 POINT upperRight( dx, dy );
353 lowerLeft += dsnOffset;
354 upperRight += dsnOffset;
356 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
360 padstack->
Append( shape );
370 snprintf(
name,
sizeof(
name ),
"Rect%sPad_%.6gx%.6g_um", uniqifier.c_str(),
392 pstart =
POINT( -dr, 0.0 );
393 pstop =
POINT( dr, 0.0 );
400 pstart =
POINT( 0.0, -dr );
401 pstop =
POINT( 0.0, dr );
407 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
413 shape =
new SHAPE( padstack );
415 padstack->
Append( shape );
418 path->aperture_width = 2.0 * radius;
421 snprintf(
name,
sizeof(
name ),
"Oval%sPad_%.6gx%.6g_um", uniqifier.c_str(),
438 POINT lowerLeft( -dx - ddy, -dy - ddx );
439 POINT upperLeft( -dx + ddy, +dy + ddx );
440 POINT upperRight( +dx - ddy, +dy - ddx );
441 POINT lowerRight( +dx + ddy, -dy + ddx );
443 lowerLeft += dsnOffset;
444 upperLeft += dsnOffset;
445 upperRight += dsnOffset;
446 lowerRight += dsnOffset;
448 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
452 padstack->
Append( shape );
455 PATH* polygon =
new PATH( shape, T_polygon );
468 snprintf(
name,
sizeof(
name ),
"Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_um", uniqifier.c_str(),
482 const int circleToSegmentsCount = 36;
494 double correctionFactor = cos( M_PI / (
double) circleToSegmentsCount );
495 int extra_clearance =
KiROUND( rradius * ( 1.0 - correctionFactor ) );
496 wxSize psize = aPad->
GetSize();
497 psize.x += extra_clearance * 2;
498 psize.y += extra_clearance * 2;
499 rradius += extra_clearance;
508 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
512 padstack->
Append( shape );
515 PATH* polygon =
new PATH( shape, T_polygon );
524 for(
int idx = 0; idx < polygonal_shape.PointCount(); idx++ )
526 POINT corner(
scale( polygonal_shape.CPoint( idx ).x ),
527 scale( -polygonal_shape.CPoint( idx ).y ) );
532 first_corner = corner;
539 snprintf(
name,
sizeof(
name ),
"RoundRect%sPad_%.6gx%.6g_%.6g_um_%f_%X", uniqifier.c_str(),
552 std::vector<wxPoint> polygonal_shape;
556 #ifdef EXPORT_CUSTOM_PADS_CONVEX_HULL 561 for(
int ii = 0; ii < p_outline.
PointCount(); ++ii )
562 polygonal_shape.push_back( wxPoint( p_outline.
CPoint( ii ) ) );
566 if( polygonal_shape.front() != polygonal_shape.back() )
567 polygonal_shape.push_back( polygonal_shape.front() );
569 for(
int ndx = 0; ndx < reportedLayers; ++ndx )
573 padstack->
Append( shape );
576 PATH* polygon =
new PATH( shape, T_polygon );
582 for(
unsigned idx = 0; idx < polygonal_shape.size(); idx++ )
584 POINT corner(
scale( polygonal_shape[idx].x ),
scale( -polygonal_shape[idx].y ) );
593 snprintf(
name,
sizeof(
name ),
"Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um_%s",
596 hash.
Format(
true ).c_str() );
627 for(
int p = 0; p < fpItems.
GetCount(); ++p )
634 double diameter =
scale(
pad->GetDrillSize().x );
639 for(
int layer=0; layer<layerCount; ++layer )
643 image->keepouts.push_back( keepout );
660 if( !mask_copper_layers.any() )
664 PADSTACKSET::iterator iter =
m_padstackset.find( *padstack );
670 padstack = (
PADSTACK*) *iter.base();
679 padNumber =
pad->GetNumber();
682 if( padNumber != wxEmptyString && pinmap.find( padNumber ) == pinmap.end() )
684 pinmap[ padNumber ] = 0;
689 int duplicates = ++pinmap[ padNumber ];
691 sprintf( buf,
"@%d", duplicates );
696 pin->kiNetCode =
pad->GetNetCode();
706 wxPoint pos(
pad->GetPos0() );
715 fpItems.
Collect( aFootprint, scanEDGEs );
717 for(
int i = 0; i < fpItems.
GetCount(); ++i )
728 image->Append( outline );
733 path->SetLayerId(
"signal" );
743 image->Append( outline );
749 path->SetLayerId(
"signal" );
752 wxPoint circle_centre = graphic->
GetStart0();
758 for(
int ii = 0; ii < polyline.
PointCount(); ++ii )
760 wxPoint corner( polyline.
CPoint( ii ).
x, polyline.
CPoint( ii ).
y );
771 image->Append( outline );
776 path->SetLayerId(
"signal" );
780 corner.x = graphic->
GetEnd0().x;
783 corner.y = graphic->
GetEnd0().y;
798 image->Append( outline );
802 path->SetAperture( 0 );
803 path->SetLayerId(
"signal" );
807 double arcAngleDeg = graphic->
GetArcAngle() / 10.0;
810 double arcStartDeg =
ArcTangente( startRadial.
y, startRadial.
x ) / 10;
816 if( arcAngleDeg < 0 )
822 arcAngleDeg = -arcAngleDeg;
841 for(
int ii = polyline.
PointCount() - 1; ii >= 0; --ii )
859 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
875 if( !zone->GetIsRuleArea() )
879 ZONE untransformedZone( *zone );
891 if( zone->GetDoNotAllowVias() && zone->GetDoNotAllowTracks() )
892 keepout_type = T_keepout;
893 else if( zone->GetDoNotAllowVias() )
894 keepout_type = T_via_keepout;
895 else if( zone->GetDoNotAllowTracks() )
896 keepout_type = T_wire_keepout;
898 keepout_type = T_keepout;
904 for(
int layer = 0; layer < copperCount; layer++ )
906 if( layer == copperCount-1 )
913 image->keepouts.push_back( keepout );
915 PATH* mainPolygon =
new PATH( keepout, T_polygon );
922 bool is_first_point =
true;
925 for( iterator = untransformedZone.
IterateWithHoles(); iterator; iterator++ )
927 wxPoint point( iterator->x, iterator->y );
934 is_first_point =
false;
948 PATH* cutout =
nullptr;
949 bool isStartContour =
true;
952 for( iterator++; iterator; iterator++ )
956 is_first_point =
true;
957 window =
new WINDOW( keepout );
960 cutout =
new PATH( window, T_polygon );
972 wxPoint point( iterator->x, iterator->y );
979 is_first_point =
false;
996 int aTopLayer,
int aBotLayer )
1000 double dsnDiameter =
scale( aCopperDiameter );
1002 for(
int layer=aTopLayer; layer<=aBotLayer; ++layer )
1006 padstack->
Append( shape );
1016 snprintf(
name,
sizeof(
name ),
"Via[%d-%d]_%.6g:%.6g_um",
1017 aTopLayer, aBotLayer, dsnDiameter,
1019 IU2um( aDrillDiameter ) );
1033 aVia->
LayerPair( &topLayerNum, &botLayerNum );
1038 if( topLayer > botLayer )
1039 std::swap( topLayer, botLayer );
1051 path->layer_id =
"pcb";
1055 for(
int ii = 0; ii < outline.
PointCount(); ii++ )
1070 PATH* poly_ko =
new PATH(
nullptr, T_polygon );
1078 for(
int jj = 0; jj < hole.
PointCount(); jj++ )
1106 items.
Collect( aBoard, scanMODULEs );
1110 for(
int i=0; i<items.
GetCount(); ++i )
1117 _(
"Symbol with value of '%s' has empty reference id." ),
1124 if( !refpair.second )
1127 _(
"Multiple symbols have identical reference IDs of '%s'." ),
1146 for(
int pcbNdx=0; pcbNdx<layerCount; ++pcbNdx )
1159 case LT_SIGNAL: layerType = T_signal;
break;
1160 case LT_POWER: layerType = T_power;
break;
1164 case LT_MIXED: layerType = T_signal;
break;
1165 case LT_JUMPER: layerType = T_jumper;
break;
1172 property->name =
"index";
1174 sprintf( temp,
"%d", pcbNdx );
1175 property->value = temp;
1212 double clearance =
scale( defaultClearance );
1216 sprintf( rule,
"(width %.6g)",
scale( defaultTrackWidth ) );
1217 rules.push_back( rule );
1219 sprintf( rule,
"(clearance %.6g)", clearance +
safetyMargin );
1220 rules.push_back( rule );
1232 if( default_smd <= 6.0 )
1235 sprintf( rule,
"(clearance %.6g (type default_smd))", default_smd );
1237 rules.push_back( rule );
1242 clearance =
scale( defaultClearance ) / 4;
1244 sprintf( rule,
"(clearance %.6g (type smd_smd))", clearance );
1245 rules.push_back( rule );
1251 int netlessZones = 0;
1254 items.
Collect( aBoard, scanZONEs );
1256 for(
int i = 0; i < items.
GetCount(); ++i )
1271 PATH* mainPolygon =
new PATH( plane, T_polygon );
1277 if( plane->
name.size() == 0 )
1285 sprintf(
name,
"@:no_net_%d", netlessZones++ );
1300 bool is_first_point =
true;
1304 wxPoint point( iterator->x, iterator->y );
1306 if( is_first_point )
1309 is_first_point =
false;
1326 bool isStartContour =
true;
1329 for( iterator++; iterator; iterator++ )
1331 if( isStartContour )
1333 is_first_point =
true;
1334 window =
new WINDOW( plane );
1338 cutout =
new PATH( window, T_polygon );
1352 wxPoint point(iterator->x, iterator->y );
1354 if( is_first_point )
1357 is_first_point =
false;
1372 items.
Collect( aBoard, scanZONEs );
1374 for(
int i = 0; i < items.
GetCount(); ++i )
1388 keepout_type = T_keepout;
1390 keepout_type = T_via_keepout;
1392 keepout_type = T_wire_keepout;
1394 keepout_type = T_keepout;
1400 for(
int layer = 0; layer < copperCount; layer++ )
1402 if( layer == copperCount - 1 )
1411 PATH* mainPolygon =
new PATH( keepout, T_polygon );
1418 bool is_first_point =
true;
1423 wxPoint point( iterator->x, iterator->y );
1425 if( is_first_point )
1428 is_first_point =
false;
1441 WINDOW* window =
nullptr;
1442 PATH* cutout =
nullptr;
1444 bool isStartContour =
true;
1447 for( iterator++; iterator; iterator++ )
1449 if( isStartContour )
1451 is_first_point =
true;
1452 window =
new WINDOW( keepout );
1455 cutout =
new PATH( window, T_polygon );
1467 wxPoint point(iterator->x, iterator->y );
1469 if( is_first_point )
1472 is_first_point =
false;
1489 std::string componentId;
1492 int highestNetCode = 0;
1496 highestNetCode = std::max( highestNetCode, i->GetNetCode() );
1501 m_nets.resize( highestNetCode + 1,
nullptr );
1503 for(
unsigned i = 1 ; i <
m_nets.size(); ++i )
1508 if( i->GetNetCode() > 0 )
1509 m_nets[i->GetNetCode()]->net_id =
TO_UTF8( i->GetNetname() );
1512 items.
Collect( aBoard, scanMODULEs );
1516 for(
int m = 0; m < items.
GetCount(); ++m )
1532 for(
unsigned p = 0; p <
image->pins.size(); ++p )
1536 int netcode =
pin->kiNetCode;
1565 comp->
places.push_back( place );
1579 place->
side = T_back;
1595 for(
unsigned n = 1; n <
m_nets.size(); ++n )
1599 if( net->
pins.size() )
1623 NETCLASSPTR netclass = nclasses.
GetDefault();
1640 netclass = nc->second;
1642 via =
makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(),
1659 items.
Collect( aBoard, scanTRACKs );
1661 std::string netname;
1665 int old_netcode = -1;
1669 for(
int i = 0; i < items.
GetCount(); ++i )
1671 PCB_TRACK* track = static_cast<PCB_TRACK*>( items[i] );
1677 if( old_netcode != netcode || old_width != track->
GetWidth() ||
1684 if( old_netcode != netcode )
1686 old_netcode = netcode;
1694 wiring->
wires.push_back( wire );
1710 path->aperture_width =
scale( old_width );
1725 items.
Collect( aBoard, scanVIAs );
1727 for(
int i = 0; i<items.
GetCount(); ++i )
1729 PCB_VIA*
via = static_cast<PCB_VIA*>( items[i] );
1732 int netcode =
via->GetNetCode();
1759 if(
via->IsLocked() )
1789 NETCLASSPTR netclass = nc->second;
1839 clazz->
rules =
new RULE( clazz, T_rule );
1842 int trackWidth = aNetClass->GetTrackWidth();
1843 sprintf(
text,
"(width %.6g)",
scale( trackWidth ) );
1847 int clearance = aNetClass->GetClearance();
1864 snprintf(
text,
sizeof(
text),
"(use_via %s)",
via->GetPadstackId().c_str() );
1879 footprint->SetFlag( 0 );
1881 if( footprint->GetLayer() ==
B_Cu )
1883 footprint->Flip( footprint->GetPosition(), false );
1884 footprint->SetFlag( 1 );
1902 if( footprint->GetFlag() )
1904 footprint->Flip( footprint->GetPosition(), false );
1905 footprint->SetFlag( 0 );
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A <via_descriptor> in the specctra dsn spec.
void FixNegativeZero()
Change negative zero to positive zero in the IEEE floating point storage format.
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
A <pin_reference> definition in the specctra dsn spec.
bool space_in_quoted_tokens
void buildLayerMaps(BOARD *aBoard)
Create a few data translation structures for layer name and number mapping between the DSN::PCB struc...
SHAPE_POLY_SET::ITERATOR IterateWithHoles()
Return an iterator to visit all points of the zone's main outline with holes.
std::map< wxString, int > PINMAP
data type used to ensure unique-ness of pin names, holding (wxString and int)
int OutlineCount() const
Return the number of vertices in a given outline/hole.
bool IsContentModified() const
void exportNETCLASS(const std::shared_ptr< NETCLASS > &aNetClass, BOARD *aBoard)
Export aNetClass to the DSN file.
A <net_descriptor> in the DSN spec.
bool IsEndContour() const
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
This source file implements export and import capabilities to the specctra dsn file format.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
STRINGS circuit
circuit descriptor list
static bool isRoundKeepout(PAD *aPad)
Decide if the pad is a copper-less through hole which needs to be made into a round keepout.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
const wxPoint & GetEnd() const
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
const wxPoint & GetStart() const
Return the starting point of the graphic.
static const double safetyMargin
static constexpr double IU_PER_MM
Mock up a conversion function.
bool m_footprintsAreFlipped
bool GetDoNotAllowVias() const
static POINT mapPt(const wxPoint &pt)
Convert a KiCad point into a DSN file point.
static double IU2um(int kicadDist)
IMAGE * LookupIMAGE(IMAGE *aImage)
Add the image only if one exactly like it does not already exist in the image container.
void SetLayerId(const char *aLayerId)
void SetLayerId(const char *aLayerId)
double GetArcAngle() const
class PCB_ARC, an arc track segment on a copper layer
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
void fillBOUNDARY(BOARD *aBoard, BOUNDARY *aBoundary)
Make the board perimeter for the DSN file by filling the BOUNDARY element in the specctra element tre...
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
const wxPoint & GetStart0() const
int LAYER_NUM
This can be replaced with int and removed.
wxString GetNetname() const
STRINGS m_layerIds
indexed by PCB layer number
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
IMAGE * makeIMAGE(BOARD *aBoard, FOOTPRINT *aFootprint)
Allocates an I::MAGE on the heap and creates all the PINs according to the PADs in the FOOTPRINT.
const NETINFO_LIST & GetNetInfo() const
class FP_SHAPE, a footprint edge
void AppendPoint(const POINT &aPoint)
class PAD, a pad in a footprint
The <class_descriptor> in the specctra spec.
void NORMALIZE_ANGLE_DEGREES_POS(double &Angle)
void SetPCB(PCB *aPcb)
Delete any existing PCB and replaces it with the given one.
void NORMALIZE_ANGLE_POS(T &Angle)
virtual bool IsLocked() const
int PointCount() const
Return the number of points (vertices) in this line chain.
void SetLayerId(const char *aLayerId)
static PCB * MakePCB()
Make a PCB with all the default ELEMs and parts on the heap.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
A <rule_descriptor> in the specctra dsn spec.
void SetVertex(const POINT &aVertex)
std::set< std::string > STRINGSET
class PCB_TRACK, a track segment (segment on a copper layer)
This file contains miscellaneous commonly used macros and functions.
void SetShape(ELEM *aShape)
static const KICAD_T scanPADs[]
const char * c_str() const
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
wxPoint GetCenter0() const
std::pair< STRINGSET::iterator, bool > STRINGSET_PAIR
std::vector< NET * > m_nets
we don't want ownership here permanently, so we don't use boost::ptr_vector
void Rotate(const wxPoint &aCentre, double aAngle) override
Move the outlines.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
int GetCount() const
Return the number of objects in the list.
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
NETCLASS_MAP::iterator iterator
void SetShape(ELEM *aShape)
const wxPoint & GetOffset() const
const wxSize & GetDrillSize() const
STRINGSET::iterator iterator
int GetTrackWidth() const
const wxPoint & GetEnd() const
Return the ending point of the graphic.
std::vector< int > m_kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
LSET is a set of PCB_LAYER_IDs.
A container for NETCLASS instances.
void AddWindow(WINDOW *aWindow)
virtual const wxString What() const
A composite of Problem() and Where()
A <plane_descriptor> in the specctra dsn spec.
static const char Default[]
the name of the default NETCLASS
void deleteNETs()
Delete all the NETs that may be in here.
Container for NETINFO_ITEM elements, which are the nets.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Handles how to draw a screen (a board, a schematic ...)
FOOTPRINTS & Footprints()
void RevertFOOTPRINTs(BOARD *aBoard)
Flip the footprints which were on the back side of the board back to the back.
Implement a <placement_reference> in the specctra dsn spec.
const wxSize & GetSize() const
A collection of nets and the parameters used to route or test these nets.
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
bool GetDoNotAllowTracks() const
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aCornerBuffer, const wxPoint &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
const wxString & GetNetname() const
void AddPadstack(PADSTACK *aPadstack)
const EDA_RECT GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
PAD_SHAPE GetShape() const
std::string component_id
reference designator
Hold either a via or a pad definition.
NETCLASSES & GetNetClasses() const
a few functions useful in geometry calculations.
void Simplify(POLYGON_MODE aFastMode)
Handle a list of polygons defining a copper zone.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
class ZONE, a copper pour area
int m_top_via_layer
specctra cu layers, 0 based index:
std::vector< std::string > STRINGS
A DSN data tree, usually coming from a DSN file.
void ExportBoardToSpecctraFile(BOARD *aBoard, const wxString &aFullFilename)
Helper method to export board to DSN file.
static PATH * makePath(const POINT &aStart, const POINT &aEnd, const std::string &aLayerName)
Create a PATH element with a single straight line, a pair of vertices.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
COMPONENT * LookupCOMPONENT(const std::string &imageName)
Look up a COMPONENT by name.
void Collect(BOARD_ITEM *aBoard, const KICAD_T aScanList[])
Collect BOARD_ITEM objects using this class's Inspector method, which does the collection.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
PADSTACK * makePADSTACK(BOARD *aBoard, PAD *aPad)
Create a #PADSTACK which matches the given pad.
int ConvertArcToPolyline(SHAPE_LINE_CHAIN &aPolyline, VECTOR2I aCenter, int aRadius, double aStartAngleDeg, double aArcAngleDeg, double aAccuracy, ERROR_LOC aErrorLoc)
Generate a polyline to approximate a arc.
void SetRotation(double aRotation)
class FOOTPRINT, a footprint
int GetRoundRectCornerRadius() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
const wxSize & GetDelta() const
void SetContentModified(bool aModified=true)
A "(shape ..)" element in the specctra dsn spec.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
bool BuiltBoardOutlines(BOARD *aBoard)
Build the board outlines and store it in m_brd_outlines.
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Handle the data for a net.
PADSTACK * LookupVia(PADSTACK *aVia)
Add the via only if one exactly like it does not already exist in the padstack container.
Implement a <component_descriptor> in the specctra dsn spec.
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
A point in the SPECCTRA DSN coordinate system.
void FromBOARD(BOARD *aBoard)
Add the entire BOARD to the PCB but does not write it out.
A <wire_shape_descriptor> in the specctra dsn spec.
double GetChamferRectRatio() const
void SetCorners(const POINT &aPoint0, const POINT &aPoint1)
void ExportPCB(const wxString &aFilename, bool aNameChange=false)
Write the internal PCB instance out as a SPECTRA DSN format file.
void AppendVia(PADSTACK *aVia)
Add aVia to the internal via container.
Information pertinent to a Pcbnew printed circuit board.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PCB_LAYER_ID
A quick note on layer IDs:
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
static double mapY(int y)
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
std::string Format(bool aCompactForm=false)
int GetCopperLayerCount() const
static double mapX(int x)
Handle the component boundary box.
NETCLASS * GetDefault() const
const wxPoint & GetEnd0() const
void SetShape(ELEM *aShape)
static bool empty(const wxTextEntryBase *aCtrl)
static double scale(int kicadDist)
Convert a distance from Pcbnew internal units to the reported Specctra DSN units in floating point fo...
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void SetBOUNDARY(BOUNDARY *aBoundary)
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
void AppendVia(const char *aViaName)
void Clear()
Remove all points from the line chain.
int GetChamferPositions() const
NETCLASSPTR GetDefault() const
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
class PCB_VIA, a via (like a track segment on a copper layer)
A <wire_via_descriptor> in the specctra dsn spec.
void SetVertex(const POINT &aVertex)
double ArcTangente(int dy, int dx)
Collect all BOARD_ITEM objects of a given set of KICAD_T type(s).
PADSTACKSET m_padstackset
Used for <keepout_descriptor> and <plane_descriptor>.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
void SetPadstackId(const char *aPadstackId)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
#define THROW_IO_ERROR(msg)
void SetDiameter(double aDiameter)
A specialization of ZONE for use in footprints.
SHAPE_POLY_SET m_brd_outlines
A <wiring_descriptor> in the specctra dsn spec.
const wxPoint & GetStart() const
PADSTACK * makeVia(int aCopperDiameter, int aDrillDiameter, int aTopLayer, int aBotLayer)
Make a round through hole #PADSTACK using the given KiCad diameter in deci-mils.
void FlipFOOTPRINTs(BOARD *aBoard)
Flip the footprints which are on the back side of the board to the front.
bool ExportSpecctraFile(const wxString &aFullFilename)
Export the current BOARD to a specctra dsn file.
STRINGS rules
rules are saved in std::string form.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
void BuildConvexHull(std::vector< wxPoint > &aResult, const std::vector< wxPoint > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.