41#include <wx/translation.h>
87 return aWidth >= 0 && aWidth <= 2 ?
schIUScale.MilsToIU( 5 * ( aWidth + 1 ) ) : 0;
113int schMm(
double aMm )
119int dbuIu(
double aDbu )
152bool isBookkeepingProp(
const std::string& aName )
154 static const char*
const skipped[] = {
160 "Implementation Path",
161 "Implementation Type",
167 for(
const char*
name : skipped )
183 std::vector<std::string> missingOrder;
184 std::map<std::string, std::vector<const ORCAD_PLACED_INSTANCE*>> missing;
188 std::vector<const ORCAD_RAW_PAGE*> allPages;
191 allPages.push_back( &page );
193 for(
const auto& [folder, pages] :
m_design.childFolderPages )
196 allPages.push_back( &page );
206 auto [it, isNew] = missing.try_emplace( inst.
pkgName );
209 missingOrder.push_back( inst.
pkgName );
211 it->second.push_back( &inst );
215 for(
const std::string&
name : missingOrder )
217 const std::vector<const ORCAD_PLACED_INSTANCE*>& insts = missing[
name];
219 note( wxString::Format(
_(
"Symbol '%s' is absent from the design cache; synthesized "
220 "placeholder from %d instance(s)." ),
240 auto stripView = [](
const std::string& aName ) -> std::string
242 size_t dot = aName.rfind(
'.' );
244 if( dot != std::string::npos )
246 std::string view = aName.substr( dot + 1 );
248 if( view ==
"Normal" || view ==
"Convert" )
249 return aName.substr( 0, dot );
255 for(
auto& [cacheName, def] :
m_design.symbols )
261 bool convertView = cacheName.size() > 8
262 && cacheName.compare( cacheName.size() - 8, 8,
".Convert" ) == 0;
263 std::string base = stripView( cacheName );
264 std::string libname =
SymbolId( base );
270 if( !ls.
name.empty() )
273 if( convertView &&
m_design.symbols.count( base +
".Normal" ) )
278 std::string bare = base.substr( 0, base.find(
'.' ) );
281 for(
const std::string& key : { base, bare } )
283 auto pkgIt =
m_design.packages.find( key );
285 if( pkgIt !=
m_design.packages.end() )
287 pkg = &pkgIt->second;
299 std::vector<std::string> pinNumbers;
301 if( pkg && !pkg->
devices.empty() )
302 pinNumbers = pkg->
devices.front().pinNumbers;
304 ls.
units.push_back( {
"A", &def, pinNumbers } );
309 std::vector<LIB_SYMBOL*> out;
317 out.push_back(
static_cast<LIB_SYMBOL*
>( symbol->Duplicate() ) );
319 catch(
const std::exception& )
330 const std::vector<const ORCAD_PLACED_INSTANCE*>& aInstances )
const
347 int det = e.
a * e.
d - e.
b * e.
c;
351 return { ( e.
d * aX - e.
b * aY ) / det, ( -e.
c * aX + e.
a * aY ) / det };
355 std::vector<ORCAD_POINT> r;
358 r.push_back( inv( t.
x - ref->
x, t.
y - ref->
y ) );
360 std::vector<char> sides;
368 int x0 = r.front().x;
369 int x1 = r.front().x;
370 int y0 = r.front().y;
371 int y1 = r.front().y;
375 x0 = std::min( x0, p.x );
376 x1 = std::max( x1, p.x );
377 y0 = std::min( y0, p.y );
378 y1 = std::max( y1, p.y );
381 bool horizFirst = ( x1 - x0 ) >= ( y1 - y0 );
385 std::vector<char> cand;
388 cand.push_back(
'L' );
391 cand.push_back(
'R' );
394 cand.push_back(
'T' );
397 cand.push_back(
'B' );
401 sides.push_back( 0 );
407 char pick = cand.front();
411 bool isTB = c ==
'T' || c ==
'B';
413 if( isTB != horizFirst )
420 sides.push_back( pick );
423 auto hasSide = [&](
char aSide )
425 return std::find( sides.begin(), sides.end(), aSide ) != sides.end();
435 int m = (int) std::floor( ( bx1 + bx2 ) / 2.0 );
442 int m = (int) std::floor( ( by1 + by2 ) / 2.0 );
453 bx1 = std::min( c1.
x, c2.
x );
454 bx2 = std::max( c1.
x, c2.
x );
455 by1 = std::min( c1.
y, c2.
y );
456 by2 = std::max( c1.
y, c2.
y );
480 for(
size_t i = 0; i < r.size(); ++i )
482 int px = r[i].x - s.
x;
483 int py = r[i].y - s.
y;
497 pin.startX = px + ddx;
498 pin.startY = py + ddy;
515 const std::string& v = aInst.
pkgName;
517 std::string tail = ( !base.empty() && v.compare( 0, base.size(), base ) == 0 )
518 ? v.substr( base.size() )
521 size_t dot = tail.find(
'.' );
522 std::string unit = tail.substr( 0, dot );
523 std::string view = dot == std::string::npos ? std::string() : tail.substr( dot + 1 );
527 std::string lower = view;
529 std::transform( lower.begin(), lower.end(), lower.begin(),
530 [](
unsigned char c )
532 return (char) std::tolower( c );
537 if( lower !=
"normal" )
545std::pair<const ORCAD_SYMBOL_DEF*, int>
551 return {
nullptr, 0 };
555 std::vector<const ORCAD_SYMBOL_DEF*> variants;
556 variants.push_back( prime );
559 variants.push_back( &v );
561 if( aInst.
pins.empty() || variants.size() == 1 )
566 for(
size_t vi = 0; vi < variants.size(); ++vi )
570 if( sym->
pins.size() != aInst.
pins.size() )
576 for(
size_t i = 0; i < sym->
pins.size(); ++i )
579 aInst.
y, sym->
pins[i].hotptX,
580 sym->
pins[i].hotptY );
582 if( calc.
x != aInst.
pins[i].x || calc.
y != aInst.
pins[i].y )
590 return { sym, (int) vi };
607 return found->second;
617 warn( wxString::Format(
_(
"No cached symbol for '%s' (%s); placeholder emitted." ),
624 if( slot.
name.empty() )
634 auto pkgIt =
m_design.packages.find( base );
636 if( pkgIt !=
m_design.packages.end() )
637 pkg = &pkgIt->second;
641 std::vector<std::string> pinNumbers;
642 std::string bare = letter.substr( 0, letter.find(
':' ) );
646 bool foundDevice =
false;
658 if( !foundDevice && !pkg->
devices.empty() && bare.empty() )
659 pinNumbers = pkg->
devices.front().pinNumbers;
662 std::string libname =
SymbolId( base );
665 libname +=
"_v" + std::to_string( vi + 1 );
669 if( ls.
name.empty() )
678 for(
size_t i = 0; i < ls.
units.size(); ++i )
680 if( ls.
units[i].letter == letter )
682 unitNo = (int) i + 1;
693 ls.
units.push_back( std::move( unit ) );
695 std::stable_sort( ls.
units.begin(), ls.
units.end(),
698 return a.letter < b.letter;
701 for(
size_t i = 0; i < ls.
units.size(); ++i )
703 if( ls.
units[i].letter == letter )
705 unitNo = (int) i + 1;
714 if( mapIt->second.first == libname )
720 for(
size_t i = 0; i < ls.
units.size(); ++i )
731 return { libname, unitNo };
736 const std::string& aNetName )
740 std::string libname =
"PWR_" +
SymbolId( aNetName );
746 auto it =
m_design.symbols.find( aSymbolName );
757 if( slot.
name.empty() )
760 slot.
name = aSymbolName;
775 ls.
units.push_back( std::move( unit ) );
797 std::unique_ptr<LIB_SYMBOL> symbol = std::make_unique<LIB_SYMBOL>(
name );
799 symbol->SetPinNameOffset( schMm( 0.254 ) );
808 symbol->SetShowPinNumbers( ( flags & 0x01 ) != 0 );
809 symbol->SetShowPinNames( ( flags & 0x04 ) == 0 );
815 symbol->SetGlobalPower();
817 if( (
int) entry.
units.size() > 1 )
818 symbol->SetUnitCount( (
int) entry.
units.size(),
false );
827 SCH_FIELD& refField = symbol->GetReferenceField();
828 SCH_FIELD& valField = symbol->GetValueField();
832 refField.
SetText( wxS(
"#PWR" ) );
855 symbol->GetFootprintField().SetVisible(
false );
856 symbol->GetDatasheetField().SetVisible(
false );
858 for(
size_t ui = 0; ui < entry.
units.size(); ++ui )
861 int unitNo = (int) ui + 1;
869 for(
size_t pi = 0; pi < unit.
symbol->
pins.size(); ++pi )
874 wxString number = position < static_cast<int>( unit.
pinNumbers.size() )
876 : wxString::Format( wxS(
"%d" ), (
int) pi + 1 );
878 if( !sourcePin.
name.empty()
893 int aOffsetX,
int aOffsetY )
897 auto toX = [aOffsetX](
int aV )
901 auto toY = [aOffsetY](
int aV )
919 shape->
SetStroke( strokeFor( aPrim, aColor ) );
931 shape->
SetStroke( strokeFor( aPrim, aColor ) );
941 if( aPrim.
points.size() < 2 )
951 if( isPolygon && aPrim.
points.front() != aPrim.
points.back() )
953 toY( aPrim.
points.front().y ) ) );
955 shape->
SetStroke( strokeFor( aPrim, aColor ) );
964 if( aPrim.
points.size() < 4 || ( aPrim.
points.size() - 1 ) % 3 != 0 )
966 if( aPrim.
points.size() >= 2 )
973 shape->
SetStroke( strokeFor( aPrim, aColor ) );
982 for(
size_t i = 0; i + 3 < aPrim.
points.size(); i += 3 )
989 shape->
SetStroke( strokeFor( aPrim, aColor ) );
1000 double cx = ( aPrim.
x1 + aPrim.
x2 ) / 2.0;
1001 double cy = ( aPrim.
y1 + aPrim.
y2 ) / 2.0;
1011 shape->
SetStroke( strokeFor( aPrim, aColor ) );
1021 for(
int k = 0; k <= 32; ++k )
1023 double a = 2.0 *
M_PI * k / 32.0;
1025 dbuIu( cy + ry * std::sin( a ) ) ) );
1028 shape->
SetStroke( strokeFor( aPrim, aColor ) );
1051 text->SetUnit( aUnit );
1064 int aOffsetX,
int aOffsetY )
1069 double cx = ( aPrim.
x1 + aPrim.
x2 ) / 2.0;
1070 double cy = ( aPrim.
y1 + aPrim.
y2 ) / 2.0;
1080 double a0 = std::atan2( ( aPrim.
start->y - cy ) / ry, ( aPrim.
start->x - cx ) / rx );
1081 double a1 = std::atan2( ( aPrim.
end->y - cy ) / ry, ( aPrim.
end->x - cx ) / rx );
1088 int steps = std::max( 4, (
int) (
std::abs( a1 - a0 ) / (
M_PI / 16.0 ) ) );
1093 for(
int k = 0; k <= steps; ++k )
1095 double a = a0 + ( a1 - a0 ) * k / steps;
1097 VECTOR2I( dbuIu( cx + rx * std::cos( a ) + aOffsetX ), dbuIu( cy + ry * std::sin( a ) + aOffsetY ) ) );
1100 shape->
SetStroke( strokeFor( aPrim, aColor ) );
1108 const wxString& aNumber,
int aUnit,
bool aPower,
1109 const std::string& aNameOverride )
1132 pin->SetOrientation( orientation );
1135 bool isClock = ( aPin.
shapeBits & 0x2 ) != 0;
1136 bool isDot = ( aPin.
shapeBits & 0x4 ) != 0;
1138 if( isClock && isDot )
1150 pin->SetVisible(
false );
1160 if( !aNameOverride.empty() )
1162 else if( !aPin.
name.empty() && aPin.
name.compare( 0, 4,
"$PIN" ) != 0 )
1166 if(
name == aNumber )
1167 name = wxEmptyString;
1170 pin->SetNumber( aNumber );
1171 pin->SetNameTextSize( schMm( 1.27 ) );
1172 pin->SetNumberTextSize( schMm( 1.27 ) );
1173 pin->SetUnit( aUnit );
1180 switch( aOrient & 7 )
1205 int w = bb.
x2 - bb.
x1;
1206 int h = bb.
y2 - bb.
y1;
1213 if( !aInst.
pins.empty() && aInst.
pins.size() == def.
pins.size() )
1217 for(
size_t i = 0; i < def.
pins.size(); ++i )
1220 def.
pins[i].hotptY );
1222 if( calc.
x != aInst.
pins[i].x || calc.
y != aInst.
pins[i].y )
1233 note( wxString::Format(
_(
"Page %s: %s uses a synthesized placeholder at a "
1234 "different orientation; pin layout approximate." ),
1240 warn( wxString::Format(
_(
"Page %s: %s pin positions mismatch (orientation %d); "
1241 "geometry may be off." ),
1259 std::string value = aInst.
value;
1263 auto vIt = aInst.
props.find(
"Value" );
1265 if( vIt != aInst.
props.end() )
1266 value = vIt->second;
1272 std::string footprint;
1273 auto fIt = aInst.
props.find(
"PCB Footprint" );
1275 if( fIt != aInst.
props.end() )
1276 footprint = fIt->second;
1278 if( footprint.empty() )
1285 symbol->
SetRef( &aSheetPath, reference );
1291 if( def.
pins.empty() && aInst.
pins.empty() )
1294 aScreen->
Append( symbol );
1301 if(
pin.wordA == 0 )
1321 if( !occurrence.IsEmpty() && !occurrence.EndsWith( wxS(
"?" ) ) )
1322 reference = occurrence;
1326 if( reference.IsEmpty() )
1327 reference = wxS(
"?" );
1334 const std::string& aNet,
SCH_SCREEN* aScreen,
1343 int w = bb.
x2 - bb.
x1;
1344 int h = bb.
y2 - bb.
y1;
1349 int bx = hasBbox ? std::min( aInst.
bbox.
x1, aInst.
bbox.
x2 ) : aInst.
x;
1350 int by = hasBbox ? std::min( aInst.
bbox.
y1, aInst.
bbox.
y2 ) : aInst.
y;
1355 wxString reference = wxString::Format( wxS(
"#PWR%04d" ),
m_powerCount );
1388 if( pinPos.
y <= bymin + ( bymax - bymin ) / 4.0 )
1413 symbol->
SetRef( &aSheetPath, reference );
1416 aScreen->
Append( symbol );
1422 const std::string& aValue,
1423 const std::string& aFootprint )
1428 int w = bb.
x2 - bb.
x1;
1429 int h = bb.
y2 - bb.
y1;
1434 int bxmin = std::min( c1.
x, c2.
x );
1435 int bxmax = std::max( c1.
x, c2.
x );
1436 int bymin = std::min( c1.
y, c2.
y );
1437 int bymax = std::max( c1.
y, c2.
y );
1445 bool vertical = angle == 90 || angle == 270;
1449 bool showRef =
false;
1450 bool showVal =
false;
1454 bool visible = ( dp.
dispMode & 0x100 ) != 0;
1456 if( dp.
name ==
"Part Reference" )
1458 else if( dp.
name ==
"Value" )
1469 bool side = !vertical && aDef.
pins.size() == 2 && aInst.
pins.size() == 2
1476 int ry = showVal ? cym - schMm( 0.9 ) : cym;
1509 if( !fpName.IsEmpty() )
1528 std::map<std::string, std::pair<VECTOR2I, const ORCAD_DISPLAY_PROP*>> shown;
1539 bool textVertical = ( aDp->rotation & 1 ) != 0;
1545 auto applyDisplayPos = [&](
SCH_FIELD* aField,
const char* aName )
1547 auto it = shown.find( aName );
1549 if( it == shown.end() )
1566 applyDisplayPos( refField,
"Part Reference" );
1567 applyDisplayPos( valField,
"Value" );
1569 for(
const auto& [propName, propValue] : aInst.
props )
1571 if( propName ==
"Value" || propName ==
"PCB Footprint" || isBookkeepingProp( propName ) )
1577 auto sIt = shown.find( propName );
1579 if( sIt != shown.end() )
1609 std::map<int, int> counts;
1610 std::vector<int> order;
1612 auto tally = [&](
int aFontIdx )
1619 auto [it, isNew] = counts.try_emplace( height, 0 );
1622 order.push_back( height );
1645 for(
int height : order )
1647 if( counts[height] > bestCount )
1650 bestCount = counts[height];
1660 if( aFontIdx > 0 && aFontIdx <= (
int)
m_design.library.fonts.size() )
1672 return schMm( 1.27 );
1679 mm = std::max( 0.7, std::min( 5.0, mm ) );
1684 mm = std::round( height * 25.4 * 0.75 / 96.0 * 100.0 ) / 100.0;
1685 mm = std::max( 0.7, mm );
1694 if( !aText || aFontIdx <= 0 || aFontIdx >
static_cast<int>(
m_design.library.fonts.size() ) )
1701 if( !font.
face.empty() )
1713 for(
unsigned char c : aName )
1716 bool separator = c ==
':' || c ==
'"' || c ==
'/' || c ==
' ' || c ==
'\t' || c ==
'\n'
1717 || c ==
'\r' || c ==
'\f' || c ==
'\v' || c == 0xA0;
1733 size_t first = out.find_first_not_of(
'_' );
1735 if( first == std::string::npos )
1738 size_t last = out.find_last_not_of(
'_' );
1739 out = out.substr( first, last - first + 1 );
1741 return out.empty() ?
"SYM" : out;
constexpr EDA_IU_SCALE schIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr Vec Centre() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
virtual void SetEnd(const VECTOR2I &aEnd)
virtual void SetBezierC2(const VECTOR2I &aPt)
virtual void SetBezierC1(const VECTOR2I &aPt)
void SetFillMode(FILL_T aFill)
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
void SetTextColor(const COLOR4D &aColor)
virtual void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual void SetTextPos(const VECTOR2I &aPoint)
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetVisible(bool aVisible)
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
A logical library item identifier and consists of various portions much like a URI.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
Define a library symbol object.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
void placePowerSymbol(ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst, const std::string &aNet, SCH_SCREEN *aScreen, const SCH_SHEET_PATH &aSheetPath)
Place one power symbol: transform base = placed bbox min corner (fall back to the anchor when the bbo...
void prepareSymbols()
Pre-pass over all pages: synthesize placeholder definitions for symbols absent from the cache (one no...
void computeFontBaseline()
Find the design's dominant text height (most frequent font height over all alias and display-prop fon...
std::pair< std::string, int > libForInstance(const ORCAD_PLACED_INSTANCE &aInst)
Resolve/register the emitted lib symbol and unit number for a placed part.
static constexpr int PIN_LEN_DBU
Standard OrCAD pin length used for synthesized placeholder pins, DBU.
std::pair< const ORCAD_SYMBOL_DEF *, int > pickVariant(const ORCAD_PLACED_INSTANCE &aInst) const
The cache may hold several stale library versions of one symbol name; pick the variant whose transfor...
const std::map< uint32_t, std::string > * m_currentOccRefs
Occurrence reference designators of the scope currently being converted; set per page so a child sche...
VECTOR2I graphicPinPos(const ORCAD_GRAPHIC_INST &aInst) const
Absolute connection point (DBU) of a GraphicInst-derived instance (power symbol / off-page connector ...
LIB_SYMBOL * kicadSymbolFor(const std::string &aLibName)
Return the fully built KiCad LIB_SYMBOL for a registered LIB_ENTRY, building and caching it on first ...
void addSymbolPin(LIB_SYMBOL *aSymbol, const ORCAD_SYMBOL_PIN &aPin, const wxString &aNumber, int aUnit, bool aPower, const std::string &aNameOverride)
Add one pin: position = hot point, length = |start - hot|, orientation from the start-relative-to-hot...
std::map< PKG_KEY, std::pair< std::string, int > > m_pkgToLib
void note(const wxString &aMsg)
Fact about the source design (not a conversion problem): RPT_SEVERITY_INFO.
void placeInstance(ORCAD_RAW_PAGE &aPage, const ORCAD_PLACED_INSTANCE &aInst, SCH_SCREEN *aScreen, const SCH_SHEET_PATH &aSheetPath)
Place one part instance on a screen: SCH_SYMBOL from the built LIB_SYMBOL (flattened-copy constructor...
int m_fontBaselineDbu
dominant text height; 0 = none
void placeSymbolFields(SCH_SYMBOL *aSymbol, const ORCAD_PLACED_INSTANCE &aInst, const ORCAD_SYMBOL_DEF &aDef, int aOrient, const std::string &aValue, const std::string &aFootprint)
KiCad-style field placement for a placed part, always reading horizontally (fields rotate with the sy...
void addSymbolArc(LIB_SYMBOL *aSymbol, const ORCAD_PRIMITIVE &aPrim, int aUnit, int aColor, int aOffsetX=0, int aOffsetY=0)
Polyline approximation of an arc primitive. Helper of addSymbolPrimitive().
int textSizeIU(int aFontIdx) const
Text size in IU for a font reference: 1.27 mm when the height is unknown; with a baseline,...
std::map< std::string, LIB_ENTRY > m_libSymbols
keyed by emitted lib name
void applyFont(EDA_TEXT *aText, int aFontIdx) const
static int toKicadOrientation(int aOrient)
Map an orientation code to the composed SYMBOL_ORIENTATION_T value for SCH_SYMBOL::SetOrientation(): ...
int m_powerCount
"#PWR%04d" counter
void placeDefinitionImages(const ORCAD_SYMBOL_DEF &aDefinition, int aBaseX, int aBaseY, int aOrient, SCH_SCREEN *aScreen)
wxString resolveReference(const ORCAD_PLACED_INSTANCE &aInst) const
Resolve a placed instance's reference designator, falling back to the Hierarchy-stream occurrence des...
std::string unitLetter(const ORCAD_PLACED_INSTANCE &aInst) const
Unit discriminator of an instance: the part of pkgName between the package base name and the '....
static std::string SymbolId(const std::string &aName)
LIB_ID-safe symbol name: ':', '"', '/' and whitespace runs -> '_'; "SYM" if empty.
void addSymbolPrimitive(LIB_SYMBOL *aSymbol, const ORCAD_PRIMITIVE &aPrim, int aUnit, int aColor, int aOffsetX=0, int aOffsetY=0)
Add one body primitive to a LIB_SYMBOL unit on LAYER_DEVICE.
ORCAD_SYMBOL_DEF synthesizeSymbol(const std::string &aPkgName, const std::vector< const ORCAD_PLACED_INSTANCE * > &aInstances) const
Best-effort placeholder for a cache-less symbol, built from the instances' T0x10 absolute pin records...
int fontHeightDbu(int aFontIdx) const
|lfHeight| of a 1-based font index; 0 for invalid/default indices.
std::string powerLibFor(const std::string &aSymbolName, const std::string &aNetName)
Resolve/register the power lib symbol for a power-symbol instance.
void warn(const wxString &aMsg)
Conversion problem: REPORTER at RPT_SEVERITY_WARNING.
std::vector< LIB_SYMBOL * > BuildSymbolLibrary()
Build KiCad library symbols from the design cache and packages alone (no schematic pages),...
static constexpr const char * LIB_NICK
Symbol library nickname used in every emitted LIB_ID.
std::tuple< std::string, std::string, int > PKG_KEY
(sourcePackage-or-pkgName, pkgName, variant index) -> (lib name, unit number).
void SetPosition(const VECTOR2I &aPosition) override
void SetText(const wxString &aText) override
virtual void SetUnit(int aUnit)
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
void SetPosition(const VECTOR2I &aPos) override
void SetStroke(const STROKE_PARAMS &aStroke) override
void AddPoint(const VECTOR2I &aPosition)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
void SetFootprintFieldText(const wxString &aFootprint)
VECTOR2I GetPosition() const override
void SetValueFieldText(const wxString &aValue, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
void SetExcludedFromBoard(bool aEnable, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
Simple container to manage line stroke parameters.
const TRANSFORM & GetTransform() const
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FILLED_WITH_BG_BODYCOLOR
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
ORCAD_CONVERTER turns a parsed ORCAD_DESIGN into KiCad schematic objects.
constexpr ORCAD_ORIENT_ENTRY ORCAD_ORIENT_TABLE[8]
Orientation table, indexed by the 3-bit orientation code.
VECTOR2I OrcadDbuToIu(int aX, int aY)
FILL_T OrcadFillType(int aFillStyle, int aHatchStyle)
VECTOR2I OrcadTransformPoint(int aOrient, int aWidth, int aHeight, int aBaseX, int aBaseY, int aPx, int aPy)
Absolute canvas position (DBU) of symbol-space point (aPx, aPy) for an instance with transform base (...
KIGFX::COLOR4D OrcadColor(int aColorIndex)
int OrcadOrientOf(int aRotation, bool aMirror)
Compose the 3-bit orientation code from the rotation bits and mirror bit.
constexpr int ORCAD_IU_PER_DBU
Schematic internal units per OrCAD DBU: 10 mil * 254 IU/mil.
LINE_STYLE OrcadLineStyle(int aStyle)
VECTOR2I OrcadOrientOffset(int aOrient, int aWidth, int aHeight)
Bbox re-anchoring offset for the given orientation and body size (DBU).
FILL_T OrcadFillType(int aFillStyle, int aHatchStyle)
int OrcadLineWidthIu(int aWidth)
LINE_STYLE OrcadLineStyle(int aStyle)
ORCAD_PORT_TYPE
Pin electrical type codes (u32 portType field of a symbol pin).
@ ORCAD_ST_GLOBAL_SYMBOL
power symbol definition
wxString FromOrcadString(const std::string &aText)
Decode raw stream bytes (Windows-1252) into a wxString for UI/UX use.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
@ PT_TRISTATE
tri state bus pin
@ PT_BIDI
input or output (like port for a microprocessor)
@ PT_OPENEMITTER
pin type open emitter
@ PT_OPENCOLLECTOR
pin type open collector
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
LINE_STYLE
Dashed line types.
Net alias attached to a wire (becomes a local label).
Axis-aligned box in OrCAD DBU; corner order as stored (not normalized).
One emitted KiCad lib symbol (possibly multi-unit).
std::string name
lib item name (no nickname)
std::unique_ptr< LIB_SYMBOL > kicadSymbol
built lazily by kicadSymbolFor()
std::vector< UNIT_INFO > units
sorted by letter; unit numbers are 1-based indices
std::string powerNet
power symbols are keyed by NET name
One unit of an emitted multi-unit symbol.
const ORCAD_SYMBOL_DEF * symbol
std::vector< std::string > pinNumbers
device pin-number map for this unit
std::string letter
unit discriminator, e.g. "A", "-16", "B:Convert"
One device of a package: the pin-number map of a unit (structure type 32).
std::vector< std::string > pinNumbers
One displayed property of an instance (Part Reference, Value, user fields).
int fontIdx
1-based into ORCAD_LIBRARY_INFO::fonts; 0 = default
std::string name
resolved property name (empty when index invalid)
One text font from the Library stream (a Win32 LOGFONTA record, 60 bytes: lfHeight i32 at +0,...
Shared body of Port / Global / OffPageConnector / TitleBlock / ERCObject and the Graphic*Inst shapes ...
int rotation
0..3 quarter turns
std::string name
cache symbol name
One entry of the 8-orientation placement table.
A package: refdes prefix, footprint and per-unit devices (structure type 31).
std::vector< ORCAD_DEVICE > devices
T0x10: one pin of a placed instance, carrying the pin's absolute page position (the connection point ...
A placed part instance on a page (structure type 13).
std::string sourcePackage
package base name
std::vector< ORCAD_DISPLAY_PROP > displayProps
ORCAD_BBOX bbox
placed box, page DBU
int rotation
0..3 quarter turns
std::map< std::string, std::string > props
short-prefix property pairs
bool mirror
orientation bit 2
std::string value
resolved Part Value
std::vector< ORCAD_PIN_INST > pins
successfully parsed T0x10 records
Integer point in OrCAD DBU.
One graphic primitive of a symbol body or nested page graphic.
int fillStyle
0 solid, 1 none, 2 hatch pattern
std::string text
kind == TEXT
std::vector< ORCAD_PRIMITIVE > children
kind == GROUP, translated by (x1, y1)
std::vector< ORCAD_POINT > points
polygon/polyline/bezier vertices
int lineStyle
0 solid, 1 dash, 2 dot, 3 dash-dot, 4 dash-dot-dot, 5 default
std::optional< ORCAD_POINT > start
arc start point
std::optional< ORCAD_POINT > end
arc end point
int lineWidth
Capture width enum: 0 thin, 1 medium, 2 wide, 3 default.
One parsed 'Views/<folder>/Pages/<page>' stream, raw structure lists in stream order.
std::vector< ORCAD_WIRE > wires
std::vector< ORCAD_PLACED_INSTANCE > instances
A symbol definition from the design Cache (LibraryPart / GlobalSymbol / PortSymbol / OffPageSymbol / ...
std::string name
cache name, e.g. "C.Normal"
std::vector< ORCAD_SYMBOL_PIN > pins
std::vector< ORCAD_PRIMITIVE > primitives
bool synthesized
placeholder built from T0x10 data
int typeId
ORCAD_ST value.
std::optional< ORCAD_BBOX > bbox
symbol-space body box
std::vector< ORCAD_SYMBOL_DEF > variants
Stale same-name cache entries (older library versions), in cache order, EXCLUDING this entry itself.
int generalFlags
LibraryPart GeneralProperties flags (-1 = absent); bit0 = pin numbers visible, bit2 = pin names hidde...
One pin of a symbol definition (structure types 26/27).
std::vector< ORCAD_ALIAS > aliases
@ USER
The field ID hasn't been set yet; field is invalid.
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
VECTOR2< int32_t > VECTOR2I