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
 
VECTOR2I location
 
int pinlength
 
VECTOR2I kicadLocation
 
bool showPinName
 
bool showDesignator
 

Detailed Description

Definition at line 218 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 144 of file altium_parser_sch.cpp.

145{
146 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PIN );
147
148 ownerindex = ReadOwnerIndex( aProps );
149 ownerpartid = ReadOwnerPartId( aProps );
150 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
151
152 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
153 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
154 designator = ALTIUM_PARSER::ReadString( aProps, "DESIGNATOR", "" );
155
156 int symbolOuterInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTER", 0 );
157 symbolOuter = static_cast<ASCH_PIN_SYMBOL_OUTER>( symbolOuterInt );
158
159 int symbolInnerInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNER", 0 );
160 symbolInner = static_cast<ASCH_PIN_SYMBOL_INNER>( symbolInnerInt );
161
162 int symbolOuterEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTEREDGE", 0 );
163 symbolOuterEdge = ( symbolOuterEdgeInt == 0 || symbolOuterEdgeInt == 1
164 || symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
165 static_cast<ASCH_PIN_SYMBOL_OUTEREDGE>( symbolOuterEdgeInt ) :
167
168 int symbolInnerEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNEREDGE", 0 );
169 symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
170 static_cast<ASCH_PIN_SYMBOL_INNEREDGE>( symbolInnerEdgeInt ) :
172 electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps, "ELECTRICAL", 0, 7,
174
175 int pinconglomerate = ALTIUM_PARSER::ReadInt( aProps, "PINCONGLOMERATE", 0 );
176
177 orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
178 showPinName = ( pinconglomerate & 0x08 ) != 0;
179 showDesignator = ( pinconglomerate & 0x10 ) != 0;
180
181 int x = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X", 0 );
182 int xfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X_FRAC", 0 );
183 int y = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y", 0 );
184 int yfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y_FRAC", 0 );
185 location = VECTOR2I( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
186
187 int p = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH", 0 );
188 int pfrac = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH_FRAC", 0 );
189 pinlength = Altium2KiCadUnit( p, pfrac );
190
191 // this code calculates the location as required by KiCad without rounding error attached
192 int kicadX = x;
193 int kicadXfrac = xfrac;
194 int kicadY = y;
195 int kicadYfrac = yfrac;
196
197 switch( orientation )
198 {
200 kicadX += p;
201 kicadXfrac += pfrac;
202 break;
203
205 kicadY += p;
206 kicadYfrac += pfrac;
207 break;
208
210 kicadX -= p;
211 kicadXfrac -= pfrac;
212 break;
213
215 kicadY -= p;
216 kicadYfrac -= pfrac;
217 break;
218
219 default:
220 wxLogWarning( "Pin has unexpected orientation" );
221 break;
222 }
223
224 kicadLocation = VECTOR2I( Altium2KiCadUnit( kicadX, kicadXfrac ),
225 -Altium2KiCadUnit( kicadY, kicadYfrac ) );
226}
int ReadOwnerPartId(const std::map< wxString, wxString > &aProperties)
int ReadOwnerIndex(const std::map< wxString, wxString > &aProperties)
constexpr int Altium2KiCadUnit(const int val, const int frac)
ALTIUM_SCH_RECORD ReadRecord(const std::map< wxString, wxString > &aProps)
ASCH_PIN_SYMBOL_INNER
ASCH_RECORD_ORIENTATION
ASCH_PIN_SYMBOL_INNEREDGE
ASCH_PIN_SYMBOL_OUTER
ASCH_PIN_SYMBOL_OUTEREDGE
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_SYMBOL_OUTER symbolOuter
VECTOR2I location
int ownerpartdisplaymode
wxString name
wxString text
VECTOR2I kicadLocation
wxString designator
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

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

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

◆ kicadLocation

VECTOR2I ASCH_PIN::kicadLocation

Definition at line 240 of file altium_parser_sch.h.

Referenced by ASCH_PIN().

◆ location

VECTOR2I ASCH_PIN::location

Definition at line 237 of file altium_parser_sch.h.

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

◆ name

wxString ASCH_PIN::name

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

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

◆ ownerindex

int ASCH_PIN::ownerindex

Definition at line 220 of file altium_parser_sch.h.

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

◆ ownerpartdisplaymode

int ASCH_PIN::ownerpartdisplaymode

Definition at line 222 of file altium_parser_sch.h.

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

◆ ownerpartid

int ASCH_PIN::ownerpartid

Definition at line 221 of file altium_parser_sch.h.

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

◆ pinlength

int ASCH_PIN::pinlength

Definition at line 238 of file altium_parser_sch.h.

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

◆ showDesignator

bool ASCH_PIN::showDesignator

Definition at line 243 of file altium_parser_sch.h.

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

◆ showPinName

bool ASCH_PIN::showPinName

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

Referenced by ASCH_PIN().

◆ symbolInnerEdge

ASCH_PIN_SYMBOL_INNEREDGE ASCH_PIN::symbolInnerEdge

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

Referenced by ASCH_PIN().

◆ symbolOuterEdge

ASCH_PIN_SYMBOL_OUTEREDGE ASCH_PIN::symbolOuterEdge

Definition at line 231 of file altium_parser_sch.h.

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

◆ text

wxString ASCH_PIN::text

Definition at line 225 of file altium_parser_sch.h.

Referenced by ASCH_PIN().


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