KiCad PCB EDA Suite
|
Export board to GenCAD file format. More...
#include <export_gencad_writer.h>
Public Member Functions | |
GENCAD_EXPORTER (BOARD *aBoard) | |
bool | WriteFile (const wxString &aFullFileName) |
Export a GenCAD file. | |
void | SetPlotOffet (VECTOR2I aOffset) |
Set the coordinates offset when exporting items. | |
void | FlipBottomPads (bool aFlip) |
Flip pad shapes on the bottom side. | |
void | UsePinNamesUnique (bool aUnique) |
Make pin names unique. | |
void | UseIndividualShapes (bool aUnique) |
Make pad shapes unique. | |
void | StoreOriginCoordsInFile (bool aStore) |
Store origin coordinate in GenCAD file. | |
Private Member Functions | |
bool | createHeaderInfoData () |
Creates the header section. | |
void | createArtworksSection () |
void | createTracksInfoData () |
Create the "$TRACKS" section. | |
void | createBoardSection () |
void | createComponentsSection () |
Create the $COMPONENTS GenCAD section. | |
void | createDevicesSection () |
Create the $DEVICES section. | |
void | createRoutesSection () |
Create the $ROUTES section. | |
void | createSignalsSection () |
void | createShapesSection () |
Create the footprint shape list. | |
void | createPadsShapesSection () |
void | footprintWriteShape (FOOTPRINT *aFootprint, const wxString &aShapeName) |
Create the shape of a footprint (SHAPE section) | |
const wxString | getShapeName (FOOTPRINT *aFootprint) |
double | mapXTo (int aX) |
Helper functions to calculate coordinates of footprints in GenCAD values. | |
double | mapYTo (int aY) |
Private Attributes | |
BOARD * | m_board |
wxString | m_fullFileName |
FILE * | m_file |
bool | m_flipBottomPads |
bool | m_useUniquePins |
bool | m_useIndividualShapes |
bool | m_storeOriginCoords |
VECTOR2I | m_gencadOffset |
Export board to GenCAD file format.
Definition at line 34 of file export_gencad_writer.h.
|
inline |
Definition at line 37 of file export_gencad_writer.h.
References m_board, m_file, m_flipBottomPads, m_storeOriginCoords, m_useIndividualShapes, and m_useUniquePins.
|
private |
Definition at line 255 of file export_gencad_writer.cpp.
References m_file.
Referenced by WriteFile().
|
private |
Definition at line 1080 of file export_gencad_writer.cpp.
References SEG::A, SEG::B, SHAPE_POLY_SET::IterateSegmentsWithHoles(), m_board, m_file, mapXTo(), mapYTo(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WriteFile().
|
private |
Create the $COMPONENTS GenCAD section.
GenCAD $COMPONENTS are the footprint placements. Bottom side components are difficult to handle because shapes must be mirrored or flipped. Silk screen layers need to be handled correctly and so on. Also it seems that no one follows the specs...
Definition at line 762 of file export_gencad_writer.cpp.
References EDA_ANGLE::AsDegrees(), B_SilkS, escapeString(), F_SilkS, genCADLayerName(), BOX2< Vec >::GetHeight(), getShapeName(), BOX2< Vec >::GetWidth(), EDA_ANGLE::Invert(), m_board, m_file, mapXTo(), mapYTo(), EDA_ANGLE::Normalize(), SCALE_FACTOR, and TO_UTF8.
Referenced by WriteFile().
|
private |
Create the $DEVICES section.
This is a list of footprints properties. Footprint shapes are in $SHAPES section.
Definition at line 1039 of file export_gencad_writer.cpp.
References componentShapes, escapeString(), LIB_ID::Format(), FOOTPRINT::GetFPID(), FOOTPRINT::GetValue(), m_file, shapeNames, and TO_UTF8.
Referenced by WriteFile().
|
private |
Creates the header section.
Definition at line 884 of file export_gencad_writer.cpp.
References ExpandTextVars(), GetBuildVersion(), m_board, m_file, m_storeOriginCoords, mapXTo(), and mapYTo().
Referenced by WriteFile().
|
private |
Definition at line 263 of file export_gencad_writer.cpp.
References PADSTACK::ALL_LAYERS, CHAMFERED_RECT, CIRCLE, PAD::Compare(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), CUSTOM, dyn_cast(), ERROR_INSIDE, F_Cu, fmt_mask(), genCADLayerName(), genCADLayerNameFlipped(), KI_FALLTHROUGH, m_board, m_file, m_flipBottomPads, next(), SHAPE_POLY_SET::OutlineCount(), OVAL, pad, SHAPE_LINE_CHAIN::PointCount(), radius, RECTANGLE, ROUNDRECT, SCALE_FACTOR, LSET::Seq(), TransformRoundChamferedRectToPolygon(), TRAPEZOID, UNIMPLEMENTED_FOR, via, viaSort(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WriteFile().
|
private |
Create the $ROUTES section.
This section handles tracks and vias
Definition at line 911 of file export_gencad_writer.cpp.
References BOARD_CONNECTED_ITEM::GetNetCode(), m_board, and TRACKS.
Referenced by WriteFile().
|
private |
Create the footprint shape list.
Since footprint shape is customizable after the placement we cannot share them. Instead we opt for the one footprint one shape one component one device approach.
Definition at line 644 of file export_gencad_writer.cpp.
References EDA_ANGLE::AsDegrees(), componentShapes, escapeString(), footprintWriteShape(), hashFootprint(), m_board, m_file, m_flipBottomPads, m_useIndividualShapes, m_useUniquePins, EDA_ANGLE::Normalize(), pad, SCALE_FACTOR, shapeNames, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by WriteFile().
|
private |
Definition at line 832 of file export_gencad_writer.cpp.
References escapeString(), NETINFO_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), m_board, m_file, pad, and TO_UTF8.
Referenced by WriteFile().
|
private |
Create the "$TRACKS" section.
This section gives the list of widths (tools) used in tracks and vias
Each track name is build using "TRACK" + track width. For instance for a width = 120 : name = "TRACK120".
Definition at line 1102 of file export_gencad_writer.cpp.
References m_board, m_file, PCB_VIA_T, and SCALE_FACTOR.
Referenced by WriteFile().
|
inline |
Flip pad shapes on the bottom side.
Definition at line 59 of file export_gencad_writer.h.
References m_flipBottomPads.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
private |
Create the shape of a footprint (SHAPE section)
The shape is always given "normal" orientation. It's almost guaranteed that the silk layer will be imported wrong but the shape also contains the pads.
Definition at line 1125 of file export_gencad_writer.cpp.
References ANGLE_0, ARC, B_SilkS, center, CIRCLE, end, escapeString(), F_SilkS, FP_THROUGH_HOLE, EDA_SHAPE::GetArcAngle(), FOOTPRINT::GetAttributes(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), FOOTPRINT::GraphicalItems(), KiROUND(), m_file, PCB_SHAPE_T, POLY, radius, RECTANGLE, RotatePoint(), SCALE_FACTOR, SEGMENT, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by createShapesSection().
|
private |
Definition at line 124 of file export_gencad_writer.cpp.
References componentShapes, FOOTPRINT::GetReference(), m_useIndividualShapes, and shapeNames.
Referenced by createComponentsSection().
|
private |
Helper functions to calculate coordinates of footprints in GenCAD values.
The GenCAD Y axis from bottom to top,
Definition at line 145 of file export_gencad_writer.cpp.
References m_gencadOffset, and SCALE_FACTOR.
Referenced by createBoardSection(), createComponentsSection(), and createHeaderInfoData().
|
private |
Definition at line 151 of file export_gencad_writer.cpp.
References m_gencadOffset, and SCALE_FACTOR.
Referenced by createBoardSection(), createComponentsSection(), and createHeaderInfoData().
|
inline |
Set the coordinates offset when exporting items.
Definition at line 56 of file export_gencad_writer.h.
References m_gencadOffset.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
inline |
Store origin coordinate in GenCAD file.
Definition at line 68 of file export_gencad_writer.h.
References m_storeOriginCoords.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
inline |
Make pad shapes unique.
Definition at line 65 of file export_gencad_writer.h.
References m_useIndividualShapes.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
inline |
Make pin names unique.
Definition at line 62 of file export_gencad_writer.h.
References m_useUniquePins.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
bool GENCAD_EXPORTER::WriteFile | ( | const wxString & | aFullFileName | ) |
Export a GenCAD file.
aFullFileName | is the full filename to create. |
Definition at line 157 of file export_gencad_writer.cpp.
References B_Cu, componentShapes, BOARD::ComputeBoundingBox(), createArtworksSection(), createBoardSection(), createComponentsSection(), createDevicesSection(), createHeaderInfoData(), createPadsShapesSection(), createRoutesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), BOARD::Footprints(), m_board, m_file, shapeNames, and TOP_BOTTOM.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
private |
Definition at line 143 of file export_gencad_writer.h.
Referenced by createBoardSection(), createComponentsSection(), createHeaderInfoData(), createPadsShapesSection(), createRoutesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), GENCAD_EXPORTER(), and WriteFile().
|
private |
Definition at line 145 of file export_gencad_writer.h.
Referenced by createArtworksSection(), createBoardSection(), createComponentsSection(), createDevicesSection(), createHeaderInfoData(), createPadsShapesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), footprintWriteShape(), GENCAD_EXPORTER(), and WriteFile().
|
private |
Definition at line 148 of file export_gencad_writer.h.
Referenced by createPadsShapesSection(), createShapesSection(), FlipBottomPads(), and GENCAD_EXPORTER().
|
private |
Definition at line 144 of file export_gencad_writer.h.
|
private |
Definition at line 154 of file export_gencad_writer.h.
Referenced by mapXTo(), mapYTo(), and SetPlotOffet().
|
private |
Definition at line 151 of file export_gencad_writer.h.
Referenced by createHeaderInfoData(), GENCAD_EXPORTER(), and StoreOriginCoordsInFile().
|
private |
Definition at line 150 of file export_gencad_writer.h.
Referenced by createShapesSection(), GENCAD_EXPORTER(), getShapeName(), and UseIndividualShapes().
|
private |
Definition at line 149 of file export_gencad_writer.h.
Referenced by createShapesSection(), GENCAD_EXPORTER(), and UsePinNamesUnique().