KiCad PCB EDA Suite
Loading...
Searching...
No Matches
altium_parser_pcb.cpp File Reference
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <ki_exception.h>
#include <math/util.h>
#include <wx/log.h>
#include <wx/translation.h>
#include "altium_parser_pcb.h"
#include "io/altium/altium_binary_parser.h"
#include "io/altium/altium_props_utils.h"

Go to the source code of this file.

Functions

ALTIUM_LAYER altium_versioned_layer (ALTIUM_LAYER aV6Layer, ALTIUM_LAYER aV7Layer)
 
bool altiumScopeExprMatchesPolygon (const wxString &aExpr)
 Return true if an Altium rule scope expression targets polygon pour primitives (matches InPolygon, InPoly, IsPolygon, or IsPoly).
 
const ARULE6selectAltiumPolygonRule (const std::vector< ARULE6 > &aRulesByPriorityAsc)
 Select the highest Altium-priority rule whose scope references polygons.
 
bool altiumViaSideIsTented (bool aTentFlag, bool aManual, bool aFromHole, uint32_t aHoleSize, int32_t aMaskExpansion, int aLandDiameter)
 Decide whether one side of an Altium via should be tented when imported into KiCad.
 
ALTIUM_LAYER altium_layer_from_name (const wxString &aName)
 
ALTIUM_MECHKIND altium_mechkind_from_name (const wxString &aName)
 
void altium_parse_polygons (std::map< wxString, wxString > &aProps, std::vector< ALTIUM_VERTICE > &aVertices)
 
static ALTIUM_MODE ReadAltiumModeFromProperties (const std::map< wxString, wxString > &aProps, wxString aKey)
 
static ALTIUM_RECORD ReadAltiumRecordFromProperties (const std::map< wxString, wxString > &aProps, wxString aKey)
 
static AEXTENDED_PRIMITIVE_INFORMATION_TYPE ReadAltiumExtendedPrimitiveInformationTypeFromProperties (const std::map< wxString, wxString > &aProps, wxString aKey)
 
static void ExpectSubrecordLengthAtLeast (const std::string &aStreamType, const std::string &aSubrecordName, size_t aExpectedLength, size_t aActualLength)
 Throw an IO_ERROR if the actual length is less than the expected length.
 
static wxString MakeAltiumDielectricKey (const wxString &aMaterial, int32_t aHeight, double aConst)
 
static std::map< wxString, double > ReadAltiumDielectricLossTangents (const std::map< wxString, wxString > &aProps)
 
static std::vector< ABOARD6_LAYER_STACKUPReadAltiumStackupFromProperties (const std::map< wxString, wxString > &aProps)
 

Variables

static const wxChar * traceAltiumImport = wxT( "KICAD_ALTIUM_IMPORT" )
 Flag to enable Altium importer logging.
 

Function Documentation

◆ altium_layer_from_name()

◆ altium_mechkind_from_name()

◆ altium_parse_polygons()

void altium_parse_polygons ( std::map< wxString, wxString > & aProps,
std::vector< ALTIUM_VERTICE > & aVertices )

◆ altium_versioned_layer()

◆ altiumScopeExprMatchesPolygon()

bool altiumScopeExprMatchesPolygon ( const wxString & aExpr)

Return true if an Altium rule scope expression targets polygon pour primitives (matches InPolygon, InPoly, IsPolygon, or IsPoly).

Definition at line 63 of file altium_parser_pcb.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and selectAltiumPolygonRule().

◆ altiumViaSideIsTented()

bool altiumViaSideIsTented ( bool aTentFlag,
bool aManual,
bool aFromHole,
uint32_t aHoleSize,
int32_t aMaskExpansion,
int aLandDiameter )

Decide whether one side of an Altium via should be tented when imported into KiCad.

Returns the explicit Altium tent flag, except when the via uses a manual solder mask expansion measured from the hole edge. KiCad vias cannot represent a hole-referenced opening, so when the resulting opening (hole + 2 * expansion) does not clear the via land the pad copper is covered and the side is treated as tented.

Parameters
aTentFlagexplicit Altium tent flag for this side
aManualtrue if the via carries a manual solder mask expansion
aFromHoletrue if the manual expansion is measured from the hole edge
aHoleSizevia hole diameter (KiCad nm)
aMaskExpansionsolder mask expansion for this side (KiCad nm, may be negative)
aLandDiametervia land (copper) diameter for this side (KiCad nm)

Definition at line 86 of file altium_parser_pcb.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and ALTIUM_PCB::ParseVias6Data().

◆ ExpectSubrecordLengthAtLeast()

static void ExpectSubrecordLengthAtLeast ( const std::string & aStreamType,
const std::string & aSubrecordName,
size_t aExpectedLength,
size_t aActualLength )
static

Throw an IO_ERROR if the actual length is less than the expected length.

Parameters
aStreamTypethe current stream type (e.g. 'Pads6')
aSubrecordNamethe current subrecord name (e.g. 'subrecord5')
aExpectedLengththe expected length needed to parse the stream
aActualLengththe actual length of the subrecord encountered

Definition at line 380 of file altium_parser_pcb.cpp.

References THROW_IO_ERROR.

Referenced by APAD6::APAD6().

◆ MakeAltiumDielectricKey()

static wxString MakeAltiumDielectricKey ( const wxString & aMaterial,
int32_t aHeight,
double aConst )
static

◆ ReadAltiumDielectricLossTangents()

static std::map< wxString, double > ReadAltiumDielectricLossTangents ( const std::map< wxString, wxString > & aProps)
static

◆ ReadAltiumExtendedPrimitiveInformationTypeFromProperties()

static AEXTENDED_PRIMITIVE_INFORMATION_TYPE ReadAltiumExtendedPrimitiveInformationTypeFromProperties ( const std::map< wxString, wxString > & aProps,
wxString aKey )
static

◆ ReadAltiumModeFromProperties()

static ALTIUM_MODE ReadAltiumModeFromProperties ( const std::map< wxString, wxString > & aProps,
wxString aKey )
static

◆ ReadAltiumRecordFromProperties()

static ALTIUM_RECORD ReadAltiumRecordFromProperties ( const std::map< wxString, wxString > & aProps,
wxString aKey )
static

◆ ReadAltiumStackupFromProperties()

static std::vector< ABOARD6_LAYER_STACKUP > ReadAltiumStackupFromProperties ( const std::map< wxString, wxString > & aProps)
static

◆ selectAltiumPolygonRule()

const ARULE6 * selectAltiumPolygonRule ( const std::vector< ARULE6 > & aRulesByPriorityAsc)

Select the highest Altium-priority rule whose scope references polygons.

Altium priority 1 is the most specific; larger numeric values are more general. aRulesByPriorityAsc must be sorted by ARULE6::priority in ascending numeric order so the first polygon-scoped match is also the highest Altium priority.

Returns nullptr if no rule references polygons.

Definition at line 71 of file altium_parser_pcb.cpp.

References altiumScopeExprMatchesPolygon().

Referenced by BOOST_AUTO_TEST_CASE(), and ALTIUM_PCB::GetRuleForPolygon().