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 29 of file export_gencad_writer.h.
|
inline |
Definition at line 32 of file export_gencad_writer.h.
|
private |
Definition at line 249 of file export_gencad_writer.cpp.
References m_file.
Referenced by WriteFile().
|
private |
Definition at line 1079 of file export_gencad_writer.cpp.
References SEG::A, SEG::B, BOARD::GetBoardPolygonOutlines(), 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 754 of file export_gencad_writer.cpp.
References EDA_ANGLE::AsDegrees(), B_SilkS, escapeString(), F_SilkS, BOARD::Footprints(), genCADLayerName(), BOARD::GetCopperLayerCount(), 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 1038 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 876 of file export_gencad_writer.cpp.
References ExpandTextVars(), GetBuildVersion(), TITLE_BLOCK::GetDate(), BOARD::GetFileName(), BOARD::GetProject(), TITLE_BLOCK::GetRevision(), BOARD::GetTitleBlock(), m_board, m_file, m_storeOriginCoords, mapXTo(), mapYTo(), and TO_UTF8.
Referenced by WriteFile().
|
private |
Definition at line 257 of file export_gencad_writer.cpp.
References PADSTACK::ALL_LAYERS, PAD::Compare(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), LSET::CuStack(), ERROR_INSIDE, F_Cu, fmt_mask(), genCADLayerName(), genCADLayerNameFlipped(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetEnabledLayers(), BOARD::GetEnabledLayers(), BOARD::GetPads(), KI_FALLTHROUGH, m_board, m_file, m_flipBottomPads, next(), SHAPE_POLY_SET::OutlineCount(), pad, SHAPE_LINE_CHAIN::PointCount(), radius, SCALE_FACTOR, LSET::Seq(), BOARD::Tracks(), TransformRoundChamferedRectToPolygon(), 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 910 of file export_gencad_writer.cpp.
References BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetEnabledLayers(), BOARD_CONNECTED_ITEM::GetNetCode(), m_board, TRACKS, and BOARD::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 638 of file export_gencad_writer.cpp.
References EDA_ANGLE::AsDegrees(), componentShapes, escapeString(), BOARD::Footprints(), 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 824 of file export_gencad_writer.cpp.
References escapeString(), BOARD::FindNet(), BOARD::Footprints(), NETINFO_ITEM::GetNetCode(), BOARD::GetNetCount(), 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 1101 of file export_gencad_writer.cpp.
References m_board, m_file, PCB_VIA_T, SCALE_FACTOR, and BOARD::Tracks().
Referenced by WriteFile().
|
inline |
Flip pad shapes on the bottom side.
Definition at line 54 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 1124 of file export_gencad_writer.cpp.
References ANGLE_0, B_SilkS, center, VECTOR2< T >::Distance(), 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, radius, RotatePoint(), SCALE_FACTOR, TO_UTF8, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by createShapesSection().
|
private |
Definition at line 123 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 144 of file export_gencad_writer.cpp.
References m_gencadOffset, SCALE_FACTOR, and VECTOR2< T >::x.
Referenced by createBoardSection(), createComponentsSection(), and createHeaderInfoData().
|
private |
Definition at line 150 of file export_gencad_writer.cpp.
References m_gencadOffset, SCALE_FACTOR, and VECTOR2< T >::y.
Referenced by createBoardSection(), createComponentsSection(), and createHeaderInfoData().
|
inline |
Set the coordinates offset when exporting items.
Definition at line 51 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 63 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 60 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 57 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 156 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, and shapeNames.
Referenced by BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
private |
Definition at line 138 of file export_gencad_writer.h.
Referenced by createBoardSection(), createComponentsSection(), createHeaderInfoData(), createPadsShapesSection(), createRoutesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), and WriteFile().
|
private |
Definition at line 140 of file export_gencad_writer.h.
Referenced by createArtworksSection(), createBoardSection(), createComponentsSection(), createDevicesSection(), createHeaderInfoData(), createPadsShapesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), footprintWriteShape(), and WriteFile().
|
private |
Definition at line 143 of file export_gencad_writer.h.
Referenced by createPadsShapesSection(), createShapesSection(), and FlipBottomPads().
|
private |
Definition at line 139 of file export_gencad_writer.h.
|
private |
Definition at line 149 of file export_gencad_writer.h.
Referenced by mapXTo(), mapYTo(), and SetPlotOffet().
|
private |
Definition at line 146 of file export_gencad_writer.h.
Referenced by createHeaderInfoData(), and StoreOriginCoordsInFile().
|
private |
Definition at line 145 of file export_gencad_writer.h.
Referenced by createShapesSection(), getShapeName(), and UseIndividualShapes().
|
private |
Definition at line 144 of file export_gencad_writer.h.
Referenced by createShapesSection(), and UsePinNamesUnique().