2022-10-08 22:00:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
|
|
|
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
2024-04-25 22:53:39 +00:00
|
|
|
* Copyright (C) 2016-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-10-08 22:00:05 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef EXPORTER_STEP_H
|
|
|
|
#define EXPORTER_STEP_H
|
|
|
|
|
|
|
|
#include <geometry/shape_poly_set.h>
|
|
|
|
#include <gal/color4d.h>
|
2024-04-22 00:39:43 +00:00
|
|
|
#include <layer_ids.h>
|
2022-10-08 22:00:05 +00:00
|
|
|
|
2023-03-02 18:38:19 +00:00
|
|
|
// Default value to chain 2 shapes when creating the board outlines
|
|
|
|
// from shapes on Edges.Cut layer
|
|
|
|
#define BOARD_DEFAULT_CHAINING_EPSILON 0.01
|
|
|
|
|
2022-10-08 22:00:05 +00:00
|
|
|
class PCBMODEL;
|
|
|
|
class BOARD;
|
2023-03-06 15:35:54 +00:00
|
|
|
class BOARD_ITEM;
|
2022-10-08 22:00:05 +00:00
|
|
|
class FOOTPRINT;
|
2023-03-02 18:38:19 +00:00
|
|
|
class PCB_TRACK;
|
2022-10-08 22:00:05 +00:00
|
|
|
class FILENAME_RESOLVER;
|
2023-08-09 23:38:43 +00:00
|
|
|
class STEP_PCB_MODEL;
|
2022-10-08 22:00:05 +00:00
|
|
|
|
|
|
|
class EXPORTER_STEP_PARAMS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EXPORTER_STEP_PARAMS() :
|
|
|
|
m_origin(),
|
|
|
|
m_overwrite( false ),
|
|
|
|
m_useGridOrigin( false ),
|
|
|
|
m_useDrillOrigin( false ),
|
2023-04-13 14:30:31 +00:00
|
|
|
m_includeUnspecified( true ),
|
|
|
|
m_includeDNP( true ),
|
2022-10-08 22:00:05 +00:00
|
|
|
m_substModels( true ),
|
2023-03-02 18:38:19 +00:00
|
|
|
m_BoardOutlinesChainingEpsilon( BOARD_DEFAULT_CHAINING_EPSILON ),
|
|
|
|
m_boardOnly( false ),
|
2024-04-22 00:39:43 +00:00
|
|
|
m_exportBoardBody( true ),
|
|
|
|
m_exportComponents( true ),
|
|
|
|
m_exportTracksVias( false ),
|
2023-08-21 02:10:43 +00:00
|
|
|
m_exportZones( false ),
|
2024-04-22 00:39:43 +00:00
|
|
|
m_exportInnerCopper( false ),
|
2024-04-19 00:42:41 +00:00
|
|
|
m_fuseShapes( false ),
|
2023-11-19 12:21:25 +00:00
|
|
|
m_optimizeStep( true ),
|
2023-08-19 15:40:45 +00:00
|
|
|
m_format( FORMAT::STEP )
|
2023-03-02 18:38:19 +00:00
|
|
|
{};
|
2022-10-08 22:00:05 +00:00
|
|
|
|
2023-08-19 15:40:45 +00:00
|
|
|
enum class FORMAT
|
|
|
|
{
|
|
|
|
STEP,
|
2024-04-17 14:31:07 +00:00
|
|
|
BREP,
|
2024-04-25 22:53:39 +00:00
|
|
|
XAO,
|
2023-08-19 15:40:45 +00:00
|
|
|
GLB
|
|
|
|
};
|
|
|
|
|
2022-10-08 22:00:05 +00:00
|
|
|
wxString m_outputFile;
|
2024-04-24 15:28:44 +00:00
|
|
|
wxString m_netFilter;
|
2022-10-08 22:00:05 +00:00
|
|
|
|
|
|
|
VECTOR2D m_origin;
|
|
|
|
|
|
|
|
bool m_overwrite;
|
|
|
|
bool m_useGridOrigin;
|
|
|
|
bool m_useDrillOrigin;
|
2023-04-13 14:30:31 +00:00
|
|
|
bool m_includeUnspecified;
|
|
|
|
bool m_includeDNP;
|
2022-10-08 22:00:05 +00:00
|
|
|
bool m_substModels;
|
2023-03-02 18:38:19 +00:00
|
|
|
double m_BoardOutlinesChainingEpsilon;
|
2022-11-13 02:52:54 +00:00
|
|
|
bool m_boardOnly;
|
2024-04-22 00:39:43 +00:00
|
|
|
bool m_exportBoardBody;
|
|
|
|
bool m_exportComponents;
|
|
|
|
bool m_exportTracksVias;
|
2023-08-21 02:10:43 +00:00
|
|
|
bool m_exportZones;
|
2024-04-22 00:39:43 +00:00
|
|
|
bool m_exportInnerCopper;
|
2024-04-19 00:42:41 +00:00
|
|
|
bool m_fuseShapes;
|
2023-11-19 12:21:25 +00:00
|
|
|
bool m_optimizeStep;
|
2023-08-19 15:40:45 +00:00
|
|
|
FORMAT m_format;
|
|
|
|
|
|
|
|
wxString GetDefaultExportExtension();
|
|
|
|
wxString GetFormatName();
|
2022-10-08 22:00:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EXPORTER_STEP
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EXPORTER_STEP( BOARD* aBoard, const EXPORTER_STEP_PARAMS& aParams );
|
|
|
|
~EXPORTER_STEP();
|
|
|
|
|
|
|
|
bool Export();
|
|
|
|
|
|
|
|
wxString m_outputFile;
|
|
|
|
|
|
|
|
void SetError() { m_error = true; }
|
2023-01-02 23:34:13 +00:00
|
|
|
void SetFail() { m_fail = true; }
|
|
|
|
void SetWarn() { m_warn = true; }
|
2022-10-08 22:00:05 +00:00
|
|
|
|
|
|
|
private:
|
2023-03-06 10:47:29 +00:00
|
|
|
bool buildBoard3DShapes();
|
|
|
|
bool buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOrigin );
|
|
|
|
bool buildTrack3DShape( PCB_TRACK* aTrack, VECTOR2D aOrigin );
|
2023-08-21 02:10:43 +00:00
|
|
|
void buildZones3DShape( VECTOR2D aOrigin );
|
2023-03-06 15:35:54 +00:00
|
|
|
bool buildGraphic3DShape( BOARD_ITEM* aItem, VECTOR2D aOrigin );
|
2022-10-08 22:00:05 +00:00
|
|
|
|
|
|
|
EXPORTER_STEP_PARAMS m_params;
|
|
|
|
std::unique_ptr<FILENAME_RESOLVER> m_resolver;
|
|
|
|
|
2023-08-15 11:41:32 +00:00
|
|
|
private:
|
|
|
|
bool m_error;
|
|
|
|
bool m_fail;
|
|
|
|
bool m_warn;
|
2022-10-08 22:00:05 +00:00
|
|
|
|
|
|
|
BOARD* m_board;
|
|
|
|
std::unique_ptr<STEP_PCB_MODEL> m_pcbModel;
|
2023-03-21 08:30:11 +00:00
|
|
|
|
|
|
|
/// the name of the project (board short filename (no path, no ext)
|
|
|
|
/// used to identify items in step file
|
|
|
|
wxString m_pcbBaseName;
|
2022-10-08 22:00:05 +00:00
|
|
|
|
2024-04-22 00:39:43 +00:00
|
|
|
std::map<PCB_LAYER_ID, SHAPE_POLY_SET> m_poly_copper_shapes;
|
2023-03-06 10:47:29 +00:00
|
|
|
|
2023-08-15 11:41:32 +00:00
|
|
|
KIGFX::COLOR4D m_solderMaskColor;
|
|
|
|
KIGFX::COLOR4D m_copperColor;
|
2022-10-08 22:00:05 +00:00
|
|
|
};
|
|
|
|
|
2023-04-13 14:30:31 +00:00
|
|
|
#endif
|