KiCad PCB EDA Suite
ASCH_PIN Struct Reference

#include <altium_parser_sch.h>

Public Member Functions

 ASCH_PIN (const std::map< wxString, wxString > &aProps)
 

Public Attributes

int ownerindex
 
int ownerpartid
 
int ownerpartdisplaymode
 
wxString name
 
wxString text
 
wxString designator
 
ASCH_PIN_SYMBOL_OUTER symbolOuter
 
ASCH_PIN_SYMBOL_INNER symbolInner
 
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
 
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
 
ASCH_PIN_ELECTRICAL electrical
 
ASCH_RECORD_ORIENTATION orientation
 
wxPoint location
 
int pinlength
 
wxPoint kicadLocation
 
bool showPinName
 
bool showDesignator
 

Detailed Description

Definition at line 193 of file altium_parser_sch.h.

Constructor & Destructor Documentation

◆ ASCH_PIN()

ASCH_PIN::ASCH_PIN ( const std::map< wxString, wxString > &  aProps)
explicit

Definition at line 126 of file altium_parser_sch.cpp.

127 {
128  wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PIN );
129 
130  ownerindex = ReadOwnerIndex( aProps );
131  ownerpartid = ReadOwnerPartId( aProps );
132  ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
133 
134  name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
135  text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
136  designator = ALTIUM_PARSER::ReadString( aProps, "DESIGNATOR", "" );
137 
138  int symbolOuterInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTER", 0 );
139  symbolOuter = static_cast<ASCH_PIN_SYMBOL_OUTER>( symbolOuterInt );
140 
141  int symbolInnerInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNER", 0 );
142  symbolInner = static_cast<ASCH_PIN_SYMBOL_INNER>( symbolInnerInt );
143 
144  int symbolOuterEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTEREDGE", 0 );
145  symbolOuterEdge = ( symbolOuterEdgeInt == 0 || symbolOuterEdgeInt == 1
146  || symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
147  static_cast<ASCH_PIN_SYMBOL_OUTEREDGE>( symbolOuterEdgeInt ) :
149 
150  int symbolInnerEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNEREDGE", 0 );
151  symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
152  static_cast<ASCH_PIN_SYMBOL_INNEREDGE>( symbolInnerEdgeInt ) :
154  electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps, "ELECTRICAL", 0, 7,
156 
157  int pinconglomerate = ALTIUM_PARSER::ReadInt( aProps, "PINCONGLOMERATE", 0 );
158 
159  orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
160  showPinName = ( pinconglomerate & 0x08 ) != 0;
161  showDesignator = ( pinconglomerate & 0x10 ) != 0;
162 
163  int x = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X", 0 );
164  int xfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X_FRAC", 0 );
165  int y = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y", 0 );
166  int yfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y_FRAC", 0 );
167  location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
168 
169  int p = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH", 0 );
170  int pfrac = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH_FRAC", 0 );
171  pinlength = Altium2KiCadUnit( p, pfrac );
172 
173  // this code calculates the location as required by KiCad without rounding error attached
174  int kicadX = x;
175  int kicadXfrac = xfrac;
176  int kicadY = y;
177  int kicadYfrac = yfrac;
178 
179  switch( orientation )
180  {
182  kicadX += p;
183  kicadXfrac += pfrac;
184  break;
186  kicadY += p;
187  kicadYfrac += pfrac;
188  break;
190  kicadX -= p;
191  kicadXfrac -= pfrac;
192  break;
194  kicadY -= p;
195  kicadYfrac -= pfrac;
196  break;
197  default:
198  wxLogWarning( "Pin has unexpected orientation" );
199  break;
200  }
201 
202  kicadLocation = wxPoint( Altium2KiCadUnit( kicadX, kicadXfrac ),
203  -Altium2KiCadUnit( kicadY, kicadYfrac ) );
204 }
wxString text
int ownerpartdisplaymode
wxPoint kicadLocation
wxPoint location
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
constexpr int Altium2KiCadUnit(const int val, const int frac)
wxString name
wxString designator
int ReadOwnerPartId(const std::map< wxString, wxString > &aProperties)
ALTIUM_SCH_RECORD ReadRecord(const std::map< wxString, wxString > &aProps)
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
int ReadOwnerIndex(const std::map< wxString, wxString > &aProperties)
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL_OUTER symbolOuter
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge

References Altium2KiCadUnit(), designator, DOWNWARDS, electrical, INPUT, kicadLocation, LEFTWARDS, location, name, NO_SYMBOL, orientation, ownerindex, ownerpartdisplaymode, ownerpartid, PIN, pinlength, ALTIUM_PARSER::ReadInt(), ReadOwnerIndex(), ReadOwnerPartId(), ReadRecord(), ALTIUM_PARSER::ReadString(), RIGHTWARDS, showDesignator, showPinName, symbolInner, symbolInnerEdge, symbolOuter, symbolOuterEdge, text, and UPWARDS.

Member Data Documentation

◆ designator

wxString ASCH_PIN::designator

Definition at line 201 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ electrical

ASCH_PIN_ELECTRICAL ASCH_PIN::electrical

Definition at line 209 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ kicadLocation

wxPoint ASCH_PIN::kicadLocation

Definition at line 215 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ location

wxPoint ASCH_PIN::location

Definition at line 212 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ name

wxString ASCH_PIN::name

Definition at line 199 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ orientation

ASCH_RECORD_ORIENTATION ASCH_PIN::orientation

Definition at line 210 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ ownerindex

int ASCH_PIN::ownerindex

Definition at line 195 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ ownerpartdisplaymode

int ASCH_PIN::ownerpartdisplaymode

Definition at line 197 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ ownerpartid

int ASCH_PIN::ownerpartid

Definition at line 196 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ pinlength

int ASCH_PIN::pinlength

Definition at line 213 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ showDesignator

bool ASCH_PIN::showDesignator

Definition at line 218 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ showPinName

bool ASCH_PIN::showPinName

Definition at line 217 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ symbolInner

ASCH_PIN_SYMBOL_INNER ASCH_PIN::symbolInner

Definition at line 204 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ symbolInnerEdge

ASCH_PIN_SYMBOL_INNEREDGE ASCH_PIN::symbolInnerEdge

Definition at line 207 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ symbolOuter

ASCH_PIN_SYMBOL_OUTER ASCH_PIN::symbolOuter

Definition at line 203 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ symbolOuterEdge

ASCH_PIN_SYMBOL_OUTEREDGE ASCH_PIN::symbolOuterEdge

Definition at line 206 of file altium_parser_sch.h.

Referenced by ASCH_PIN(), and SCH_ALTIUM_PLUGIN::ParsePin().

◆ text

wxString ASCH_PIN::text

Definition at line 200 of file altium_parser_sch.h.

Referenced by ASCH_PIN().


The documentation for this struct was generated from the following files: