kicad/utils/kicad2step/pcb/kicadpcb.h

128 lines
3.7 KiB
C
Raw Normal View History

2016-09-02 10:08:40 +00:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
2021-07-29 11:10:58 +00:00
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
2016-09-02 10:08:40 +00:00
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file kicadpcb.h
* declares the main PCB object
*/
#ifndef KICADPCB_H
#define KICADPCB_H
#include <wx/string.h>
#include <string>
#include <vector>
#include "3d_resolver.h"
#include "base.h"
#ifdef SUPPORTS_IGES
#undef SUPPORTS_IGES
#endif
extern void ReportMessage( const wxString& aMessage );
2016-09-02 10:08:40 +00:00
namespace SEXPR
{
class SEXPR;
}
2020-11-14 19:16:42 +00:00
class KICADFOOTPRINT;
2016-09-02 10:08:40 +00:00
class KICADCURVE;
class PCBMODEL;
class KICADPCB
{
public:
KICADPCB( const wxString& aPcbName );
2016-09-02 10:08:40 +00:00
virtual ~KICADPCB();
int GetLayerId( std::string& aLayerName );
2016-09-02 10:08:40 +00:00
void SetOrigin( double aXOrigin, double aYOrigin )
{
m_origin.x = aXOrigin;
m_origin.y = aYOrigin;
}
void UseGridOrigin( bool aUseOrigin )
{
m_useGridOrigin = aUseOrigin;
}
void UseDrillOrigin( bool aUseOrigin )
{
m_useDrillOrigin = aUseOrigin;
}
void SetMinDistance( double aDistance )
{
m_minDistance = aDistance;
}
2016-09-02 10:08:40 +00:00
bool ReadFile( const wxString& aFileName );
bool ComposePCB( bool aComposeVirtual = true, bool aSubstituteModels = true );
bool WriteSTEP( const wxString& aFileName );
2021-07-29 11:10:58 +00:00
#ifdef SUPPORTS_IGES
bool WriteIGES( const wxString& aFileName );
2021-07-29 11:10:58 +00:00
#endif
private:
bool parsePCB( SEXPR::SEXPR* data );
bool parseGeneral( SEXPR::SEXPR* data );
bool parseSetup( SEXPR::SEXPR* data );
bool parseLayers( SEXPR::SEXPR* data );
bool parseModule( SEXPR::SEXPR* data );
bool parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType );
bool parseRect( SEXPR::SEXPR* data );
bool parsePolygon( SEXPR::SEXPR* data );
2021-09-22 11:19:29 +00:00
private:
S3D_RESOLVER m_resolver;
wxString m_filename;
PCBMODEL* m_pcb_model;
DOUBLET m_origin;
DOUBLET m_gridOrigin;
DOUBLET m_drillOrigin;
bool m_useGridOrigin;
bool m_useDrillOrigin;
bool m_hasGridOrigin; // indicates origin found in source file
bool m_hasDrillOrigin; // indicates origin found in source file
2021-07-29 11:10:58 +00:00
// minimum distance between points to treat them as separate entities (mm)
2021-09-22 11:19:29 +00:00
double m_minDistance;
2021-07-29 11:10:58 +00:00
// the names of layers in use, and the internal layer ID
2021-09-22 11:19:29 +00:00
std::map<std::string, int> m_layersNames;
2021-07-29 11:10:58 +00:00
// PCB parameters/entities
double m_thickness;
std::vector<KICADFOOTPRINT*> m_footprints;
std::vector<KICADCURVE*> m_curves;
wxString m_pcbName;
2016-09-02 10:08:40 +00:00
};
#endif // KICADPCB_H