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>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2018-09-20 09:05:52 +00:00
|
|
|
extern void ReportMessage( const wxString& aMessage );
|
|
|
|
|
2016-09-02 10:08:40 +00:00
|
|
|
namespace SEXPR
|
|
|
|
{
|
|
|
|
class SEXPR;
|
|
|
|
}
|
|
|
|
|
|
|
|
class KICADMODULE;
|
|
|
|
class KICADCURVE;
|
|
|
|
class PCBMODEL;
|
|
|
|
|
|
|
|
class KICADPCB
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
S3D_RESOLVER m_resolver;
|
2018-09-20 09:05:52 +00:00
|
|
|
wxString m_filename;
|
2018-10-02 06:34:07 +00:00
|
|
|
PCBMODEL* m_pcb_model;
|
2016-09-02 10:08:40 +00:00
|
|
|
DOUBLET m_origin;
|
2016-09-04 07:08:56 +00:00
|
|
|
DOUBLET m_gridOrigin;
|
|
|
|
DOUBLET m_drillOrigin;
|
|
|
|
bool m_useGridOrigin;
|
|
|
|
bool m_useDrillOrigin;
|
|
|
|
// set to TRUE if the origin was actually parsed
|
|
|
|
bool m_hasGridOrigin;
|
|
|
|
bool m_hasDrillOrigin;
|
2018-06-19 08:14:10 +00:00
|
|
|
// minimum distance between points to treat them as separate entities (mm)
|
|
|
|
double m_minDistance;
|
2017-06-08 06:33:14 +00:00
|
|
|
// the names of layers in use, and the internal layer ID
|
|
|
|
std::map<std::string, int> m_layersNames;
|
2016-09-02 10:08:40 +00:00
|
|
|
|
|
|
|
// PCB parameters/entities
|
|
|
|
double m_thickness;
|
|
|
|
std::vector< KICADMODULE* > m_modules;
|
|
|
|
std::vector< KICADCURVE* > m_curves;
|
|
|
|
|
|
|
|
bool parsePCB( SEXPR::SEXPR* data );
|
|
|
|
bool parseGeneral( SEXPR::SEXPR* data );
|
2016-09-04 07:08:56 +00:00
|
|
|
bool parseSetup( SEXPR::SEXPR* data );
|
2017-06-08 06:33:14 +00:00
|
|
|
bool parseLayers( SEXPR::SEXPR* data );
|
2016-09-02 10:08:40 +00:00
|
|
|
bool parseModule( SEXPR::SEXPR* data );
|
|
|
|
bool parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType );
|
2020-08-17 17:30:35 +00:00
|
|
|
bool parseRect( SEXPR::SEXPR* data );
|
2016-09-02 10:08:40 +00:00
|
|
|
|
|
|
|
public:
|
2018-10-02 06:34:07 +00:00
|
|
|
KICADPCB();
|
2016-09-02 10:08:40 +00:00
|
|
|
virtual ~KICADPCB();
|
|
|
|
|
2017-06-08 06:33:14 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-09-04 07:08:56 +00:00
|
|
|
void UseGridOrigin( bool aUseOrigin )
|
|
|
|
{
|
|
|
|
m_useGridOrigin = aUseOrigin;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UseDrillOrigin( bool aUseOrigin )
|
|
|
|
{
|
|
|
|
m_useDrillOrigin = aUseOrigin;
|
|
|
|
}
|
|
|
|
|
2018-06-19 08:14:10 +00:00
|
|
|
void SetMinDistance( double aDistance )
|
|
|
|
{
|
|
|
|
m_minDistance = aDistance;
|
|
|
|
}
|
|
|
|
|
2016-09-02 10:08:40 +00:00
|
|
|
bool ReadFile( const wxString& aFileName );
|
2016-09-18 00:25:10 +00:00
|
|
|
bool ComposePCB( bool aComposeVirtual = true );
|
2018-09-11 07:23:11 +00:00
|
|
|
bool WriteSTEP( const wxString& aFileName );
|
2016-09-02 10:08:40 +00:00
|
|
|
#ifdef SUPPORTS_IGES
|
2018-09-11 07:23:11 +00:00
|
|
|
bool WriteIGES( const wxString& aFileName );
|
2016-09-02 10:08:40 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // KICADPCB_H
|