KiCad PCB EDA Suite
ASCH_PIN Struct Reference

#include <altium_parser_sch.h>

Public Member Functions

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

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 191 of file altium_parser_sch.h.

Constructor & Destructor Documentation

◆ ASCH_PIN()

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

Definition at line 116 of file altium_parser_sch.cpp.

117 {
118  wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PIN );
119 
120  ownerindex =
121  ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
122  ownerpartid =
123  ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
125  ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
126 
127  name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
128  text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
129  designator = ALTIUM_PARSER::PropertiesReadString( aProperties, "DESIGNATOR", "" );
130 
131  int symbolOuterInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_OUTER", 0 );
132  symbolOuter = static_cast<ASCH_PIN_SYMBOL_OUTER>( symbolOuterInt );
133 
134  int symbolInnerInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_INNER", 0 );
135  symbolInner = static_cast<ASCH_PIN_SYMBOL_INNER>( symbolInnerInt );
136 
137  int symbolOuterEdgeInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_OUTEREDGE", 0 );
138  symbolOuterEdge = ( symbolOuterEdgeInt == 0 || symbolOuterEdgeInt == 1
139  || symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
140  static_cast<ASCH_PIN_SYMBOL_OUTEREDGE>( symbolOuterEdgeInt ) :
142 
143  int symbolInnerEdgeInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_INNEREDGE", 0 );
144  symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
145  static_cast<ASCH_PIN_SYMBOL_INNEREDGE>( symbolInnerEdgeInt ) :
147  electrical = PropertiesReadEnum<ASCH_PIN_ELECTRICAL>(
148  aProperties, "ELECTRICAL", 0, 7, ASCH_PIN_ELECTRICAL::INPUT );
149 
150  int pinconglomerate = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINCONGLOMERATE", 0 );
151 
152  orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
153  showPinName = ( pinconglomerate & 0x08 ) != 0;
154  showDesignator = ( pinconglomerate & 0x10 ) != 0;
155 
156  int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
157  int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
158  int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
159  int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
160  location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
161 
162  int p = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH", 0 );
163  int pfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH_FRAC", 0 );
164  pinlength = Altium2KiCadUnit( p, pfrac );
165 
166  // this code calculates the location as required by KiCad without rounding error attached
167  int kicadX = x;
168  int kicadXfrac = xfrac;
169  int kicadY = y;
170  int kicadYfrac = yfrac;
171 
172  switch( orientation )
173  {
175  kicadX += p;
176  kicadXfrac += pfrac;
177  break;
179  kicadY += p;
180  kicadYfrac += pfrac;
181  break;
183  kicadX -= p;
184  kicadXfrac -= pfrac;
185  break;
187  kicadY -= p;
188  kicadYfrac -= pfrac;
189  break;
190  default:
191  wxLogWarning( "Pin has unexpected orientation" );
192  break;
193  }
194  kicadLocation = wxPoint(
195  Altium2KiCadUnit( kicadX, kicadXfrac ), -Altium2KiCadUnit( kicadY, kicadYfrac ) );
196 }
wxString text
static int PropertiesReadInt(const std::map< wxString, wxString > &aProperties, const wxString &aKey, int aDefault)
int ownerpartdisplaymode
wxPoint kicadLocation
wxPoint location
constexpr int Altium2KiCadUnit(const int val, const int frac)
wxString name
wxString designator
ALTIUM_SCH_RECORD PropertiesReadRecord(const std::map< wxString, wxString > &aProperties)
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
const int ALTIUM_COMPONENT_NONE
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL_OUTER symbolOuter
static wxString PropertiesReadString(const std::map< wxString, wxString > &aProperties, const wxString &aKey, const wxString &aDefault)
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge

References Altium2KiCadUnit(), ALTIUM_COMPONENT_NONE, designator, DOWNWARDS, electrical, INPUT, kicadLocation, LEFTWARDS, location, name, NO_SYMBOL, orientation, ownerindex, ownerpartdisplaymode, ownerpartid, PIN, pinlength, ALTIUM_PARSER::PropertiesReadInt(), PropertiesReadRecord(), ALTIUM_PARSER::PropertiesReadString(), RIGHTWARDS, showDesignator, showPinName, symbolInner, symbolInnerEdge, symbolOuter, symbolOuterEdge, text, and UPWARDS.

Member Data Documentation

◆ designator

wxString ASCH_PIN::designator

Definition at line 199 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 207 of file altium_parser_sch.h.

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

◆ kicadLocation

wxPoint ASCH_PIN::kicadLocation

Definition at line 213 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ location

wxPoint ASCH_PIN::location

Definition at line 210 of file altium_parser_sch.h.

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

◆ name

wxString ASCH_PIN::name

Definition at line 197 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 208 of file altium_parser_sch.h.

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

◆ ownerindex

int ASCH_PIN::ownerindex

Definition at line 193 of file altium_parser_sch.h.

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

◆ ownerpartdisplaymode

int ASCH_PIN::ownerpartdisplaymode

Definition at line 195 of file altium_parser_sch.h.

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

◆ ownerpartid

int ASCH_PIN::ownerpartid

Definition at line 194 of file altium_parser_sch.h.

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

◆ pinlength

int ASCH_PIN::pinlength

Definition at line 211 of file altium_parser_sch.h.

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

◆ showDesignator

bool ASCH_PIN::showDesignator

Definition at line 216 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ showPinName

bool ASCH_PIN::showPinName

Definition at line 215 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ symbolInner

ASCH_PIN_SYMBOL_INNER ASCH_PIN::symbolInner

Definition at line 202 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ symbolInnerEdge

ASCH_PIN_SYMBOL_INNEREDGE ASCH_PIN::symbolInnerEdge

Definition at line 205 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 201 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ symbolOuterEdge

ASCH_PIN_SYMBOL_OUTEREDGE ASCH_PIN::symbolOuterEdge

Definition at line 204 of file altium_parser_sch.h.

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

◆ text

wxString ASCH_PIN::text

Definition at line 198 of file altium_parser_sch.h.

Referenced by ASCH_PIN().


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