KiCad PCB EDA Suite
Loading...
Searching...
No Matches
export_gencad_writer.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6* This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <cstdio> // for FILE
23
24#include <wx/string.h>
25
26#include <math/vector2d.h>
27
28#include <pad.h>
29
30class BOARD;
31class FOOTPRINT;
32
39{
40public:
42 m_board( aBoard ),
43 m_file( nullptr ),
44 m_flipBottomPads( false ),
45 m_useUniquePins( false ),
46 m_useIndividualShapes( false ),
47 m_storeOriginCoords( false )
48 {
49 }
50
57 bool WriteFile( const wxString& aFullFileName );
58
60 void SetPlotOffet( VECTOR2I aOffset ) { m_gencadOffset = aOffset; }
61
63 void FlipBottomPads( bool aFlip ) { m_flipBottomPads = aFlip; }
64
66 void UsePinNamesUnique( bool aUnique ) { m_useUniquePins = aUnique; }
67
69 void UseIndividualShapes( bool aUnique ) { m_useIndividualShapes = aUnique; }
70
72 void StoreOriginCoordsInFile( bool aStore ) { m_storeOriginCoords = aStore; }
73
74private:
78
87
89 void createBoardSection();
90
99
105
107
115 void createRoutesSection();
117
118
125 void createShapesSection();
127
132 void writePadShape( const std::string& aName, PAD* aPad, PCB_LAYER_ID aPadLayer );
133
140 void footprintWriteShape( FOOTPRINT* aFootprint, const wxString& aShapeName );
141 const wxString getShapeName( FOOTPRINT* aFootprint );
142
148 double mapXTo( int aX );
149 double mapYTo( int aY );
150
151
152private:
155 FILE* m_file;
156
157 // Export options
162
163 // These are the export origin (the auxiliary axis)
165};
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
void createRoutesSection()
Create the $ROUTES section.
void UseIndividualShapes(bool aUnique)
Make pad shapes unique.
GENCAD_EXPORTER(BOARD *aBoard)
void createTracksInfoData()
Create the "$TRACKS" section.
void createShapesSection()
Create the footprint shape list.
const wxString getShapeName(FOOTPRINT *aFootprint)
void createDevicesSection()
Create the $DEVICES section.
bool createHeaderInfoData()
Creates the header section.
double mapXTo(int aX)
Helper functions to calculate coordinates of footprints in GenCAD values.
void UsePinNamesUnique(bool aUnique)
Make pin names unique.
void StoreOriginCoordsInFile(bool aStore)
Store origin coordinate in GenCAD file.
void FlipBottomPads(bool aFlip)
Flip pad shapes on the bottom side.
void footprintWriteShape(FOOTPRINT *aFootprint, const wxString &aShapeName)
Create the shape of a footprint (SHAPE section)
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 PADS...
void SetPlotOffet(VECTOR2I aOffset)
Set the coordinates offset when exporting items.
bool WriteFile(const wxString &aFullFileName)
Export a GenCAD file.
void createComponentsSection()
Create the $COMPONENTS GenCAD section.
Definition pad.h:61
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683