KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PADS_COMMON Namespace Reference

Classes

struct  RELATED_FILES
 Result of detecting related PADS project files. More...
 

Enumerations

enum class  PADS_FILE_TYPE { UNKNOWN , PCB_ASCII , SCHEMATIC_ASCII }
 Types of PADS files that can be detected. More...
 

Functions

KIID GenerateDeterministicUuid (const std::string &aIdentifier)
 Generate a deterministic KIID from a PADS component identifier.
 
PADS_FILE_TYPE DetectPadsFileType (const wxString &aFilePath)
 Detect the type of a PADS file by examining its header.
 
RELATED_FILES FindRelatedPadsFiles (const wxString &aFilePath)
 Find related PADS project files from a given source file.
 
int ParseInt (const std::string &aStr, int aDefault=0, const std::string &aContext={})
 Parse integer from string with error context.
 
double ParseDouble (const std::string &aStr, double aDefault=0.0, const std::string &aContext={})
 Parse double from string with error context.
 
wxString ConvertInvertedNetName (const std::string &aNetName)
 Convert a PADS net name to KiCad format, handling inverted signal notation.
 
wxString ConvertText (const std::string &aText)
 Decode text from a PADS file, which uses an 8-bit codepage rather than UTF-8.
 
LINE_STYLE PadsLineStyleToKiCad (int aPadsStyle)
 Convert a PADS line style integer to a KiCad LINE_STYLE enum value.
 
void DecodeJustification (int aJustification, GR_TEXT_H_ALIGN_T &aHJustify, GR_TEXT_V_ALIGN_T &aVJustify)
 Decode a PADS text justification code into KiCad horizontal and vertical alignment.
 

Enumeration Type Documentation

◆ PADS_FILE_TYPE

enum class PADS_COMMON::PADS_FILE_TYPE
strong

Types of PADS files that can be detected.

Enumerator
UNKNOWN 
PCB_ASCII 

PADS PowerPCB ASCII (.asc)

SCHEMATIC_ASCII 

PADS Logic ASCII (.asc or .txt)

Definition at line 62 of file pads_common.h.

Function Documentation

◆ ConvertInvertedNetName()

wxString PADS_COMMON::ConvertInvertedNetName ( const std::string & aNetName)

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.

Parameters
aNetNameRaw PADS net name.
Returns
Net name in KiCad notation.

Definition at line 289 of file pads_common.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::convertNetName(), PCB_IO_PADS::ensureNet(), PCB_IO_PADS_BINARY::ensureNet(), PCB_IO_PADS::generateDrcRules(), PCB_IO_PADS::loadBoardSetup(), PCB_IO_PADS::loadClusterGroups(), PCB_IO_PADS::loadCopperShapes(), PCB_IO_PADS::loadFootprints(), PCB_IO_PADS::loadTestPoints(), PCB_IO_PADS::loadTracksAndVias(), PCB_IO_PADS_BINARY::loadTracksAndVias(), PCB_IO_PADS::loadZones(), and PCB_IO_PADS_BINARY::loadZones().

◆ ConvertText()

wxString PADS_COMMON::ConvertText ( const std::string & aText)

Decode text from a PADS file, which uses an 8-bit codepage rather than UTF-8.

A direct UTF-8 conversion discards the whole string on the first high byte, so decode UTF-8 when valid and otherwise fall back to Windows-1252 / ISO-8859-1.

Parameters
aTextRaw text bytes from the PADS file.
Returns
Decoded wxString.

Definition at line 301 of file pads_common.cpp.

References result.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_IO_PADS::loadTexts().

◆ DecodeJustification()

void PADS_COMMON::DecodeJustification ( int aJustification,
GR_TEXT_H_ALIGN_T & aHJustify,
GR_TEXT_V_ALIGN_T & aVJustify )

Decode a PADS text justification code into KiCad horizontal and vertical alignment.

PADS encodes the anchor of a text string as a single integer combining a vertical band and a horizontal code: value = vertical_band + horizontal_code vertical bands bottom (0..1), top (2..7), middle (8..) horizontal codes left=0, right=1, center=4

The same encoding is used for free text, part field labels and net name labels, so both the PCB and schematic importers share this decode to stay consistent.

Parameters
aJustificationRaw PADS justification code.
aHJustifyReceives the decoded horizontal alignment.
aVJustifyReceives the decoded vertical alignment.

Definition at line 342 of file pads_common.cpp.

References GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_BOTTOM, GR_TEXT_V_ALIGN_CENTER, and GR_TEXT_V_ALIGN_TOP.

Referenced by PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::ApplyFieldSettings(), BOOST_AUTO_TEST_CASE(), createSchText(), and SCH_IO_PADS::LoadSchematicFile().

◆ DetectPadsFileType()

PADS_FILE_TYPE PADS_COMMON::DetectPadsFileType ( const wxString & aFilePath)

Detect the type of a PADS file by examining its header.

Parameters
aFilePathPath to the file to examine.
Returns
Detected file type.

Definition at line 98 of file pads_common.cpp.

References PCB_ASCII, SCHEMATIC_ASCII, and UNKNOWN.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), FindRelatedPadsFiles(), and KICAD_MANAGER_FRAME::ImportNonKiCadProject().

◆ FindRelatedPadsFiles()

RELATED_FILES PADS_COMMON::FindRelatedPadsFiles ( 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
Parameters
aFilePathPath to the source file being imported.
Returns
Structure containing paths to any related files found.

Definition at line 140 of file pads_common.cpp.

References DetectPadsFileType(), PCB_ASCII, result, SCHEMATIC_ASCII, and UNKNOWN.

Referenced by BOOST_AUTO_TEST_CASE(), and IMPORT_PROJ_HELPER::ImportPadsFiles().

◆ GenerateDeterministicUuid()

KIID PADS_COMMON::GenerateDeterministicUuid ( const std::string & aIdentifier)

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.

Parameters
aIdentifierString identifying the component (typically refdes or combination of part type and refdes).
Returns
A deterministic KIID that can be used for cross-probe linking.

Definition at line 36 of file pads_common.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PCB_IO_PADS::loadFootprints(), PCB_IO_PADS_BINARY::loadFootprints(), and SCH_IO_PADS::LoadSchematicFile().

◆ PadsLineStyleToKiCad()

LINE_STYLE PADS_COMMON::PadsLineStyleToKiCad ( int aPadsStyle)

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.

Definition at line 324 of file pads_common.cpp.

References DASH, DASHDOT, DASHDOTDOT, DOT, and SOLID.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PADS_SCH::PADS_SCH_SYMBOL_BUILDER::createShape(), PADS_SCH::PADS_SCH_SYMBOL_BUILDER::createShapes(), and SCH_IO_PADS::LoadSchematicFile().

◆ ParseDouble()

double PADS_COMMON::ParseDouble ( const std::string & aStr,
double aDefault = 0.0,
const std::string & aContext = {} )

Parse double from string with error context.

Returns aDefault on failure and logs a trace warning.

Definition at line 270 of file pads_common.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PADS_SCH::PADS_SCH_PARSER::parseGraphicPrimitive(), PADS_IO::PARSER::parseSectionPARTDECAL(), and PADS_IO::PARSER::parseSectionTEXT().

◆ ParseInt()