|
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 | writePadShape (const std::string &aName, PAD *aPad, PCB_LAYER_ID aPadLayer) |
Write one "PAD" entry for the copper aPad carries on aPadLayer, named aName as referenced from a PADSTACK entry. | |
| 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 38 of file export_gencad_writer.h.
|
inline |
Definition at line 41 of file export_gencad_writer.h.
References m_board, m_file, m_flipBottomPads, m_storeOriginCoords, m_useIndividualShapes, and m_useUniquePins.
|
private |
Definition at line 312 of file export_gencad_writer.cpp.
References m_file.
Referenced by WriteFile().
|
private |
Definition at line 1162 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 846 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 1121 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 968 of file export_gencad_writer.cpp.
References ExpandTextVars(), FOR_GUI, GetBuildVersion(), m_board, m_file, m_storeOriginCoords, mapXTo(), and mapYTo().
Referenced by WriteFile().
|
private |
Definition at line 539 of file export_gencad_writer.cpp.
References PAD::Compare(), dyn_cast(), genCADLayerName(), genCADLayerNameFlipped(), m_board, m_file, m_flipBottomPads, pad, padShapeName(), SCALE_FACTOR, LSET::Seq(), via, viaShapeStem(), viaSort(), viaStackName(), and writePadShape().
Referenced by WriteFile().
|
private |
Create the $ROUTES section.
This section handles tracks and vias
Definition at line 995 of file export_gencad_writer.cpp.
References BOARD_CONNECTED_ITEM::GetNetCode(), and m_board.
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 728 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 916 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 1186 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 63 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 1209 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 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, and SCALE_FACTOR.
Referenced by createBoardSection(), createComponentsSection(), and createHeaderInfoData().
|
private |
Definition at line 150 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 60 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 72 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 69 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 66 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, shapeNames, and TOP_BOTTOM.
Referenced by BOOST_AUTO_TEST_CASE(), BOARD_EDITOR_CONTROL::ExportGenCAD(), and PCBNEW_JOBS_HANDLER::JobExportGencad().
|
private |
Write one "PAD" entry for the copper aPad carries on aPadLayer, named aName as referenced from a PADSTACK entry.
Definition at line 320 of file export_gencad_writer.cpp.
References CHAMFERED_RECT, CIRCLE, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), CUSTOM, ERROR_INSIDE, PAD::GetChamferPositions(), PAD::GetChamferRectRatio(), PAD::GetDelta(), PAD::GetDrillSize(), BOARD_ITEM::GetMaxError(), PAD::GetOffset(), PAD::GetOrientation(), PAD::GetRoundRectCornerRadius(), PAD::GetShape(), PAD::GetSize(), KI_FALLTHROUGH, m_file, PAD::MergePrimitivesAsPolygon(), next(), SHAPE_POLY_SET::OutlineCount(), OVAL, SHAPE_LINE_CHAIN::PointCount(), radius, RECTANGLE, ROUNDRECT, SCALE_FACTOR, PAD::ShowPadShape(), TransformRoundChamferedRectToPolygon(), TRAPEZOID, UNIMPLEMENTED_FOR, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by createPadsShapesSection().
|
private |
Definition at line 153 of file export_gencad_writer.h.
Referenced by createBoardSection(), createComponentsSection(), createHeaderInfoData(), createPadsShapesSection(), createRoutesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), GENCAD_EXPORTER(), and WriteFile().
|
private |
Definition at line 155 of file export_gencad_writer.h.
Referenced by createArtworksSection(), createBoardSection(), createComponentsSection(), createDevicesSection(), createHeaderInfoData(), createPadsShapesSection(), createShapesSection(), createSignalsSection(), createTracksInfoData(), footprintWriteShape(), GENCAD_EXPORTER(), WriteFile(), and writePadShape().
|
private |
Definition at line 158 of file export_gencad_writer.h.
Referenced by createPadsShapesSection(), createShapesSection(), FlipBottomPads(), and GENCAD_EXPORTER().
|
private |
Definition at line 154 of file export_gencad_writer.h.
|
private |
Definition at line 164 of file export_gencad_writer.h.
Referenced by mapXTo(), mapYTo(), and SetPlotOffet().
|
private |
Definition at line 161 of file export_gencad_writer.h.
Referenced by createHeaderInfoData(), GENCAD_EXPORTER(), and StoreOriginCoordsInFile().
|
private |
Definition at line 160 of file export_gencad_writer.h.
Referenced by createShapesSection(), GENCAD_EXPORTER(), getShapeName(), and UseIndividualShapes().
|
private |
Definition at line 159 of file export_gencad_writer.h.
Referenced by createShapesSection(), GENCAD_EXPORTER(), and UsePinNamesUnique().