35 auto& x =
nets_map.emplace( std::piecewise_construct, std::forward_as_tuple( 0 ),
36 std::forward_as_tuple(
nets.size(),
"$NONE$" ) )
51 for(
const auto& subnet :
subnets )
65 auto& net =
nets_map.emplace( std::piecewise_construct,
67 std::forward_as_tuple(
nets.size(), netName ) )
70 nets.push_back( &net );
94 static const std::map<TYPE, std::string> type_map = {
95 { TYPE::COPPER,
"C" },
117 static const std::map<FILL_TYPE, std::string> fill_type_map = { {
FILL_TYPE::SOLID,
"S" },
120 static const std::map<CUTOUT_TYPE, std::string> cutout_type_map = {
134 static const std::map<SIDE, std::string> side_map = {
159 layers.push_back( aLayer );
188 ost <<
"CT" << std::endl;
190 ost <<
"CE" << std::endl;
199 std::shared_ptr<FOOTPRINT> fp(
static_cast<FOOTPRINT*
>( aFp->
Clone() ) );
201 fp->SetParentGroup(
nullptr );
202 fp->SetPosition( { 0, 0 } );
215 wxString fp_name = fp->GetFPID().GetLibItemName().wx_str();
218 if( fp_name.IsEmpty() )
219 fp_name = wxS(
"__" );
228 PACKAGE* pkg = &( iter->second );
232 BOX2I bbox = fp->GetBoundingBox();
239 if( fp->Pads().size() < 2 )
242 for(
size_t i = 0; i < fp->Pads().size(); ++i )
244 const PAD* pad1 = fp->Pads()[i];
246 for(
size_t j = i + 1; j < fp->Pads().size(); ++j )
248 const PAD* pad2 = fp->Pads()[j];
259 pkg_outline = courtyard;
263 pkg_outline = courtyard_back;
268 pkg_outline = fp->GetBoundingHull();
275 for(
int ii = 0; ii < pkg_outline.
OutlineCount(); ++ii )
278 std::make_unique<OUTLINE_CONTOUR>( pkg_outline.
Polygon( ii ) ) );
282 for(
size_t i = 0; i < fp->Pads().size(); ++i )
284 const PAD*
pad = fp->Pads()[i];
303 name = wxString::Format(
"NPTH%zu", aPinNum );
304 else if(
name.empty() )
305 name = wxString::Format(
"PAD%zu", aPinNum );
317 pin->type = PIN::TYPE::THROUGH_HOLE;
321 pin->type = PIN::TYPE::SURFACE;
349 const std::shared_ptr<SHAPE_POLY_SET>& polygons =
354 if( polygons->OutlineCount() > 0 )
356 pin->m_pinOutlines.push_back( std::make_unique<OUTLINE_CONTOUR>( polygons->Polygon( 0 ) ) );
363 static const std::map<TYPE, std::string> type_map = { { TYPE::SURFACE,
"S" },
364 { TYPE::THROUGH_HOLE,
"T" },
365 { TYPE::BLIND,
"B" } };
367 static const std::map<ELECTRICAL_TYPE, std::string> etype_map = {
383 outline->Write( ost );
396 outline->Write( ost );
408 ost <<
"# " << wxDateTime::Now().FormatISOCombined() << std::endl;
413 for(
const auto& layer :
layers )
422 for(
const auto& net :
nets )
424 ost <<
"#NET " << net->m_index << std::endl;
431 ost <<
"# PKG " << i << std::endl;
434 ost <<
"#" << std::endl;
constexpr EDA_IU_SCALE pcbIUScale
wxString GetBuildVersion()
Get the full KiCad version string.
void WriteAttributes(std::ostream &ost, const std::string &prefix="") const
void WriteAttributes(std::ostream &ost) const
VECTOR2I GetFPRelativePosition() const
constexpr const Vec & GetPosition() const
constexpr const Vec GetEnd() const
void Write(std::ostream &ost) const
void Write(std::ostream &ost) const
std::list< std::unique_ptr< SUB_NET > > subnets
void AddPin(const PAD *aPad, size_t aPinNum)
std::vector< std::shared_ptr< PIN > > m_pinsVec
wxString m_name
<! Reference number of the package to be used in CMP.
void Write(std::ostream &ost) const
std::list< std::unique_ptr< PKG_OUTLINE > > m_pkgOutlines
std::list< std::unique_ptr< PKG_OUTLINE > > m_pinOutlines
std::pair< wxString, wxString > m_center
void Write(std::ostream &ost) const
void WriteSubnet(std::ostream &ost) const override
void WriteSubnet(std::ostream &ost) const override
void WriteSubnet(std::ostream &ost) const override
void WriteSubnet(std::ostream &ost) const override
std::list< FEATURE_ID > feature_ids
void Write(std::ostream &ost) const
void AddFeatureID(FEATURE_ID::TYPE type, const wxString &layer, size_t feature_id)
virtual void WriteSubnet(std::ostream &ost) const =0
std::list< const PACKAGE * > packages
std::map< wxString, size_t > layers_map
std::list< const NET * > nets
std::map< size_t, NET > nets_map
std::vector< wxString > layers
std::map< size_t, PACKAGE > packages_map
void AddNET(const NETINFO_ITEM *aNet)
std::vector< std::shared_ptr< FOOTPRINT > > m_eda_footprints
size_t GetLyrIdx(const wxString &aLayerName)
void AddPackage(const FOOTPRINT *aFp)
void Write(std::ostream &ost) const
Handle the data for a net.
const wxString & GetNetname() const
void Write(std::ostream &ost) const override
void Write(std::ostream &ost) const override
std::unique_ptr< ODB_SURFACE_DATA > m_surfaces
void Write(std::ostream &ost) const override
void Write(std::ostream &ost) const override
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
PAD_ATTRIB GetAttribute() const
const wxString & GetNumber() const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
bool IsOnCopperLayer() const override
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
bool HasHole() const override
static std::string m_unitsStr
Represent a set of closed polygons.
POLYGON & Polygon(int aIndex)
Return the aIndex-th subpolygon in the set.
int OutlineCount() const
Return the number of outlines in the set.
static constexpr EDA_ANGLE ANGLE_0
size_t hash_fp_item(const EDA_ITEM *aItem, int aFlags)
Calculate hash of an EDA_ITEM.
Hashing functions for EDA_ITEMs.
@ REL_COORD
Use coordinates relative to the parent object.
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
wxString Data2String(double aVal)
void RemoveWhitespace(wxString &aStr)
std::pair< wxString, wxString > AddXY(const VECTOR2I &aVec)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
VECTOR2< double > VECTOR2D