2020-04-03 23:22:24 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
2020-12-18 15:40:13 +00:00
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-04-03 23:22:24 +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 altium_plugin.cpp
|
|
|
|
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
|
|
|
#include <altium_designer_plugin.h>
|
|
|
|
#include <altium_pcb.h>
|
|
|
|
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
2020-04-03 23:22:24 +00:00
|
|
|
|
|
|
|
#include <compoundfilereader.h>
|
|
|
|
#include <utf.h>
|
|
|
|
|
|
|
|
ALTIUM_DESIGNER_PLUGIN::ALTIUM_DESIGNER_PLUGIN()
|
|
|
|
{
|
|
|
|
m_board = nullptr;
|
|
|
|
m_props = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ALTIUM_DESIGNER_PLUGIN::~ALTIUM_DESIGNER_PLUGIN()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxString ALTIUM_DESIGNER_PLUGIN::PluginName() const
|
|
|
|
{
|
|
|
|
return wxT( "Altium Designer" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxString ALTIUM_DESIGNER_PLUGIN::GetFileExtension() const
|
|
|
|
{
|
|
|
|
return wxT( "PcbDoc" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-18 15:40:13 +00:00
|
|
|
BOARD* ALTIUM_DESIGNER_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
|
2021-06-23 22:53:08 +00:00
|
|
|
const PROPERTIES* aProperties, PROJECT* aProject,
|
|
|
|
PROGRESS_REPORTER* aProgressReporter )
|
2020-04-03 23:22:24 +00:00
|
|
|
{
|
|
|
|
m_props = aProperties;
|
|
|
|
|
|
|
|
m_board = aAppendToMe ? aAppendToMe : new BOARD();
|
|
|
|
|
|
|
|
// Give the filename to the board if it's new
|
|
|
|
if( !aAppendToMe )
|
|
|
|
m_board->SetFileName( aFileName );
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
const std::map<ALTIUM_PCB_DIR, std::string> mapping = {
|
|
|
|
{ ALTIUM_PCB_DIR::FILE_HEADER, "FileHeader" },
|
2021-06-26 10:49:58 +00:00
|
|
|
{ ALTIUM_PCB_DIR::ARCS6, "Arcs6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::BOARD6, "Board6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::BOARDREGIONS, "BoardRegions\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::CLASSES6, "Classes6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::COMPONENTS6, "Components6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::COMPONENTBODIES6, "ComponentBodies6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::DIMENSIONS6, "Dimensions6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::FILLS6, "Fills6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::MODELS, "Models\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::NETS6, "Nets6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::PADS6, "Pads6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::POLYGONS6, "Polygons6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::REGIONS6, "Regions6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::RULES6, "Rules6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::SHAPEBASEDREGIONS6, "ShapeBasedRegions6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::TEXTS6, "Texts6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::TRACKS6, "Tracks6\\" },
|
2021-11-10 16:46:01 +00:00
|
|
|
{ ALTIUM_PCB_DIR::VIAS6, "Vias6\\" },
|
|
|
|
{ ALTIUM_PCB_DIR::WIDESTRINGS6, "WideStrings6\\" }
|
2020-04-03 23:22:24 +00:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
2021-06-26 10:49:58 +00:00
|
|
|
ParseAltiumPcb( m_board, aFileName, aProgressReporter, mapping );
|
2020-04-03 23:22:24 +00:00
|
|
|
|
|
|
|
return m_board;
|
|
|
|
}
|