PADS: add ASCII format importer for PCB and schematic files

Add complete import support for PADS ASCII (.asc) files, covering both
PCB layouts and schematics. The importer handles board outlines, copper
pours, routing with via inference, footprint decals, net assignment,
design rules, and component placement for PCB files. For schematics, it
supports symbol building from CAEDECAL definitions, multi-gate and
multi-variant parts, power symbols, wire routing, net labeling, arc
graphics, title blocks, and hierarchical sheet connectivity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19944
This commit is contained in:
Seth Hillbrand
2026-02-10 10:00:00 -08:00
parent 7db7083cd0
commit 0e7a052af0
122 changed files with 204371 additions and 7 deletions
+4
View File
@@ -25,6 +25,9 @@ add_subdirectory( gal )
# Get the netlist reader library
add_subdirectory( netlist_reader )
# Get the shared PADS format support library
add_subdirectory( io/pads )
# Only for win32 cross compilation using MXE
add_compile_definitions( $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${MSYS}>>:GLEW_STATIC> )
@@ -126,6 +129,7 @@ set( KICOMMON_SRCS
jobs/jobset.cpp
jobs/job_fp_export_svg.cpp
jobs/job_fp_upgrade.cpp
jobs/job_pcb_import.cpp
jobs/job_pcb_render.cpp
jobs/job_pcb_drc.cpp
jobs/job_rc.cpp
+31
View File
@@ -144,6 +144,11 @@ static const wxChar ScreenDPI[] = wxT( "ScreenDPI" );
static const wxChar EnableUseAuiPerspective[] = wxT( "EnableUseAuiPerspective" );
static const wxChar HistoryLockStaleTimeout[] = wxT( "HistoryLockStaleTimeout" );
static const wxChar ZoneFillIterativeRefill[] = wxT( "ZoneFillIterativeRefill" );
static const wxChar PadsPcbTextHeightScale[] = wxT( "PadsPcbTextHeightScale" );
static const wxChar PadsPcbTextWidthScale[] = wxT( "PadsPcbTextWidthScale" );
static const wxChar PadsSchTextHeightScale[] = wxT( "PadsSchTextHeightScale" );
static const wxChar PadsSchTextWidthScale[] = wxT( "PadsSchTextWidthScale" );
static const wxChar PadsTextAnchorOffsetNm[] = wxT( "PadsTextAnchorOffsetNm" );
} // namespace AC_KEYS
@@ -336,6 +341,12 @@ ADVANCED_CFG::ADVANCED_CFG()
m_HistoryLockStaleTimeout = 300; // 5 minutes default
m_ZoneFillIterativeRefill = true;
m_PadsPcbTextHeightScale = 0.69;
m_PadsPcbTextWidthScale = 0.64;
m_PadsSchTextHeightScale = 0.50;
m_PadsSchTextWidthScale = 0.46;
m_PadsTextAnchorOffsetNm = 350000;
loadFromConfigFile();
}
@@ -652,6 +663,26 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
m_entries.push_back( std::make_unique<PARAM_CFG_BOOL>( true, AC_KEYS::ZoneFillIterativeRefill,
&m_ZoneFillIterativeRefill, m_ZoneFillIterativeRefill ) );
m_entries.push_back( std::make_unique<PARAM_CFG_DOUBLE>( true, AC_KEYS::PadsPcbTextHeightScale,
&m_PadsPcbTextHeightScale,
m_PadsPcbTextHeightScale, 0.1, 1.0 ) );
m_entries.push_back( std::make_unique<PARAM_CFG_DOUBLE>( true, AC_KEYS::PadsPcbTextWidthScale,
&m_PadsPcbTextWidthScale,
m_PadsPcbTextWidthScale, 0.1, 1.0 ) );
m_entries.push_back( std::make_unique<PARAM_CFG_DOUBLE>( true, AC_KEYS::PadsSchTextHeightScale,
&m_PadsSchTextHeightScale,
m_PadsSchTextHeightScale, 0.1, 1.0 ) );
m_entries.push_back( std::make_unique<PARAM_CFG_DOUBLE>( true, AC_KEYS::PadsSchTextWidthScale,
&m_PadsSchTextWidthScale,
m_PadsSchTextWidthScale, 0.1, 1.0 ) );
m_entries.push_back( std::make_unique<PARAM_CFG_INT>( true, AC_KEYS::PadsTextAnchorOffsetNm,
&m_PadsTextAnchorOffsetNm,
m_PadsTextAnchorOffsetNm, 0, 1000000 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
m_entries.push_back( std::make_unique<PARAM_CFG_WXSTRING>( true, AC_KEYS::TraceMasks, &m_traceMasks, wxS( "" ) ) );
+49
View File
@@ -0,0 +1,49 @@
# This program source code file is part of KiCad, a free EDA CAD application.
#
# Copyright The KiCad Developers, see AUTHORS.txt for contributors.
#
# 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 3
# 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/gpl-3.0.html
# or you may search the http://www.gnu.org website for the version 3 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Shared PADS format support library
# This library contains common utilities for parsing PADS files that are used
# by both pcbnew and eeschema importers.
set( PADS_COMMON_SRCS
pads_attribute_mapper.cpp
pads_common.cpp
pads_unit_converter.cpp
)
add_library( pads_common STATIC
${PADS_COMMON_SRCS}
)
target_include_directories( pads_common PUBLIC
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/libs/kimath/include
${CMAKE_SOURCE_DIR}/libs/core/include
)
target_include_directories( pads_common PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries( pads_common
kicommon
)
+139
View File
@@ -0,0 +1,139 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <io/pads/pads_attribute_mapper.h>
#include <algorithm>
#include <cctype>
PADS_ATTRIBUTE_MAPPER::PADS_ATTRIBUTE_MAPPER()
{
// Standard PADS attribute mappings to KiCad fields
// Reference designator variations
m_standardMappings["ref.des."] = FIELD_REFERENCE;
m_standardMappings["ref des"] = FIELD_REFERENCE;
m_standardMappings["ref-des"] = FIELD_REFERENCE;
m_standardMappings["refdes"] = FIELD_REFERENCE;
m_standardMappings["reference"] = FIELD_REFERENCE;
// Value/Part type variations
m_standardMappings["part type"] = FIELD_VALUE;
m_standardMappings["part-type"] = FIELD_VALUE;
m_standardMappings["parttype"] = FIELD_VALUE;
m_standardMappings["value"] = FIELD_VALUE;
m_standardMappings["part_type"] = FIELD_VALUE;
// Footprint/Decal variations
m_standardMappings["pcb decal"] = FIELD_FOOTPRINT;
m_standardMappings["pcb_decal"] = FIELD_FOOTPRINT;
m_standardMappings["decal"] = FIELD_FOOTPRINT;
m_standardMappings["footprint"] = FIELD_FOOTPRINT;
m_standardMappings["pattern"] = FIELD_FOOTPRINT;
// Datasheet variations
m_standardMappings["datasheet"] = FIELD_DATASHEET;
m_standardMappings["data sheet"] = FIELD_DATASHEET;
m_standardMappings["spec"] = FIELD_DATASHEET;
m_standardMappings["specification"] = FIELD_DATASHEET;
// MPN (Manufacturer Part Number) variations
m_standardMappings["part number"] = FIELD_MPN;
m_standardMappings["part_number"] = FIELD_MPN;
m_standardMappings["partnumber"] = FIELD_MPN;
m_standardMappings["pn"] = FIELD_MPN;
m_standardMappings["mpn"] = FIELD_MPN;
m_standardMappings["mfr part number"] = FIELD_MPN;
m_standardMappings["mfr_part_number"] = FIELD_MPN;
// Manufacturer variations
m_standardMappings["manufacturer"] = FIELD_MANUFACTURER;
m_standardMappings["mfr"] = FIELD_MANUFACTURER;
m_standardMappings["mfg"] = FIELD_MANUFACTURER;
m_standardMappings["vendor"] = FIELD_MANUFACTURER;
}
std::string PADS_ATTRIBUTE_MAPPER::normalizeAttrName( const std::string& aName ) const
{
std::string normalized;
normalized.reserve( aName.size() );
for( char c : aName )
{
normalized += static_cast<char>( std::tolower( static_cast<unsigned char>( c ) ) );
}
return normalized;
}
std::string PADS_ATTRIBUTE_MAPPER::GetKiCadFieldName( const std::string& aPadsAttr ) const
{
std::string normalized = normalizeAttrName( aPadsAttr );
// Check custom mappings first (they take precedence)
auto customIt = m_customMappings.find( normalized );
if( customIt != m_customMappings.end() )
return customIt->second;
// Then check standard mappings
auto standardIt = m_standardMappings.find( normalized );
if( standardIt != m_standardMappings.end() )
return standardIt->second;
// Return original name if no mapping exists
return aPadsAttr;
}
bool PADS_ATTRIBUTE_MAPPER::IsStandardField( const std::string& aPadsAttr ) const
{
return IsReferenceField( aPadsAttr ) || IsValueField( aPadsAttr ) || IsFootprintField( aPadsAttr );
}
bool PADS_ATTRIBUTE_MAPPER::IsReferenceField( const std::string& aPadsAttr ) const
{
std::string fieldName = GetKiCadFieldName( aPadsAttr );
return fieldName == FIELD_REFERENCE;
}
bool PADS_ATTRIBUTE_MAPPER::IsValueField( const std::string& aPadsAttr ) const
{
std::string fieldName = GetKiCadFieldName( aPadsAttr );
return fieldName == FIELD_VALUE;
}
bool PADS_ATTRIBUTE_MAPPER::IsFootprintField( const std::string& aPadsAttr ) const
{
std::string fieldName = GetKiCadFieldName( aPadsAttr );
return fieldName == FIELD_FOOTPRINT;
}
void PADS_ATTRIBUTE_MAPPER::AddMapping( const std::string& aPadsAttr, const std::string& aKiCadField )
{
std::string normalized = normalizeAttrName( aPadsAttr );
m_customMappings[normalized] = aKiCadField;
}
+116
View File
@@ -0,0 +1,116 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_ATTRIBUTE_MAPPER_H
#define PADS_ATTRIBUTE_MAPPER_H
#include <map>
#include <string>
/**
* Maps PADS attribute names to KiCad field names.
*
* PADS uses different attribute names than KiCad for standard fields.
* This class provides mapping from PADS names to KiCad-compatible names,
* and identifies which attributes correspond to standard KiCad fields
* (Reference, Value, Footprint) versus custom user fields.
*/
class PADS_ATTRIBUTE_MAPPER
{
public:
PADS_ATTRIBUTE_MAPPER();
/**
* Get the KiCad field name for a PADS attribute.
*
* For known PADS attributes (like "Ref.Des.", "Part Type"), returns
* the corresponding KiCad field name. For unknown attributes, returns
* the original name unchanged.
*
* @param aPadsAttr The PADS attribute name.
* @return The corresponding KiCad field name.
*/
std::string GetKiCadFieldName( const std::string& aPadsAttr ) const;
/**
* Check if a PADS attribute maps to a standard KiCad field.
*
* Standard fields are Reference, Value, and Footprint. These are
* handled specially in KiCad and exist on every footprint.
*
* @param aPadsAttr The PADS attribute name.
* @return True if this is a standard field (Reference, Value, Footprint).
*/
bool IsStandardField( const std::string& aPadsAttr ) const;
/**
* Check if a PADS attribute maps to the Reference field.
*
* @param aPadsAttr The PADS attribute name.
* @return True if this maps to the Reference field.
*/
bool IsReferenceField( const std::string& aPadsAttr ) const;
/**
* Check if a PADS attribute maps to the Value field.
*
* @param aPadsAttr The PADS attribute name.
* @return True if this maps to the Value field.
*/
bool IsValueField( const std::string& aPadsAttr ) const;
/**
* Check if a PADS attribute maps to the Footprint field.
*
* @param aPadsAttr The PADS attribute name.
* @return True if this maps to the Footprint field.
*/
bool IsFootprintField( const std::string& aPadsAttr ) const;
/**
* Add or override a custom attribute mapping.
*
* @param aPadsAttr The PADS attribute name.
* @param aKiCadField The KiCad field name to map to.
*/
void AddMapping( const std::string& aPadsAttr, const std::string& aKiCadField );
/**
* Get all custom mappings.
*
* @return Map of PADS attribute names to KiCad field names.
*/
const std::map<std::string, std::string>& GetMappings() const { return m_customMappings; }
// Standard KiCad field names
static constexpr const char* FIELD_REFERENCE = "Reference";
static constexpr const char* FIELD_VALUE = "Value";
static constexpr const char* FIELD_FOOTPRINT = "Footprint";
static constexpr const char* FIELD_DATASHEET = "Datasheet";
static constexpr const char* FIELD_MPN = "MPN";
static constexpr const char* FIELD_MANUFACTURER = "Manufacturer";
private:
std::string normalizeAttrName( const std::string& aName ) const;
std::map<std::string, std::string> m_standardMappings;
std::map<std::string, std::string> m_customMappings;
};
#endif // PADS_ATTRIBUTE_MAPPER_H
+311
View File
@@ -0,0 +1,311 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <io/pads/pads_common.h>
#include <cstdint>
#include <sstream>
#include <iomanip>
#include <fstream>
#include <exception>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/log.h>
namespace PADS_COMMON
{
KIID GenerateDeterministicUuid( const std::string& aIdentifier )
{
// Use FNV-1a hash algorithm to generate a 128-bit hash from the identifier string.
// This produces deterministic output for the same input, enabling cross-probe
// linking between schematic and PCB imports.
// FNV-1a parameters for 64-bit
const uint64_t FNV_PRIME = 0x00000100000001B3ULL;
const uint64_t FNV_OFFSET = 0xcbf29ce484222325ULL;
// Hash the identifier twice with different salts to get 128 bits
uint64_t hash1 = FNV_OFFSET;
uint64_t hash2 = FNV_OFFSET;
// First hash with "PADS1:" prefix
std::string salt1 = "PADS1:" + aIdentifier;
for( char c : salt1 )
{
hash1 ^= static_cast<uint8_t>( c );
hash1 *= FNV_PRIME;
}
// Second hash with "PADS2:" prefix
std::string salt2 = "PADS2:" + aIdentifier;
for( char c : salt2 )
{
hash2 ^= static_cast<uint8_t>( c );
hash2 *= FNV_PRIME;
}
// Format as UUID string (xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
// Version 4 UUID format with deterministic values
std::ostringstream ss;
ss << std::hex << std::setfill( '0' );
// First 8 hex chars from hash1
ss << std::setw( 8 ) << ( hash1 >> 32 );
ss << '-';
// Next 4 hex chars from hash1
ss << std::setw( 4 ) << ( ( hash1 >> 16 ) & 0xFFFF );
ss << '-';
// Version 4 UUID: set version bits
uint16_t version = ( ( hash1 & 0xFFFF ) & 0x0FFF ) | 0x4000;
ss << std::setw( 4 ) << version;
ss << '-';
// Variant bits: set to 10xx (RFC 4122 variant)
uint16_t variant = ( ( hash2 >> 48 ) & 0x3FFF ) | 0x8000;
ss << std::setw( 4 ) << variant;
ss << '-';
// Last 12 hex chars from hash2
ss << std::setw( 12 ) << ( hash2 & 0xFFFFFFFFFFFFULL );
return KIID( ss.str() );
}
PADS_FILE_TYPE DetectPadsFileType( const wxString& aFilePath )
{
std::ifstream file( aFilePath.fn_str() );
if( !file.is_open() )
return PADS_FILE_TYPE::UNKNOWN;
std::string line;
if( !std::getline( file, line ) )
return PADS_FILE_TYPE::UNKNOWN;
// PADS PowerPCB (PCB) files start with *PADS-POWERPCB* or !PADS-POWERPCB*
if( line.find( "*PADS-POWERPCB*" ) != std::string::npos
|| line.find( "!PADS-POWERPCB" ) != std::string::npos )
return PADS_FILE_TYPE::PCB_ASCII;
// PADS Router PCB files start with *PADS2000* or !PADS2000*
if( line.find( "*PADS2000*" ) != std::string::npos
|| line.find( "!PADS2000" ) != std::string::npos )
return PADS_FILE_TYPE::PCB_ASCII;
// PADS Logic schematic files start with *PADS-POWERLOGIC* or !PADS-POWERLOGIC*
if( line.find( "*PADS-POWERLOGIC*" ) != std::string::npos
|| line.find( "!PADS-POWERLOGIC" ) != std::string::npos )
return PADS_FILE_TYPE::SCHEMATIC_ASCII;
if( line.find( "*PADS-LOGIC*" ) != std::string::npos
|| line.find( "!PADS-LOGIC" ) != std::string::npos )
return PADS_FILE_TYPE::SCHEMATIC_ASCII;
return PADS_FILE_TYPE::UNKNOWN;
}
RELATED_FILES FindRelatedPadsFiles( const wxString& aFilePath )
{
RELATED_FILES result;
wxFileName sourceFn( aFilePath );
if( !sourceFn.IsOk() || !sourceFn.FileExists() )
return result;
PADS_FILE_TYPE sourceType = DetectPadsFileType( aFilePath );
if( sourceType == PADS_FILE_TYPE::UNKNOWN )
return result;
// Set the source file in the appropriate field
if( sourceType == PADS_FILE_TYPE::PCB_ASCII )
result.pcbFile = aFilePath;
else if( sourceType == PADS_FILE_TYPE::SCHEMATIC_ASCII )
result.schematicFile = aFilePath;
wxString sourceDir = sourceFn.GetPath();
wxString sourceBase = sourceFn.GetName();
// Get list of potential related files in the same directory
wxDir dir( sourceDir );
if( !dir.IsOpened() )
return result;
// Common PADS file extensions to check
static const std::vector<wxString> extensions = { wxS( "asc" ), wxS( "ASC" ), wxS( "txt" ),
wxS( "TXT" ) };
wxString filename;
bool cont = dir.GetFirst( &filename );
while( cont )
{
wxFileName candidateFn( sourceDir, filename );
wxString candidatePath = candidateFn.GetFullPath();
// Skip the source file itself
if( candidatePath == aFilePath )
{
cont = dir.GetNext( &filename );
continue;
}
// Check if this file matches any of our extensions
wxString ext = candidateFn.GetExt().Lower();
bool validExt = false;
for( const wxString& validExtension : extensions )
{
if( ext == validExtension.Lower() )
{
validExt = true;
break;
}
}
if( !validExt )
{
cont = dir.GetNext( &filename );
continue;
}
// Prioritize files with matching base names
bool matchingBase = ( candidateFn.GetName() == sourceBase );
PADS_FILE_TYPE candidateType = DetectPadsFileType( candidatePath );
// If we imported PCB, look for schematic
if( sourceType == PADS_FILE_TYPE::PCB_ASCII
&& candidateType == PADS_FILE_TYPE::SCHEMATIC_ASCII )
{
if( matchingBase || result.schematicFile.IsEmpty() )
{
result.schematicFile = candidatePath;
// If we found a matching base name, stop looking
if( matchingBase )
{
cont = dir.GetNext( &filename );
continue;
}
}
}
// If we imported schematic, look for PCB
else if( sourceType == PADS_FILE_TYPE::SCHEMATIC_ASCII
&& candidateType == PADS_FILE_TYPE::PCB_ASCII )
{
if( matchingBase || result.pcbFile.IsEmpty() )
{
result.pcbFile = candidatePath;
// If we found a matching base name, stop looking
if( matchingBase )
{
cont = dir.GetNext( &filename );
continue;
}
}
}
cont = dir.GetNext( &filename );
}
return result;
}
int ParseInt( const std::string& aStr, int aDefault, const std::string& aContext )
{
try
{
return std::stoi( aStr );
}
catch( const std::exception& )
{
if( !aContext.empty() )
{
wxLogTrace( wxT( "PADS" ), wxT( "Parse error in %s: '%s' is not a valid integer" ),
wxString::FromUTF8( aContext ), wxString::FromUTF8( aStr ) );
}
return aDefault;
}
}
double ParseDouble( const std::string& aStr, double aDefault, const std::string& aContext )
{
try
{
return std::stod( aStr );
}
catch( const std::exception& )
{
if( !aContext.empty() )
{
wxLogTrace( wxT( "PADS" ), wxT( "Parse error in %s: '%s' is not a valid number" ),
wxString::FromUTF8( aContext ), wxString::FromUTF8( aStr ) );
}
return aDefault;
}
}
wxString ConvertInvertedNetName( const std::string& aNetName )
{
if( aNetName.empty() )
return wxString();
if( aNetName[0] == '/' )
return wxT( "~{" ) + wxString::FromUTF8( aNetName.substr( 1 ) ) + wxT( "}" );
return wxString::FromUTF8( aNetName );
}
LINE_STYLE PadsLineStyleToKiCad( int aPadsStyle )
{
int8_t s = static_cast<int8_t>( aPadsStyle & 0xFF );
switch( s )
{
case 0: return LINE_STYLE::DASH;
case 1: return LINE_STYLE::SOLID;
case -1: return LINE_STYLE::SOLID;
case -2: return LINE_STYLE::DASH;
case -3: return LINE_STYLE::DOT;
case -4: return LINE_STYLE::DASHDOT;
case -5: return LINE_STYLE::DASHDOTDOT;
default: return LINE_STYLE::SOLID;
}
}
} // namespace PADS_COMMON
+145
View File
@@ -0,0 +1,145 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_COMMON_H
#define PADS_COMMON_H
#include <kiid.h>
#include <string>
#include <stroke_params.h>
#include <wx/string.h>
/**
* @file pads_common.h
* @brief Common utilities and types for parsing PADS file formats.
*
* This header provides shared functionality used by both the PCB (pcbnew) and
* schematic (eeschema) PADS importers. Utilities include deterministic UUID
* generation, file type detection, and safe parsing helpers.
*/
namespace PADS_COMMON
{
/**
* Generate a deterministic KIID from a PADS component identifier.
*
* This function creates a reproducible UUID based on the input string, enabling
* cross-probe linking between schematic symbols and PCB footprints when both
* are imported from the same PADS project.
*
* The UUID is generated using a hash of the input string formatted into a valid
* UUID structure. The same input will always produce the same UUID.
*
* @param aIdentifier String identifying the component (typically refdes or
* combination of part type and refdes).
* @return A deterministic KIID that can be used for cross-probe linking.
*/
KIID GenerateDeterministicUuid( const std::string& aIdentifier );
/**
* Types of PADS files that can be detected.
*/
enum class PADS_FILE_TYPE
{
UNKNOWN,
PCB_ASCII, ///< PADS PowerPCB ASCII (.asc)
SCHEMATIC_ASCII ///< PADS Logic ASCII (.asc or .txt)
};
/**
* Result of detecting related PADS project files.
*/
struct RELATED_FILES
{
wxString pcbFile; ///< Path to PCB file if found
wxString schematicFile; ///< Path to schematic file if found
bool HasPcb() const { return !pcbFile.IsEmpty(); }
bool HasSchematic() const { return !schematicFile.IsEmpty(); }
bool HasBoth() const { return HasPcb() && HasSchematic(); }
};
/**
* Detect the type of a PADS file by examining its header.
*
* @param aFilePath Path to the file to examine.
* @return Detected file type.
*/
PADS_FILE_TYPE DetectPadsFileType( const wxString& aFilePath );
/**
* Find related PADS project files from a given source file.
*
* When importing a PADS PCB file, looks for matching schematic files.
* When importing a PADS schematic file, looks for matching PCB files.
* Matches are found by:
* 1. Same base filename with different file headers
* 2. Files in same directory with compatible headers
*
* @param aFilePath Path to the source file being imported.
* @return Structure containing paths to any related files found.
*/
RELATED_FILES FindRelatedPadsFiles( const wxString& aFilePath );
/**
* Parse integer from string with error context.
* Returns aDefault on failure and logs a trace warning.
*/
int ParseInt( const std::string& aStr, int aDefault = 0, const std::string& aContext = {} );
/**
* Parse double from string with error context.
* Returns aDefault on failure and logs a trace warning.
*/
double ParseDouble( const std::string& aStr, double aDefault = 0.0,
const std::string& aContext = {} );
/**
* Convert a PADS net name to KiCad format, handling inverted signal notation.
*
* PADS uses a "/" prefix to indicate inverted signals (e.g. "/RESET").
* KiCad uses overbar notation "~{name}" for the same purpose.
* Non-inverted names pass through unchanged.
*
* This function is shared between the PCB and schematic importers to ensure
* both sides produce identical net names.
*
* @param aNetName Raw PADS net name.
* @return Net name in KiCad notation.
*/
wxString ConvertInvertedNetName( const std::string& aNetName );
/**
* Convert a PADS line style integer to a KiCad LINE_STYLE enum value.
*
* PADS stores line style as an unsigned int that should be interpreted as
* a signed int8_t for mapping.
*/
LINE_STYLE PadsLineStyleToKiCad( int aPadsStyle );
} // namespace PADS_COMMON
#endif // PADS_COMMON_H
+191
View File
@@ -0,0 +1,191 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "pads_unit_converter.h"
#include <cmath>
PADS_UNIT_CONVERTER::PADS_UNIT_CONVERTER() :
m_unitType( PADS_UNIT_TYPE::MILS ),
m_scaleFactor( MILS_TO_NM ),
m_basicUnitsMode( false ),
m_basicUnitsScale( BASIC_TO_NM )
{
}
void PADS_UNIT_CONVERTER::SetBaseUnits( PADS_UNIT_TYPE aUnitType )
{
m_unitType = aUnitType;
updateScaleFactor();
}
void PADS_UNIT_CONVERTER::SetBasicUnitsMode( bool aEnabled )
{
m_basicUnitsMode = aEnabled;
updateScaleFactor();
}
void PADS_UNIT_CONVERTER::SetBasicUnitsScale( double aScale )
{
m_basicUnitsScale = aScale;
if( m_basicUnitsMode )
updateScaleFactor();
}
bool PADS_UNIT_CONVERTER::ParseFileHeader( const std::string& aHeader )
{
// Look for BASIC indicator in header like "!PADS-POWERPCB-V9.0-BASIC!"
if( aHeader.find( "BASIC" ) != std::string::npos ||
aHeader.find( "basic" ) != std::string::npos )
{
SetBasicUnitsMode( true );
return true;
}
// Look for explicit unit type indicators
if( aHeader.find( "MILS" ) != std::string::npos ||
aHeader.find( "mils" ) != std::string::npos )
{
SetBasicUnitsMode( false );
SetBaseUnits( PADS_UNIT_TYPE::MILS );
return true;
}
if( aHeader.find( "METRIC" ) != std::string::npos ||
aHeader.find( "metric" ) != std::string::npos )
{
SetBasicUnitsMode( false );
SetBaseUnits( PADS_UNIT_TYPE::METRIC );
return true;
}
if( aHeader.find( "INCHES" ) != std::string::npos ||
aHeader.find( "inches" ) != std::string::npos )
{
SetBasicUnitsMode( false );
SetBaseUnits( PADS_UNIT_TYPE::INCHES );
return true;
}
return false;
}
std::optional<PADS_UNIT_TYPE> PADS_UNIT_CONVERTER::ParseUnitCode( const std::string& aUnitCode )
{
if( aUnitCode.empty() )
return std::nullopt;
// "M" and "D" (default) both mean MILS
if( aUnitCode == "M" || aUnitCode == "m" || aUnitCode == "D" || aUnitCode == "d" ||
aUnitCode == "MILS" || aUnitCode == "mils" || aUnitCode == "MIL" || aUnitCode == "mil" )
{
return PADS_UNIT_TYPE::MILS;
}
// "MM" means METRIC (millimeters)
if( aUnitCode == "MM" || aUnitCode == "mm" ||
aUnitCode == "METRIC" || aUnitCode == "metric" )
{
return PADS_UNIT_TYPE::METRIC;
}
// "I" means INCHES
if( aUnitCode == "I" || aUnitCode == "i" ||
aUnitCode == "INCHES" || aUnitCode == "inches" || aUnitCode == "INCH" || aUnitCode == "inch" )
{
return PADS_UNIT_TYPE::INCHES;
}
// "N" means no override
if( aUnitCode == "N" || aUnitCode == "n" )
return std::nullopt;
return std::nullopt;
}
bool PADS_UNIT_CONVERTER::PushUnitOverride( const std::string& aUnitCode )
{
std::optional<PADS_UNIT_TYPE> unitType = ParseUnitCode( aUnitCode );
if( !unitType.has_value() )
return false;
m_unitOverrideStack.push_back( *unitType );
updateScaleFactor();
return true;
}
void PADS_UNIT_CONVERTER::PopUnitOverride()
{
if( !m_unitOverrideStack.empty() )
{
m_unitOverrideStack.pop_back();
updateScaleFactor();
}
}
void PADS_UNIT_CONVERTER::updateScaleFactor()
{
if( m_basicUnitsMode )
{
m_scaleFactor = m_basicUnitsScale;
return;
}
// Use override if present, otherwise use base unit type
PADS_UNIT_TYPE effectiveType = m_unitOverrideStack.empty()
? m_unitType
: m_unitOverrideStack.back();
switch( effectiveType )
{
case PADS_UNIT_TYPE::MILS:
m_scaleFactor = MILS_TO_NM;
break;
case PADS_UNIT_TYPE::METRIC:
m_scaleFactor = MM_TO_NM;
break;
case PADS_UNIT_TYPE::INCHES:
m_scaleFactor = INCHES_TO_NM;
break;
}
}
int64_t PADS_UNIT_CONVERTER::ToNanometers( double aValue ) const
{
return static_cast<int64_t>( std::round( aValue * m_scaleFactor ) );
}
int64_t PADS_UNIT_CONVERTER::ToNanometersSize( double aValue ) const
{
return static_cast<int64_t>( std::round( aValue * m_scaleFactor ) );
}
+199
View File
@@ -0,0 +1,199 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_UNIT_CONVERTER_H
#define PADS_UNIT_CONVERTER_H
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
/**
* Unit types supported by PADS file formats.
*/
enum class PADS_UNIT_TYPE
{
MILS, ///< Thousandths of an inch (1 mil = 0.001 inch)
METRIC, ///< Millimeters
INCHES ///< Inches
};
/**
* Converts PADS file format units to KiCad internal units (nanometers).
*
* PADS files can use different unit systems: MILS, METRIC (mm), or INCHES.
* Additionally, files can use BASIC units which are internal database units.
* This class handles conversion from any of these to KiCad's internal
* nanometer representation.
*/
class PADS_UNIT_CONVERTER
{
public:
PADS_UNIT_CONVERTER();
/**
* Set the base units for conversion.
*
* @param aUnitType The unit type used in the PADS file.
*/
void SetBaseUnits( PADS_UNIT_TYPE aUnitType );
/**
* Get the current unit type.
*
* @return The currently configured unit type.
*/
PADS_UNIT_TYPE GetUnitType() const { return m_unitType; }
/**
* Enable or disable BASIC units mode.
*
* BASIC units are PADS internal database units at 1/38100 mil resolution.
* When enabled, coordinate values are interpreted as BASIC units regardless
* of the base unit type.
*
* @param aEnabled True to enable BASIC units mode.
*/
void SetBasicUnitsMode( bool aEnabled );
/**
* Check if BASIC units mode is enabled.
*
* @return True if BASIC units mode is enabled.
*/
bool IsBasicUnitsMode() const { return m_basicUnitsMode; }
/**
* Set a custom scale for BASIC units.
*
* Some PADS files may use non-standard BASIC unit scales. The default
* scale is MILS_TO_NM / 38100.0 (1/38100 mil per unit).
*
* @param aScale The scale factor in nanometers per BASIC unit.
*/
void SetBasicUnitsScale( double aScale );
/**
* Get the current BASIC units scale.
*
* @return The scale factor in nanometers per BASIC unit.
*/
double GetBasicUnitsScale() const { return m_basicUnitsScale; }
/**
* Parse a PADS file header string and configure units accordingly.
*
* Detects BASIC mode from header strings like "!PADS-POWERPCB-V9.0-BASIC!"
* and unit types from strings like "!PADS-POWERPCB-V9.5-MILS!".
*
* @param aHeader The file header string to parse.
* @return True if the header was successfully parsed and units configured.
*/
bool ParseFileHeader( const std::string& aHeader );
/**
* Parse a PADS unit code and return the corresponding unit type.
*
* PADS uses short codes in parts and decals to specify local unit overrides:
* - "M" = MILS
* - "MM" = METRIC (millimeters)
* - "I" = INCHES
* - "D" = MILS (default)
* - "N" = No override (returns empty optional)
*
* @param aUnitCode The unit code string to parse.
* @return The corresponding unit type, or empty optional if code is invalid
* or indicates no override.
*/
static std::optional<PADS_UNIT_TYPE> ParseUnitCode( const std::string& aUnitCode );
/**
* Push a unit override onto the stack.
*
* PADS parts and decals can specify their own units that temporarily
* override the file's base units. This pushes an override onto the
* stack, affecting all subsequent conversions until popped.
*
* @param aUnitCode The unit code string (e.g., "M", "MM", "I").
* @return True if a valid override was pushed, false if code was invalid
* or indicated no override.
*/
bool PushUnitOverride( const std::string& aUnitCode );
/**
* Pop the most recent unit override from the stack.
*
* Removes the most recent override, reverting to the previous unit
* setting (either another override or the base units).
*/
void PopUnitOverride();
/**
* Check if any unit overrides are currently active.
*
* @return True if one or more overrides are on the stack.
*/
bool HasUnitOverride() const { return !m_unitOverrideStack.empty(); }
/**
* Get the current override depth.
*
* @return The number of overrides currently on the stack.
*/
size_t GetOverrideDepth() const { return m_unitOverrideStack.size(); }
/**
* Convert a coordinate value to nanometers.
*
* This is the primary conversion function for positional values.
*
* @param aValue The value in PADS file units.
* @return The value in nanometers (KiCad internal units).
*/
int64_t ToNanometers( double aValue ) const;
/**
* Convert a size value to nanometers.
*
* Size values (widths, heights, radii) use the same conversion as
* coordinates but may have different rounding behavior in the future.
*
* @param aValue The size value in PADS file units.
* @return The size in nanometers (KiCad internal units).
*/
int64_t ToNanometersSize( double aValue ) const;
// Conversion constants
static constexpr double MILS_TO_NM = 25400.0; // 1 mil = 25.4 um = 25400 nm
static constexpr double MM_TO_NM = 1000000.0; // 1 mm = 1,000,000 nm
static constexpr double INCHES_TO_NM = 25400000.0; // 1 inch = 25.4 mm = 25,400,000 nm
static constexpr double BASIC_TO_NM = MILS_TO_NM / 38100.0; // 1 BASIC unit = 1/38100 mil
private:
void updateScaleFactor();
PADS_UNIT_TYPE m_unitType;
double m_scaleFactor;
bool m_basicUnitsMode;
double m_basicUnitsScale;
std::vector<PADS_UNIT_TYPE> m_unitOverrideStack;
};
#endif // PADS_UNIT_CONVERTER_H
+69
View File
@@ -0,0 +1,69 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <jobs/job_pcb_import.h>
#include <jobs/job_registry.h>
#include <i18n_utility.h>
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_IMPORT::FORMAT,
{
{ JOB_PCB_IMPORT::FORMAT::AUTO, "auto" },
{ JOB_PCB_IMPORT::FORMAT::PADS, "pads" },
{ JOB_PCB_IMPORT::FORMAT::ALTIUM, "altium" },
{ JOB_PCB_IMPORT::FORMAT::EAGLE, "eagle" },
{ JOB_PCB_IMPORT::FORMAT::CADSTAR, "cadstar" },
{ JOB_PCB_IMPORT::FORMAT::FABMASTER, "fabmaster" },
{ JOB_PCB_IMPORT::FORMAT::PCAD, "pcad" },
{ JOB_PCB_IMPORT::FORMAT::SOLIDWORKS, "solidworks" }
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_IMPORT::REPORT_FORMAT,
{
{ JOB_PCB_IMPORT::REPORT_FORMAT::NONE, "none" },
{ JOB_PCB_IMPORT::REPORT_FORMAT::JSON, "json" },
{ JOB_PCB_IMPORT::REPORT_FORMAT::TEXT, "text" }
} )
JOB_PCB_IMPORT::JOB_PCB_IMPORT() :
JOB( "pcb_import", false )
{
m_params.emplace_back( new JOB_PARAM<FORMAT>( "format", &m_format, m_format ) );
m_params.emplace_back( new JOB_PARAM<wxString>( "layer_map_file", &m_layerMapFile, m_layerMapFile ) );
m_params.emplace_back( new JOB_PARAM<bool>( "auto_map", &m_autoMap, m_autoMap ) );
m_params.emplace_back( new JOB_PARAM<REPORT_FORMAT>( "report_format", &m_reportFormat, m_reportFormat ) );
m_params.emplace_back( new JOB_PARAM<wxString>( "report_file", &m_reportFile, m_reportFile ) );
}
wxString JOB_PCB_IMPORT::GetDefaultDescription() const
{
return _( "Import PCB" );
}
wxString JOB_PCB_IMPORT::GetSettingsDialogTitle() const
{
return _( "PCB Import Job Settings" );
}
REGISTER_JOB( pcb_import, _HKI( "PCB: Import" ), KIWAY::FACE_PCB, JOB_PCB_IMPORT );
+67
View File
@@ -0,0 +1,67 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef JOB_PCB_IMPORT_H
#define JOB_PCB_IMPORT_H
#include <kicommon.h>
#include "job.h"
/**
* Job to import a non-KiCad PCB file to KiCad format.
*
* Supports importing from PADS, Altium, Eagle, and other formats supported
* by the PCB_IO plugins.
*/
class KICOMMON_API JOB_PCB_IMPORT : public JOB
{
public:
JOB_PCB_IMPORT();
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
enum class FORMAT
{
AUTO,
PADS,
ALTIUM,
EAGLE,
CADSTAR,
FABMASTER,
PCAD,
SOLIDWORKS
};
enum class REPORT_FORMAT
{
NONE,
JSON,
TEXT
};
wxString m_inputFile;
FORMAT m_format = FORMAT::AUTO;
wxString m_layerMapFile;
bool m_autoMap = true;
REPORT_FORMAT m_reportFormat = REPORT_FORMAT::NONE;
wxString m_reportFile;
};
#endif
+6
View File
@@ -303,6 +303,12 @@ wxString FILEEXT::EagleFilesWildcard()
}
wxString FILEEXT::PADSProjectFilesWildcard()
{
return _( "PADS ASCII files" ) + AddFileExtListToFilter( { "asc", "txt" } );
}
wxString FILEEXT::OrCadPcb2NetlistFileWildcard()
{
return _( "OrcadPCB2 netlist files" )
+8
View File
@@ -88,6 +88,12 @@ set( EESCHEMA_SCH_IO
# EasyEDA Pro IO plugin
sch_io/easyedapro/sch_easyedapro_parser.cpp
sch_io/easyedapro/sch_io_easyedapro.cpp
# PADS Logic IO plugin
sch_io/pads/sch_io_pads.cpp
sch_io/pads/pads_sch_parser.cpp
sch_io/pads/pads_sch_symbol_builder.cpp
sch_io/pads/pads_sch_schematic_builder.cpp
)
set( EESCHEMA_DLGS
@@ -609,6 +615,7 @@ target_include_directories( eeschema_kiface_objects
target_link_libraries( eeschema_kiface_objects
PUBLIC
common
pads_common
pcm )
# Since we're not using target_link_libraries, we need to explicitly
@@ -630,6 +637,7 @@ target_link_libraries( eeschema_kiface
PRIVATE
common
eeschema_kiface_objects
pads_common
pcm
markdown_lib
scripting
+1
View File
@@ -1469,6 +1469,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
case SCH_IO_MGR::SCH_LTSPICE:
case SCH_IO_MGR::SCH_EASYEDA:
case SCH_IO_MGR::SCH_EASYEDAPRO:
case SCH_IO_MGR::SCH_PADS:
{
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
// Unless we are passing the files in aproperties, in which case aFileName can be empty.
File diff suppressed because it is too large Load Diff
+647
View File
@@ -0,0 +1,647 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_SCH_PARSER_H_
#define PADS_SCH_PARSER_H_
#include <string>
#include <vector>
#include <map>
#include <set>
#include <optional>
class REPORTER;
namespace PADS_SCH
{
enum class UNIT_TYPE
{
MILS,
METRIC,
INCHES
};
struct FILE_HEADER
{
std::string product;
std::string version;
std::string description;
bool valid = false;
};
struct SHEET_SIZE
{
double width = 11000.0;
double height = 8500.0;
std::string name;
};
/**
* General schematic parameters from *SCH* and *FIELDS* sections.
*/
struct PARAMETERS
{
UNIT_TYPE units = UNIT_TYPE::MILS;
double grid_x = 100.0;
double grid_y = 100.0;
std::string border_template;
std::string job_name;
SHEET_SIZE sheet_size;
double text_size = 60.0;
double line_width = 1.0;
// Additional *SCH* parameters
int cur_sheet = 0;
int conn_width = 0;
int bus_width = 0;
int bus_angle = 0;
int pin_name_h = 0;
int pin_name_w = 0;
int ref_name_h = 0;
int ref_name_w = 0;
int part_name_h = 0;
int part_name_w = 0;
int pin_no_h = 0;
int pin_no_w = 0;
int net_name_h = 0;
int net_name_w = 0;
int text_h = 0;
int text_w = 0;
int dot_grid = 0;
int tied_dot_size = 0;
int real_width = 0;
std::string font_mode;
std::string default_font;
// All user fields from *FIELDS*, keyed by field name
std::map<std::string, std::string> fields;
};
struct POINT
{
double x = 0.0;
double y = 0.0;
};
struct ARC_DATA
{
double bulge = 0.0;
double angle = 0.0;
double bbox_x1 = 0.0;
double bbox_y1 = 0.0;
double bbox_x2 = 0.0;
double bbox_y2 = 0.0;
};
struct GRAPHIC_POINT
{
POINT coord;
std::optional<ARC_DATA> arc;
};
enum class PIN_TYPE
{
PASSIVE,
INPUT,
OUTPUT,
BIDIRECTIONAL,
TRISTATE,
OPEN_COLLECTOR,
OPEN_EMITTER,
POWER,
UNSPECIFIED
};
/**
* Pin T/P line pair from CAEDECAL.
*/
struct SYMBOL_PIN
{
std::string name;
std::string number;
POINT position;
PIN_TYPE type = PIN_TYPE::UNSPECIFIED;
double length = 200.0;
double rotation = 0.0;
bool inverted = false;
bool clock = false;
// T-line fields
int side = 0;
int pn_h = 0;
int pn_w = 0;
int pn_angle = 0;
int pn_just = 0;
int pl_h = 0;
int pl_w = 0;
int pl_angle = 0;
int pl_just = 0;
std::string pin_decal_name;
// P-line fields
POINT pn_offset;
int pn_off_angle = 0;
int pn_off_just = 0;
POINT pl_offset;
int pl_off_angle = 0;
int pl_off_just = 0;
int p_flags = 0;
};
enum class GRAPHIC_TYPE
{
LINE,
RECTANGLE,
CIRCLE,
ARC,
POLYLINE
};
/**
* Graphic primitive from CAEDECAL or LINES sections (OPEN, CLOSED, CIRCLE, COPCLS).
*/
struct SYMBOL_GRAPHIC
{
GRAPHIC_TYPE type = GRAPHIC_TYPE::LINE;
double line_width = 0.0;
bool filled = false;
int line_style = 255;
std::vector<GRAPHIC_POINT> points;
POINT center;
double radius = 0.0;
double start_angle = 0.0;
double end_angle = 0.0;
};
struct SYMBOL_TEXT
{
std::string content;
POINT position;
double size = 60.0;
double rotation = 0.0;
bool visible = true;
int justification = 0;
int width_factor = 0;
int attr_flag = 0;
std::string font_name;
};
/**
* Attribute label pair from CAEDECAL or PART entries.
*/
struct CAEDECAL_ATTR
{
POINT position;
int angle = 0;
int justification = 0;
int height = 0;
int width = 0;
int visibility = 0;
std::string font_name;
std::string attr_name;
};
/**
* Symbol definition from *CAEDECAL* section.
*
* Contains graphic primitives and pin definitions for a reusable schematic symbol.
*/
struct SYMBOL_DEF
{
std::string name;
std::string timestamp;
int gate_count = 1;
int current_gate = 1;
std::vector<SYMBOL_PIN> pins;
std::vector<SYMBOL_GRAPHIC> graphics;
std::vector<SYMBOL_TEXT> texts;
// Full CAEDECAL header fields
int f1 = 0;
int f2 = 0;
int height = 0;
int width = 0;
int h2 = 0;
int w2 = 0;
int num_attrs = 0;
int num_pieces = 0;
int has_polarity = 0;
int num_pins = 0;
int pin_origin_code = 0;
int is_pin_decal = 0;
std::string font1;
std::string font2;
std::vector<CAEDECAL_ATTR> attrs;
};
struct PART_ATTRIBUTE
{
std::string name;
std::string value;
POINT position;
double rotation = 0.0;
double size = 60.0;
bool visible = true;
int justification = 0;
int height = 0;
int width = 0;
int visibility = 0;
std::string font_name;
};
/**
* Part instance from *PART* section.
*/
struct PART_PLACEMENT
{
std::string reference;
std::string symbol_name;
std::string part_type;
POINT position;
double rotation = 0.0;
int mirror_flags = 0;
std::string power_net_name;
int sheet_number = 1;
int gate_number = 1;
std::vector<PART_ATTRIBUTE> attributes;
// Full *PART* header fields
int h1 = 0;
int w1 = 0;
int h2 = 0;
int w2 = 0;
int num_attrs = 0;
int num_displayed_values = 0;
int num_pins = 0;
int gate_index = 0;
int pin_origin_code = 0;
std::string font1;
std::string font2;
// Attribute value overrides parsed from "name" value lines
std::map<std::string, std::string> attr_overrides;
// Pin override lines (zero-based index -> formatting)
struct PIN_OVERRIDE
{
int height = 0;
int width = 0;
int angle = 0;
int justification = 0;
};
std::vector<PIN_OVERRIDE> pin_overrides;
};
/**
* Wire segment connecting two endpoints through coordinate vertices.
*/
struct WIRE_SEGMENT
{
POINT start;
POINT end;
int sheet_number = 1;
// Real format fields
std::string endpoint_a;
std::string endpoint_b;
int vertex_count = 0;
int flags = 0;
std::vector<POINT> vertices;
};
struct PIN_CONNECTION
{
std::string reference;
std::string pin_number;
int sheet_number = 1;
};
/**
* Signal (net) definition from CONNECTION and SIGNAL sections.
*/
struct SCH_SIGNAL
{
std::string name;
std::vector<WIRE_SEGMENT> wires;
std::vector<PIN_CONNECTION> connections;
int flags1 = 0;
int flags2 = 0;
std::string function;
};
/**
* Off-page reference from *OFFPAGE REFS* section.
*/
struct OFF_PAGE_CONNECTOR
{
std::string signal_name;
int source_sheet = 1;
int target_sheet = 1;
POINT position;
int id = 0;
std::string symbol_lib;
int rotation = 0;
int flags1 = 0;
int flags2 = 0;
};
struct SHEET_DEF
{
int sheet_number = 1;
std::string name;
SHEET_SIZE size;
};
/**
* Sheet header from *SHT* section.
*/
struct SHEET_HEADER
{
int sheet_num = 0;
std::string sheet_name;
int parent_num = -1;
std::string parent_name;
};
/**
* Junction dot from *TIEDOTS* section.
*/
struct TIED_DOT
{
int id = 0;
POINT position;
int sheet_number = 1;
};
/**
* Free text item from *TEXT* section.
*/
struct TEXT_ITEM
{
POINT position;
int rotation = 0;
int justification = 0;
int height = 0;
int width_factor = 0;
int attr_flag = 0;
std::string font_name;
std::string content;
};
/**
* Graphical line/shape item from *LINES* section.
*/
struct LINES_ITEM
{
std::string name;
POINT origin;
int param1 = 0;
int param2 = 0;
std::vector<SYMBOL_GRAPHIC> primitives;
std::vector<TEXT_ITEM> texts;
};
/**
* Net name label from *NETNAMES* section.
*/
struct NETNAME_LABEL
{
std::string net_name;
std::string anchor_ref;
int x_offset = 0;
int y_offset = 0;
int rotation = 0;
int justification = 0;
int f3 = 0;
int f4 = 0;
int f5 = 0;
int f6 = 0;
int f7 = 0;
int height = 0;
int width_pct = 0;
std::string font_name;
};
/**
* Pin definition within a PARTTYPE GATE.
*/
struct PARTTYPE_PIN
{
std::string pin_id;
int swap_group = 0;
char pin_type = 'U';
std::string pin_name;
};
/**
* Gate definition within a PARTTYPE.
*/
struct GATE_DEF
{
int num_decal_variants = 0;
int num_pins = 0;
int swap_flag = 0;
std::vector<std::string> decal_names;
std::vector<PARTTYPE_PIN> pins;
};
/**
* Part type definition from *PARTTYPE* section.
*/
struct PARTTYPE_DEF
{
std::string name;
std::string category;
int num_physical = 0;
int num_sigpins = 0;
int unused = 0;
int num_swap_groups = 0;
std::string timestamp;
std::vector<GATE_DEF> gates;
// For special symbols ($GND_SYMS, $PWR_SYMS, $OSR_SYMS)
std::string special_keyword;
struct SPECIAL_VARIANT
{
std::string decal_name;
std::string pin_type;
std::string net_suffix;
};
std::vector<SPECIAL_VARIANT> special_variants;
// For CONN-based connectors
bool is_connector = false;
// SIGPIN entries (hidden power pins)
struct SIGPIN
{
std::string pin_number;
std::string net_name;
};
std::vector<SIGPIN> sigpins;
// Swap group lines
std::vector<std::string> swap_lines;
};
/**
* Parser for PADS Logic schematic design export files.
*
* Handles the *PADS-LOGIC-V9.0* ASCII export format with global sections
* (*SCH*, *CAM*, *MISC*, *FIELDS*) followed by per-sheet sections.
*/
class PADS_SCH_PARSER
{
public:
PADS_SCH_PARSER();
~PADS_SCH_PARSER();
void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; }
bool Parse( const std::string& aFileName );
static bool CheckFileHeader( const std::string& aFileName );
static PIN_TYPE ParsePinTypeChar( char aTypeChar );
const FILE_HEADER& GetHeader() const { return m_header; }
const PARAMETERS& GetParameters() const { return m_parameters; }
const std::vector<SYMBOL_DEF>& GetSymbolDefs() const { return m_symbolDefs; }
const SYMBOL_DEF* GetSymbolDef( const std::string& aName ) const;
const std::vector<PART_PLACEMENT>& GetPartPlacements() const { return m_partPlacements; }
const PART_PLACEMENT* GetPartPlacement( const std::string& aReference ) const;
const std::vector<SCH_SIGNAL>& GetSignals() const { return m_signals; }
const SCH_SIGNAL* GetSignal( const std::string& aName ) const;
std::string GetVersion() const { return m_header.version; }
bool IsValid() const { return m_header.valid; }
int GetSheetCount() const;
std::set<int> GetSheetNumbers() const;
const std::vector<OFF_PAGE_CONNECTOR>& GetOffPageConnectors() const { return m_offPageConnectors; }
std::vector<SCH_SIGNAL> GetSignalsOnSheet( int aSheetNumber ) const;
std::vector<PART_PLACEMENT> GetPartsOnSheet( int aSheetNumber ) const;
const std::map<std::string, PARTTYPE_DEF>& GetPartTypes() const { return m_partTypes; }
const std::vector<TIED_DOT>& GetTiedDots() const { return m_tiedDots; }
const std::vector<SHEET_HEADER>& GetSheetHeaders() const { return m_sheetHeaders; }
const std::vector<TEXT_ITEM>& GetTextItems() const { return m_textItems; }
const std::vector<LINES_ITEM>& GetLinesItems() const { return m_linesItems; }
const std::vector<NETNAME_LABEL>& GetNetNameLabels() const { return m_netNameLabels; }
private:
bool parseHeader( const std::string& aLine );
size_t parseSectionSCH( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionFIELDS( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionSHT( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionCAE( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionTEXT( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionLINES( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionCAEDECAL( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionPARTTYPE( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionPART( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionOFFPAGEREFS( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionTIEDOTS( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionCONNECTION( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSectionNETNAMES( const std::vector<std::string>& aLines, size_t aStartLine );
size_t skipBraceDelimitedSection( const std::vector<std::string>& aLines, size_t aStartLine );
size_t parseSymbolDef( const std::vector<std::string>& aLines, size_t aStartLine,
SYMBOL_DEF& aSymbol );
size_t parsePartPlacement( const std::vector<std::string>& aLines, size_t aStartLine,
PART_PLACEMENT& aPart );
size_t parseSignalDef( const std::vector<std::string>& aLines, size_t aStartLine,
SCH_SIGNAL& aSignal );
size_t parseGraphicPrimitive( const std::vector<std::string>& aLines, size_t aStartLine,
SYMBOL_GRAPHIC& aGraphic );
void mergePartTypeData();
PIN_TYPE parsePinType( const std::string& aTypeStr );
bool isSectionMarker( const std::string& aLine ) const;
std::string extractSectionName( const std::string& aLine ) const;
REPORTER* m_reporter;
FILE_HEADER m_header;
PARAMETERS m_parameters;
std::vector<SYMBOL_DEF> m_symbolDefs;
std::vector<PART_PLACEMENT> m_partPlacements;
std::vector<SCH_SIGNAL> m_signals;
std::vector<OFF_PAGE_CONNECTOR> m_offPageConnectors;
int m_lineNumber;
int m_currentSheet;
std::map<std::string, PARTTYPE_DEF> m_partTypes;
std::vector<TIED_DOT> m_tiedDots;
std::vector<SHEET_HEADER> m_sheetHeaders;
std::vector<TEXT_ITEM> m_textItems;
std::vector<LINES_ITEM> m_linesItems;
std::vector<NETNAME_LABEL> m_netNameLabels;
};
} // namespace PADS_SCH
#endif // PADS_SCH_PARSER_H_
@@ -0,0 +1,940 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <sch_io/pads/pads_sch_schematic_builder.h>
#include <sch_line.h>
#include <sch_junction.h>
#include <sch_label.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_sheet_pin.h>
#include <sch_symbol.h>
#include <schematic.h>
#include <wildcards_and_files_ext.h>
#include <layer_ids.h>
#include <template_fieldnames.h>
#include <title_block.h>
#include <io/pads/pads_attribute_mapper.h>
#include <io/pads/pads_common.h>
#include <advanced_config.h>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
namespace PADS_SCH
{
PADS_SCH_SCHEMATIC_BUILDER::PADS_SCH_SCHEMATIC_BUILDER( const PARAMETERS& aParams,
SCHEMATIC* aSchematic ) :
m_params( aParams ),
m_schematic( aSchematic ),
m_pageHeightIU( schIUScale.MilsToIU( aParams.sheet_size.height ) )
{
}
PADS_SCH_SCHEMATIC_BUILDER::~PADS_SCH_SCHEMATIC_BUILDER()
{
}
int PADS_SCH_SCHEMATIC_BUILDER::toKiCadUnits( double aPadsValue ) const
{
double milsValue = aPadsValue;
switch( m_params.units )
{
case UNIT_TYPE::MILS:
milsValue = aPadsValue;
break;
case UNIT_TYPE::METRIC:
milsValue = aPadsValue * 39.3701;
break;
case UNIT_TYPE::INCHES:
milsValue = aPadsValue * 1000.0;
break;
}
return schIUScale.MilsToIU( milsValue );
}
int PADS_SCH_SCHEMATIC_BUILDER::toKiCadY( double aPadsY ) const
{
return m_pageHeightIU - toKiCadUnits( aPadsY );
}
wxString PADS_SCH_SCHEMATIC_BUILDER::convertNetName( const std::string& aName ) const
{
return PADS_COMMON::ConvertInvertedNetName( aName );
}
int PADS_SCH_SCHEMATIC_BUILDER::CreateWires( const std::vector<SCH_SIGNAL>& aSignals,
SCH_SCREEN* aScreen )
{
int wireCount = 0;
for( const auto& signal : aSignals )
{
for( const auto& wire : signal.wires )
{
SCH_LINE* schLine = CreateWire( wire );
if( schLine )
{
schLine->SetFlags( IS_NEW );
aScreen->Append( schLine );
wireCount++;
}
}
}
return wireCount;
}
SCH_LINE* PADS_SCH_SCHEMATIC_BUILDER::CreateWire( const WIRE_SEGMENT& aWire )
{
VECTOR2I start( toKiCadUnits( aWire.start.x ), toKiCadY( aWire.start.y ) );
VECTOR2I end( toKiCadUnits( aWire.end.x ), toKiCadY( aWire.end.y ) );
SCH_LINE* line = new SCH_LINE( start, SCH_LAYER_ID::LAYER_WIRE );
line->SetEndPoint( end );
return line;
}
int PADS_SCH_SCHEMATIC_BUILDER::CreateJunctions( const std::vector<SCH_SIGNAL>& aSignals,
SCH_SCREEN* aScreen )
{
std::vector<VECTOR2I> junctionPoints = findJunctionPoints( aSignals );
for( const auto& pt : junctionPoints )
{
SCH_JUNCTION* junction = new SCH_JUNCTION( pt );
junction->SetFlags( IS_NEW );
aScreen->Append( junction );
}
return static_cast<int>( junctionPoints.size() );
}
std::vector<VECTOR2I> PADS_SCH_SCHEMATIC_BUILDER::findJunctionPoints(
const std::vector<SCH_SIGNAL>& aSignals )
{
std::vector<VECTOR2I> junctions;
for( const auto& signal : aSignals )
{
// Count how many wire endpoints connect at each point
std::map<std::pair<int, int>, int> pointCount;
for( const auto& wire : signal.wires )
{
VECTOR2I start( toKiCadUnits( wire.start.x ), toKiCadY( wire.start.y ) );
VECTOR2I end( toKiCadUnits( wire.end.x ), toKiCadY( wire.end.y ) );
pointCount[{ start.x, start.y }]++;
pointCount[{ end.x, end.y }]++;
}
// Junction needed where 3+ wire endpoints meet
for( const auto& [coords, count] : pointCount )
{
if( count >= 3 )
{
junctions.emplace_back( coords.first, coords.second );
}
}
}
return junctions;
}
int PADS_SCH_SCHEMATIC_BUILDER::CreateNetLabels( const std::vector<SCH_SIGNAL>& aSignals,
SCH_SCREEN* aScreen,
const std::set<std::string>& aSignalOpcIds,
const std::set<std::string>& aSkipSignals )
{
int labelCount = 0;
for( const auto& signal : aSignals )
{
if( signal.name.empty() || signal.name[0] == '$' )
continue;
if( aSkipSignals.count( signal.name ) )
continue;
if( signal.wires.empty() )
continue;
// Collect label placements from OPC wire endpoints. Each OPC produces one label.
std::vector<std::pair<VECTOR2I, VECTOR2I>> opcPlacements;
for( const auto& wire : signal.wires )
{
if( wire.vertices.size() < 2 )
continue;
// endpoint_a references first vertex, endpoint_b references last vertex
if( !wire.endpoint_a.empty() && wire.endpoint_a.substr( 0, 3 ) == "@@@"
&& aSignalOpcIds.count( wire.endpoint_a ) )
{
VECTOR2I labelPos( toKiCadUnits( wire.vertices.front().x ),
toKiCadY( wire.vertices.front().y ) );
VECTOR2I adjPos( toKiCadUnits( wire.vertices[1].x ),
toKiCadY( wire.vertices[1].y ) );
opcPlacements.emplace_back( labelPos, adjPos );
}
if( !wire.endpoint_b.empty() && wire.endpoint_b.substr( 0, 3 ) == "@@@"
&& aSignalOpcIds.count( wire.endpoint_b ) )
{
size_t last = wire.vertices.size() - 1;
VECTOR2I labelPos( toKiCadUnits( wire.vertices[last].x ),
toKiCadY( wire.vertices[last].y ) );
VECTOR2I adjPos( toKiCadUnits( wire.vertices[last - 1].x ),
toKiCadY( wire.vertices[last - 1].y ) );
opcPlacements.emplace_back( labelPos, adjPos );
}
}
for( const auto& [labelPos, adjPos] : opcPlacements )
{
SPIN_STYLE orient = computeLabelOrientation( labelPos, adjPos );
SCH_GLOBALLABEL* label = CreateNetLabel( signal, labelPos, orient );
if( label )
{
label->SetFlags( IS_NEW );
aScreen->Append( label );
labelCount++;
}
}
}
return labelCount;
}
SPIN_STYLE PADS_SCH_SCHEMATIC_BUILDER::computeLabelOrientation(
const VECTOR2I& aLabelPos, const VECTOR2I& aAdjacentPos )
{
// The wire goes from aLabelPos toward aAdjacentPos. The label text extends
// in the opposite direction so it doesn't overlap the wire.
int dx = aAdjacentPos.x - aLabelPos.x;
int dy = aAdjacentPos.y - aLabelPos.y;
if( std::abs( dx ) >= std::abs( dy ) )
{
return ( dx > 0 ) ? SPIN_STYLE::LEFT : SPIN_STYLE::RIGHT;
}
else
{
return ( dy > 0 ) ? SPIN_STYLE::UP : SPIN_STYLE::BOTTOM;
}
}
SCH_GLOBALLABEL* PADS_SCH_SCHEMATIC_BUILDER::CreateNetLabel( const SCH_SIGNAL& aSignal,
const VECTOR2I& aPosition,
SPIN_STYLE aOrientation )
{
wxString labelName = convertNetName( aSignal.name );
SCH_GLOBALLABEL* label = new SCH_GLOBALLABEL( aPosition, labelName );
label->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
label->SetSpinStyle( aOrientation );
int labelSize = schIUScale.MilsToIU( 50 );
label->SetTextSize( VECTOR2I( labelSize, labelSize ) );
return label;
}
VECTOR2I PADS_SCH_SCHEMATIC_BUILDER::chooseLabelPosition( const SCH_SIGNAL& aSignal )
{
if( aSignal.wires.empty() )
return VECTOR2I( 0, 0 );
// Count how many wire segments share each endpoint. An endpoint referenced
// only once is a dangling wire end -- the correct place for a global label.
// Only first and last vertices are true endpoints; interior ones are bends.
std::map<std::pair<int, int>, int> endpointCount;
for( const auto& wire : aSignal.wires )
{
if( wire.vertices.size() < 2 )
continue;
auto first = wire.vertices.front();
auto last = wire.vertices.back();
endpointCount[{ static_cast<int>( first.x * 1000 ),
static_cast<int>( first.y * 1000 ) }]++;
endpointCount[{ static_cast<int>( last.x * 1000 ),
static_cast<int>( last.y * 1000 ) }]++;
}
// Also count pin connection positions so we can avoid placing on a pin
std::set<std::pair<int, int>> pinEndpoints;
for( const auto& wire : aSignal.wires )
{
if( wire.vertices.size() < 2 )
continue;
// endpoint_a/endpoint_b hold pin references (e.g. "R1.1"); if non-empty,
// that endpoint connects to a component pin. OPC references (starting
// with "@@@") are off-page connectors, not physical pins.
if( !wire.endpoint_a.empty() && wire.endpoint_a.substr( 0, 3 ) != "@@@" )
{
auto pt = wire.vertices.front();
pinEndpoints.insert( { static_cast<int>( pt.x * 1000 ),
static_cast<int>( pt.y * 1000 ) } );
}
if( !wire.endpoint_b.empty() && wire.endpoint_b.substr( 0, 3 ) != "@@@" )
{
auto pt = wire.vertices.back();
pinEndpoints.insert( { static_cast<int>( pt.x * 1000 ),
static_cast<int>( pt.y * 1000 ) } );
}
}
// Prefer a dangling endpoint that is NOT at a pin
for( const auto& wire : aSignal.wires )
{
if( wire.vertices.size() < 2 )
continue;
for( const auto* vtx : { &wire.vertices.front(), &wire.vertices.back() } )
{
auto key = std::make_pair( static_cast<int>( vtx->x * 1000 ),
static_cast<int>( vtx->y * 1000 ) );
if( endpointCount[key] == 1 && pinEndpoints.count( key ) == 0 )
return VECTOR2I( toKiCadUnits( vtx->x ), toKiCadY( vtx->y ) );
}
}
// Fallback: any dangling endpoint (even if at a pin)
for( const auto& wire : aSignal.wires )
{
if( wire.vertices.size() < 2 )
continue;
for( const auto* vtx : { &wire.vertices.front(), &wire.vertices.back() } )
{
auto key = std::make_pair( static_cast<int>( vtx->x * 1000 ),
static_cast<int>( vtx->y * 1000 ) );
if( endpointCount[key] == 1 )
return VECTOR2I( toKiCadUnits( vtx->x ), toKiCadY( vtx->y ) );
}
}
// Last resort: first endpoint of the first wire that has vertices
for( const auto& wire : aSignal.wires )
{
if( !wire.vertices.empty() )
{
const auto& vtx = wire.vertices[0];
return VECTOR2I( toKiCadUnits( vtx.x ), toKiCadY( vtx.y ) );
}
}
return VECTOR2I( 0, 0 );
}
int PADS_SCH_SCHEMATIC_BUILDER::CreateBusWires( const std::vector<SCH_SIGNAL>& aSignals,
SCH_SCREEN* aScreen )
{
int busCount = 0;
for( const auto& signal : aSignals )
{
if( !IsBusSignal( signal.name ) )
continue;
for( const auto& wire : signal.wires )
{
SCH_LINE* busLine = CreateBusWire( wire );
if( busLine )
{
busLine->SetFlags( IS_NEW );
aScreen->Append( busLine );
busCount++;
}
}
}
return busCount;
}
SCH_LINE* PADS_SCH_SCHEMATIC_BUILDER::CreateBusWire( const WIRE_SEGMENT& aWire )
{
VECTOR2I start( toKiCadUnits( aWire.start.x ), toKiCadY( aWire.start.y ) );
VECTOR2I end( toKiCadUnits( aWire.end.x ), toKiCadY( aWire.end.y ) );
SCH_LINE* line = new SCH_LINE( start, SCH_LAYER_ID::LAYER_BUS );
line->SetEndPoint( end );
return line;
}
bool PADS_SCH_SCHEMATIC_BUILDER::IsBusSignal( const std::string& aName )
{
if( aName.empty() )
return false;
// Check for bus naming patterns commonly used in PADS
// Pattern 1: NAME[n:m] or NAME[n..m] - range notation
size_t bracketPos = aName.find( '[' );
if( bracketPos != std::string::npos )
{
size_t closeBracket = aName.find( ']', bracketPos );
if( closeBracket != std::string::npos )
{
std::string range = aName.substr( bracketPos + 1, closeBracket - bracketPos - 1 );
if( range.find( ':' ) != std::string::npos ||
range.find( ".." ) != std::string::npos )
{
return true;
}
}
}
// Pattern 2: NAME<n:m> or NAME<n..m>
size_t anglePos = aName.find( '<' );
if( anglePos != std::string::npos )
{
size_t closeAngle = aName.find( '>', anglePos );
if( closeAngle != std::string::npos )
{
std::string range = aName.substr( anglePos + 1, closeAngle - anglePos - 1 );
if( range.find( ':' ) != std::string::npos ||
range.find( ".." ) != std::string::npos )
{
return true;
}
}
}
return false;
}
void PADS_SCH_SCHEMATIC_BUILDER::ApplyPartAttributes( SCH_SYMBOL* aSymbol,
const PART_PLACEMENT& aPlacement )
{
if( !aSymbol || !m_schematic )
return;
// Set reference designator, stripping any gate suffix (e.g., "U17-A" → "U17")
if( !aPlacement.reference.empty() )
{
std::string ref = aPlacement.reference;
size_t sepPos = ref.rfind( '-' );
if( sepPos == std::string::npos )
sepPos = ref.rfind( '.' );
if( sepPos != std::string::npos && sepPos + 1 < ref.size()
&& std::isalpha( static_cast<unsigned char>( ref[sepPos + 1] ) ) )
{
ref = ref.substr( 0, sepPos );
}
aSymbol->SetRef( &m_schematic->CurrentSheet(), wxString::FromUTF8( ref ) );
}
// Value field is always the PARTTYPE name. Parametric values like VALUE1
// flow through CreateCustomFields as user-defined fields.
if( !aPlacement.part_type.empty() )
{
aSymbol->SetValueFieldText( wxString::FromUTF8( aPlacement.part_type ) );
}
// Look for PCB DECAL attribute to set footprint
for( const auto& attr : aPlacement.attributes )
{
if( attr.name == "PCB DECAL" || attr.name == "PCB_DECAL" || attr.name == "FOOTPRINT" )
{
if( !attr.value.empty() )
{
aSymbol->SetFootprintFieldText( wxString::FromUTF8( attr.value ) );
}
break;
}
}
// Apply visibility and position settings
ApplyFieldSettings( aSymbol, aPlacement );
}
void PADS_SCH_SCHEMATIC_BUILDER::ApplyFieldSettings( SCH_SYMBOL* aSymbol,
const PART_PLACEMENT& aPlacement )
{
if( !aSymbol )
return;
PADS_ATTRIBUTE_MAPPER mapper;
for( const auto& attr : aPlacement.attributes )
{
SCH_FIELD* field = nullptr;
bool isRefOrValue = false;
if( mapper.IsReferenceField( attr.name ) )
{
field = aSymbol->GetField( FIELD_T::REFERENCE );
isRefOrValue = true;
}
else if( mapper.IsValueField( attr.name ) )
{
field = aSymbol->GetField( FIELD_T::VALUE );
isRefOrValue = true;
}
else if( mapper.IsFootprintField( attr.name ) )
{
field = aSymbol->GetField( FIELD_T::FOOTPRINT );
}
if( field )
{
bool isRef = mapper.IsReferenceField( attr.name );
if( isRef )
field->SetVisible( true );
else
field->SetVisible( isRefOrValue ? attr.visible : false );
// PADS field positions are in CAEDECAL coordinates (pre-mirror).
// KiCad applies the symbol transform to field positions, so
// pre-compensate X for mirrored-Y symbols.
int fx = toKiCadUnits( attr.position.x );
if( aPlacement.mirror_flags & 1 )
fx = -fx;
VECTOR2I fieldPos( fx, -toKiCadUnits( attr.position.y ) );
field->SetPosition( aSymbol->GetPosition() + fieldPos );
if( attr.rotation != 0.0 )
{
field->SetTextAngleDegrees( attr.rotation );
}
if( attr.height > 0 )
{
int scaledH = static_cast<int>(
schIUScale.MilsToIU( attr.height )
* ADVANCED_CFG::GetCfg().m_PadsSchTextHeightScale );
int scaledW = static_cast<int>(
schIUScale.MilsToIU( attr.height )
* ADVANCED_CFG::GetCfg().m_PadsSchTextWidthScale );
field->SetTextSize( VECTOR2I( scaledW, scaledH ) );
}
else
{
int fieldTextSize = schIUScale.MilsToIU( 50 );
field->SetTextSize( VECTOR2I( fieldTextSize, fieldTextSize ) );
}
if( attr.width > 0 )
field->SetTextThickness( schIUScale.MilsToIU( attr.width ) );
field->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
field->SetVertJustify( isRef ? GR_TEXT_V_ALIGN_BOTTOM : GR_TEXT_V_ALIGN_CENTER );
}
}
}
int PADS_SCH_SCHEMATIC_BUILDER::CreateCustomFields( SCH_SYMBOL* aSymbol,
const PART_PLACEMENT& aPlacement )
{
if( !aSymbol )
return 0;
int fieldsCreated = 0;
PADS_ATTRIBUTE_MAPPER mapper;
std::set<std::string> processedNames;
for( const auto& attr : aPlacement.attributes )
{
// Skip standard fields that are handled by ApplyPartAttributes
if( mapper.IsStandardField( attr.name ) )
continue;
// Skip empty attributes
if( attr.value.empty() )
continue;
processedNames.insert( attr.name );
// Get the mapped field name
std::string fieldName = mapper.GetKiCadFieldName( attr.name );
// Check if this field already exists on the symbol
SCH_FIELD* existingField = aSymbol->GetField( wxString::FromUTF8( fieldName ) );
if( existingField )
{
// Update existing field value and settings
existingField->SetText( wxString::FromUTF8( attr.value ) );
existingField->SetVisible( false );
}
else
{
// Create a new custom field using FIELD_T::USER for custom fields
SCH_FIELD newField( aSymbol, FIELD_T::USER, wxString::FromUTF8( fieldName ) );
newField.SetText( wxString::FromUTF8( attr.value ) );
newField.SetVisible( false );
// Apply position offset from attribute
VECTOR2I fieldPos( toKiCadUnits( attr.position.x ), -toKiCadUnits( attr.position.y ) );
newField.SetPosition( aSymbol->GetPosition() + fieldPos );
// Apply rotation if specified
if( attr.rotation != 0.0 )
{
newField.SetTextAngleDegrees( attr.rotation );
}
// Apply text size if specified
if( attr.size > 0.0 )
{
int textSize = toKiCadUnits( attr.size );
newField.SetTextSize( VECTOR2I( textSize, textSize ) );
}
aSymbol->GetFields().push_back( newField );
fieldsCreated++;
}
}
// Create fields from attr_overrides that weren't in the attributes vector
for( const auto& [name, value] : aPlacement.attr_overrides )
{
if( value.empty() || processedNames.count( name ) || mapper.IsStandardField( name ) )
continue;
std::string fieldName = mapper.GetKiCadFieldName( name );
SCH_FIELD* existingField = aSymbol->GetField( wxString::FromUTF8( fieldName ) );
if( existingField )
{
existingField->SetText( wxString::FromUTF8( value ) );
existingField->SetVisible( false );
}
else
{
SCH_FIELD newField( aSymbol, FIELD_T::USER, wxString::FromUTF8( fieldName ) );
newField.SetText( wxString::FromUTF8( value ) );
newField.SetVisible( false );
newField.SetPosition( aSymbol->GetPosition() );
aSymbol->GetFields().push_back( newField );
fieldsCreated++;
}
}
return fieldsCreated;
}
void PADS_SCH_SCHEMATIC_BUILDER::CreateTitleBlock( SCH_SCREEN* aScreen )
{
if( !aScreen )
return;
// Look up the first non-empty value from a list of candidate field names
auto findField = [this]( const std::initializer_list<const char*>& aCandidates ) -> std::string
{
for( const char* name : aCandidates )
{
auto it = m_params.fields.find( name );
if( it != m_params.fields.end() && !it->second.empty() )
return it->second;
}
return {};
};
TITLE_BLOCK tb;
std::string title = findField( { "Title", "TITLE1" } );
if( title.empty() )
title = m_params.job_name;
if( !title.empty() )
tb.SetTitle( wxString::FromUTF8( title ) );
std::string date = findField( { "DATE", "Release Date", "Drawn Date" } );
if( !date.empty() )
tb.SetDate( wxString::FromUTF8( date ) );
std::string revision = findField( { "Revision", "VER" } );
if( !revision.empty() )
tb.SetRevision( wxString::FromUTF8( revision ) );
std::string company = findField( { "Company Name" } );
if( !company.empty() )
tb.SetCompany( wxString::FromUTF8( company ) );
std::string drawingNumber = findField( { "DN", "Drawing Number" } );
if( !drawingNumber.empty() )
tb.SetComment( 0, wxString::FromUTF8( drawingNumber ) );
std::string designer = findField( { "DESIGNER" } );
if( !designer.empty() )
tb.SetComment( 1, wxString::FromUTF8( designer ) );
std::string drawnBy = findField( { "DRAWNBY", "Drawn By" } );
if( !drawnBy.empty() )
tb.SetComment( 2, wxString::FromUTF8( drawnBy ) );
std::string builtFor = findField( { "BUILTFOR" } );
if( !builtFor.empty() )
tb.SetComment( 3, wxString::FromUTF8( builtFor ) );
aScreen->SetTitleBlock( tb );
}
SCH_SHEET* PADS_SCH_SCHEMATIC_BUILDER::CreateHierarchicalSheet( int aSheetNumber, int aTotalSheets,
SCH_SHEET* aParentSheet,
const wxString& aBaseFilename )
{
if( !aParentSheet || !m_schematic )
return nullptr;
VECTOR2I pos = CalculateSheetPosition( aSheetNumber - 1, aTotalSheets );
VECTOR2I size = GetDefaultSheetSize();
SCH_SHEET* sheet = new SCH_SHEET( aParentSheet, pos, size );
// Create a screen for this sheet
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
sheet->SetScreen( screen );
// Generate sheet filename based on base filename and sheet number
wxFileName fn( aBaseFilename );
wxString sheetFilename = wxString::Format( wxT( "%s_sheet%d.%s" ),
fn.GetName(),
aSheetNumber,
FILEEXT::KiCadSchematicFileExtension );
// Set the sheet filename field
sheet->GetField( FIELD_T::SHEET_FILENAME )->SetText( sheetFilename );
// Set sheet name
wxString sheetName = wxString::Format( wxT( "Sheet %d" ), aSheetNumber );
sheet->GetField( FIELD_T::SHEET_NAME )->SetText( sheetName );
// Set full path for the screen if project is available
if( m_schematic->IsValid() )
{
wxFileName screenFn( m_schematic->Project().GetProjectPath(), sheetFilename );
screen->SetFileName( screenFn.GetFullPath() );
}
else
{
screen->SetFileName( sheetFilename );
}
sheet->SetFlags( IS_NEW );
// Add the sheet to the parent's screen
SCH_SCREEN* parentScreen = aParentSheet->GetScreen();
if( parentScreen )
{
parentScreen->Append( sheet );
}
return sheet;
}
VECTOR2I PADS_SCH_SCHEMATIC_BUILDER::GetDefaultSheetSize() const
{
// Default sheet symbol size in mils (approximately 2" x 1.5")
return VECTOR2I( schIUScale.MilsToIU( 2000 ), schIUScale.MilsToIU( 1500 ) );
}
VECTOR2I PADS_SCH_SCHEMATIC_BUILDER::CalculateSheetPosition( int aSheetIndex, int aTotalSheets ) const
{
// Arrange sheet symbols in a grid on the root sheet
// Start position offset from origin
const int startX = schIUScale.MilsToIU( 500 );
const int startY = schIUScale.MilsToIU( 500 );
// Spacing between sheet symbols
const int spacingX = schIUScale.MilsToIU( 2500 );
const int spacingY = schIUScale.MilsToIU( 2000 );
// Calculate grid columns based on total sheets (aim for roughly square layout)
int columns = static_cast<int>( std::ceil( std::sqrt( static_cast<double>( aTotalSheets ) ) ) );
if( columns < 1 )
columns = 1;
int row = aSheetIndex / columns;
int col = aSheetIndex % columns;
return VECTOR2I( startX + col * spacingX, startY + row * spacingY );
}
SCH_SHEET_PIN* PADS_SCH_SCHEMATIC_BUILDER::CreateSheetPin( SCH_SHEET* aSheet,
const std::string& aSignalName,
int aPinIndex )
{
if( !aSheet )
return nullptr;
wxString name = wxString::FromUTF8( aSignalName );
// Position pins along the left edge of the sheet
VECTOR2I sheetPos = aSheet->GetPosition();
int pinSpacing = schIUScale.MilsToIU( 200 );
int yOffset = schIUScale.MilsToIU( 100 ) + aPinIndex * pinSpacing;
VECTOR2I pinPos( sheetPos.x, sheetPos.y + yOffset );
SCH_SHEET_PIN* pin = new SCH_SHEET_PIN( aSheet, pinPos, name );
pin->SetSide( SHEET_SIDE::LEFT );
pin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
aSheet->AddPin( pin );
return pin;
}
SCH_HIERLABEL* PADS_SCH_SCHEMATIC_BUILDER::CreateHierLabel( const std::string& aSignalName,
const VECTOR2I& aPosition,
SCH_SCREEN* aScreen )
{
if( !aScreen )
return nullptr;
wxString name = wxString::FromUTF8( aSignalName );
SCH_HIERLABEL* label = new SCH_HIERLABEL( aPosition, name );
label->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
label->SetFlags( IS_NEW );
aScreen->Append( label );
return label;
}
bool PADS_SCH_SCHEMATIC_BUILDER::IsGlobalSignal( const std::string& aSignalName,
const std::set<int>& aSheetNumbers )
{
if( aSignalName.empty() )
return false;
// Signals appearing on multiple sheets should be global
if( aSheetNumbers.size() > 1 )
return true;
// Common power net names are always global
std::string upperName = aSignalName;
std::transform( upperName.begin(), upperName.end(), upperName.begin(), ::toupper );
static const std::set<std::string> globalPatterns = {
"VCC", "VDD", "VEE", "VSS", "GND", "AGND", "DGND", "PGND",
"V+", "V-", "VBAT", "VBUS", "VIN", "VOUT",
"+5V", "+3V3", "+3.3V", "+12V", "-12V", "+24V",
"0V", "EARTH", "CHASSIS"
};
if( globalPatterns.count( upperName ) > 0 )
return true;
// Check for voltage patterns like +1V8, +2V5, etc.
if( ( upperName[0] == '+' || upperName[0] == '-' ) && upperName.length() >= 3 )
{
bool hasDigit = false;
bool hasV = false;
for( char c : upperName.substr( 1 ) )
{
if( std::isdigit( c ) )
hasDigit = true;
if( c == 'V' )
hasV = true;
}
if( hasDigit && hasV )
return true;
}
return false;
}
} // namespace PADS_SCH
@@ -0,0 +1,298 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_SCH_SCHEMATIC_BUILDER_H_
#define PADS_SCH_SCHEMATIC_BUILDER_H_
#include <sch_io/pads/pads_sch_parser.h>
#include <sch_label.h>
#include <set>
#include <vector>
#include <memory>
#include <wx/string.h>
class SCH_SCREEN;
class SCH_SHEET;
class SCH_SHEET_PATH;
class SCH_SHEET_PIN;
class SCH_HIERLABEL;
class SCH_GLOBALLABEL;
class SCH_LINE;
class SCH_JUNCTION;
class SCH_LABEL;
class SCH_BUS_WIRE_ENTRY;
class SCH_SYMBOL;
class SCHEMATIC;
namespace PADS_SCH
{
/**
* Builder class to create KiCad schematic elements from parsed PADS data.
*
* This class handles the conversion of parsed PADS signals and connectivity
* into KiCad schematic wire segments, junctions, and labels.
*/
class PADS_SCH_SCHEMATIC_BUILDER
{
public:
PADS_SCH_SCHEMATIC_BUILDER( const PARAMETERS& aParams, SCHEMATIC* aSchematic );
~PADS_SCH_SCHEMATIC_BUILDER();
/**
* Create wire segments from signal definitions and add to screen.
*
* @param aSignals Vector of parsed signal definitions.
* @param aScreen Target screen to add wires to.
* @return Number of wires created.
*/
int CreateWires( const std::vector<SCH_SIGNAL>& aSignals, SCH_SCREEN* aScreen );
/**
* Create a single wire segment.
*
* @param aWire Wire segment data.
* @return New SCH_LINE object. Caller takes ownership.
*/
SCH_LINE* CreateWire( const WIRE_SEGMENT& aWire );
/**
* Create junctions at wire intersection points.
*
* @param aSignals Vector of parsed signal definitions.
* @param aScreen Target screen to add junctions to.
* @return Number of junctions created.
*/
int CreateJunctions( const std::vector<SCH_SIGNAL>& aSignals, SCH_SCREEN* aScreen );
/**
* Create net labels for named signals.
*
* For signals with OPC endpoints, one label is created per OPC connection point with
* orientation derived from the adjacent wire direction. Signals without OPC endpoints
* fall back to a single label at a dangling wire end.
*
* @param aSignals Vector of parsed signal definitions.
* @param aScreen Target screen to add labels to.
* @param aSignalOpcIds Set of OPC reference strings (e.g. "@@@O48") for signal OPCs.
* @param aSkipSignals Signal names to skip (e.g. power nets handled elsewhere).
* @return Number of labels created.
*/
int CreateNetLabels( const std::vector<SCH_SIGNAL>& aSignals, SCH_SCREEN* aScreen,
const std::set<std::string>& aSignalOpcIds,
const std::set<std::string>& aSkipSignals = {} );
/**
* Create a global net label for a signal.
*
* PADS signals are global by nature, so all net labels are created as
* SCH_GLOBALLABEL to avoid sheet-path prefix issues with local labels.
*
* @param aSignal Signal definition.
* @param aPosition Label position.
* @param aOrientation Label spin style (default RIGHT).
* @return New SCH_GLOBALLABEL object. Caller takes ownership.
*/
SCH_GLOBALLABEL* CreateNetLabel( const SCH_SIGNAL& aSignal, const VECTOR2I& aPosition,
SPIN_STYLE aOrientation = SPIN_STYLE::RIGHT );
/**
* Create bus wires and entries for bus signals.
*
* @param aSignals Vector of parsed signal definitions.
* @param aScreen Target screen to add bus wires to.
* @return Number of bus wires created.
*/
int CreateBusWires( const std::vector<SCH_SIGNAL>& aSignals, SCH_SCREEN* aScreen );
/**
* Create a single bus wire segment.
*
* @param aWire Wire segment data.
* @return New SCH_LINE object with bus layer. Caller takes ownership.
*/
SCH_LINE* CreateBusWire( const WIRE_SEGMENT& aWire );
/**
* Check if a signal name indicates a bus.
*
* @param aName Signal name to check.
* @return True if the name matches bus naming patterns.
*/
static bool IsBusSignal( const std::string& aName );
/**
* Apply part attributes to a symbol instance.
*
* Sets the reference designator, value, footprint, and other fields from the
* parsed PADS part placement attributes.
*
* @param aSymbol Target symbol instance to update.
* @param aPlacement Parsed part placement with attributes.
*/
void ApplyPartAttributes( SCH_SYMBOL* aSymbol, const PART_PLACEMENT& aPlacement );
/**
* Apply field visibility and position from PADS attribute settings.
*
* @param aSymbol Target symbol instance.
* @param aPlacement Parsed part placement with attribute visibility settings.
*/
void ApplyFieldSettings( SCH_SYMBOL* aSymbol, const PART_PLACEMENT& aPlacement );
/**
* Create custom fields from non-standard PADS attributes.
*
* Creates KiCad custom fields for PADS attributes that don't map to
* standard fields (Reference, Value, Footprint, Datasheet, Description).
* Uses PADS_ATTRIBUTE_MAPPER for name normalization.
*
* @param aSymbol Target symbol instance.
* @param aPlacement Parsed part placement with attributes.
* @return Number of custom fields created.
*/
int CreateCustomFields( SCH_SYMBOL* aSymbol, const PART_PLACEMENT& aPlacement );
/**
* Create title block from parsed PADS parameters.
*
* Maps PADS *FIELDS* section entries to KiCad TITLE_BLOCK, checking both standard
* and custom field names since PADS designs often leave standard names empty and
* use custom variants instead (e.g. "TITLE1" instead of "Title").
*
* @param aScreen Target screen to set title block on.
*/
void CreateTitleBlock( SCH_SCREEN* aScreen );
/**
* Create hierarchical sheet for a sub-schematic page.
*
* Creates a SCH_SHEET object representing a sub-sheet in the hierarchy.
* The sheet is positioned on the parent sheet and linked with a screen
* for the sub-schematic content.
*
* @param aSheetNumber Sheet number (1-based).
* @param aTotalSheets Total number of sheets in the design.
* @param aParentSheet Parent sheet to contain this sub-sheet.
* @param aBaseFilename Base filename for generating sheet filenames.
* @return New SCH_SHEET object. Caller takes ownership.
*/
SCH_SHEET* CreateHierarchicalSheet( int aSheetNumber, int aTotalSheets,
SCH_SHEET* aParentSheet,
const wxString& aBaseFilename );
/**
* Get standard sheet size for a given sheet number.
*
* Returns a default sheet symbol size suitable for display on the parent.
*/
VECTOR2I GetDefaultSheetSize() const;
/**
* Calculate position for a sheet symbol on the parent sheet.
*
* Arranges sheets in a grid layout.
*
* @param aSheetIndex Zero-based sheet index.
* @param aTotalSheets Total number of sub-sheets.
* @return Position for the sheet symbol.
*/
VECTOR2I CalculateSheetPosition( int aSheetIndex, int aTotalSheets ) const;
/**
* Create hierarchical sheet pin on a sheet symbol.
*
* Sheet pins connect to hierarchical labels inside the sub-schematic.
*
* @param aSheet Target sheet to add pin to.
* @param aSignalName Name of the signal crossing the hierarchy.
* @param aPinIndex Index for positioning the pin on the sheet edge.
* @return New SCH_SHEET_PIN object. Ownership transferred to sheet.
*/
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet, const std::string& aSignalName,
int aPinIndex );
/**
* Create hierarchical label in a sub-schematic.
*
* Hierarchical labels connect to sheet pins on the parent sheet.
*
* @param aSignalName Name of the signal.
* @param aPosition Label position.
* @param aScreen Target screen to add label to.
* @return New SCH_HIERLABEL object. Caller takes ownership.
*/
SCH_HIERLABEL* CreateHierLabel( const std::string& aSignalName, const VECTOR2I& aPosition,
SCH_SCREEN* aScreen );
/**
* Check if a signal name represents a global signal.
*
* Global signals include power nets (VCC, GND) and signals
* that appear on multiple sheets.
*
* @param aSignalName Signal name to check.
* @param aSheetNumbers Set of sheet numbers where signal appears.
* @return True if this should be a global label.
*/
static bool IsGlobalSignal( const std::string& aSignalName,
const std::set<int>& aSheetNumbers );
private:
/**
* Convert PADS coordinate to KiCad internal units.
*/
int toKiCadUnits( double aPadsValue ) const;
/**
* Convert PADS Y coordinate to KiCad Y, accounting for Y-axis inversion and page offset.
*/
int toKiCadY( double aPadsY ) const;
/**
* Find junction points where 3+ wire segments meet.
*/
std::vector<VECTOR2I> findJunctionPoints( const std::vector<SCH_SIGNAL>& aSignals );
/**
* Choose best position for net label on a signal's wires.
*/
VECTOR2I chooseLabelPosition( const SCH_SIGNAL& aSignal );
/**
* Compute label orientation from the wire direction at the label position.
* The label extends opposite to the wire direction.
*/
SPIN_STYLE computeLabelOrientation( const VECTOR2I& aLabelPos,
const VECTOR2I& aAdjacentPos );
/**
* Convert a PADS net name for use as a KiCad label.
* Handles "/" prefix → "~{}" overbar conversion for inverted signals.
*/
wxString convertNetName( const std::string& aName ) const;
const PARAMETERS& m_params;
SCHEMATIC* m_schematic;
int m_pageHeightIU;
};
} // namespace PADS_SCH
#endif // PADS_SCH_SCHEMATIC_BUILDER_H_
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,197 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_SCH_SYMBOL_BUILDER_H_
#define PADS_SCH_SYMBOL_BUILDER_H_
#include <sch_io/pads/pads_sch_parser.h>
#include <lib_id.h>
#include <map>
#include <memory>
#include <optional>
#include <string>
class LIB_SYMBOL;
class SCH_SHAPE;
class SCH_PIN;
class SCHEMATIC;
namespace PADS_SCH
{
/**
* Builder class to convert PADS symbol definitions to KiCad LIB_SYMBOL objects.
*
* This class handles the conversion of parsed PADS symbol definitions (graphics and pins)
* to KiCad's embedded symbol format for schematic import.
*/
class PADS_SCH_SYMBOL_BUILDER
{
public:
PADS_SCH_SYMBOL_BUILDER( const PARAMETERS& aParams );
~PADS_SCH_SYMBOL_BUILDER();
/**
* Build a KiCad LIB_SYMBOL from a PADS symbol definition.
*
* @param aSymbolDef The parsed PADS symbol definition.
* @return A new LIB_SYMBOL object. Caller takes ownership.
*/
LIB_SYMBOL* BuildSymbol( const SYMBOL_DEF& aSymbolDef );
/**
* Get or create a symbol for the given definition.
*
* If the symbol has already been created, returns a pointer to the existing symbol.
* Otherwise creates a new symbol and caches it.
*
* @param aSymbolDef The parsed PADS symbol definition.
* @return Pointer to the symbol (owned by this builder).
*/
LIB_SYMBOL* GetOrCreateSymbol( const SYMBOL_DEF& aSymbolDef );
/**
* Check if a symbol with the given name already exists.
*/
bool HasSymbol( const std::string& aName ) const;
/**
* Get a cached symbol by name.
*
* @param aName Symbol name.
* @return Pointer to the symbol, or nullptr if not found.
*/
LIB_SYMBOL* GetSymbol( const std::string& aName ) const;
/**
* Check if a symbol name indicates a power symbol.
*
* @param aName Symbol name to check.
* @return True if the name matches common power symbol patterns.
*/
static bool IsPowerSymbol( const std::string& aName );
/**
* Get KiCad power library symbol ID for a PADS power symbol.
*
* @param aPadsName PADS symbol name.
* @return LIB_ID for the KiCad power library symbol, or nullopt if no mapping.
*/
static std::optional<LIB_ID> GetKiCadPowerSymbolId( const std::string& aPadsName );
/**
* Build a power symbol using hard-coded KiCad-standard graphics.
*
* @param aKiCadName KiCad power symbol name (e.g. "GND", "VCC", "VEE").
* @return A new LIB_SYMBOL with power graphics, or nullptr if the name is unrecognized.
* Caller takes ownership.
*/
LIB_SYMBOL* BuildKiCadPowerSymbol( const std::string& aKiCadName );
/**
* Map a PADS special_variant to a power symbol style name.
*
* Uses the variant's decal_name pattern (RAIL, ARROW, BUBBLE) and pin_type
* to determine the appropriate KiCad power symbol style.
*
* @param aDecalName Variant decal name (e.g. "+RAIL", "AGND", "+BUBBLE").
* @param aPinType Variant pin type ("G" for ground, "P" for power).
* @return Internal style name for BuildKiCadPowerSymbol(), or empty if unrecognized.
*/
static std::string GetPowerStyleFromVariant( const std::string& aDecalName,
const std::string& aPinType );
/**
* Build a composite multi-unit LIB_SYMBOL from a multi-gate PARTTYPE.
*
* Each gate becomes a separate unit with its own graphics, pins, and text.
* Pin numbers/names/types are taken from the GATE_DEF pin list rather than
* from the CAEDECAL SYMBOL_DEF, which only has placeholder pin data.
*
* @param aPartType The multi-gate PARTTYPE definition.
* @param aSymbolDefs All parsed CAEDECAL definitions for decal lookup.
* @return A new multi-unit LIB_SYMBOL. Caller takes ownership.
*/
LIB_SYMBOL* BuildMultiUnitSymbol( const PARTTYPE_DEF& aPartType,
const std::vector<SYMBOL_DEF>& aSymbolDefs );
/**
* Get or create a multi-unit symbol for the given PARTTYPE.
*
* Cached by PARTTYPE name so that all instances of the same multi-gate part
* share one composite LIB_SYMBOL.
*/
LIB_SYMBOL* GetOrCreateMultiUnitSymbol( const PARTTYPE_DEF& aPartType,
const std::vector<SYMBOL_DEF>& aSymbolDefs );
/**
* Get or create a single-gate symbol with PARTTYPE-specific pin remapping.
*
* Since mergePartTypeData() no longer mutates shared SYMBOL_DEF pins,
* this method applies pin number/name/type overrides from GATE_DEF::pins
* at build time. Cached by PARTTYPE name to keep separate symbols when
* multiple PARTTYPEs share the same CAEDECAL.
*/
LIB_SYMBOL* GetOrCreatePartTypeSymbol( const PARTTYPE_DEF& aPartType,
const SYMBOL_DEF& aSymbolDef );
/**
* Add hidden power pins from PARTTYPE SIGPIN entries to an existing symbol.
*
* Each SIGPIN becomes an invisible PT_POWER_IN pin at position (0,0).
* Duplicate pin numbers are skipped.
*/
void AddHiddenPowerPins( LIB_SYMBOL* aSymbol,
const std::vector<PARTTYPE_DEF::SIGPIN>& aSigpins );
private:
/**
* Convert PADS coordinate to KiCad internal units.
*/
int toKiCadUnits( double aPadsValue ) const;
/**
* Create a SCH_SHAPE from a PADS graphic element.
* Returns nullptr for mixed line/arc paths (use createShapes instead).
*/
SCH_SHAPE* createShape( const SYMBOL_GRAPHIC& aGraphic );
/**
* Create one or more SCH_SHAPEs from a PADS graphic element.
* Handles mixed line/arc paths by emitting individual line and arc shapes.
*/
std::vector<SCH_SHAPE*> createShapes( const SYMBOL_GRAPHIC& aGraphic );
/**
* Create a SCH_PIN from a PADS pin definition.
*/
SCH_PIN* createPin( const SYMBOL_PIN& aPin, LIB_SYMBOL* aParent );
/**
* Map PADS pin type to KiCad electrical type.
*/
int mapPinType( PIN_TYPE aPadsType );
const PARAMETERS& m_params;
std::map<std::string, std::unique_ptr<LIB_SYMBOL>> m_symbolCache;
};
} // namespace PADS_SCH
#endif // PADS_SCH_SYMBOL_BUILDER_H_
File diff suppressed because it is too large Load Diff
+76
View File
@@ -0,0 +1,76 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCH_IO_PADS_H_
#define SCH_IO_PADS_H_
#include <sch_io/sch_io.h>
#include <sch_io/sch_io_mgr.h>
#include <unordered_map>
class SCH_SCREEN;
class SCH_SHEET;
class SCHEMATIC;
class LIB_SYMBOL;
/**
* A #SCH_IO derivation for loading PADS Logic schematic files.
*
* PADS Logic exports schematic designs as ASCII text files that can be parsed
* and converted to KiCad schematic format.
*/
class SCH_IO_PADS : public SCH_IO
{
public:
SCH_IO_PADS();
~SCH_IO_PADS();
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
{
return IO_BASE::IO_FILE_DESC( _HKI( "PADS Logic schematic files" ), { "asc", "txt" } );
}
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
{
return IO_BASE::IO_FILE_DESC( _HKI( "PADS Logic library files" ), { "asc", "txt" } );
}
bool CanReadSchematicFile( const wxString& aFileName ) const override;
bool CanReadLibrary( const wxString& aFileName ) const override;
int GetModifyHash() const override { return 0; }
SCH_SHEET* LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
SCH_SHEET* aAppendToMe = nullptr,
const std::map<std::string, UTF8>* aProperties = nullptr ) override;
private:
/**
* Check if the file header indicates a PADS Logic schematic file.
*
* @param aFileName Path to the file to check.
* @return True if file appears to be a PADS Logic schematic.
*/
bool checkFileHeader( const wxString& aFileName ) const;
std::unordered_map<wxString, SEVERITY> m_errorMessages;
};
#endif // SCH_IO_PADS_H_
+5
View File
@@ -35,6 +35,7 @@
#include <sch_io/database/sch_io_database.h>
#include <sch_io/ltspice/sch_io_ltspice.h>
#include <sch_io/http_lib/sch_io_http_lib.h>
#include <sch_io/pads/sch_io_pads.h>
#include <common.h> // for ExpandEnvVarSubstitutions
#include <wildcards_and_files_ext.h>
@@ -76,6 +77,7 @@ SCH_IO* SCH_IO_MGR::FindPlugin( SCH_FILE_T aFileType )
case SCH_EASYEDAPRO: return new SCH_IO_EASYEDAPRO();
case SCH_LTSPICE: return new SCH_IO_LTSPICE();
case SCH_HTTP: return new SCH_IO_HTTP_LIB();
case SCH_PADS: return new SCH_IO_PADS();
default: return nullptr;
}
}
@@ -99,6 +101,7 @@ const wxString SCH_IO_MGR::ShowType( SCH_FILE_T aType )
case SCH_EASYEDAPRO: return wxString( wxT( "EasyEDA (JLCEDA) Pro" ) );
case SCH_LTSPICE: return wxString( wxT( "LTspice" ) );
case SCH_HTTP: return wxString( wxT( "HTTP" ) );
case SCH_PADS: return wxString( wxT( "PADS Logic" ) );
case SCH_NESTED_TABLE: return LIBRARY_TABLE_ROW::TABLE_TYPE_NAME;
default: return wxString::Format( _( "Unknown SCH_FILE_T value: %d" ), aType );
}
@@ -131,6 +134,8 @@ SCH_IO_MGR::SCH_FILE_T SCH_IO_MGR::EnumFromStr( const wxString& aType )
return SCH_LTSPICE;
else if( aType == wxT( "HTTP" ) )
return SCH_HTTP;
else if( aType == wxT( "PADS Logic" ) )
return SCH_PADS;
else if( aType == LIBRARY_TABLE_ROW::TABLE_TYPE_NAME )
return SCH_NESTED_TABLE;
+1
View File
@@ -67,6 +67,7 @@ public:
SCH_EASYEDAPRO, ///< EasyEDA Pro archive
SCH_LTSPICE, ///< LtSpice Schematic format
SCH_HTTP, ///< KiCad HTTP library
SCH_PADS, ///< PADS Logic schematic format
// Add your schematic type here.
SCH_FILE_UNKNOWN,
+2
View File
@@ -62,6 +62,7 @@ class SCH_LABEL_BASE;
class PLOTTER;
class REPORTER;
class SCH_IO_ALTIUM;
class SCH_IO_PADS;
class SCH_EDIT_FRAME;
class SCH_SHEET_LIST;
class SCH_IO_KICAD_SEXPR_PARSER;
@@ -642,6 +643,7 @@ private:
friend SCH_IO_KICAD_SEXPR_PARSER; // Only to load instance information from schematic file.
friend SCH_IO_KICAD_SEXPR; // Only to save the loaded instance information to schematic file.
friend SCH_IO_ALTIUM;
friend SCH_IO_PADS;
friend TEST_SCH_SCREEN_FIXTURE;
bool doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings,
+48
View File
@@ -919,6 +919,54 @@ public:
*/
int m_HistoryLockStaleTimeout;
/**
* PADS text height scale factor for PCB imports.
* PADS text height includes leading/descender; multiply by this to get
* character cell height.
*
* Setting name: "PadsPcbTextHeightScale"
* Valid values: 0.1 to 1.0
* Default value: 0.69
*/
double m_PadsPcbTextHeightScale;
/**
* PADS text width scale factor for PCB imports.
*
* Setting name: "PadsPcbTextWidthScale"
* Valid values: 0.1 to 1.0
* Default value: 0.64
*/
double m_PadsPcbTextWidthScale;
/**
* PADS text height scale factor for schematic imports.
*
* Setting name: "PadsSchTextHeightScale"
* Valid values: 0.1 to 1.0
* Default value: 0.50
*/
double m_PadsSchTextHeightScale;
/**
* PADS text width scale factor for schematic imports.
*
* Setting name: "PadsSchTextWidthScale"
* Valid values: 0.1 to 1.0
* Default value: 0.46
*/
double m_PadsSchTextWidthScale;
/**
* PADS text anchor offset in nanometers for PCB imports.
* Compensates for the difference between PADS and KiCad text anchor positions.
*
* Setting name: "PadsTextAnchorOffsetNm"
* Valid values: 0 to 1000000
* Default value: 350000
*/
int m_PadsTextAnchorOffsetNm;
/**
* Enable iterative zone filling to handle isolated islands in higher priority zones.
*
+1
View File
@@ -252,6 +252,7 @@ public:
static wxString CadstarArchiveFilesWildcard();
static wxString AltiumProjectFilesWildcard();
static wxString EagleFilesWildcard();
static wxString PADSProjectFilesWildcard();
static wxString EasyEdaArchiveWildcard();
static wxString EasyEdaProFileWildcard();
static wxString PdfFileWildcard();
+5
View File
@@ -72,6 +72,7 @@ set( KICAD_CLI_SRCS
cli/command_pcb_export_stats.cpp
cli/command_pcb_export_svg.cpp
cli/command_pcb_upgrade.cpp
cli/command_pcb_import.cpp
cli/command_fp_export_svg.cpp
cli/command_fp_upgrade.cpp
cli/command_sch_upgrade.cpp
@@ -155,6 +156,7 @@ if( APPLE )
target_link_libraries( kicad
nlohmann_json
common
pads_common
kicommon
core
${wxWidgets_LIBRARIES}
@@ -167,6 +169,7 @@ if( APPLE )
target_link_libraries( kicad-cli
nlohmann_json
common
pads_common
${wxWidgets_LIBRARIES}
core
)
@@ -176,6 +179,7 @@ else()
common
gal
common #repeated due to a circular dependency between gal and common
pads_common
kicommon
core
${wxWidgets_LIBRARIES}
@@ -186,6 +190,7 @@ else()
common
gal
common #repeated due to a circular dependency between gal and common
pads_common
kicommon
core
${wxWidgets_LIBRARIES}
+149
View File
@@ -0,0 +1,149 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "command_pcb_import.h"
#include <cli/exit_codes.h>
#include <jobs/job_pcb_import.h>
#include <kiface_base.h>
#include <string_utils.h>
#include <macros.h>
#include <wx/crt.h>
#include <wx/filename.h>
#define ARG_FORMAT "--format"
#define ARG_LAYER_MAP "--layer-map"
#define ARG_AUTO_MAP "--auto-map"
#define ARG_REPORT_FORMAT "--report-format"
#define ARG_REPORT_FILE "--report-file"
CLI::PCB_IMPORT_COMMAND::PCB_IMPORT_COMMAND() : COMMAND( "import" )
{
addCommonArgs( true, true, IO_TYPE::FILE, IO_TYPE::FILE );
m_argParser.add_description(
UTF8STDSTR( _( "Import a non-KiCad PCB file to KiCad format" ) ) );
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "auto" ) )
.help( UTF8STDSTR( _( "Input format hint: auto, pads, altium, eagle, cadstar, "
"fabmaster, pcad, solidworks (default: auto)" ) ) )
.metavar( "FORMAT" );
m_argParser.add_argument( ARG_LAYER_MAP )
.default_value( std::string( "" ) )
.help( UTF8STDSTR( _( "JSON file with layer name mappings" ) ) )
.metavar( "FILE" );
m_argParser.add_argument( ARG_AUTO_MAP )
.help( UTF8STDSTR( _( "Use automatic layer mapping (default behavior)" ) ) )
.flag();
m_argParser.add_argument( ARG_REPORT_FORMAT )
.default_value( std::string( "none" ) )
.help( UTF8STDSTR( _( "Import report format: none, json, text (default: none)" ) ) )
.metavar( "FORMAT" );
m_argParser.add_argument( ARG_REPORT_FILE )
.default_value( std::string( "" ) )
.help( UTF8STDSTR( _( "File path for import report (default: stdout)" ) ) )
.metavar( "FILE" );
}
int CLI::PCB_IMPORT_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_PCB_IMPORT> importJob = std::make_unique<JOB_PCB_IMPORT>();
importJob->m_inputFile = m_argInput;
importJob->SetConfiguredOutputPath( m_argOutput );
wxString format = From_UTF8( m_argParser.get<std::string>( ARG_FORMAT ).c_str() );
if( format == wxS( "auto" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::AUTO;
}
else if( format == wxS( "pads" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::PADS;
}
else if( format == wxS( "altium" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::ALTIUM;
}
else if( format == wxS( "eagle" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::EAGLE;
}
else if( format == wxS( "cadstar" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::CADSTAR;
}
else if( format == wxS( "fabmaster" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::FABMASTER;
}
else if( format == wxS( "pcad" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::PCAD;
}
else if( format == wxS( "solidworks" ) )
{
importJob->m_format = JOB_PCB_IMPORT::FORMAT::SOLIDWORKS;
}
else
{
wxFprintf( stderr, _( "Invalid format: %s\n" ), format );
return EXIT_CODES::ERR_ARGS;
}
wxString layerMapFile = From_UTF8( m_argParser.get<std::string>( ARG_LAYER_MAP ).c_str() );
importJob->m_layerMapFile = layerMapFile;
importJob->m_autoMap = m_argParser.get<bool>( ARG_AUTO_MAP ) || layerMapFile.IsEmpty();
wxString reportFormat = From_UTF8( m_argParser.get<std::string>( ARG_REPORT_FORMAT ).c_str() );
if( reportFormat == wxS( "none" ) )
{
importJob->m_reportFormat = JOB_PCB_IMPORT::REPORT_FORMAT::NONE;
}
else if( reportFormat == wxS( "json" ) )
{
importJob->m_reportFormat = JOB_PCB_IMPORT::REPORT_FORMAT::JSON;
}
else if( reportFormat == wxS( "text" ) )
{
importJob->m_reportFormat = JOB_PCB_IMPORT::REPORT_FORMAT::TEXT;
}
else
{
wxFprintf( stderr, _( "Invalid report format: %s\n" ), reportFormat );
return EXIT_CODES::ERR_ARGS;
}
wxString reportFile = From_UTF8( m_argParser.get<std::string>( ARG_REPORT_FILE ).c_str() );
importJob->m_reportFile = reportFile;
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, importJob.get() );
return exitCode;
}
+39
View File
@@ -0,0 +1,39 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMAND_PCB_IMPORT_H
#define COMMAND_PCB_IMPORT_H
#include "command.h"
namespace CLI
{
class PCB_IMPORT_COMMAND : public COMMAND
{
public:
PCB_IMPORT_COMMAND();
protected:
int doPerform( KIWAY& aKiway ) override;
};
}
#endif
+37
View File
@@ -42,6 +42,7 @@
#include <io/easyedapro/easyedapro_import_utils.h>
#include <io/easyedapro/easyedapro_parser.h>
#include <io/common/plugin_common_choose_project.h>
#include <io/pads/pads_common.h>
#include <dialogs/dialog_import_choose_project.h>
#include <wx/log.h>
@@ -293,6 +294,42 @@ void IMPORT_PROJ_HELPER::AltiumProjectHandler()
}
void IMPORT_PROJ_HELPER::ImportPadsFiles()
{
m_properties.clear();
PADS_COMMON::RELATED_FILES related = PADS_COMMON::FindRelatedPadsFiles( m_InputFile.GetFullPath() );
if( !related.HasPcb() && !related.HasSchematic() )
return;
std::vector<SCOPED_FILE_REMOVER> copiedFiles;
auto copyAndImport = [&]( const wxString& sourceFile, FRAME_T frameType, int fileType )
{
if( sourceFile.IsEmpty() )
return;
wxFileName srcFn( sourceFile );
wxFileName targetFile( m_TargetProj.GetPath(), srcFn.GetName(), srcFn.GetExt() );
if( !targetFile.FileExists() )
{
bool copied = wxCopyFile( srcFn.GetFullPath(), targetFile.GetFullPath(), false );
if( copied )
copiedFiles.emplace_back( targetFile.GetFullPath() );
}
if( targetFile.FileExists() )
doImport( targetFile.GetFullPath(), frameType, fileType );
};
copyAndImport( related.schematicFile, FRAME_SCH, SCH_IO_MGR::SCH_PADS );
copyAndImport( related.pcbFile, FRAME_PCB_EDITOR, PCB_IO_MGR::PADS );
}
void IMPORT_PROJ_HELPER::ImportFiles( int aImportedSchFileType, int aImportedPcbFileType )
{
m_properties.clear();
+6 -1
View File
@@ -54,6 +54,11 @@ public:
*/
void ImportFiles( int aImportedSchFileType, int aImportedPcbFileType );
/**
* @brief Converts PADS ASCII schematic and PCB files to KiCad type files.
*/
void ImportPadsFiles();
wxFileName m_InputFile;
wxFileName m_TargetProj;
@@ -79,4 +84,4 @@ private:
void AltiumProjectHandler();
};
#endif
#endif
+26 -2
View File
@@ -36,6 +36,7 @@
#include <kidialog.h>
#include <kiplatform/ui.h>
#include <wildcards_and_files_ext.h>
#include <io/pads/pads_common.h>
#include <sch_io/sch_io_mgr.h>
#include <pcb_io/pcb_io_mgr.h>
@@ -61,6 +62,18 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
if( inputdlg.ShowModal() == wxID_CANCEL )
return;
wxString inputPath = inputdlg.GetPath();
bool isPadsProject = ( aSchFileType == SCH_IO_MGR::SCH_PADS
&& aPcbFileType == PCB_IO_MGR::PADS );
if( isPadsProject
&& PADS_COMMON::DetectPadsFileType( inputPath ) == PADS_COMMON::PADS_FILE_TYPE::UNKNOWN )
{
DisplayErrorMessage( this,
_( "The selected file does not appear to be a PADS ASCII schematic or PCB." ) );
return;
}
// OK, we got a new project to open. Time to close any existing project before we go on
// to collect info about where to put the new one, etc. Otherwise the workflow is kind of
// disjoint.
@@ -71,7 +84,7 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
std::vector<wxString> pcbFileExts( aPcbFileExtensions.begin(), aPcbFileExtensions.end() );
IMPORT_PROJ_HELPER importProj( this, schFileExts, pcbFileExts );
importProj.m_InputFile = inputdlg.GetPath();
importProj.m_InputFile = inputPath;
// Don't use wxFileDialog here. On GTK builds, the default path is returned unless a
// file is actually selected.
@@ -137,7 +150,10 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
CreateNewProject( importProj.m_TargetProj.GetFullPath(), false /* Don't create stub files */ );
LoadProject( importProj.m_TargetProj );
importProj.ImportFiles( aSchFileType, aPcbFileType );
if( isPadsProject )
importProj.ImportPadsFiles();
else
importProj.ImportFiles( aSchFileType, aPcbFileType );
ReCreateTreePrj();
m_active_project = true;
@@ -179,3 +195,11 @@ void KICAD_MANAGER_FRAME::OnImportEasyEdaProFiles( wxCommandEvent& event )
ImportNonKiCadProject( _( "Import EasyEDA Pro Project" ), FILEEXT::EasyEdaProFileWildcard(), { "INPUT" },
{ "INPUT" }, SCH_IO_MGR::SCH_EASYEDAPRO, PCB_IO_MGR::EASYEDAPRO );
}
void KICAD_MANAGER_FRAME::OnImportPadsProjectFiles( wxCommandEvent& event )
{
ImportNonKiCadProject( _( "Import PADS Project Files" ), FILEEXT::PADSProjectFilesWildcard(),
{ "asc", "txt" }, { "asc", "txt" }, SCH_IO_MGR::SCH_PADS,
PCB_IO_MGR::PADS );
}
+5
View File
@@ -75,6 +75,7 @@
#include "cli/command_sch_export_netlist.h"
#include "cli/command_sch_export_plot.h"
#include "cli/command_pcb_upgrade.h"
#include "cli/command_pcb_import.h"
#include "cli/command_fp.h"
#include "cli/command_fp_export.h"
#include "cli/command_fp_export_svg.h"
@@ -127,6 +128,7 @@ static CLI::PCB_COMMAND pcbCmd{};
static CLI::PCB_DRC_COMMAND pcbDrcCmd{};
static CLI::PCB_RENDER_COMMAND pcbRenderCmd{};
static CLI::PCB_UPGRADE_COMMAND pcbUpgradeCmd{};
static CLI::PCB_IMPORT_COMMAND pcbImportCmd{};
static CLI::PCB_EXPORT_DRILL_COMMAND exportPcbDrillCmd{};
static CLI::PCB_EXPORT_DXF_COMMAND exportPcbDxfCmd{};
static CLI::PCB_EXPORT_3D_COMMAND exportPcbGlbCmd{ "glb", UTF8STDSTR( _( "Export GLB (binary GLTF)" ) ), JOB_EXPORT_PCB_3D::FORMAT::GLB };
@@ -206,6 +208,9 @@ static std::vector<COMMAND_ENTRY> commandStack = {
{
&pcbDrcCmd
},
{
&pcbImportCmd
},
{
&pcbRenderCmd
},
+2 -1
View File
@@ -40,7 +40,8 @@ enum id_kicad_frm {
ID_IMPORT_EAGLE_PROJECT,
ID_IMPORT_EASYEDA_PROJECT,
ID_IMPORT_EASYEDAPRO_PROJECT,
ID_IMPORT_ALTIUM_PROJECT
ID_IMPORT_ALTIUM_PROJECT,
ID_IMPORT_PADS_PROJECT
};
#endif
+1
View File
@@ -118,6 +118,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_MENU( ID_IMPORT_EASYEDA_PROJECT, KICAD_MANAGER_FRAME::OnImportEasyEdaFiles )
EVT_MENU( ID_IMPORT_EASYEDAPRO_PROJECT, KICAD_MANAGER_FRAME::OnImportEasyEdaProFiles )
EVT_MENU( ID_IMPORT_ALTIUM_PROJECT, KICAD_MANAGER_FRAME::OnImportAltiumProjectFiles )
EVT_MENU( ID_IMPORT_PADS_PROJECT, KICAD_MANAGER_FRAME::OnImportPadsProjectFiles )
// Range menu events
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, KICAD_MANAGER_FRAME::OnFileHistory )
+5
View File
@@ -125,6 +125,11 @@ public:
*/
void OnImportEasyEdaProFiles( wxCommandEvent& event );
/**
* Open dialog to import PADS Logic schematic and PCB files.
*/
void OnImportPadsProjectFiles( wxCommandEvent& event );
/**
* Prints the current working directory name and the project name on the text panel.
*/
+4
View File
@@ -145,6 +145,10 @@ void KICAD_MANAGER_FRAME::doReCreateMenuBar()
_( "Import EasyEDA (JLCEDA) Professional schematic and board" ),
ID_IMPORT_EASYEDAPRO_PROJECT, BITMAPS::import_project );
importMenu->Add( _( "PADS Project..." ),
_( "Import PADS Logic schematic and PADS ASCII PCB (*.asc, *.txt)" ),
ID_IMPORT_PADS_PROJECT, BITMAPS::import_project );
fileMenu->Add( importMenu );
fileMenu->AppendSeparator();
+2 -1
View File
@@ -791,8 +791,9 @@ add_subdirectory( pcb_io/easyedapro )
add_subdirectory( pcb_io/fabmaster )
add_subdirectory( pcb_io/ipc2581 )
add_subdirectory( pcb_io/odbpp )
add_subdirectory( pcb_io/pads )
set( PCBNEW_IO_LIBRARIES pcad2kicadpcb altium2pcbnew cadstar2pcbnew easyeda easyedapro fabmaster ipc2581 odbpp CACHE INTERNAL "")
set( PCBNEW_IO_LIBRARIES pcad2kicadpcb altium2pcbnew cadstar2pcbnew easyeda easyedapro fabmaster ipc2581 odbpp pads2pcbnew CACHE INTERNAL "")
#a very small program launcher for pcbnew_kiface
add_executable( pcbnew WIN32 MACOSX_BUNDLE
+1
View File
@@ -1193,6 +1193,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
case PCB_IO_MGR::ALTIUM_CIRCUIT_MAKER:
case PCB_IO_MGR::ALTIUM_CIRCUIT_STUDIO:
case PCB_IO_MGR::SOLIDWORKS_PCB:
case PCB_IO_MGR::PADS:
return OpenProjectFiles( std::vector<wxString>( 1, aFileName ), KICTL_NONKICAD_ONLY );
default:
+19
View File
@@ -0,0 +1,19 @@
# Sources for the pcbnew PLUGIN called PADS_PLUGIN
set( PADS2PCBNEW_SRCS
pads_layer_mapper.cpp
pads_parser.cpp
pcb_io_pads.cpp
)
add_library( pads2pcbnew STATIC ${PADS2PCBNEW_SRCS} )
target_link_libraries( pads2pcbnew
pcbcommon
pads_common
)
# Make all headers be prefixed by pads/ to differentiate them
target_include_directories( pads2pcbnew PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../" )
+99
View File
@@ -0,0 +1,99 @@
# PADS PCB Importer
This plugin imports PADS PowerPCB ASCII (.asc) files into KiCad.
## Supported Features
### Board Elements
- Copper layers (up to 32 layers)
- Silkscreen and solder mask layers
- Board outline
- Tracks and vias
- Pads with various shapes (round, square, rectangular, oblong, annular)
- Copper pours/zones
- Text elements
- Keepout areas
### Via Types
- Standard through-hole vias
- Blind and buried vias (mapped to micro vias where applicable)
### Footprints
- Imported footprints are cached in the board file
- Original PADS decal names preserved where possible
## Command Line Usage
```bash
kicad-cli pcb import --format pads input.asc -o output.kicad_pcb
```
### Options
- `--format pads` - Specify PADS format (auto-detected from .asc extension)
- `-o, --output` - Output KiCad PCB file path
- `--report-format json|text` - Generate import report
- `--report-file` - Path to save import report
## Known Limitations
1. **Copper Pours**: Complex pour shapes may not import perfectly. Zone fills
should be regenerated in KiCad after import.
2. **Design Rules**: PADS design rules are not imported. Default KiCad DRC
rules will apply to imported boards.
3. **Net Classes**: PADS net classes are imported but may need adjustment
for KiCad's net class system.
4. **Schematic Link**: Only PCB data is imported; schematic must be
recreated or imported separately.
## File Format Support
### Supported Versions
- PADS PowerPCB V9.0 through V9.5
- PADS Layout files exported as ASCII
### Unit Systems
- MILS (default for most PADS files)
- METRIC (millimeters)
- INCHES
- BASIC (PADS internal database units)
## Developer Notes
### Architecture
The importer consists of three main components:
1. **PCB_IO_PADS** (`pcb_io_pads.cpp`) - Plugin interface implementing PCB_IO
2. **PADS_PARSER** (`pads_parser.cpp`) - Parses ASCII format sections
3. **Layer Mapping** - Maps PADS layer numbers to KiCad layer IDs
### Extending the Parser
To add support for new PADS features:
1. Identify the section keyword in the ASCII format (e.g., `*PARTDECAL*`)
2. Add a parsing method in `PADS_PARSER` class
3. Map parsed data to appropriate KiCad objects
4. Add unit tests in `qa/tests/pcbnew/`
### Testing
```bash
# Run PADS importer tests
cd build
ctest -R pads -V
# Run QA visual regression tests
KICAD_CLI=./build/kicad/kicad-cli python -m pytest qa/tests/cli/test_pads_importer.py -v
```
### Test Data
Test files are located in `qa/data/pcbnew/plugins/pads/`:
- `CE086A5_3/` - 8-layer complex board
- `KA014A2/` - 2-layer board
- `TJ005A1t/` - 2-layer board
- `synthetic_*.asc` - Synthetic test cases for edge cases
File diff suppressed because it is too large Load Diff
+212
View File
@@ -0,0 +1,212 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2026 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
#pragma once
#include <string>
#include <vector>
#include <map>
#include <cstdint>
#include <wx/string.h>
#include "pads_parser.h"
namespace PADS_IO
{
/**
* Parser for PADS binary PCB file format (.pcb).
*
* Reads the binary PADS file and populates the same intermediate structs as the
* ASCII PARSER class, allowing the existing struct-to-KiCad conversion code to
* be shared between both importers.
*
* Binary file structure:
* [Header] 10 bytes: magic(2) + version(2) + reserved(6)
* [Section Directory] N*16 bytes per entry
* [Section Data] Concatenated section payloads
* [Metadata Region] Part types, components, nets, config, attributes
* [Footer] 46 bytes: padding(4) + GUID(38) + size_check(4)
*
* Supported versions: 0x2021, 0x2025, 0x2026, 0x2027
*/
class BINARY_PARSER
{
public:
BINARY_PARSER();
~BINARY_PARSER();
void Parse( const wxString& aFileName );
/**
* Check if a file appears to be a PADS binary PCB file.
* Checks the 2-byte magic (0x00FF) and version field.
*/
static bool IsBinaryPadsFile( const wxString& aFileName );
const PARAMETERS& GetParameters() const { return m_parameters; }
const std::vector<PART>& GetParts() const { return m_parts; }
const std::vector<NET>& GetNets() const { return m_nets; }
const std::vector<ROUTE>& GetRoutes() const { return m_routes; }
const std::vector<TEXT>& GetTexts() const { return m_texts; }
const std::vector<POUR>& GetPours() const { return m_pours; }
const std::vector<POLYLINE>& GetBoardOutlines() const { return m_boardOutlines; }
const std::map<std::string, PART_DECAL>& GetPartDecals() const { return m_decals; }
int GetLayerCount() const { return m_parameters.layer_count; }
bool IsBasicUnits() const { return true; }
std::vector<LAYER_INFO> GetLayerInfos() const;
private:
static constexpr uint16_t MAGIC = 0xFF00;
static constexpr int HEADER_SIZE = 10;
static constexpr int FOOTER_SIZE = 46;
static constexpr int DIR_ENTRY_SIZE = 16;
static constexpr int32_t ANGLE_SCALE = 1800000;
struct DirEntry
{
int index = 0;
uint32_t count = 0;
uint32_t totalBytes = 0;
uint32_t dataOffset = 0;
uint32_t perItem = 0;
};
// Version helpers
bool isOldFormat() const { return m_version == 0x2021; }
int dirEntryCount() const;
// Low-level readers
uint8_t readU8( size_t aOffset ) const;
uint16_t readU16( size_t aOffset ) const;
uint32_t readU32( size_t aOffset ) const;
int32_t readI32( size_t aOffset ) const;
std::string readFixedString( size_t aOffset, size_t aMaxLen ) const;
// File structure parsing
void parseHeader();
void parseFooter();
void parseDirectory();
// Section data accessors
const uint8_t* sectionData( int aIndex ) const;
uint32_t sectionSize( int aIndex ) const;
const DirEntry* getSection( int aIndex ) const;
// Section parsers
void parseBoardSetup();
void parseStringPool();
void parsePartPlacements();
void parseSection19Parts();
void parsePadStacks();
void parsePartDecals();
void parseFootprintDefs();
void parseLineVertices();
void parseBoardOutline();
void parseNetNames();
void parseMetadataRegion();
void parseDftConfig( size_t aStart, size_t aEnd );
void parseRouteVertices();
void parseTextRecords();
void parseCopperPours();
// DFT format parsers
std::map<std::string, std::string> parseDftDotPadded( size_t aPos, size_t aEnd ) const;
std::map<std::string, std::string> parseDftNullSeparated( size_t aPos, size_t aEnd ) const;
// Net name helpers
std::string extractNetName( const uint8_t* aData, size_t aOffset ) const;
bool isValidNetName( const std::string& aName ) const;
// String pool resolver
std::string resolveString( uint32_t aByteOffset ) const;
// Coordinate conversion from binary absolute to PADS_IO design-relative units
double toBasicCoordX( int32_t aRawValue ) const;
double toBasicCoordY( int32_t aRawValue ) const;
double toBasicAngle( int32_t aRawAngle ) const;
// File data
std::vector<uint8_t> m_data;
uint16_t m_version = 0;
int m_numDirEntries = 0;
// Directory
std::vector<DirEntry> m_dirEntries;
// String pool (section 57)
std::vector<uint8_t> m_stringPoolBytes;
// Line vertex pool (section 12)
struct LineVertex
{
int32_t x = 0;
int32_t y = 0;
uint32_t extra = 0;
};
std::vector<LineVertex> m_lineVertices;
// Coordinate origin from DFT_CONFIGURATION
int32_t m_originX = 0;
int32_t m_originY = 0;
bool m_originFound = false;
// Pad stack cache indexed by section 4 record number
std::map<int, std::vector<PAD_STACK_LAYER>> m_padStackCache;
// Footprint type name -> decal name mapping from section 17
std::map<std::string, std::string> m_fpTypeToDecal;
// Route segment from section 24 linking to section 60 vertices
struct RouteSegment
{
int32_t x1 = 0;
int32_t y1 = 0;
int32_t x2 = 0;
int32_t y2 = 0;
int32_t width = 0;
};
std::vector<RouteSegment> m_routeSegments;
// Via locations from section 59 (pin connection endpoints)
struct ViaLocation
{
int32_t x = 0;
int32_t y = 0;
};
std::vector<ViaLocation> m_viaLocations;
// Output data (same structs as ASCII parser)
PARAMETERS m_parameters;
std::vector<PART> m_parts;
std::vector<NET> m_nets;
std::vector<ROUTE> m_routes;
std::vector<TEXT> m_texts;
std::vector<POUR> m_pours;
std::vector<POLYLINE> m_boardOutlines;
std::map<std::string, PART_DECAL> m_decals;
};
} // namespace PADS_IO
+358
View File
@@ -0,0 +1,358 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "pads_layer_mapper.h"
#include <algorithm>
#include <cctype>
#include <wx/string.h>
PADS_LAYER_MAPPER::PADS_LAYER_MAPPER() :
m_copperLayerCount( 2 )
{
// Initialize standard PADS layer name mappings (case-insensitive)
m_layerNameMap["silkscreen top"] = PADS_LAYER_TYPE::SILKSCREEN_TOP;
m_layerNameMap["silk top"] = PADS_LAYER_TYPE::SILKSCREEN_TOP;
m_layerNameMap["sst"] = PADS_LAYER_TYPE::SILKSCREEN_TOP;
m_layerNameMap["top silk"] = PADS_LAYER_TYPE::SILKSCREEN_TOP;
m_layerNameMap["top overlay"] = PADS_LAYER_TYPE::SILKSCREEN_TOP;
m_layerNameMap["silkscreen bottom"] = PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
m_layerNameMap["silk bottom"] = PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
m_layerNameMap["ssb"] = PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
m_layerNameMap["bottom silk"] = PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
m_layerNameMap["bottom overlay"] = PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
m_layerNameMap["solder mask top"] = PADS_LAYER_TYPE::SOLDERMASK_TOP;
m_layerNameMap["soldermask top"] = PADS_LAYER_TYPE::SOLDERMASK_TOP;
m_layerNameMap["smt"] = PADS_LAYER_TYPE::SOLDERMASK_TOP;
m_layerNameMap["top mask"] = PADS_LAYER_TYPE::SOLDERMASK_TOP;
m_layerNameMap["top solder mask"] = PADS_LAYER_TYPE::SOLDERMASK_TOP;
m_layerNameMap["solder mask bottom"] = PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
m_layerNameMap["soldermask bottom"] = PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
m_layerNameMap["smb"] = PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
m_layerNameMap["bottom mask"] = PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
m_layerNameMap["bottom solder mask"] = PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
m_layerNameMap["paste top"] = PADS_LAYER_TYPE::PASTE_TOP;
m_layerNameMap["paste mask top"] = PADS_LAYER_TYPE::PASTE_TOP;
m_layerNameMap["solder paste top"] = PADS_LAYER_TYPE::PASTE_TOP;
m_layerNameMap["top paste"] = PADS_LAYER_TYPE::PASTE_TOP;
m_layerNameMap["paste bottom"] = PADS_LAYER_TYPE::PASTE_BOTTOM;
m_layerNameMap["paste mask bottom"] = PADS_LAYER_TYPE::PASTE_BOTTOM;
m_layerNameMap["solder paste bottom"] = PADS_LAYER_TYPE::PASTE_BOTTOM;
m_layerNameMap["bottom paste"] = PADS_LAYER_TYPE::PASTE_BOTTOM;
m_layerNameMap["assembly top"] = PADS_LAYER_TYPE::ASSEMBLY_TOP;
m_layerNameMap["top assembly"] = PADS_LAYER_TYPE::ASSEMBLY_TOP;
m_layerNameMap["assy top"] = PADS_LAYER_TYPE::ASSEMBLY_TOP;
m_layerNameMap["component outline top"] = PADS_LAYER_TYPE::ASSEMBLY_TOP;
m_layerNameMap["assembly bottom"] = PADS_LAYER_TYPE::ASSEMBLY_BOTTOM;
m_layerNameMap["bottom assembly"] = PADS_LAYER_TYPE::ASSEMBLY_BOTTOM;
m_layerNameMap["assy bottom"] = PADS_LAYER_TYPE::ASSEMBLY_BOTTOM;
m_layerNameMap["component outline bottom"] = PADS_LAYER_TYPE::ASSEMBLY_BOTTOM;
m_layerNameMap["board outline"] = PADS_LAYER_TYPE::BOARD_OUTLINE;
m_layerNameMap["board"] = PADS_LAYER_TYPE::BOARD_OUTLINE;
m_layerNameMap["outline"] = PADS_LAYER_TYPE::BOARD_OUTLINE;
m_layerNameMap["board geometry"] = PADS_LAYER_TYPE::BOARD_OUTLINE;
m_layerNameMap["documentation"] = PADS_LAYER_TYPE::DOCUMENTATION;
m_layerNameMap["doc"] = PADS_LAYER_TYPE::DOCUMENTATION;
}
void PADS_LAYER_MAPPER::SetCopperLayerCount( int aLayerCount )
{
if( aLayerCount < 1 )
aLayerCount = 1;
m_copperLayerCount = aLayerCount;
}
std::string PADS_LAYER_MAPPER::normalizeLayerName( const std::string& aName ) const
{
std::string normalized;
normalized.reserve( aName.size() );
for( char c : aName )
{
normalized += static_cast<char>( std::tolower( static_cast<unsigned char>( c ) ) );
}
return normalized;
}
PADS_LAYER_TYPE PADS_LAYER_MAPPER::GetLayerType( int aPadsLayer ) const
{
// Pad stack special values
if( aPadsLayer == LAYER_PAD_STACK_TOP )
return PADS_LAYER_TYPE::COPPER_TOP;
if( aPadsLayer == LAYER_PAD_STACK_BOTTOM )
return PADS_LAYER_TYPE::COPPER_BOTTOM;
if( aPadsLayer == LAYER_PAD_STACK_INNER )
return PADS_LAYER_TYPE::COPPER_INNER;
// Copper layers: 1 = Top, m_copperLayerCount = Bottom, 2 to N-1 = Inner
if( aPadsLayer == 1 )
return PADS_LAYER_TYPE::COPPER_TOP;
if( aPadsLayer == m_copperLayerCount && m_copperLayerCount > 1 )
return PADS_LAYER_TYPE::COPPER_BOTTOM;
if( aPadsLayer > 1 && aPadsLayer < m_copperLayerCount )
return PADS_LAYER_TYPE::COPPER_INNER;
// Non-copper layers by number
if( aPadsLayer == LAYER_SILKSCREEN_TOP )
return PADS_LAYER_TYPE::SILKSCREEN_TOP;
if( aPadsLayer == LAYER_SILKSCREEN_BOTTOM )
return PADS_LAYER_TYPE::SILKSCREEN_BOTTOM;
if( aPadsLayer == LAYER_SOLDERMASK_TOP )
return PADS_LAYER_TYPE::SOLDERMASK_TOP;
if( aPadsLayer == LAYER_SOLDERMASK_BOTTOM )
return PADS_LAYER_TYPE::SOLDERMASK_BOTTOM;
if( aPadsLayer == LAYER_PASTE_TOP )
return PADS_LAYER_TYPE::PASTE_TOP;
if( aPadsLayer == LAYER_PASTE_BOTTOM )
return PADS_LAYER_TYPE::PASTE_BOTTOM;
if( aPadsLayer == LAYER_ASSEMBLY_TOP )
return PADS_LAYER_TYPE::ASSEMBLY_TOP;
if( aPadsLayer == LAYER_ASSEMBLY_BOTTOM )
return PADS_LAYER_TYPE::ASSEMBLY_BOTTOM;
return PADS_LAYER_TYPE::UNKNOWN;
}
PADS_LAYER_TYPE PADS_LAYER_MAPPER::ParseLayerName( const std::string& aLayerName ) const
{
std::string normalized = normalizeLayerName( aLayerName );
auto it = m_layerNameMap.find( normalized );
if( it != m_layerNameMap.end() )
return it->second;
// Check for copper layer naming patterns like "Layer 1", "Inner 1", etc.
if( normalized.find( "top" ) != std::string::npos ||
normalized.find( "layer 1" ) != std::string::npos ||
normalized == "1" )
{
return PADS_LAYER_TYPE::COPPER_TOP;
}
if( normalized.find( "bottom" ) != std::string::npos ||
normalized.find( "bot" ) != std::string::npos )
{
return PADS_LAYER_TYPE::COPPER_BOTTOM;
}
if( normalized.find( "inner" ) != std::string::npos ||
normalized.find( "mid" ) != std::string::npos ||
normalized.find( "internal" ) != std::string::npos )
{
return PADS_LAYER_TYPE::COPPER_INNER;
}
return PADS_LAYER_TYPE::UNKNOWN;
}
PCB_LAYER_ID PADS_LAYER_MAPPER::mapInnerCopperLayer( int aPadsLayer ) const
{
// PADS inner layers are numbered 2 through (m_copperLayerCount - 1)
// KiCad inner layers are In1_Cu, In2_Cu, etc. with IDs spaced by 2
int innerIndex = aPadsLayer - 2;
if( innerIndex < 0 )
innerIndex = 0;
if( innerIndex >= 30 )
innerIndex = 29;
return static_cast<PCB_LAYER_ID>( In1_Cu + innerIndex * 2 );
}
PCB_LAYER_ID PADS_LAYER_MAPPER::GetAutoMapLayer( int aPadsLayer, PADS_LAYER_TYPE aType ) const
{
// If type is not provided, determine it from layer number
if( aType == PADS_LAYER_TYPE::UNKNOWN )
aType = GetLayerType( aPadsLayer );
switch( aType )
{
case PADS_LAYER_TYPE::COPPER_TOP:
return F_Cu;
case PADS_LAYER_TYPE::COPPER_BOTTOM:
return B_Cu;
case PADS_LAYER_TYPE::COPPER_INNER:
return mapInnerCopperLayer( aPadsLayer );
case PADS_LAYER_TYPE::SILKSCREEN_TOP:
return F_SilkS;
case PADS_LAYER_TYPE::SILKSCREEN_BOTTOM:
return B_SilkS;
case PADS_LAYER_TYPE::SOLDERMASK_TOP:
return F_Mask;
case PADS_LAYER_TYPE::SOLDERMASK_BOTTOM:
return B_Mask;
case PADS_LAYER_TYPE::PASTE_TOP:
return F_Paste;
case PADS_LAYER_TYPE::PASTE_BOTTOM:
return B_Paste;
case PADS_LAYER_TYPE::ASSEMBLY_TOP:
return F_Fab;
case PADS_LAYER_TYPE::ASSEMBLY_BOTTOM:
return B_Fab;
case PADS_LAYER_TYPE::BOARD_OUTLINE:
return Edge_Cuts;
case PADS_LAYER_TYPE::DOCUMENTATION:
return Cmts_User;
case PADS_LAYER_TYPE::DRILL_DRAWING:
return Dwgs_User;
case PADS_LAYER_TYPE::UNKNOWN:
default:
return UNDEFINED_LAYER;
}
}
LSET PADS_LAYER_MAPPER::GetPermittedLayers( PADS_LAYER_TYPE aType ) const
{
switch( aType )
{
case PADS_LAYER_TYPE::COPPER_TOP:
case PADS_LAYER_TYPE::COPPER_BOTTOM:
case PADS_LAYER_TYPE::COPPER_INNER:
return LSET::AllCuMask();
case PADS_LAYER_TYPE::SILKSCREEN_TOP:
case PADS_LAYER_TYPE::SILKSCREEN_BOTTOM:
return LSET( { F_SilkS, B_SilkS } );
case PADS_LAYER_TYPE::SOLDERMASK_TOP:
case PADS_LAYER_TYPE::SOLDERMASK_BOTTOM:
return LSET( { F_Mask, B_Mask } );
case PADS_LAYER_TYPE::PASTE_TOP:
case PADS_LAYER_TYPE::PASTE_BOTTOM:
return LSET( { F_Paste, B_Paste } );
case PADS_LAYER_TYPE::ASSEMBLY_TOP:
case PADS_LAYER_TYPE::ASSEMBLY_BOTTOM:
return LSET( { F_Fab, B_Fab, F_CrtYd, B_CrtYd } );
case PADS_LAYER_TYPE::BOARD_OUTLINE:
return LSET( { Edge_Cuts } );
case PADS_LAYER_TYPE::DOCUMENTATION:
return LSET::AllNonCuMask();
case PADS_LAYER_TYPE::DRILL_DRAWING:
return LSET( { Dwgs_User, F_Fab, B_Fab, Cmts_User } );
case PADS_LAYER_TYPE::UNKNOWN:
default:
return LSET::AllLayersMask();
}
}
std::vector<INPUT_LAYER_DESC> PADS_LAYER_MAPPER::BuildInputLayerDescriptions(
const std::vector<PADS_LAYER_INFO>& aLayerInfos ) const
{
std::vector<INPUT_LAYER_DESC> descs;
descs.reserve( aLayerInfos.size() );
for( const PADS_LAYER_INFO& info : aLayerInfos )
{
INPUT_LAYER_DESC desc;
desc.Name = wxString::FromUTF8( info.name );
desc.PermittedLayers = GetPermittedLayers( info.type );
desc.AutoMapLayer = GetAutoMapLayer( info.padsLayerNum, info.type );
desc.Required = info.required;
descs.push_back( desc );
}
return descs;
}
void PADS_LAYER_MAPPER::AddLayerNameMapping( const std::string& aName, PADS_LAYER_TYPE aType )
{
std::string normalized = normalizeLayerName( aName );
m_layerNameMap[normalized] = aType;
}
std::string PADS_LAYER_MAPPER::LayerTypeToString( PADS_LAYER_TYPE aType )
{
switch( aType )
{
case PADS_LAYER_TYPE::COPPER_TOP: return "Copper Top";
case PADS_LAYER_TYPE::COPPER_BOTTOM: return "Copper Bottom";
case PADS_LAYER_TYPE::COPPER_INNER: return "Copper Inner";
case PADS_LAYER_TYPE::SILKSCREEN_TOP: return "Silkscreen Top";
case PADS_LAYER_TYPE::SILKSCREEN_BOTTOM: return "Silkscreen Bottom";
case PADS_LAYER_TYPE::SOLDERMASK_TOP: return "Solder Mask Top";
case PADS_LAYER_TYPE::SOLDERMASK_BOTTOM: return "Solder Mask Bottom";
case PADS_LAYER_TYPE::PASTE_TOP: return "Paste Top";
case PADS_LAYER_TYPE::PASTE_BOTTOM: return "Paste Bottom";
case PADS_LAYER_TYPE::ASSEMBLY_TOP: return "Assembly Top";
case PADS_LAYER_TYPE::ASSEMBLY_BOTTOM: return "Assembly Bottom";
case PADS_LAYER_TYPE::DOCUMENTATION: return "Documentation";
case PADS_LAYER_TYPE::BOARD_OUTLINE: return "Board Outline";
case PADS_LAYER_TYPE::DRILL_DRAWING: return "Drill Drawing";
case PADS_LAYER_TYPE::UNKNOWN:
default: return "Unknown";
}
}
+183
View File
@@ -0,0 +1,183 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PADS_LAYER_MAPPER_H
#define PADS_LAYER_MAPPER_H
#include <string>
#include <map>
#include <vector>
#include <layer_ids.h>
#include <lset.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
/**
* PADS layer types. These represent the functional categories of layers
* in PADS designs, independent of specific layer numbers.
*/
enum class PADS_LAYER_TYPE
{
UNKNOWN,
COPPER_TOP,
COPPER_BOTTOM,
COPPER_INNER,
SILKSCREEN_TOP,
SILKSCREEN_BOTTOM,
SOLDERMASK_TOP,
SOLDERMASK_BOTTOM,
PASTE_TOP,
PASTE_BOTTOM,
ASSEMBLY_TOP,
ASSEMBLY_BOTTOM,
DOCUMENTATION,
BOARD_OUTLINE,
DRILL_DRAWING
};
/**
* Information about a single PADS layer.
*/
struct PADS_LAYER_INFO
{
int padsLayerNum; ///< PADS layer number
std::string name; ///< Layer name as it appears in PADS file
PADS_LAYER_TYPE type; ///< Categorized layer type
bool required; ///< Whether this layer must be mapped
};
/**
* Maps PADS layer numbers and names to KiCad layer IDs.
*
* PADS uses a different layer numbering scheme than KiCad:
* - Layer 1 is Top copper
* - Layer N (where N is layer count) is Bottom copper
* - Layers 2 through N-1 are inner copper layers
* - Negative layer numbers (-2, -1) are used in pad stacks for Top/Bottom
* - Higher positive numbers (20+) represent non-copper layers
*
* This class handles the translation between these systems and provides
* auto-mapping suggestions for the layer mapping dialog.
*/
class PADS_LAYER_MAPPER
{
public:
PADS_LAYER_MAPPER();
/**
* Set the total number of copper layers in the PADS design.
*
* @param aLayerCount Total copper layers (e.g., 2 for a 2-layer board)
*/
void SetCopperLayerCount( int aLayerCount );
/**
* Get the current copper layer count.
*/
int GetCopperLayerCount() const { return m_copperLayerCount; }
/**
* Parse a PADS layer number and return its type.
*
* @param aPadsLayer The PADS layer number
* @return The layer type (COPPER_TOP, COPPER_INNER, etc.)
*/
PADS_LAYER_TYPE GetLayerType( int aPadsLayer ) const;
/**
* Parse a PADS layer name and return its type.
*
* Recognizes common PADS layer names like "Silkscreen Top",
* "Solder Mask Top", etc.
*
* @param aLayerName The PADS layer name
* @return The layer type
*/
PADS_LAYER_TYPE ParseLayerName( const std::string& aLayerName ) const;
/**
* Get the suggested KiCad layer for a PADS layer.
*
* @param aPadsLayer The PADS layer number
* @param aType Optional override for the layer type (if known)
* @return The suggested KiCad layer ID
*/
PCB_LAYER_ID GetAutoMapLayer( int aPadsLayer,
PADS_LAYER_TYPE aType = PADS_LAYER_TYPE::UNKNOWN ) const;
/**
* Get the permitted KiCad layers for a given PADS layer type.
*
* @param aType The PADS layer type
* @return Set of permitted KiCad layers
*/
LSET GetPermittedLayers( PADS_LAYER_TYPE aType ) const;
/**
* Build a vector of INPUT_LAYER_DESC from parsed PADS layer information.
*
* This is used to populate the layer mapping dialog.
*
* @param aLayerInfos Vector of parsed layer information
* @return Vector of INPUT_LAYER_DESC for layer mapping dialog
*/
std::vector<INPUT_LAYER_DESC> BuildInputLayerDescriptions(
const std::vector<PADS_LAYER_INFO>& aLayerInfos ) const;
/**
* Add or update a layer name to type mapping.
*
* @param aName The PADS layer name
* @param aType The layer type it represents
*/
void AddLayerNameMapping( const std::string& aName, PADS_LAYER_TYPE aType );
/**
* Convert a layer type to a human-readable string.
*/
static std::string LayerTypeToString( PADS_LAYER_TYPE aType );
// Well-known PADS layer numbers
static constexpr int LAYER_PAD_STACK_TOP = -2; ///< Pad stack: Top copper
static constexpr int LAYER_PAD_STACK_BOTTOM = -1; ///< Pad stack: Bottom copper
static constexpr int LAYER_PAD_STACK_INNER = 0; ///< Pad stack: Inner copper
// Common PADS layer number ranges
static constexpr int LAYER_SILKSCREEN_TOP = 26;
static constexpr int LAYER_SILKSCREEN_BOTTOM = 27;
static constexpr int LAYER_SOLDERMASK_TOP = 25;
static constexpr int LAYER_SOLDERMASK_BOTTOM = 28;
static constexpr int LAYER_PASTE_TOP = 29;
static constexpr int LAYER_PASTE_BOTTOM = 30;
static constexpr int LAYER_ASSEMBLY_TOP = 21;
static constexpr int LAYER_ASSEMBLY_BOTTOM = 22;
static constexpr int LAYER_BOARD_OUTLINE = 1;
private:
int m_copperLayerCount;
std::map<std::string, PADS_LAYER_TYPE> m_layerNameMap;
PCB_LAYER_ID mapInnerCopperLayer( int aPadsLayer ) const;
std::string normalizeLayerName( const std::string& aName ) const;
};
#endif // PADS_LAYER_MAPPER_H
File diff suppressed because it is too large Load Diff
+810
View File
@@ -0,0 +1,810 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
#pragma once
#include <string>
#include <vector>
#include <map>
#include <optional>
#include <wx/string.h>
#include <wx/gdicmn.h> // For wxPoint if needed, or use VECTOR2I
#include <math/vector2d.h>
namespace PADS_IO
{
enum class UNIT_TYPE
{
MILS,
METRIC,
INCHES
};
struct POINT
{
double x;
double y;
};
/**
* Arc definition using center point, radius, and angles.
*
* PADS uses center/radius/angles representation for arcs. Angles are in degrees,
* with 0 pointing right (+X) and positive angles going counter-clockwise.
*/
struct ARC
{
double cx; ///< Center X coordinate
double cy; ///< Center Y coordinate
double radius; ///< Arc radius
double start_angle; ///< Start angle in degrees (0 = +X, CCW positive)
double delta_angle; ///< Arc sweep angle in degrees (positive = CCW)
};
/**
* A point that may be either a line endpoint or an arc segment.
*
* In PADS format, polylines can contain arc corners. When is_arc is true,
* the arc field defines the arc from the previous point to this point's x,y.
*/
struct ARC_POINT
{
double x; ///< Endpoint X coordinate
double y; ///< Endpoint Y coordinate
bool is_arc; ///< True if this segment is an arc, false for line
ARC arc; ///< Arc parameters (only valid when is_arc is true)
ARC_POINT() : x( 0 ), y( 0 ), is_arc( false ), arc{ 0, 0, 0, 0, 0 } {}
ARC_POINT( double aX, double aY ) : x( aX ), y( aY ), is_arc( false ), arc{ 0, 0, 0, 0, 0 } {}
ARC_POINT( double aX, double aY, const ARC& aArc ) : x( aX ), y( aY ), is_arc( true ), arc( aArc ) {}
};
/**
* File header information from PADS header line.
*/
/**
* PADS file types (PCB design or library).
*/
enum class PADS_FILE_TYPE
{
PCB, ///< PCB design file (POWERPCB, PADS-LAYOUT, etc.)
LIB_LINE, ///< Library line items (drafting)
LIB_SCH_DECAL, ///< Library schematic decals
LIB_PCB_DECAL, ///< Library PCB decals (footprints)
LIB_PART_TYPE ///< Library part types
};
struct FILE_HEADER
{
std::string product; ///< Product name: POWERPCB, PADS, LAYOUT, PADS-LIBRARY-*
std::string version; ///< Version string like V9.4, V9
std::string units; ///< Units: MILS, MM, INCH, BASIC
std::string mode; ///< Optional mode like 250L
std::string encoding; ///< Optional encoding like CP1252
PADS_FILE_TYPE file_type = PADS_FILE_TYPE::PCB; ///< Type of PADS file
};
struct PARAMETERS
{
UNIT_TYPE units = UNIT_TYPE::MILS;
int layer_count = 2;
POINT origin = {0, 0};
double user_grid = 0.0; ///< User-defined snap grid (USERGRID)
// Thermal relief settings (global defaults)
double thermal_line_width = 30.0; ///< Thermal line width for THT (THERLINEWID)
double thermal_smd_width = 20.0; ///< Thermal line width for SMD (THERSMDWID)
int thermal_flags = 0; ///< Thermal relief flags (THERFLAGS)
double thermal_min_clearance = 5.0; ///< Starved thermal minimum clearance (STMINCLEAR)
int thermal_min_spokes = 4; ///< Starved thermal minimum spokes (STMINSPOKES)
// Drill parameters
double drill_oversize = 0.0; ///< Drill oversize for plated holes (DRLOVERSIZE)
// Via defaults extracted from file
std::string default_signal_via; ///< Default signal routing via (VIAPSHVIA)
};
/**
* Design rule definitions from *PCB* section.
*/
struct DESIGN_RULES
{
double min_clearance = 8.0; ///< Minimum copper clearance (MINCLEAR)
double default_clearance = 10.0; ///< Default copper clearance (DEFAULTCLEAR)
double min_track_width = 6.0; ///< Minimum track width (MINTRACKWID)
double default_track_width = 10.0; ///< Default track width (DEFAULTTRACKWID)
double min_via_size = 20.0; ///< Minimum via outer diameter (MINVIASIZE)
double default_via_size = 40.0; ///< Default via outer diameter (DEFAULTVIASIZE)
double min_via_drill = 10.0; ///< Minimum via drill diameter (MINVIADRILL)
double default_via_drill = 20.0; ///< Default via drill diameter (DEFAULTVIADRILL)
double hole_to_hole = 10.0; ///< Minimum hole-to-hole spacing (HOLEHOLE)
double silk_clearance = 5.0; ///< Minimum silkscreen clearance (SILKCLEAR)
double mask_clearance = 3.0; ///< Solder mask clearance (MASKCLEAR)
};
struct ATTRIBUTE
{
// Line 1
bool visible = true;
double x = 0.0;
double y = 0.0;
double orientation = 0.0;
int level = 0;
double height = 0.0;
double width = 0.0;
bool mirrored = false;
std::string hjust;
std::string vjust;
bool right_reading = false;
// Line 2
std::string font_info;
// Line 3
std::string name; // "Ref.Des.", "Part Type", "VALUE", etc.
};
struct PART
{
std::string name;
std::string decal; ///< Primary decal (first in colon-separated list)
std::string part_type; ///< Part type name when using PARTTYPE@DECAL syntax
std::vector<std::string> alternate_decals; ///< Alternate decals (remaining after ':' splits)
int alt_decal_index = -1; ///< ALT field from placement (-1 = use primary decal)
std::string value;
std::string units;
POINT location;
double rotation = 0.0;
bool bottom_layer = false;
bool glued = false;
bool explicit_decal = false; ///< True if decal was explicitly specified with @ syntax
std::vector<ATTRIBUTE> attributes;
std::string reuse_instance; ///< Reuse block instance name (if member of reuse)
std::string reuse_part; ///< Original part ref des inside the reuse block
};
struct NET_PIN
{
std::string ref_des;
std::string pin_name;
std::string reuse_instance; ///< Reuse block instance name (if .REUSE. suffix)
std::string reuse_signal; ///< Reuse block signal name (if .REUSE. suffix)
};
struct NET
{
std::string name;
std::vector<NET_PIN> pins;
};
/**
* Net class definition with routing constraints.
*/
struct NET_CLASS_DEF
{
std::string name; ///< Net class name
double clearance = 0.0; ///< Copper clearance (CLEARANCE)
double track_width = 0.0; ///< Track width (TRACKWIDTH)
double via_size = 0.0; ///< Via diameter (VIASIZE)
double via_drill = 0.0; ///< Via drill diameter (VIADRILL)
double diff_pair_gap = 0.0; ///< Differential pair gap (DIFFPAIRGAP)
double diff_pair_width = 0.0; ///< Differential pair width (DIFFPAIRWIDTH)
std::vector<std::string> net_names; ///< Nets assigned to this class
};
/**
* Differential pair definition.
*/
struct DIFF_PAIR_DEF
{
std::string name; ///< Pair name
std::string positive_net; ///< Positive net name
std::string negative_net; ///< Negative net name
double gap = 0.0; ///< Spacing between traces
double width = 0.0; ///< Trace width
};
/**
* Teardrop parameters for a route point.
*/
struct TEARDROP
{
double pad_width = 0.0; ///< Teardrop width at pad side
double pad_length = 0.0; ///< Teardrop length toward pad
int pad_flags = 0; ///< Pad-side teardrop flags
double net_width = 0.0; ///< Teardrop width at net side
double net_length = 0.0; ///< Teardrop length toward net
int net_flags = 0; ///< Net-side teardrop flags
bool has_pad_teardrop = false;
bool has_net_teardrop = false;
};
/**
* Jumper endpoint marker in a route.
*/
struct JUMPER_MARKER
{
std::string name; ///< Jumper part name
bool is_start = false; ///< True if start (S), false if end (E)
double x = 0.0;
double y = 0.0;
};
/**
* Jumper definition from *JUMPER* section.
*
* Format: name flags minlen maxlen lenincr lcount padstack [end_padstack]
* Followed by lcount label entries (2 lines each).
*/
struct JUMPER_DEF
{
std::string name; ///< Jumper name/reference designator
bool via_enabled = false; ///< V flag: via enabled
bool wirebond = false; ///< W flag: wirebond jumper
bool display_silk = false; ///< D flag: display special silk
bool glued = false; ///< G flag: glued
double min_length = 0.0; ///< Minimum possible length
double max_length = 0.0; ///< Maximum possible length
double length_increment = 0.0; ///< Length increment
std::string padstack; ///< Pad stack for start pin (or both if end_padstack empty)
std::string end_padstack; ///< Pad stack for end pin (optional)
std::vector<ATTRIBUTE> labels; ///< Reference designator labels
};
struct TRACK
{
int layer = 0;
double width = 0.0;
std::vector<ARC_POINT> points; ///< Track points, may include arc segments
};
struct PAD_STACK_LAYER
{
int layer = 0;
std::string shape; ///< Shape code: R, S, A, O, OF, RF, RT, ST, RA, SA, RC, OC
double sizeA = 0.0; ///< Primary size (diameter or width)
double sizeB = 0.0; ///< Secondary size (height for rectangles/ovals)
double offsetX = 0.0; ///< Pad offset X from terminal position
double offsetY = 0.0; ///< Pad offset Y from terminal position
double rotation = 0.0; ///< Pad rotation angle in degrees
double drill = 0.0; ///< Drill hole diameter (0 for SMD)
bool plated = true; ///< True if drill is plated (PTH vs NPTH)
double inner_diameter = 0.0; ///< Inner diameter for annular ring (0 = solid)
double corner_radius = 0.0; ///< Corner radius magnitude (always positive)
bool chamfered = false; ///< True if corners are chamfered (negative corner in PADS)
double finger_offset = 0.0; ///< Finger pad offset along orientation axis
// Slotted drill parameters
double slot_orientation = 0.0; ///< Slot orientation in degrees (0-179.999)
double slot_length = 0.0; ///< Slot length
double slot_offset = 0.0; ///< Slot offset from electrical center
// Thermal pad parameters (for RT/ST shapes)
double thermal_spoke_orientation = 0.0; ///< First spoke orientation in degrees
double thermal_outer_diameter = 0.0; ///< Outer diameter of thermal or void in plane
double thermal_spoke_width = 0.0; ///< Width of thermal spokes
int thermal_spoke_count = 0; ///< Number of thermal spokes (typically 4)
};
enum class VIA_TYPE
{
THROUGH, ///< Via spans all copper layers
BLIND, ///< Via starts at top or bottom and ends at inner layer
BURIED, ///< Via spans only inner layers
MICROVIA ///< Single-layer blind via (typically HDI)
};
struct VIA_DEF
{
std::string name;
double drill = 0.0;
double size = 0.0;
std::vector<PAD_STACK_LAYER> stack;
int start_layer = 0; ///< First PADS layer number in via span
int end_layer = 0; ///< Last PADS layer number in via span
VIA_TYPE via_type = VIA_TYPE::THROUGH; ///< Classified via type
int drill_start = 0; ///< Drill start layer from file (for blind/buried vias)
int drill_end = 0; ///< Drill end layer from file (for blind/buried vias)
};
struct VIA
{
std::string name; // Via type name
POINT location;
};
/**
* Pour style types from PADS piece types.
*/
enum class POUR_STYLE
{
SOLID, ///< Solid filled pour (POUROUT, POLY)
HATCHED, ///< Hatched pour (HATOUT)
VOID ///< Void/empty region (VOIDOUT)
};
/**
* Thermal relief type for pad/via connections.
*/
enum class THERMAL_TYPE
{
NONE, ///< No thermal relief defined
PAD, ///< Pad thermal relief (PADTHERM)
VIA ///< Via thermal relief (VIATHERM)
};
struct POUR
{
std::string net_name;
int layer = 0;
int priority = 0;
double width = 0.0;
std::vector<ARC_POINT> points; ///< Pour outline, may include arc segments
bool is_cutout = false; ///< True if this is a cutout (POCUT) piece
std::string owner_pour; ///< Name of parent pour for cutouts
POUR_STYLE style = POUR_STYLE::SOLID; ///< Pour fill style
double hatch_grid = 0.0; ///< Hatch grid spacing for hatched pours
double hatch_width = 0.0; ///< Hatch line width
// Thermal relief definitions (PADTHERM, VIATHERM)
THERMAL_TYPE thermal_type = THERMAL_TYPE::NONE;
double thermal_spoke_width = 0.0; ///< Spoke width for thermal relief
int thermal_spoke_count = 4; ///< Number of spokes (typically 4)
double thermal_gap = 0.0; ///< Gap between pad and pour
};
struct DECAL_ITEM
{
std::string type; ///< CLOSED, OPEN, CIRCLE, COPCLS, TAG, etc.
int layer = 0;
double width = 0.0;
std::vector<ARC_POINT> points; ///< Shape points, may include arc segments
int pinnum = -1; ///< Pin association for copper pieces (-1 = none, 0+ = pin index)
std::string restrictions; ///< Keepout restrictions (R,C,V,T,A) for KPTCLS/KPTCIR
bool is_tag_open = false; ///< True if this is an opening TAG (level=1)
bool is_tag_close = false; ///< True if this is a closing TAG (level=0)
};
struct DECAL_PAD
{
int pin_number; // 0 for default
POINT position;
std::string name; // e.g. "1", "A1"
std::vector<PAD_STACK_LAYER> stack;
bool custom_stack = false;
};
struct TERMINAL
{
double x;
double y;
std::string name; // Pin number
};
struct PART_DECAL
{
std::string name;
std::string units; // M, I, U, etc.
std::vector<DECAL_ITEM> items;
std::vector<ATTRIBUTE> attributes;
std::vector<TERMINAL> terminals;
std::map<int, std::vector<PAD_STACK_LAYER>> pad_stacks;
};
/**
* Standard signal pin definition (power, ground, etc.)
*/
struct SIGPIN
{
std::string pin_number; ///< Pin number
double width = 0.0; ///< Track width for connections
std::string signal_name; ///< Standard signal name (e.g., VCC, GND)
};
/**
* Pin type classification for gate definitions.
*/
enum class PIN_ELEC_TYPE
{
UNDEFINED, ///< U - Undefined
SOURCE, ///< S - Source pin
BIDIRECTIONAL, ///< B - Bidirectional pin
OPEN_COLLECTOR, ///< C - Open collector or or-tieable source
TRISTATE, ///< T - Tri-state pin
LOAD, ///< L - Load pin
TERMINATOR, ///< Z - Terminator pin
POWER, ///< P - Power pin
GROUND ///< G - Ground pin
};
/**
* Pin definition within a gate.
*/
struct GATE_PIN
{
std::string pin_number; ///< Electrical pin number
int swap_type = 0; ///< Swap type (0 = not swappable)
PIN_ELEC_TYPE elec_type = PIN_ELEC_TYPE::UNDEFINED;
std::string func_name; ///< Optional functional name
};
/**
* Gate definition for gate-swappable parts.
*/
struct GATE_DEF
{
int gate_swap_type = 0; ///< Gate swap type (0 = not swappable)
std::vector<GATE_PIN> pins; ///< Pins in this gate
};
struct PART_TYPE
{
std::string name;
std::string decal_name;
std::map<std::string, int> pin_pad_map; ///< Maps pin name to pad stack index
std::map<std::string, std::string> attributes; ///< Attribute name-value pairs from {...} block
std::vector<SIGPIN> signal_pins; ///< Standard signal pin definitions
std::vector<GATE_DEF> gates; ///< Gate definitions for swap support
};
struct ROUTE
{
std::string net_name;
std::vector<TRACK> tracks;
std::vector<VIA> vias;
std::vector<NET_PIN> pins; ///< Pins connected to this net (from pin pair lines)
std::vector<TEARDROP> teardrops; ///< Teardrop locations in this route
std::vector<JUMPER_MARKER> jumpers; ///< Jumper start/end points in this route
};
struct TEXT
{
std::string content;
POINT location;
double height = 0.0;
double width = 0.0;
int layer = 0;
double rotation = 0.0;
bool mirrored = false;
std::string hjust; ///< Horizontal justification: LEFT, CENTER, RIGHT
std::string vjust; ///< Vertical justification: UP, CENTER, DOWN
int ndim = 0; ///< Dimension number for auto-dimensioning text (0 if not used)
std::string reuse_instance; ///< Reuse block instance name (if .REUSE. suffix)
std::string font_style; ///< Font style (Regular, Bold, Italic, Underline, or combinations)
double font_height = 0.0; ///< Font height for text box calculation (optional)
double font_descent = 0.0; ///< Font descent for text box calculation (optional)
std::string font_face; ///< Font face name
};
struct LINE
{
int layer;
double width;
POINT start;
POINT end;
};
/**
* Line style enumeration for 2D graphics.
*/
enum class LINE_STYLE
{
SOLID = 0,
DASHED = 1,
DOTTED = 2,
DASH_DOTTED = 3,
DASH_DOUBLE_DOTTED = 4
};
/**
* A 2D graphic line/shape from the LINES section (type=LINES).
*
* These are drawing items like polylines, polygons, and circles used for
* documentation, assembly drawings, or other non-electrical purposes.
*/
struct GRAPHIC_LINE
{
std::string name; ///< Item name
int layer = 0; ///< Layer number
double width = 0.0; ///< Line width
LINE_STYLE style = LINE_STYLE::SOLID; ///< Line style (solid, dashed, etc.)
bool closed = false; ///< True if shape is closed (polygon/circle)
bool filled = false; ///< True if shape should be filled
std::vector<ARC_POINT> points; ///< Shape vertices, may include arcs
std::string reuse_instance; ///< Reuse block instance name (if member of reuse)
};
/**
* A polyline that may contain arc segments.
*
* Used for board outlines and complex graphics that can include arc corners.
*/
struct POLYLINE
{
int layer;
double width;
bool closed; ///< True if polyline forms a closed shape
std::vector<ARC_POINT> points; ///< Polyline vertices, may include arcs
};
struct BOARD_ITEM
{
// Base for board outline, etc.
};
/**
* A copper shape from the LINES section (type=COPPER).
*
* Copper shapes are standalone copper areas not part of a pour. They can be
* associated with a net and may include cutouts.
*/
struct COPPER_SHAPE
{
std::string name; ///< Shape name
std::string net_name; ///< Associated net (empty if unconnected)
int layer = 0; ///< Layer number
bool filled = false; ///< True for filled shapes (COPCLS, COPCIR)
bool is_cutout = false; ///< True for cutouts (COPCUT, COPCCO)
std::vector<ARC_POINT> outline; ///< Shape outline vertices
};
/**
* Layer types from PADS LAYER_TYPE field.
*/
enum class PADS_LAYER_FUNCTION
{
UNKNOWN,
ROUTING, ///< Copper routing layer
PLANE, ///< Power/ground plane
MIXED, ///< Mixed signal/plane
UNASSIGNED, ///< Unassigned layer
SOLDER_MASK, ///< Solder mask
PASTE_MASK, ///< Solder paste mask
SILK_SCREEN, ///< Silkscreen/legend
ASSEMBLY, ///< Assembly drawing
DOCUMENTATION, ///< Documentation layer
DRILL ///< Drill drawing
};
struct LAYER_INFO
{
int number; ///< PADS layer number
std::string name; ///< Layer name
PADS_LAYER_FUNCTION layer_type; ///< Parsed layer type from file
bool is_copper; ///< True if copper layer
bool required; ///< True if layer must be mapped
};
/**
* A reuse block instance placement.
*/
struct REUSE_NET
{
bool merge = false; ///< True to merge nets, false to rename
std::string name; ///< Original net name from reuse definition
};
struct REUSE_INSTANCE
{
std::string instance_name; ///< Instance name
std::string part_naming; ///< Part naming scheme (may be multi-word like "PREFIX pref")
std::string net_naming; ///< Net naming scheme (may be multi-word like "SUFFIX suf")
POINT location = {}; ///< Placement location
double rotation = 0.0; ///< Rotation angle in degrees
bool glued = false; ///< True if glued in place
};
/**
* A reuse block definition containing parts and routes that can be instantiated.
*/
struct REUSE_BLOCK
{
std::string name; ///< Block type name
long timestamp = 0; ///< Creation/modification timestamp
std::string part_naming; ///< Default part naming scheme
std::string net_naming; ///< Default net naming scheme
std::vector<std::string> part_names; ///< Parts contained in this block
std::vector<REUSE_NET> nets; ///< Nets contained in this block with merge flags
std::vector<REUSE_INSTANCE> instances; ///< Placements of this block
};
/**
* A cluster of related route segments that should be grouped together.
*/
struct CLUSTER
{
std::string name; ///< Cluster name/identifier
int id = 0; ///< Cluster ID number
std::vector<std::string> net_names; ///< Nets belonging to this cluster
std::vector<std::string> segment_refs; ///< References to route segments in cluster
};
/**
* A test point definition for manufacturing/testing access.
*/
struct TEST_POINT
{
std::string type; ///< VIA or PIN
double x = 0.0; ///< X coordinate
double y = 0.0; ///< Y coordinate
int side = 0; ///< Probe side (0=through, 1=top, 2=bottom)
std::string net_name; ///< Net this test point connects to
std::string symbol_name; ///< Symbol/pad name for the test point
};
/**
* A dimension annotation for measurement display.
*/
struct DIMENSION
{
std::string name; ///< Dimension identifier
double x = 0.0; ///< Origin X coordinate
double y = 0.0; ///< Origin Y coordinate
double crossbar_pos = 0.0; ///< Crossbar position (Y for horizontal, X for vertical)
bool is_horizontal = true; ///< True for horizontal dimension
int layer = 0; ///< Layer for dimension graphics
std::vector<POINT> points; ///< Dimension geometry points (measurement endpoints)
std::string text; ///< Dimension text/value
double text_height = 0.0; ///< Text height
double text_width = 0.0; ///< Text width
double rotation = 0.0; ///< Text rotation angle
};
/**
* Keepout types in PADS.
*/
enum class KEEPOUT_TYPE
{
ALL, ///< All objects
ROUTE, ///< Routing keepout (traces)
VIA, ///< Via keepout
COPPER, ///< Copper pour keepout
PLACEMENT ///< Component placement keepout
};
/**
* A keepout area definition.
*/
struct KEEPOUT
{
KEEPOUT_TYPE type = KEEPOUT_TYPE::ALL; ///< Type of keepout
std::vector<ARC_POINT> outline; ///< Keepout boundary
std::vector<int> layers; ///< Affected layers (empty = all)
bool no_traces = true; ///< Prohibit traces (R restriction)
bool no_vias = true; ///< Prohibit vias (V restriction)
bool no_copper = true; ///< Prohibit copper pours (C restriction)
bool no_components = false; ///< Prohibit component placement (P restriction)
bool height_restriction = false; ///< Component height restriction (H restriction)
double max_height = 0.0; ///< Maximum component height when height_restriction is true
bool no_test_points = false; ///< Prohibit test points (T restriction)
bool no_accordion = false; ///< Prohibit accordion flex (A restriction for accordion, not all)
};
class PARSER
{
public:
PARSER();
~PARSER();
void Parse( const wxString& aFileName );
const PARAMETERS& GetParameters() const { return m_parameters; }
const std::vector<PART>& GetParts() const { return m_parts; }
const std::vector<NET>& GetNets() const { return m_nets; }
const std::vector<ROUTE>& GetRoutes() const { return m_routes; }
const std::vector<TEXT>& GetTexts() const { return m_texts; }
const std::vector<LINE>& GetLines() const { return m_lines; }
const std::vector<POLYLINE>& GetBoardOutlines() const { return m_board_outlines; }
const std::vector<POUR>& GetPours() const { return m_pours; }
const std::map<std::string, VIA_DEF>& GetViaDefs() const { return m_via_defs; }
const std::map<std::string, PART_DECAL>& GetPartDecals() const { return m_decals; }
const std::map<std::string, PART_TYPE>& GetPartTypes() const { return m_part_types; }
const std::map<std::string, std::map<std::string, std::string>>& GetPartInstanceAttrs() const
{
return m_part_instance_attrs;
}
const std::map<std::string, REUSE_BLOCK>& GetReuseBlocks() const { return m_reuse_blocks; }
const std::vector<CLUSTER>& GetClusters() const { return m_clusters; }
const std::vector<TEST_POINT>& GetTestPoints() const { return m_test_points; }
const std::vector<DIMENSION>& GetDimensions() const { return m_dimensions; }
const DESIGN_RULES& GetDesignRules() const { return m_design_rules; }
const std::vector<NET_CLASS_DEF>& GetNetClasses() const { return m_net_classes; }
const std::vector<DIFF_PAIR_DEF>& GetDiffPairs() const { return m_diff_pairs; }
const std::vector<KEEPOUT>& GetKeepouts() const { return m_keepouts; }
const std::vector<JUMPER_DEF>& GetJumperDefs() const { return m_jumper_defs; }
const std::vector<COPPER_SHAPE>& GetCopperShapes() const { return m_copper_shapes; }
const std::vector<GRAPHIC_LINE>& GetGraphicLines() const { return m_graphic_lines; }
const FILE_HEADER& GetFileHeader() const { return m_file_header; }
bool IsBasicUnits() const { return m_is_basic_units; }
/**
* Get layer information for layer mapping dialog.
*
* This generates layer info based on the parsed file header information.
* Call after Parse() to get accurate layer information.
*/
std::vector<LAYER_INFO> GetLayerInfos() const;
private:
void parseLine( const std::string& aLine );
void parseSectionPCB( std::ifstream& aStream );
void parseSectionPARTS( std::ifstream& aStream );
void parseSectionNETS( std::ifstream& aStream );
void parseSectionROUTES( std::ifstream& aStream );
void parseSectionTEXT( std::ifstream& aStream );
void parseSectionBOARD( std::ifstream& aStream );
void parseSectionLINES( std::ifstream& aStream );
void parseSectionVIA( std::ifstream& aStream );
void parseSectionPOUR( std::ifstream& aStream );
void parseSectionPARTDECAL( std::ifstream& aStream );
void parseSectionPARTTYPE( std::ifstream& aStream );
void parseSectionREUSE( std::ifstream& aStream );
void parseSectionCLUSTER( std::ifstream& aStream );
void parseSectionJUMPER( std::ifstream& aStream );
void parseSectionTESTPOINT( std::ifstream& aStream );
void parseSectionNETCLASS( std::ifstream& aStream );
void parseSectionDIFFPAIR( std::ifstream& aStream );
void parseSectionLAYERDEFS( std::ifstream& aStream );
void parseSectionMISC( std::ifstream& aStream );
// Helper to read next line skipping comments and empty lines
bool readLine( std::ifstream& aStream, std::string& aLine );
void pushBackLine( const std::string& aLine );
PARAMETERS m_parameters;
std::vector<PART> m_parts;
std::vector<NET> m_nets;
std::vector<ROUTE> m_routes;
std::vector<TEXT> m_texts;
std::vector<LINE> m_lines;
std::vector<POLYLINE> m_board_outlines;
std::vector<POUR> m_pours;
std::map<std::string, VIA_DEF> m_via_defs;
std::map<std::string, PART_DECAL> m_decals;
std::map<std::string, PART_TYPE> m_part_types;
///< Per-instance attribute overrides from PART <name> {...} blocks in *PARTTYPE* section
std::map<std::string, std::map<std::string, std::string>> m_part_instance_attrs;
std::map<std::string, REUSE_BLOCK> m_reuse_blocks;
std::vector<CLUSTER> m_clusters;
std::vector<TEST_POINT> m_test_points;
std::vector<DIMENSION> m_dimensions;
DESIGN_RULES m_design_rules;
std::vector<NET_CLASS_DEF> m_net_classes;
std::vector<DIFF_PAIR_DEF> m_diff_pairs;
std::vector<KEEPOUT> m_keepouts;
std::vector<JUMPER_DEF> m_jumper_defs; ///< Jumper definitions from *JUMPER* section
std::vector<COPPER_SHAPE> m_copper_shapes; ///< Copper shapes from *LINES* section
std::vector<GRAPHIC_LINE> m_graphic_lines; ///< 2D graphic lines from *LINES* section
std::map<int, LAYER_INFO> m_layer_defs; ///< Parsed layer definitions by layer number
FILE_HEADER m_file_header; ///< Parsed file header info
bool m_is_basic_units = false;
std::string m_current_section;
std::optional<std::string> m_pushed_line;
};
} // namespace PADS_IO
File diff suppressed because it is too large Load Diff
+106
View File
@@ -0,0 +1,106 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
#pragma once
#include <pcb_io/pcb_io.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
#include <io/pads/pads_unit_converter.h>
#include "pads_layer_mapper.h"
#include <map>
#include <string>
#include <vector>
class BOARD;
namespace PADS_IO { class PARSER; }
class PCB_IO_PADS : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
PCB_IO_PADS();
~PCB_IO_PADS() override;
const IO_FILE_DESC GetBoardFileDesc() const override;
const IO_FILE_DESC GetLibraryDesc() const override;
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
bool CanReadBoard( const wxString& aFileName ) const override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const std::map<std::string, UTF8>* aProperties, PROJECT* aProject ) override;
/**
* Return the automapped layers.
*
* The callback needs to have the context of the current board so it can
* correctly determine copper layer mapping. Thus, it is not static and is
* expected to be bound to an instance of PCB_IO_PADS.
*
* @param aInputLayerDescriptionVector the input layer descriptions from the PADS file
* @return Auto-mapped layers
*/
std::map<wxString, PCB_LAYER_ID> DefaultLayerMappingCallback(
const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector );
private:
// LoadBoard helper methods -- each handles one logical section of the import
int scaleSize( double aVal ) const;
int scaleCoord( double aVal, bool aIsX ) const;
PCB_LAYER_ID getMappedLayer( int aPadsLayer ) const;
void ensureNet( const std::string& aNetName );
void loadBoardSetup();
void loadNets();
void loadFootprints();
void loadReuseBlockGroups();
void loadTestPoints();
void loadTexts();
void loadTracksAndVias();
void loadClusterGroups();
void loadZones();
void loadBoardOutline();
void loadDimensions();
void loadKeepouts();
void loadGraphicLines();
void generateDrcRules( const wxString& aFileName );
void reportStatistics();
void clearLoadingState();
// Persistent state
std::map<wxString, PCB_LAYER_ID> m_layer_map; ///< PADS layer names to KiCad layers
// Loading state -- valid only during LoadBoard, cleared by clearLoadingState()
BOARD* m_loadBoard = nullptr;
const PADS_IO::PARSER* m_parser = nullptr;
PADS_UNIT_CONVERTER m_unitConverter;
PADS_LAYER_MAPPER m_layerMapper;
std::vector<PADS_LAYER_INFO> m_layerInfos;
double m_scaleFactor = 0.0;
double m_originX = 0.0;
double m_originY = 0.0;
std::map<std::string, std::string> m_pinToNetMap;
std::map<std::string, std::string> m_partToBlockMap;
int m_testPointIndex = 1;
};
+735
View File
@@ -0,0 +1,735 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2026 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 "pcb_io_pads_binary.h"
#include "pads_binary_parser.h"
#include "pads_layer_mapper.h"
#include <algorithm>
#include <cmath>
#include <functional>
#include <set>
#include <board.h>
#include <pcb_track.h>
#include <pcb_text.h>
#include <footprint.h>
#include <zone.h>
#include <io/pads/pads_unit_converter.h>
#include <io/pads/pads_common.h>
#include <netinfo.h>
#include <wx/log.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <pad.h>
#include <pcb_shape.h>
#include <board_design_settings.h>
#include <netclass.h>
#include <geometry/eda_angle.h>
#include <string_utils.h>
#include <progress_reporter.h>
#include <reporter.h>
#include <locale_io.h>
#include <advanced_config.h>
#include <geometry/shape_arc.h>
PCB_IO_PADS_BINARY::PCB_IO_PADS_BINARY() : PCB_IO( "PADS Binary" )
{
LAYER_MAPPABLE_PLUGIN::RegisterCallback(
std::bind( &PCB_IO_PADS_BINARY::DefaultLayerMappingCallback, this,
std::placeholders::_1 ) );
}
PCB_IO_PADS_BINARY::~PCB_IO_PADS_BINARY() = default;
const IO_BASE::IO_FILE_DESC PCB_IO_PADS_BINARY::GetBoardFileDesc() const
{
IO_FILE_DESC desc;
desc.m_FileExtensions.emplace_back( "pcb" );
desc.m_Description = "PADS Binary";
return desc;
}
const IO_BASE::IO_FILE_DESC PCB_IO_PADS_BINARY::GetLibraryDesc() const
{
return IO_FILE_DESC( "PADS Binary Library", { "pcb" } );
}
long long PCB_IO_PADS_BINARY::GetLibraryTimestamp( const wxString& aLibraryPath ) const
{
return 0;
}
bool PCB_IO_PADS_BINARY::CanReadBoard( const wxString& aFileName ) const
{
if( !PCB_IO::CanReadBoard( aFileName ) )
return false;
return PADS_IO::BINARY_PARSER::IsBinaryPadsFile( aFileName );
}
BOARD* PCB_IO_PADS_BINARY::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const std::map<std::string, UTF8>* aProperties,
PROJECT* aProject )
{
LOCALE_IO setlocale;
std::unique_ptr<BOARD> board( aAppendToMe ? aAppendToMe : new BOARD() );
if( m_reporter )
m_reporter->Report( _( "Starting PADS binary PCB import" ), RPT_SEVERITY_INFO );
if( m_progressReporter )
m_progressReporter->SetNumPhases( 3 );
PADS_IO::BINARY_PARSER parser;
try
{
parser.Parse( aFileName );
}
catch( const std::exception& e )
{
THROW_IO_ERROR( wxString::Format( "Error parsing PADS binary file: %s", e.what() ) );
}
m_loadBoard = board.get();
m_parser = &parser;
try
{
if( m_progressReporter )
m_progressReporter->BeginPhase( 1 );
loadBoardSetup();
loadNets();
if( m_progressReporter )
m_progressReporter->BeginPhase( 2 );
loadFootprints();
loadBoardOutline();
loadTracksAndVias();
loadTexts();
loadZones();
reportStatistics();
}
catch( ... )
{
clearLoadingState();
throw;
}
clearLoadingState();
return board.release();
}
void PCB_IO_PADS_BINARY::loadBoardSetup()
{
m_layerMapper.SetCopperLayerCount( m_parser->GetParameters().layer_count );
std::vector<PADS_IO::LAYER_INFO> padsLayerInfos = m_parser->GetLayerInfos();
auto convertLayerType = []( PADS_IO::PADS_LAYER_FUNCTION func ) -> PADS_LAYER_TYPE {
switch( func )
{
case PADS_IO::PADS_LAYER_FUNCTION::ROUTING:
case PADS_IO::PADS_LAYER_FUNCTION::PLANE:
case PADS_IO::PADS_LAYER_FUNCTION::MIXED:
return PADS_LAYER_TYPE::COPPER_INNER;
case PADS_IO::PADS_LAYER_FUNCTION::SOLDER_MASK:
return PADS_LAYER_TYPE::SOLDERMASK_TOP;
case PADS_IO::PADS_LAYER_FUNCTION::PASTE_MASK:
return PADS_LAYER_TYPE::PASTE_TOP;
case PADS_IO::PADS_LAYER_FUNCTION::SILK_SCREEN:
return PADS_LAYER_TYPE::SILKSCREEN_TOP;
case PADS_IO::PADS_LAYER_FUNCTION::ASSEMBLY:
return PADS_LAYER_TYPE::ASSEMBLY_TOP;
case PADS_IO::PADS_LAYER_FUNCTION::DOCUMENTATION:
return PADS_LAYER_TYPE::DOCUMENTATION;
case PADS_IO::PADS_LAYER_FUNCTION::DRILL:
return PADS_LAYER_TYPE::DRILL_DRAWING;
default:
return PADS_LAYER_TYPE::UNKNOWN;
}
};
for( const auto& padsInfo : padsLayerInfos )
{
PADS_LAYER_INFO info;
info.padsLayerNum = padsInfo.number;
info.name = padsInfo.name;
if( padsInfo.layer_type != PADS_IO::PADS_LAYER_FUNCTION::UNKNOWN )
{
info.type = convertLayerType( padsInfo.layer_type );
if( info.type == PADS_LAYER_TYPE::COPPER_INNER )
{
if( padsInfo.number == 1 )
info.type = PADS_LAYER_TYPE::COPPER_TOP;
else if( padsInfo.number == m_parser->GetParameters().layer_count )
info.type = PADS_LAYER_TYPE::COPPER_BOTTOM;
}
}
else
{
info.type = m_layerMapper.GetLayerType( padsInfo.number );
}
info.required = padsInfo.required;
m_layerInfos.push_back( info );
}
std::vector<INPUT_LAYER_DESC> inputDescs =
m_layerMapper.BuildInputLayerDescriptions( m_layerInfos );
if( m_layer_mapping_handler )
m_layerMap = m_layer_mapping_handler( inputDescs );
int copperLayerCount = m_parser->GetParameters().layer_count;
if( copperLayerCount < 1 )
copperLayerCount = 2;
m_loadBoard->SetCopperLayerCount( copperLayerCount );
// Binary files always use BASIC units
m_unitConverter.SetBasicUnitsMode( true );
m_scaleFactor = PADS_UNIT_CONVERTER::BASIC_TO_NM;
m_originX = m_parser->GetParameters().origin.x;
m_originY = m_parser->GetParameters().origin.y;
// Fall back to board outline center only when the parser found no DFT origin.
// The DFT origin produces exact coordinate matches; overriding it shifts all parts.
if( m_originX == 0.0 && m_originY == 0.0 )
{
const auto& boardOutlines = m_parser->GetBoardOutlines();
if( !boardOutlines.empty() )
{
double minX = std::numeric_limits<double>::max();
double maxX = std::numeric_limits<double>::lowest();
double minY = std::numeric_limits<double>::max();
double maxY = std::numeric_limits<double>::lowest();
for( const auto& outline : boardOutlines )
{
for( const auto& pt : outline.points )
{
minX = std::min( minX, pt.x );
maxX = std::max( maxX, pt.x );
minY = std::min( minY, pt.y );
maxY = std::max( maxY, pt.y );
}
}
if( minX < maxX && minY < maxY )
{
m_originX = ( minX + maxX ) / 2.0;
m_originY = ( minY + maxY ) / 2.0;
}
}
}
}
void PCB_IO_PADS_BINARY::loadNets()
{
const auto& nets = m_parser->GetNets();
for( const auto& padsNet : nets )
ensureNet( padsNet.name );
}
void PCB_IO_PADS_BINARY::loadFootprints()
{
const auto& decals = m_parser->GetPartDecals();
const auto& parts = m_parser->GetParts();
for( const auto& padsPart : parts )
{
FOOTPRINT* footprint = new FOOTPRINT( m_loadBoard );
footprint->SetReference( padsPart.name );
KIID symbolUuid = PADS_COMMON::GenerateDeterministicUuid( padsPart.name );
KIID_PATH path;
path.push_back( symbolUuid );
footprint->SetPath( path );
std::string decalName = padsPart.decal;
LIB_ID fpid;
if( !decalName.empty() )
fpid.SetLibItemName( wxString::FromUTF8( decalName ) );
else
fpid.SetLibItemName( wxString::FromUTF8( padsPart.name ) );
footprint->SetFPID( fpid );
footprint->SetValue( padsPart.decal );
footprint->SetPosition( VECTOR2I( scaleCoord( padsPart.location.x, true ),
scaleCoord( padsPart.location.y, false ) ) );
footprint->SetOrientation( EDA_ANGLE( padsPart.rotation, DEGREES_T ) );
footprint->SetLayer( F_Cu );
m_loadBoard->Add( footprint );
if( padsPart.bottom_layer )
footprint->Flip( footprint->GetPosition(), FLIP_DIRECTION::LEFT_RIGHT );
}
}
void PCB_IO_PADS_BINARY::loadBoardOutline()
{
for( const PADS_IO::POLYLINE& polyline : m_parser->GetBoardOutlines() )
{
const auto& pts = polyline.points;
if( pts.size() < 2 )
continue;
for( size_t i = 0; i < pts.size() - 1; ++i )
{
const PADS_IO::ARC_POINT& p1 = pts[i];
const PADS_IO::ARC_POINT& p2 = pts[i + 1];
if( std::abs( p1.x - p2.x ) < 0.001 && std::abs( p1.y - p2.y ) < 0.001 )
continue;
PCB_SHAPE* shape = new PCB_SHAPE( m_loadBoard );
shape->SetShape( SHAPE_T::SEGMENT );
shape->SetStart( VECTOR2I( scaleCoord( p1.x, true ),
scaleCoord( p1.y, false ) ) );
shape->SetEnd( VECTOR2I( scaleCoord( p2.x, true ),
scaleCoord( p2.y, false ) ) );
shape->SetWidth( scaleSize( polyline.width ) );
shape->SetLayer( Edge_Cuts );
m_loadBoard->Add( shape );
}
if( polyline.closed && pts.size() > 2 )
{
const PADS_IO::ARC_POINT& pLast = pts.back();
const PADS_IO::ARC_POINT& pFirst = pts.front();
bool needsClosing = ( std::abs( pLast.x - pFirst.x ) > 0.001
|| std::abs( pLast.y - pFirst.y ) > 0.001 );
if( needsClosing )
{
PCB_SHAPE* shape = new PCB_SHAPE( m_loadBoard );
shape->SetShape( SHAPE_T::SEGMENT );
shape->SetStart( VECTOR2I( scaleCoord( pLast.x, true ),
scaleCoord( pLast.y, false ) ) );
shape->SetEnd( VECTOR2I( scaleCoord( pFirst.x, true ),
scaleCoord( pFirst.y, false ) ) );
shape->SetWidth( scaleSize( polyline.width ) );
shape->SetLayer( Edge_Cuts );
m_loadBoard->Add( shape );
}
}
}
}
void PCB_IO_PADS_BINARY::loadTracksAndVias()
{
const auto& routes = m_parser->GetRoutes();
std::set<std::pair<int, int>> placedThroughVias;
for( const auto& route : routes )
{
NETINFO_ITEM* net = nullptr;
if( !route.net_name.empty() )
{
net = m_loadBoard->FindNet(
PADS_COMMON::ConvertInvertedNetName( route.net_name ) );
if( !net )
continue;
}
for( const auto& track_def : route.tracks )
{
if( track_def.points.size() < 2 )
continue;
PCB_LAYER_ID track_layer = getMappedLayer( track_def.layer );
// Binary routes with layer 0 default to F_Cu since the binary
// format's layer field mapping is not yet fully decoded.
if( !IsCopperLayer( track_layer ) )
{
if( route.net_name.empty() && track_def.layer == 0 )
{
track_layer = F_Cu;
}
else
{
if( m_reporter )
{
m_reporter->Report( wxString::Format(
_( "Skipping track on non-copper layer %d" ), track_def.layer ),
RPT_SEVERITY_WARNING );
}
continue;
}
}
int track_width = scaleSize( track_def.width );
if( track_width <= 0 )
track_width = scaleSize( 8.0 );
for( size_t i = 0; i < track_def.points.size() - 1; ++i )
{
const PADS_IO::ARC_POINT& p1 = track_def.points[i];
const PADS_IO::ARC_POINT& p2 = track_def.points[i + 1];
VECTOR2I start( scaleCoord( p1.x, true ), scaleCoord( p1.y, false ) );
VECTOR2I end( scaleCoord( p2.x, true ), scaleCoord( p2.y, false ) );
if( ( start - end ).EuclideanNorm() < 1000 )
continue;
if( p2.is_arc )
{
VECTOR2I center( scaleCoord( p2.arc.cx, true ),
scaleCoord( p2.arc.cy, false ) );
bool clockwise = ( p2.arc.delta_angle < 0 );
SHAPE_ARC shapeArc;
shapeArc.ConstructFromStartEndCenter( start, end, center, clockwise,
track_width );
PCB_ARC* arc = new PCB_ARC( m_loadBoard, &shapeArc );
if( net )
arc->SetNet( net );
arc->SetWidth( track_width );
arc->SetLayer( track_layer );
m_loadBoard->Add( arc );
}
else
{
PCB_TRACK* track = new PCB_TRACK( m_loadBoard );
if( net )
track->SetNet( net );
track->SetWidth( track_width );
track->SetLayer( track_layer );
track->SetStart( start );
track->SetEnd( end );
m_loadBoard->Add( track );
}
}
}
for( const auto& via_def : route.vias )
{
VECTOR2I pos( scaleCoord( via_def.location.x, true ),
scaleCoord( via_def.location.y, false ) );
if( placedThroughVias.count( std::make_pair( pos.x, pos.y ) ) )
continue;
placedThroughVias.insert( std::make_pair( pos.x, pos.y ) );
PCB_VIA* via = new PCB_VIA( m_loadBoard );
if( net )
via->SetNet( net );
via->SetPosition( pos );
via->SetWidth( scaleSize( 20.0 ) );
via->SetDrill( scaleSize( 10.0 ) );
via->SetLayerPair( F_Cu, B_Cu );
via->SetViaType( VIATYPE::THROUGH );
m_loadBoard->Add( via );
}
}
}
void PCB_IO_PADS_BINARY::loadTexts()
{
const auto& texts = m_parser->GetTexts();
for( const auto& pads_text : texts )
{
PCB_LAYER_ID textLayer = getMappedLayer( pads_text.layer );
if( textLayer == UNDEFINED_LAYER )
{
if( m_reporter )
{
m_reporter->Report( wxString::Format(
_( "Text on unmapped layer %d assigned to Comments layer" ),
pads_text.layer ), RPT_SEVERITY_WARNING );
}
textLayer = Cmts_User;
}
PCB_TEXT* text = new PCB_TEXT( m_loadBoard );
text->SetText( pads_text.content );
int scaledSize = scaleSize( pads_text.height );
int charHeight =
static_cast<int>( scaledSize * ADVANCED_CFG::GetCfg().m_PadsPcbTextHeightScale );
int charWidth =
static_cast<int>( scaledSize * ADVANCED_CFG::GetCfg().m_PadsPcbTextWidthScale );
text->SetTextSize( VECTOR2I( charWidth, charHeight ) );
if( pads_text.width > 0 )
text->SetTextThickness( scaleSize( pads_text.width ) );
EDA_ANGLE textAngle( pads_text.rotation, DEGREES_T );
text->SetTextAngle( textAngle );
VECTOR2I pos( scaleCoord( pads_text.location.x, true ),
scaleCoord( pads_text.location.y, false ) );
VECTOR2I textShift( -ADVANCED_CFG::GetCfg().m_PadsTextAnchorOffsetNm, 0 );
RotatePoint( textShift, textAngle );
text->SetPosition( pos + textShift );
if( pads_text.hjust == "LEFT" )
text->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
else if( pads_text.hjust == "RIGHT" )
text->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else
text->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
if( pads_text.vjust == "UP" )
text->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
else if( pads_text.vjust == "DOWN" )
text->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else
text->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
text->SetKeepUpright( false );
text->SetLayer( textLayer );
m_loadBoard->Add( text );
}
}
void PCB_IO_PADS_BINARY::loadZones()
{
const auto& pours = m_parser->GetPours();
const auto& params = m_parser->GetParameters();
int maxPriority = 0;
for( const auto& pour_def : pours )
{
if( pour_def.priority > maxPriority )
maxPriority = pour_def.priority;
}
for( const auto& pour_def : pours )
{
PCB_LAYER_ID pourLayer = getMappedLayer( pour_def.layer );
if( pourLayer == UNDEFINED_LAYER )
{
if( m_reporter )
{
m_reporter->Report( wxString::Format(
_( "Skipping pour on unmapped layer %d" ), pour_def.layer ),
RPT_SEVERITY_WARNING );
}
continue;
}
ZONE* zone = new ZONE( m_loadBoard );
zone->SetLayer( pourLayer );
zone->Outline()->NewOutline();
for( const auto& pt : pour_def.points )
{
zone->Outline()->Append( scaleCoord( pt.x, true ), scaleCoord( pt.y, false ) );
}
if( pour_def.is_cutout )
{
zone->SetIsRuleArea( true );
zone->SetDoNotAllowZoneFills( true );
zone->SetDoNotAllowTracks( false );
zone->SetDoNotAllowVias( false );
zone->SetDoNotAllowPads( false );
zone->SetDoNotAllowFootprints( false );
zone->SetZoneName( wxString::Format( wxT( "Cutout_%s" ), pour_def.owner_pour ) );
}
else
{
NETINFO_ITEM* net = m_loadBoard->FindNet(
PADS_COMMON::ConvertInvertedNetName( pour_def.net_name ) );
if( net )
zone->SetNet( net );
int kicadPriority = maxPriority - pour_def.priority + 1;
zone->SetAssignedPriority( kicadPriority );
zone->SetMinThickness( scaleSize( pour_def.width ) );
zone->SetThermalReliefGap( scaleSize( params.thermal_min_clearance ) );
zone->SetThermalReliefSpokeWidth( scaleSize( params.thermal_line_width ) );
zone->SetPadConnection( ZONE_CONNECTION::THERMAL );
}
m_loadBoard->Add( zone );
}
}
void PCB_IO_PADS_BINARY::reportStatistics()
{
if( !m_reporter )
return;
size_t trackCount = 0;
size_t viaCount = 0;
for( PCB_TRACK* track : m_loadBoard->Tracks() )
{
if( track->Type() == PCB_VIA_T )
viaCount++;
else
trackCount++;
}
m_reporter->Report( wxString::Format( _( "Imported %zu footprints, %d nets, %zu tracks,"
" %zu vias, %zu zones" ),
m_loadBoard->Footprints().size(),
m_loadBoard->GetNetCount(),
trackCount, viaCount,
m_loadBoard->Zones().size() ),
RPT_SEVERITY_INFO );
}
std::map<wxString, PCB_LAYER_ID> PCB_IO_PADS_BINARY::DefaultLayerMappingCallback(
const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector )
{
std::map<wxString, PCB_LAYER_ID> layerMap;
for( const INPUT_LAYER_DESC& layer : aInputLayerDescriptionVector )
layerMap[layer.Name] = layer.AutoMapLayer;
return layerMap;
}
int PCB_IO_PADS_BINARY::scaleSize( double aVal ) const
{
return static_cast<int>( m_unitConverter.ToNanometersSize( aVal ) );
}
int PCB_IO_PADS_BINARY::scaleCoord( double aVal, bool aIsX ) const
{
double origin = aIsX ? m_originX : m_originY;
long long originNm = static_cast<long long>( std::round( origin * m_scaleFactor ) );
long long valNm = static_cast<long long>( std::round( aVal * m_scaleFactor ) );
if( aIsX )
return static_cast<int>( valNm - originNm );
else
return static_cast<int>( originNm - valNm );
}
PCB_LAYER_ID PCB_IO_PADS_BINARY::getMappedLayer( int aPadsLayer ) const
{
for( const auto& info : m_layerInfos )
{
if( info.padsLayerNum == aPadsLayer )
{
auto it = m_layerMap.find( wxString::FromUTF8( info.name ) );
if( it != m_layerMap.end() && it->second != UNDEFINED_LAYER )
return it->second;
return m_layerMapper.GetAutoMapLayer( aPadsLayer, info.type );
}
}
return m_layerMapper.GetAutoMapLayer( aPadsLayer );
}
void PCB_IO_PADS_BINARY::ensureNet( const std::string& aNetName )
{
if( aNetName.empty() )
return;
wxString wxName = PADS_COMMON::ConvertInvertedNetName( aNetName );
if( m_loadBoard->FindNet( wxName ) == nullptr )
{
NETINFO_ITEM* net = new NETINFO_ITEM(
m_loadBoard, wxName,
static_cast<int>( m_loadBoard->GetNetCount() ) + 1 );
m_loadBoard->Add( net );
}
}
void PCB_IO_PADS_BINARY::clearLoadingState()
{
m_loadBoard = nullptr;
m_parser = nullptr;
m_unitConverter = PADS_UNIT_CONVERTER();
m_layerMapper = PADS_LAYER_MAPPER();
m_layerInfos.clear();
m_scaleFactor = 0.0;
m_originX = 0.0;
m_originY = 0.0;
m_pinToNetMap.clear();
}
+94
View File
@@ -0,0 +1,94 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2026 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
#pragma once
#include <pcb_io/pcb_io.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
#include <io/pads/pads_unit_converter.h>
#include "pads_layer_mapper.h"
#include <map>
#include <string>
#include <vector>
class BOARD;
namespace PADS_IO { class BINARY_PARSER; }
/**
* PCB I/O plugin for importing PADS binary .pcb files.
*
* This plugin reads the native binary format used by PADS Layout, which is
* distinct from the ASCII export format handled by PCB_IO_PADS. The binary
* parser populates the same intermediate PADS_IO structs, and this wrapper
* converts them to KiCad objects using the same patterns as the ASCII importer.
*/
class PCB_IO_PADS_BINARY : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
PCB_IO_PADS_BINARY();
~PCB_IO_PADS_BINARY() override;
const IO_FILE_DESC GetBoardFileDesc() const override;
const IO_FILE_DESC GetLibraryDesc() const override;
long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
bool CanReadBoard( const wxString& aFileName ) const override;
BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const std::map<std::string, UTF8>* aProperties, PROJECT* aProject ) override;
std::map<wxString, PCB_LAYER_ID> DefaultLayerMappingCallback(
const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector );
private:
int scaleSize( double aVal ) const;
int scaleCoord( double aVal, bool aIsX ) const;
PCB_LAYER_ID getMappedLayer( int aPadsLayer ) const;
void ensureNet( const std::string& aNetName );
void loadBoardSetup();
void loadNets();
void loadFootprints();
void loadBoardOutline();
void loadTracksAndVias();
void loadTexts();
void loadZones();
void reportStatistics();
void clearLoadingState();
// Persistent state
std::map<wxString, PCB_LAYER_ID> m_layerMap;
// Loading state
BOARD* m_loadBoard = nullptr;
const PADS_IO::BINARY_PARSER* m_parser = nullptr;
PADS_UNIT_CONVERTER m_unitConverter;
PADS_LAYER_MAPPER m_layerMapper;
std::vector<PADS_LAYER_INFO> m_layerInfos;
double m_scaleFactor = 0.0;
double m_originX = 0.0;
double m_originY = 0.0;
std::map<std::string, std::string> m_pinToNetMap;
};
+6
View File
@@ -46,6 +46,7 @@
#include <pcb_io/easyedapro/pcb_io_easyedapro.h>
#include <pcb_io/ipc2581/pcb_io_ipc2581.h>
#include <pcb_io/odbpp/pcb_io_odbpp.h>
#include <pcb_io/pads/pcb_io_pads.h>
#include <reporter.h>
#include <libraries/library_table_parser.h>
@@ -344,4 +345,9 @@ static PCB_IO_MGR::REGISTER_PLUGIN registerODBPPPlugin(
PCB_IO_MGR::ODBPP,
wxT( "ODB++" ),
[]() -> PCB_IO* { return new PCB_IO_ODBPP; } );
static PCB_IO_MGR::REGISTER_PLUGIN registerPadsPlugin(
PCB_IO_MGR::PADS,
wxT( "PADS" ),
[]() -> PCB_IO* { return new PCB_IO_PADS(); } );
// clang-format on
+1
View File
@@ -70,6 +70,7 @@ public:
SOLIDWORKS_PCB,
IPC2581,
ODBPP,
PADS,
// add your type here.
// etc.
+244
View File
@@ -46,7 +46,9 @@
#include <jobs/job_export_pcb_3d.h>
#include <jobs/job_pcb_render.h>
#include <jobs/job_pcb_drc.h>
#include <jobs/job_pcb_import.h>
#include <jobs/job_pcb_upgrade.h>
#include <nlohmann/json.hpp>
#include <eda_units.h>
#include <lset.h>
#include <cli/exit_codes.h>
@@ -150,6 +152,11 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
{
return true;
} );
Register( "pcb_import", std::bind( &PCBNEW_JOBS_HANDLER::JobImport, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
return true;
} );
Register( "svg", std::bind( &PCBNEW_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ),
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
{
@@ -2769,3 +2776,240 @@ void PCBNEW_JOBS_HANDLER::loadOverrideDrawingSheet( BOARD* aBrd, const wxString&
// failed loading custom path, revert back to default
loadSheet( aBrd->GetProject()->GetProjectFile().m_BoardDrawingSheetFile );
}
int PCBNEW_JOBS_HANDLER::JobImport( JOB* aJob )
{
JOB_PCB_IMPORT* job = dynamic_cast<JOB_PCB_IMPORT*>( aJob );
if( !job )
return CLI::EXIT_CODES::ERR_UNKNOWN;
// Map job format to PCB_IO file type
PCB_IO_MGR::PCB_FILE_T fileType = PCB_IO_MGR::PCB_FILE_UNKNOWN;
switch( job->m_format )
{
case JOB_PCB_IMPORT::FORMAT::AUTO:
fileType = PCB_IO_MGR::FindPluginTypeFromBoardPath( job->m_inputFile );
break;
case JOB_PCB_IMPORT::FORMAT::PADS:
fileType = PCB_IO_MGR::PADS;
break;
case JOB_PCB_IMPORT::FORMAT::ALTIUM:
fileType = PCB_IO_MGR::ALTIUM_DESIGNER;
break;
case JOB_PCB_IMPORT::FORMAT::EAGLE:
fileType = PCB_IO_MGR::EAGLE;
break;
case JOB_PCB_IMPORT::FORMAT::CADSTAR:
fileType = PCB_IO_MGR::CADSTAR_PCB_ARCHIVE;
break;
case JOB_PCB_IMPORT::FORMAT::FABMASTER:
fileType = PCB_IO_MGR::FABMASTER;
break;
case JOB_PCB_IMPORT::FORMAT::PCAD:
fileType = PCB_IO_MGR::PCAD;
break;
case JOB_PCB_IMPORT::FORMAT::SOLIDWORKS:
fileType = PCB_IO_MGR::SOLIDWORKS_PCB;
break;
}
if( fileType == PCB_IO_MGR::PCB_FILE_UNKNOWN )
{
m_reporter->Report( wxString::Format( _( "Unable to determine file format for '%s'\n" ),
job->m_inputFile ),
RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
// Check that input file exists
if( !wxFile::Exists( job->m_inputFile ) )
{
m_reporter->Report( wxString::Format( _( "Input file not found: '%s'\n" ),
job->m_inputFile ),
RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
// Determine output path
wxString outputPath = job->GetConfiguredOutputPath();
if( outputPath.IsEmpty() )
{
wxFileName fn( job->m_inputFile );
fn.SetExt( FILEEXT::KiCadPcbFileExtension );
outputPath = fn.GetFullPath();
}
BOARD* board = nullptr;
wxString formatName = PCB_IO_MGR::ShowType( fileType );
std::vector<wxString> warnings;
try
{
IO_RELEASER<PCB_IO> pi( PCB_IO_MGR::FindPlugin( fileType ) );
if( !pi )
{
m_reporter->Report( wxString::Format( _( "No plugin found for file type '%s'\n" ),
formatName ),
RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_UNKNOWN;
}
m_reporter->Report( wxString::Format( _( "Importing '%s' using %s format...\n" ),
job->m_inputFile, formatName ),
RPT_SEVERITY_INFO );
board = pi->LoadBoard( job->m_inputFile, nullptr, nullptr, nullptr );
if( !board )
{
m_reporter->Report( _( "Failed to load board\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
// Save as KiCad format
IO_RELEASER<PCB_IO> kicadPlugin( PCB_IO_MGR::FindPlugin( PCB_IO_MGR::KICAD_SEXP ) );
kicadPlugin->SaveBoard( outputPath, board );
m_reporter->Report( wxString::Format( _( "Successfully saved imported board to '%s'\n" ),
outputPath ),
RPT_SEVERITY_INFO );
// Generate report if requested
if( job->m_reportFormat != JOB_PCB_IMPORT::REPORT_FORMAT::NONE )
{
wxFileName inputFn( job->m_inputFile );
wxFileName outputFn( outputPath );
// Count board statistics
size_t footprintCount = board->Footprints().size();
size_t trackCount = 0;
size_t viaCount = 0;
size_t zoneCount = board->Zones().size();
for( PCB_TRACK* track : board->Tracks() )
{
if( track->Type() == PCB_VIA_T )
viaCount++;
else
trackCount++;
}
// Build layer mapping info
nlohmann::json layerMappings = nlohmann::json::object();
LSEQ enabledLayers = board->GetEnabledLayers().Seq();
for( PCB_LAYER_ID layer : enabledLayers )
{
wxString layerName = board->GetLayerName( layer );
layerMappings[layerName.ToStdString()] = {
{ "kicad_layer", LSET::Name( layer ).ToStdString() },
{ "method", job->m_autoMap ? "auto" : "manual" }
};
}
if( job->m_reportFormat == JOB_PCB_IMPORT::REPORT_FORMAT::JSON )
{
nlohmann::json report;
report["source_file"] = inputFn.GetFullName().ToStdString();
report["source_format"] = formatName.ToStdString();
report["output_file"] = outputFn.GetFullName().ToStdString();
report["layer_mapping"] = layerMappings;
report["statistics"] = {
{ "footprints", footprintCount },
{ "tracks", trackCount },
{ "vias", viaCount },
{ "zones", zoneCount }
};
nlohmann::json warningsJson = nlohmann::json::array();
for( const wxString& warning : warnings )
warningsJson.push_back( warning.ToStdString() );
report["warnings"] = warningsJson;
report["errors"] = nlohmann::json::array();
wxString reportOutput = wxString::FromUTF8( report.dump( 2 ) );
if( !job->m_reportFile.IsEmpty() )
{
wxFile file( job->m_reportFile, wxFile::write );
if( file.IsOpened() )
{
file.Write( reportOutput );
file.Close();
}
}
else
{
m_reporter->Report( reportOutput + wxS( "\n" ), RPT_SEVERITY_INFO );
}
}
else if( job->m_reportFormat == JOB_PCB_IMPORT::REPORT_FORMAT::TEXT )
{
wxString text;
text += wxString::Format( wxS( "Import Report\n" ) );
text += wxString::Format( wxS( "=============\n\n" ) );
text += wxString::Format( wxS( "Source file: %s\n" ), inputFn.GetFullName() );
text += wxString::Format( wxS( "Source format: %s\n" ), formatName );
text += wxString::Format( wxS( "Output file: %s\n\n" ), outputFn.GetFullName() );
text += wxS( "Statistics:\n" );
text += wxString::Format( wxS( " Footprints: %zu\n" ), footprintCount );
text += wxString::Format( wxS( " Tracks: %zu\n" ), trackCount );
text += wxString::Format( wxS( " Vias: %zu\n" ), viaCount );
text += wxString::Format( wxS( " Zones: %zu\n" ), zoneCount );
if( !warnings.empty() )
{
text += wxS( "\nWarnings:\n" );
for( const wxString& warning : warnings )
text += wxString::Format( wxS( " - %s\n" ), warning );
}
if( !job->m_reportFile.IsEmpty() )
{
wxFile file( job->m_reportFile, wxFile::write );
if( file.IsOpened() )
{
file.Write( text );
file.Close();
}
}
else
{
m_reporter->Report( text, RPT_SEVERITY_INFO );
}
}
}
delete board;
}
catch( const IO_ERROR& ioe )
{
m_reporter->Report( wxString::Format( _( "Error during import: %s\n" ), ioe.What() ),
RPT_SEVERITY_ERROR );
delete board;
return CLI::EXIT_CODES::ERR_UNKNOWN;
}
return CLI::EXIT_CODES::SUCCESS;
}
+1
View File
@@ -58,6 +58,7 @@ public:
int JobExportIpcD356( JOB* aJob );
int JobExportStats( JOB* aJob );
int JobUpgrade( JOB* aJob );
int JobImport( JOB* aJob );
private:
BOARD* getBoard( const wxString& aPath = wxEmptyString );
+5
View File
@@ -65,10 +65,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
+5
View File
@@ -236,10 +236,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
+6
View File
@@ -10,6 +10,7 @@
"method": 0,
"options": 0,
"recursive": true,
"regroup_units": false,
"scope": 0,
"sort_order": 0
},
@@ -344,10 +345,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
+7 -1
View File
@@ -85,7 +85,8 @@
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.1
"silk_text_thickness": 0.1,
"user_layer_count": 4
},
"editing": {
"fp_angle_snap_mode": 1,
@@ -149,10 +150,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
+7
View File
@@ -70,10 +70,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
@@ -98,7 +103,9 @@
"units": 1
},
"template": {
"filter": 0,
"last_used": "",
"recent_templates": [],
"window": {
"pos": {
"x": -1,
+1 -1
View File
@@ -108,6 +108,6 @@
"pdf_viewer_name": "",
"text_editor": "/usr/bin/open -e",
"use_system_pdf_viewer": true,
"working_dir": "/home/seth/code/kicad/kicad-source-mirror/qa/tests"
"working_dir": "/home/seth/Developer/kicad/worktrees/pads/qa/tests"
}
}
+5
View File
@@ -603,10 +603,15 @@
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
+8
View File
@@ -81,15 +81,23 @@
"meta": {
"version": 1
},
"pin_table": {
"crossprobe_on_selection": true
},
"pin_table_visible_columns": "0 1 2 3 4 5 9 10",
"plugins": {
"actions": []
},
"printing": {
"as_item_checkboxes": false,
"background": false,
"color_theme": "",
"drill_marks": 1,
"edge_cuts_on_all_pages": true,
"layers": [],
"mirror": false,
"monochrome": true,
"pagination": 1,
"scale": 1.0,
"title_block": false,
"use_theme": false
@@ -0,0 +1,153 @@
*PADS-LOGIC-V9.0* DESIGN EXPORT FILE FROM PADS LOGIC VVX.2.15
*SCH*
UNITS 0
USERGRID 100 100
SHEET SIZE A
BORDER NAME Default_A
JOBNAME "Part Test"
TEXTSIZE 60 0
LINEWIDTH 2
*SHT* 1 Sheet1 0 Root
*CAEDECAL*
RES_0805 0 0 100 400 100 400 2 4 0 2 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-100 0 0 0 50 69 0 "Arial"
Ref.Des.
100 0 0 0 50 69 0 "Arial"
Value
CLOSED 5 10 255
-100 -50
100 -50
100 50
-100 50
-100 -50
OPEN 2 10 255
-200 0
-100 0
OPEN 2 10 255
100 0
200 0
OPEN 2 10 255
-100 0
100 0
T-200 0 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T200 0 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
CAP_0603 0 0 100 400 100 400 2 2 0 2 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-100 0 0 0 50 69 0 "Arial"
Ref.Des.
100 0 0 0 50 69 0 "Arial"
Value
OPEN 2 10 255
-100 -50
-100 50
OPEN 2 10 255
100 -50
100 50
T-200 0 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T200 0 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
IC_QUAD_NAND 0 0 800 600 800 600 2 1 0 3 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-300 -450 0 0 60 69 0 "Arial"
Ref.Des.
300 -450 0 0 50 69 0 "Arial"
Value
CLOSED 5 10 255
-300 -400
300 -400
300 400
-300 400
-300 -400
T-500 -300 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 -200 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 -250 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
*PARTTYPE*
RES_0805 Resistor 1 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 2 0
RES_0805
1 0 U 1
2 0 U 2
CAP_0603 Capacitor 1 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 2 0
CAP_0603
1 0 U +
2 0 U -
IC_QUAD_NAND Logic 4 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 3 0
IC_QUAD_NAND
1 0 L 1A
2 0 L 1B
3 0 S 1Y
*PART*
R1 RES_0805 1000 2000 0 0 50 69 50 69 2 1 0 0 0 0
"Arial"
"Arial"
1050 2100 0 0 50 69 0 "Arial"
Ref.Des.
1050 1900 0 0 50 69 0 "Arial"
Value
1050 1900 0 0 50 69 0 "Arial"
"Value" 10K
R2 RES_0805 1000 3000 1 0 50 69 50 69 2 0 0 0 0 0
"Arial"
"Arial"
1100 3050 0 0 50 69 0 "Arial"
Ref.Des.
1100 2950 0 0 50 69 8 "Arial"
Value
C1 CAP_0603 2000 2000 0 1 50 69 50 69 3 0 0 0 0 0
"Arial"
"Arial"
2050 2100 0 0 50 69 0 "Arial"
Ref.Des.
2050 1900 0 0 50 69 0 "Arial"
Value
0 0 0 0 50 69 8 "Arial"
Footprint
U1 IC_QUAD_NAND 5000 3000 0 0 60 69 50 69 4 0 0 0 0 0
"Arial"
"Arial"
5050 3100 0 0 60 69 0 "Arial"
Ref.Des.
5050 2900 0 0 50 69 0 "Arial"
Value
0 0 0 0 50 69 8 "Arial"
Footprint
0 0 0 0 50 69 8 "Arial"
MPN
U1.A IC_QUAD_NAND 6000 3000 0 0 0 0 0 0 0 0 0 0 1 0
"Arial"
"Arial"
*CONNECTION*
*END*
@@ -0,0 +1,9 @@
*PADS-POWERLOGIC-V9.5* DESIGN EXPORT FILE FROM PADS POWERLOGIC
*SCH*
UNITS 1
USERGRID 2.54 2.54
SHEET SIZE B
BORDER NAME ISO_A3
*END*
@@ -0,0 +1,63 @@
*PADS-LOGIC-V9.0* DESIGN EXPORT FILE FROM PADS LOGIC VVX.2.15
*SCH*
UNITS 0
USERGRID 100 100
SHEET SIZE A
BORDER NAME Default_A
JOBNAME "Signal Test"
TEXTSIZE 60 0
LINEWIDTH 2
*SHT* 1 Sheet1 0 Root
*PART*
R1 RES_0805 1000 2000 0 0 50 69 50 69 1 0 0 0 0 0
"Arial"
"Arial"
1050 2100 0 0 50 69 0 "Arial"
Ref.Des.
R2 RES_0805 3000 2000 0 0 50 69 50 69 1 0 0 0 0 0
"Arial"
"Arial"
3050 2100 0 0 50 69 0 "Arial"
Ref.Des.
U1 IC_NAND 5000 2000 0 0 50 69 50 69 1 0 0 0 0 0
"Arial"
"Arial"
5050 2100 0 0 50 69 0 "Arial"
Ref.Des.
*CONNECTION*
*SIGNAL* VCC 0 0
R1.1 U1.14 2 0
1000 2000
2000 2000
U1.14 @@@D1 2 0
2000 2000
2000 3000
*SIGNAL* GND 0 0
R2.2 U1.7 2 0
3000 2000
4000 2000
*SIGNAL* NET1 0 0
R1.2 R2.1 2 0
1000 2000
1500 2000
R2.1 @@@D2 2 0
1500 2000
3000 2000
U1.1 @@@D2 2 0
3000 2000
4000 2000
U1.2 @@@D3 2 0
4000 2000
5000 2000
*SIGNAL* OUTPUT 0 0
U1.3 @@@O1 2 0
5500 2000
6000 2000
*END*
@@ -0,0 +1,22 @@
*PADS-LOGIC-V9.0* DESIGN EXPORT FILE FROM PADS LOGIC VVX.2.15
*SCH*
UNITS 0
USERGRID 100 100
SHEET SIZE A
BORDER NAME Default_A
JOBNAME "Test Design"
TEXTSIZE 60 0
LINEWIDTH 2
*FIELDS*
"Title" Simple Test
"Revision" A
*SHT* 1 Sheet1 0 Root
*PART*
*CONNECTION*
*END*
@@ -0,0 +1,167 @@
*PADS-LOGIC-V9.0* DESIGN EXPORT FILE FROM PADS LOGIC VVX.2.15
*SCH*
UNITS 0
USERGRID 100 100
SHEET SIZE A
BORDER NAME Default_A
JOBNAME "Symbol Test"
TEXTSIZE 60 0
LINEWIDTH 2
*SHT* 1 Sheet1 0 Root
*CAEDECAL*
RES_0805 0 0 100 400 100 400 2 4 0 2 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-100 0 0 0 50 69 0 "Arial"
Ref.Des.
100 0 0 0 50 69 0 "Arial"
Value
CLOSED 5 10 255
-100 -50
100 -50
100 50
-100 50
-100 -50
OPEN 2 10 255
-200 0
-100 0
OPEN 2 10 255
100 0
200 0
OPEN 2 10 255
-100 0
100 0
T-200 0 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T200 0 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
CAP_0603 0 0 100 400 100 400 2 2 0 2 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-100 0 0 0 50 69 0 "Arial"
Ref.Des.
100 0 0 0 50 69 0 "Arial"
Value
OPEN 2 10 255
-100 -50
-100 50
OPEN 2 10 255
100 -50
100 50
T-200 0 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T200 0 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
IC_QUAD_NAND 0 0 800 600 800 600 2 9 0 14 0 0
TIMESTAMP 2025_01_12_08_00_00
"Arial"
"Arial"
-300 -450 0 0 60 69 0 "Arial"
Ref.Des.
300 -450 0 0 50 69 0 "Arial"
Value
CLOSED 5 10 255
-300 -400
300 -400
300 400
-300 400
-300 -400
OPEN 2 10 255
-300 -300
-250 -300
OPEN 2 10 255
-300 -200
-250 -200
OPEN 2 10 255
-300 -100
-250 -100
OPEN 2 10 255
-300 0
-250 0
OPEN 2 10 255
250 -250
300 -250
OPEN 2 10 255
-300 100
-250 100
OPEN 2 10 255
250 50
300 50
OPEN 2 10 255
250 350
300 350
T-500 -300 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 -200 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 -250 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 -100 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 0 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 50 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 100 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 350 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 200 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 300 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 150 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 400 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T-500 500 0 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
T300 250 2 0 50 69 0 5 50 69 0 5 PINSHRT
P0 0 0 5 0 0 0 5 0
*PARTTYPE*
RES_0805 Resistor 1 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 2 0
RES_0805
1 0 U 1
2 0 U 2
CAP_0603 Capacitor 1 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 2 0
CAP_0603
1 0 U +
2 0 U -
IC_QUAD_NAND Logic 4 0 0 0
TIMESTAMP 2025_01_12_08_00_00
GATE 1 14 0
IC_QUAD_NAND
1 0 L 1A
2 0 L 1B
3 0 S 1Y
4 0 L 2A
5 0 L 2B
6 0 S 2Y
7 0 G GND
8 0 L 3A
9 0 L 3B
10 0 S 3Y
11 0 L 4A
12 0 L 4B
13 0 S 4Y
14 0 G VCC
*PART*
*CONNECTION*
*END*
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 John Simonis, John LaRocco, Qudsia Tahmina
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,5 @@
(version 1)
(rule "DiffPair_D1_gap"
(condition "A.NetName == 'N01271' && B.NetName == 'N01267'")
(constraint clearance (min 0.3048mm)))
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
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 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,17 @@
(version 1)
(rule "DiffPair_D1_gap"
(condition "A.NetName == 'TXN2' && B.NetName == 'TXP2'")
(constraint clearance (min 0.2032mm)))
(rule "DiffPair_D2_gap"
(condition "A.NetName == 'TXP1' && B.NetName == 'TXN1'")
(constraint clearance (min 0.2032mm)))
(rule "DiffPair_D3_gap"
(condition "A.NetName == 'RXN1' && B.NetName == 'RXP1'")
(constraint clearance (min 0.2032mm)))
(rule "DiffPair_D4_gap"
(condition "A.NetName == 'RXP2' && B.NetName == 'RXN2'")
(constraint clearance (min 0.2032mm)))
Binary file not shown.
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+311
View File
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+311
View File
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
+311
View File
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,311 @@
CERN Open Hardware Licence Version 2 - Weakly Reciprocal
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
two reciprocal licences: this licence, CERN-OHL-W (weakly reciprocal)
and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-W is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-W.
1.2 'Compatible Licence' means
a) any earlier version of the CERN Open Hardware licence, or
b) any version of the CERN-OHL-S or the CERN-OHL-W, or
c) any licence which permits You to treat the Source to which
it applies as licensed under CERN-OHL-S or CERN-OHL-W
provided that on Conveyance of any such Source, or any
associated Product You treat the Source in question as being
licensed under CERN-OHL-S or CERN-OHL-W as appropriate.
1.3 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.4 'Covered Source' means Source that is explicitly made available
under this Licence.
1.5 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.6 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.7 'Available Component' means any part, sub-assembly, library or
code which:
a) is licensed to You as Complete Source under a Compatible
Licence; or
b) is available, at the time a Product or the Source containing
it is first Conveyed, to You and any other prospective
licensees
i) with sufficient rights and information (including any
configuration and programming files and information
about its characteristics and interfaces) to enable it
either to be Made itself, or to be sourced and used to
Make the Product; or
ii) as part of the normal distribution of a tool used to
design or Make the Product.
1.8 'External Material' means anything (including Source) which:
a) is only combined with Covered Source in such a way that it
interfaces with the Covered Source using a documented
interface which is described in the Covered Source; and
b) is not a derivative of or contains Covered Source, or, if it
is, it is solely to the extent necessary to facilitate such
interfacing.
1.9 'Complete Source' means the set of all Source necessary to Make
a Product, in the preferred form for making modifications,
including necessary installation and interfacing information
both for the Product, and for any included Available Components.
If the format is proprietary, it must also be made available in
a format (if the proprietary tool can create it) which is
viewable with a tool available to potential licensees and
licensed under a licence approved by the Free Software
Foundation or the Open Source Initiative. Complete Source need
not include the Source of any Available Component, provided that
You include in the Complete Source sufficient information to
enable a recipient to Make or source and use the Available
Component to Make the Product.
1.10 'Source Location' means a location where a Licensor has placed
Covered Source, and which that Licensor reasonably believes will
remain easily accessible for at least three years for anyone to
obtain a digital copy.
1.11 'Notice' means copyright, acknowledgement and trademark notices,
Source Location references, modification notices (subsection
3.3(b)) and all notices that refer to this Licence and to the
disclaimer of warranties that are included in the Covered
Source.
1.12 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.13 'Licensor' means a natural or legal person who creates or
modifies Covered Source. A person may be a Licensee and a
Licensor at the same time.
1.14 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices, provided that
You irrevocably undertake to make that modified Covered Source
available from a Source Location should You Convey a Product in
circumstances where the recipient does not otherwise receive a
copy of the modified Covered Source. In each case subsection 3.3
shall apply.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2;
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it;
c) add a Source Location Notice for the modified Covered Source
if You Convey in circumstances where the recipient does not
otherwise receive a copy of the modified Covered Source; and
d) license the modified Covered Source under the terms and
conditions of this Licence (or, as set out in subsection
8.3, a later version, if permitted by the licence of the
original Covered Source). Such modified Covered Source must
be licensed as a whole, but excluding Available Components
contained in it or External Material to which it is
interfaced, which remain licensed under their own applicable
licences.
4 Making and Conveying Products
4.1 You may Make Products, and/or Convey them, provided that You
either provide each recipient with a copy of the Complete Source
or ensure that each recipient is notified of the Source Location
of the Complete Source. That Complete Source includes Covered
Source and You must accordingly satisfy Your obligations set out
in subsection 3.3. If specified in a Notice, the Product must
visibly and securely display the Source Location on it or its
packaging or documentation in the manner specified in that
Notice.
4.2 Where You Convey a Product which incorporates External Material,
the Complete Source for that Product which You are required to
provide under subsection 4.1 need not include any Source for the
External Material.
4.3 You may license Products under terms of Your choice, provided
that such terms do not restrict or attempt to restrict any
recipients' rights under this Licence to the Covered Source.
5 Research and Development
You may Convey Covered Source, modified Covered Source or Products to
a legal entity carrying out development, testing or quality assurance
work on Your behalf provided that the work is performed on terms which
prevent the entity from both using the Source or Products for its own
internal purposes and Conveying the Source or Products or any
modifications to them to any person other than You. Any modifications
made by the entity shall be deemed to be made by You pursuant to
subsection 3.2.
6 DISCLAIMER AND LIABILITY
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
7 Patents
7.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in subsections 7.2 and 8.4) patent licence to Make, have
Made, use, offer to sell, sell, import, and otherwise transfer
the Covered Source and Products, where such licence applies only
to those patent claims licensable by such Licensor that are
necessarily infringed by exercising rights under the Covered
Source as Conveyed by that Licensor.
7.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
8 General
8.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
8.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
8.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
You may treat Covered Source licensed under CERN-OHL-W as
licensed under CERN-OHL-S if and only if all Available
Components referenced in the Covered Source comply with the
corresponding definition of Available Component for CERN-OHL-S.
8.4 This Licence shall terminate with immediate effect if You fail
to comply with any of its terms and conditions.
8.5 However, if You cease all breaches of this Licence, then Your
Licence from any Licensor is reinstated unless such Licensor has
terminated this Licence by giving You, while You remain in
breach, a notice specifying the breach and requiring You to cure
it within 30 days, and You have failed to come into compliance
in all material respects by the end of the 30 day period. Should
You repeat the breach after receipt of a cure notice and
subsequent reinstatement, this Licence will terminate
immediately and permanently. Section 6 shall continue to apply
after any termination.
8.6 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2017, Yuan Mei
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,64 @@
!PADS-POWERPCB-V9.5-MILS! DESIGN DATABASE ASCII FILE 1.0
*PCB* GENERAL PARAMETERS OF THE PCB
UNITS 0
ORIGIN 0.0 0.0
*PART* PART ITEMS
*NET* NET LIST ITEMS
*ROUTE* ROUTING ITEMS
*LINES* LINES ITEMS
*REMARK* NAME TYPE XLOC YLOC PIECES TEXT SIGSTR
*REMARK* PIECETYPE CORNERS WIDTHHGHT LINESTYLE LEVEL [RESTRICTIONS]
TESTBOARD_OUTLINE BOARD 0 0 1 0
CLOSED 5 10 0 0
0 0
1000 0
1000 1000
0 1000
0 0
KEEPOUT_RECT KEEPOUT 100 100 1 0
CLOSED 4 10 0 1
0 0
200 0
200 200
0 200
VIA_RESTRICT RESTRICTVIA 400 400 1 0
CLOSED 4 10 0 1
0 0
100 0
100 100
0 100
ROUTE_RESTRICT RESTRICTROUTE 600 100 1 0
CLOSED 4 10 0 1
0 0
150 0
150 150
0 150
AREA_RESTRICT RESTRICTAREA 100 600 1 0
CLOSED 4 10 0 1
0 0
200 0
200 200
0 200
PLACEMENT_KO PLACEMENT_KEEPOUT 500 500 1 0
CLOSED 4 10 0 1
0 0
100 0
100 100
0 100
*TEXT* TEXT ITEMS
*END*
@@ -0,0 +1,22 @@
!PADS-POWERPCB-V9.4-MILS!
*PCB* PADS Layout
*REUSE*
TYPE Amplifier Channel
TIMESTAMP 1234567890
PART_NAMING SUFFIX
PART U1
PART U2
PART C1
PART R1
NET_NAMING PREFIX
NET 1 POWER
NET 1 GROUND
NET 0 INPUT
NET 0 OUTPUT
REUSE LeftChannel SUFFIX R PREFIX R~ 1000.0 2000.0 0.0 Y
REUSE RightChannel SUFFIX L PREFIX L~ 3000.0 2000.0 90.0 N
REUSE MidChannel START 100 NEXT 5000.0 2000.0 180.0 N
*END*
@@ -0,0 +1,59 @@
!PADS-POWERPCB-V9.5-MILS! DESIGN DATABASE ASCII FILE 1.0
*PCB* GENERAL PARAMETERS OF THE PCB
UNITS 0
ORIGIN 0.0 0.0
*PART* PART ITEMS
*NET* NET LIST ITEMS
*ROUTE* ROUTING ITEMS
*LINES* LINES ITEMS
*REMARK* Synthetic test for various arc types
*REMARK* Tests full circle, 90-degree arc, 180-degree arc, small arc, and open arc
BOARD_OUTLINE BOARD 0 0 1 0
CLOSED 5 10 0 0
0 0
5000 0
5000 5000
0 5000
0 0
FULL_CIRCLE COPPER 500 500 1 0
CIRCLE 200
QUARTER_ARC_90 COPPER 1000 500 1 0
OPEN 2 10 0 1
0 0
ARC 0 -200 200 0 100 -100 CCW
HALF_ARC_180 COPPER 1500 500 1 0
OPEN 2 10 0 1
0 200
ARC 0 0 0 -200 0 0 CW
SMALL_ARC_30 COPPER 2000 500 1 0
OPEN 2 10 0 1
0 0
ARC 100 0 100 52 100 26 CCW
LARGE_ARC_270 COPPER 2500 500 1 0
OPEN 2 10 0 1
200 0
ARC 0 0 0 200 100 100 CCW
MIXED_LINE_ARC COPPER 500 1500 1 0
OPEN 4 10 0 1
0 0
500 0
ARC 500 250 250 250 375 250 CCW
0 250
*TEXT* TEXT ITEMS
*END*

Some files were not shown because too many files have changed in this diff Show More