KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_altium_circuit_studio.cpp
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 (C) 2019 Thomas Pointhuber <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#include <wx/string.h>
26
27#include <font/fontconfig.h>
28
31#include <altium_pcb.h>
32#include <pcb_io/pcb_io.h>
33#include <reporter.h>
34
40
41
45
46
47bool PCB_IO_ALTIUM_CIRCUIT_STUDIO::CanReadBoard( const wxString& aFileName ) const
48{
49 if( !PCB_IO::CanReadBoard( aFileName ) )
50 return false;
51
53}
54
55
56void PCB_IO_ALTIUM_CIRCUIT_STUDIO::loadBoard( const wxString& aFileName, BOARD& aBoard, bool aIsNewLoad,
57 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
58{
59 m_props = aProperties;
60 m_board = &aBoard;
61
62 // Collect the font substitution warnings (RAII - automatically reset on scope exit)
64
65 // clang-format off
66 const std::map<ALTIUM_PCB_DIR, std::string> mapping = {
67 { ALTIUM_PCB_DIR::FILE_HEADER, "FileHeader" },
68 { ALTIUM_PCB_DIR::ARCS6, "00C595EB90524FFC8C3BD9670020A2" },
69 { ALTIUM_PCB_DIR::BOARD6, "88857D7F1DF64F7BBB61848C965636" },
70 { ALTIUM_PCB_DIR::BOARDREGIONS, "8957CF30F167408D9D263D23FE7C89" },
71 { ALTIUM_PCB_DIR::CLASSES6, "847EFBF87A5149B1AA326A52AD6357" },
72 { ALTIUM_PCB_DIR::COMPONENTS6, "465416896A15486999A39C643935D2" },
73 { ALTIUM_PCB_DIR::COMPONENTBODIES6, "1849D9B5512D452A93EABF4E40B122" }, // or B6AD30D75241498BA2536EBF001752 ?
74 { ALTIUM_PCB_DIR::DIMENSIONS6, "16C81DBC13C447FF8B42A426677F3C" },
75 { ALTIUM_PCB_DIR::FILLS6, "4E83BDC3253747F08E9006D7F57020" },
76 { ALTIUM_PCB_DIR::MODELS, "C0F7599ECC6A4D648DF5BB557679AF" },
77 { ALTIUM_PCB_DIR::NETS6, "D95A0DA2FE9047779A5194C127F30B" },
78 { ALTIUM_PCB_DIR::PADS6, "47D69BC5107A4B8DB8DAA23E39C238" },
79 { ALTIUM_PCB_DIR::POLYGONS6, "D7038392280E4E229B9D9B5426B295" },
80 { ALTIUM_PCB_DIR::REGIONS6, "FFDDC21382BB42FE8A7D0C328D272C" },
81 { ALTIUM_PCB_DIR::RULES6, "48B2FA96DB7546818752B34373D6C6" },
82 { ALTIUM_PCB_DIR::SHAPEBASEDREGIONS6, "D5F54B536E124FB89E2D51B1121508" },
83 { ALTIUM_PCB_DIR::TEXTS6, "349ABBB211DB4F5B8AE41B1B49555A" },
84 { ALTIUM_PCB_DIR::TRACKS6, "530C20C225354B858B2578CAB8C08D" },
85 { ALTIUM_PCB_DIR::VIAS6, "CA5F5989BCDB404DA70A9D1D3D5758" },
86 { ALTIUM_PCB_DIR::WIDESTRINGS6, "87FBF0C5BC194B909FF42199450A76" }
87 };
88 // clang-format on
89
90 LoadAltiumBoard( aFileName, m_board, mapping, m_props, aProject,
92}
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
RAII class to set and restore the fontconfig reporter.
Definition reporter.h:385
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
Definition io_base.h:238
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
Definition io_base.h:241
virtual void RegisterCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.
LAYER_MAPPING_HANDLER m_layer_mapping_handler
Callback to get layer mapping.
static LOAD_INFO_REPORTER & GetInstance()
Definition reporter.cpp:351
PCB_IO_ALTIUM_CIRCUIT_STUDIO()
Pcbnew PLUGIN for Altium *.PcbDoc format.
bool CanReadBoard(const wxString &aFileName) const override
void loadBoard(const wxString &aFileName, BOARD &aBoard, bool aIsNewLoad, const std::map< std::string, UTF8 > *aProperties, PROJECT *aProject=nullptr) override
Parse aFileName into aBoard.
static bool checkFileHeader(const wxString &aFileName)
static std::map< wxString, PCB_LAYER_ID > DefaultLayerMappingCallback(const std::vector< INPUT_LAYER_DESC > &aInputLayerDescriptionVector)
Return the automapped layers.
BOARD * m_board
The board BOARD being worked on, no ownership here.
Definition pcb_io.h:393
virtual bool CanReadBoard(const wxString &aFileName) const
Definition pcb_io.cpp:40
PCB_IO(const wxString &aName)
Definition pcb_io.h:372
const std::map< std::string, UTF8 > * m_props
Properties passed via Save() or Load(), no ownership, may be NULL.
Definition pcb_io.h:396
Container for project specific data.
Definition project.h:63
void LoadAltiumBoard(const wxString &aFileName, BOARD *aBoard, const std::map< ALTIUM_PCB_DIR, std::string > &aMapping, const std::map< std::string, UTF8 > *aProperties, PROJECT *aProject, PROGRESS_REPORTER *aProgressReporter, LAYER_MAPPING_HANDLER &aLayerMappingHandler, REPORTER *aReporter)