Commit a03fb7a9 authored by Thomas Pointhuber's avatar Thomas Pointhuber Committed by Jon Evans
Browse files

Altium: Refactor and add initial structure for schematic importer

altium: move pcbnew/altium2kicadpcb_plugin -> pcbnew/plugins/altium

See: kicad/code/kicad#4412
parent eb0d3d65
......@@ -14,6 +14,7 @@ Licensed under BOOSTv1:
Licensed under ISC:
- portions of code in include/geometry/polygon_triangulation.h
Licensed under MIT:
- compoundfilereader in thirdparty/compoundfilereader
- delaunator in thirdparty/delaunator
- tinyspline_lib in thirdparty/tinyspline_lib
- nlohmann/json in thirdparty/nlohmann_json
......
......@@ -269,6 +269,10 @@ set( PLOTTERS_CONTROL_SRCS
plotters/common_plot_functions.cpp
)
set( PLUGINS_ALTIUM_SRCS
plugins/altium/altium_parser.cpp
)
set( COMMON_SRCS
${LIB_KICAD_SRCS}
${COMMON_ABOUT_DLG_SRCS}
......@@ -277,6 +281,7 @@ set( COMMON_SRCS
${COMMON_PAGE_LAYOUT_SRCS}
${COMMON_PREVIEW_ITEMS_SRCS}
${PLOTTERS_CONTROL_SRCS}
${PLUGINS_ALTIUM_SRCS}
advanced_config.cpp
array_axis.cpp
array_options.cpp
......@@ -437,6 +442,7 @@ target_include_directories( common PRIVATE
add_dependencies( common libcontext )
add_dependencies( common version_header )
add_dependencies( common compoundfilereader ) # used by altium_parser.cpp
target_link_libraries( common
kimath
......@@ -454,6 +460,9 @@ target_include_directories( common PUBLIC
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
target_include_directories( common PUBLIC
$<TARGET_PROPERTY:compoundfilereader,INTERFACE_INCLUDE_DIRECTORIES>
) # used by altium_parser.cpp
set( PCB_COMMON_SRCS
base_screen.cpp
......
......@@ -113,6 +113,11 @@ static const wxChar DrawArcCenterStartEndMaxAngle[] = wxT( "DrawArcCenterStartEn
*/
static const wxChar StrokeTriangulation[] = wxT( "StrokeTriangulation" );
/**
* When true, enable Altium Schematic import (*.SchDoc)
*/
static const wxChar PluginAltiumSch[] = wxT( "PluginAltiumSch" );
} // namespace KEYS
......@@ -196,6 +201,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_drawArcAccuracy = 10.0;
m_drawArcCenterMaxAngle = 50.0;
m_DrawTriangulationOutlines = false;
m_PluginAltiumSch = false;
loadFromConfigFile();
}
......@@ -254,6 +260,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
&m_DrawTriangulationOutlines, false ) );
configParams.push_back(
new PARAM_CFG_BOOL( true, AC_KEYS::PluginAltiumSch, &m_PluginAltiumSch, false ) );
wxConfigLoadSetups( &aCfg, configParams );
for( auto param : configParams )
......
......@@ -68,8 +68,8 @@ ALTIUM_PARSER::ALTIUM_PARSER(
const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry )
{
m_subrecord_end = nullptr;
m_size = static_cast<size_t>( aEntry->size );
m_error = false;
m_size = static_cast<size_t>( aEntry->size );
m_error = false;
m_content.reset( new char[m_size] );
m_pos = m_content.get();
......@@ -155,10 +155,10 @@ int32_t ALTIUM_PARSER::PropertiesReadKicadUnit( const std::map<wxString, wxStrin
size_t decimal_point = value.find( '.' );
size_t value_end = value.find_first_not_of( "+-0123456789." );
wxString before_decimal_str = value.Left( decimal_point );
int before_decimal = wxAtoi( before_decimal_str );
int after_decimal = 0;
size_t after_decimal_digits = 0;
wxString before_decimal_str = value.Left( decimal_point );
int before_decimal = wxAtoi( before_decimal_str );
int after_decimal = 0;
size_t after_decimal_digits = 0;
if( decimal_point != wxString::npos )
{
if( value_end != wxString::npos )
......
......@@ -229,6 +229,12 @@ wxString KiCadSchematicFileWildcard()
}
wxString AltiumSchematicFileWildcard()
{
return _( "Altium schematic files" ) + AddFileExtListToFilter( { "SchDoc" } );
}
wxString EagleSchematicFileWildcard()
{
return _( "Eagle XML schematic files" ) + AddFileExtListToFilter( { "sch" } );
......
......@@ -67,12 +67,11 @@ set_target_properties( cvpcb_kiface PROPERTIES
)
target_link_libraries( cvpcb_kiface
pcbcommon
pcad2kicadpcb
altium2kicadpcb
3d-viewer
gal
common
kimath
${PCBNEW_IO_LIBRARIES}
  • Um, I don't think this is guaranteed to work on first run since the pcbnew cmake file comes after cvpcb, so this variable will be empty on first run but then populated in the cache for all future runs.

  • Yeah I just found this too, I think we should just move cvpcb to be after pcbnew unless that doesn't work for some reason

  • Good find. It would be nice to not need such a workaround at all, but restructuring the program dependencies should do someone with more CMake and KiCad knowledge.

Please register or sign in to reply
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
......
......@@ -33,6 +33,11 @@ include_directories(
${INC_AFTER}
)
set( EESCHEMA_SCH_PLUGINS_ALTIUM
sch_plugins/altium/sch_altium_plugin.cpp
sch_plugins/altium/altium_parser_sch.cpp
)
set( EESCHEMA_DLGS
dialogs/dialog_annotate.cpp
dialogs/dialog_annotate_base.cpp
......@@ -143,6 +148,7 @@ set ( EESCHEMA_LIBEDIT_SRCS
)
set( EESCHEMA_SRCS
${EESCHEMA_SCH_PLUGINS_ALTIUM}
${EESCHEMA_DLGS}
${EESCHEMA_WIDGETS}
${EESCHEMA_LIBEDIT_SRCS}
......
......@@ -24,45 +24,40 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <sch_draw_panel.h>
#include <advanced_config.h>
#include <class_library.h>
#include <confirm.h>
#include <env_paths.h>
#include <connection_graph.h>
#include <dialog_migrate_buses.h>
#include <dialog_symbol_remap.h>
#include <eeschema_settings.h>
#include <gestfich.h>
#include <sch_edit_frame.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <richio.h>
#include <trace_helpers.h>
#include <tool/tool_manager.h>
#include <id.h>
#include <class_library.h>
#include <lib_edit_frame.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_component.h>
#include <schematic.h>
#include <wildcards_and_files_ext.h>
#include <kiface_i.h>
#include <kiplatform/app.h>
#include <pgm_base.h>
#include <profile.h>
#include <project/project_file.h>
#include <project_rescue.h>
#include <reporter.h>
#include <eeschema_config.h>
#include <eeschema_settings.h>
#include <sch_legacy_plugin.h>
#include <richio.h>
#include <sch_component.h>
#include <sch_eagle_plugin.h>
#include <sch_edit_frame.h>
#include <sch_legacy_plugin.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <symbol_lib_table.h>
#include <dialog_symbol_remap.h>
#include <dialog_migrate_buses.h>
#include <ws_data_model.h>
#include <connection_graph.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <tools/sch_editor_control.h>
#include <project/project_file.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <netlist.h>
#include <trace_helpers.h>
#include <widgets/infobar.h>
#include <kiplatform/app.h>
#include <wildcards_and_files_ext.h>
#include <ws_data_model.h>
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
......@@ -596,8 +591,27 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
bool setProject = Prj().GetProjectFullName().IsEmpty();
wxString path = wxPathOnly( Prj().GetProjectFullName() );
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxEmptyString,
EagleSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
// clang-format off
std::list<std::pair<const wxString, const SCH_IO_MGR::SCH_FILE_T>> loaders;
if( ADVANCED_CFG::GetCfg().m_PluginAltiumSch )
loaders.emplace_back( AltiumSchematicFileWildcard(), SCH_IO_MGR::SCH_ALTIUM ); // Import Altium schematic files
loaders.emplace_back( EagleSchematicFileWildcard(), SCH_IO_MGR::SCH_EAGLE ); // Import Eagle schematic files
// clang-format on
wxString fileFilters;
for( auto& loader : loaders )
{
if( !fileFilters.IsEmpty() )
fileFilters += wxChar( '|' );
fileFilters += wxGetTranslation( loader.first );
}
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxEmptyString, fileFilters,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); // TODO
if( dlg.ShowModal() == wxID_CANCEL )
return;
......@@ -617,8 +631,26 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
Schematic().SetProject( &Prj() );
}
// For now there is only one import plugin
importFile( dlg.GetPath(), SCH_IO_MGR::SCH_EAGLE );
wxFileName fn = dlg.GetPath();
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::SCH_FILE_T::SCH_FILE_UNKNOWN;
for( auto& loader : loaders )
{
if( fn.GetExt().CmpNoCase( SCH_IO_MGR::GetFileExtension( loader.second ) ) == 0 )
{
pluginType = loader.second;
break;
}
}
if( pluginType == SCH_IO_MGR::SCH_FILE_T::SCH_FILE_UNKNOWN )
{
wxLogError( wxString::Format( "unexpected file extension: %s", fn.GetExt() ) );
return;
}
importFile( dlg.GetPath(), pluginType );
}
......@@ -817,6 +849,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
switch( (SCH_IO_MGR::SCH_FILE_T) aFileType )
{
case SCH_IO_MGR::SCH_ALTIUM:
case SCH_IO_MGR::SCH_EAGLE:
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
wxASSERT_MSG( wxFileName( aFileName ).IsAbsolute(),
......@@ -832,7 +865,8 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
try
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi(
SCH_IO_MGR::FindPlugin( (SCH_IO_MGR::SCH_FILE_T) aFileType ) );
Schematic().SetRoot( pi->Load( aFileName, &Schematic() ) );
// Eagle sheets do not use a worksheet frame by default, so set it to an empty one
......
......@@ -27,6 +27,7 @@
#include <lib_item.h>
#include <math/util.h> // for KiROUND
#include <trigo.h> // for GetLineLength
class LIB_CIRCLE : public LIB_ITEM
......
......@@ -28,6 +28,7 @@
#include <sch_eagle_plugin.h>
#include <sch_sexpr_plugin.h>
#include <sch_plugins/altium/sch_altium_plugin.h>
#include <wildcards_and_files_ext.h>
#define FMT_UNIMPLEMENTED _( "Plugin \"%s\" does not implement the \"%s\" function." )
......@@ -58,6 +59,8 @@ SCH_PLUGIN* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
return new SCH_LEGACY_PLUGIN();
case SCH_KICAD:
return new SCH_SEXPR_PLUGIN();
case SCH_ALTIUM:
return new SCH_ALTIUM_PLUGIN();
case SCH_EAGLE:
return new SCH_EAGLE_PLUGIN();
default:
......@@ -95,8 +98,11 @@ const wxString SCH_IO_MGR::ShowType( SCH_FILE_T aType )
case SCH_KICAD:
return wxString( wxT( "KiCad" ) );
case SCH_ALTIUM:
return wxString( wxT( "Altium" ) );
case SCH_EAGLE:
return wxString( wxT( "EAGLE" ) );
return wxString( wxT( "EAGLE" ) );
}
}
......@@ -111,6 +117,8 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::EnumFromStr( const wxString& aType )
return SCH_LEGACY;
else if( aType == wxT( "KiCad" ) )
return SCH_KICAD;
else if( aType == wxT( "Altium" ) )
return SCH_ALTIUM;
else if( aType == wxT( "EAGLE" ) )
return SCH_EAGLE;
......
......@@ -55,6 +55,7 @@ public:
{
SCH_LEGACY, ///< Legacy Eeschema file formats prior to s-expression.
SCH_KICAD, ///< The s-expression version of the schematic file formats.
SCH_ALTIUM, ///< Altium file format
SCH_EAGLE, ///< Autodesk Eagle file format
// Add your schematic type here.
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
*
* 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
*/
#include <iostream>
#include <unordered_map>
#include <convert_to_biu.h>
#include <ki_exception.h>
#include "plugins/altium/altium_parser.h"
#include "sch_plugins/altium/altium_parser_sch.h"
ALTIUM_SCH_RECORD PropertiesReadRecord( const std::map<wxString, wxString>& aProperties )
{
int recordId = ALTIUM_PARSER::PropertiesReadInt( aProperties, "RECORD", 0 );
return static_cast<ALTIUM_SCH_RECORD>( recordId );
}
constexpr int Altium2KiCadUnit( const int val, const int frac )
{
return Mils2iu( val ) * 10 + Mils2iu( frac ) / 10000; // TODO: correct, rounding issues?
}
ASCH_COMPONENT::ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::COMPONENT );
currentpartid =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "CURRENTPARTID", ALTIUM_COMPONENT_NONE );
libreference = ALTIUM_PARSER::PropertiesReadString( aProperties, "LIBREFERENCE", "" );
orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PIN );
ownerindex =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
designator = ALTIUM_PARSER::PropertiesReadString( aProperties, "DESIGNATOR", "" );
int pinconglomerate = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINCONGLOMERATE", 0 );
orientation = pinconglomerate & 0x03;
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::RECTANGLE );
ownerindex =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
bottomLeft = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "CORNER.X", 0 );
xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "CORNER.X_FRAC", 0 );
y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "CORNER.Y", 0 );
yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "CORNER.Y_FRAC", 0 );
topRight = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
lineWidth = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LINEWIDTH", 0 );
isSolid = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISSOLID", false );
isTransparent = ALTIUM_PARSER::PropertiesReadBool( aProperties, "TRANSPARENT", false );
}
ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NET_LABEL );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BUS );
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
linewidth = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LINEWIDTH", 0 );
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 0; i < locationcount; i++ )
{
const wxString si = std::to_string( i + 1 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "X" + si, 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "X" + si + "_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "Y" + si, 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "Y" + si + "_FRAC", 0 );
points.emplace_back( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
}
ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::WIRE );
/*std::cout << "-----------------------------------" << std::endl;
// debug
for( auto& property : aProperties )
{
std::cout << " * '" << property.first << "' = '" << property.second << "'"
<< std::endl;
}*/
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
linewidth = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LINEWIDTH", 0 );
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 0; i < locationcount; i++ )
{
const wxString si = std::to_string( i + 1 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "X" + si, 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "X" + si + "_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "Y" + si, 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "Y" + si + "_FRAC", 0 );
points.emplace_back( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
}
ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::DESIGNATOR );
ownerindex =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 );
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
}
\ No newline at end of file
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
*
* 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 ALTIUM_PARSER_SCH_H
#define ALTIUM_PARSER_SCH_H
#include <cstdint>
#include <cstring>
#include <map>
#include <vector>