KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_converter.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * Based on the dsn2kicad reference implementation and on OrCAD file format
7 * documentation from the OpenOrCadParser project (MIT licensed).
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
24
25#ifndef ORCAD_CONVERTER_H_
26#define ORCAD_CONVERTER_H_
27
28#include <cstdint>
29#include <functional>
30#include <map>
31#include <memory>
32#include <set>
33#include <string>
34#include <tuple>
35#include <utility>
36#include <vector>
37
38#include <wx/string.h>
39
40#include <geometry/seg.h>
41#include <math/box2.h>
42#include <math/vector2d.h>
43#include <gal/color4d.h>
44#include <eda_shape.h>
45#include <kiid.h>
46
49
50class LIB_SYMBOL;
51class SCH_LINE;
52class EDA_TEXT;
54class REPORTER;
55class SCHEMATIC;
56class SCH_FIELD;
57class SCH_ITEM;
58class SCH_LABEL_BASE;
59class SCH_LABEL;
60class SCH_SCREEN;
61class SCH_SHEET;
62class SCH_SHEET_PIN;
63class SCH_SHEET_PATH;
64class SCH_SYMBOL;
65class SCH_TEXT;
66class SPIN_STYLE;
67class wxMemoryBuffer;
68
69
71inline constexpr int ORCAD_IU_PER_DBU = 2540;
72
73KIGFX::COLOR4D OrcadColor( int aColorIndex );
74int OrcadLineWidthIu( int aWidth );
75int OrcadPageGraphicLineWidthIu( int aWidth );
76LINE_STYLE OrcadLineStyle( int aStyle );
77std::pair<double, double> OrcadDashRatios( int aFormatVersionMajor );
78FILL_T OrcadFillType( int aFillStyle, int aHatchStyle );
79int OrcadHatchPitchIu( uint32_t aModifyTimestamp );
80int OrcadHatchLineWidthIu( uint32_t aModifyTimestamp );
81std::vector<SEG> OrcadHatchLines( const EDA_SHAPE& aShape, int aHatchStyle, int aPitch );
82int OrcadTextBaselineOffset( int aTextSize );
83int OrcadDisplayType( const ORCAD_DISPLAY_PROP& aProp );
87int OrcadDisplayFontId( const ORCAD_DISPLAY_PROP& aProp );
88int OrcadPageOrder( wxString& aName );
89VECTOR2I OrcadStretchedImageSize( int aWidth, int aHeight, int aBoxWidth, int aBoxHeight );
90wxString OrcadPinNameMarkup( const wxString& aName );
91
92inline VECTOR2I OrcadDbuToIu( int aX, int aY )
93{
94 return VECTOR2I( aX * ORCAD_IU_PER_DBU, aY * ORCAD_IU_PER_DBU );
95}
96
97
100 const std::function<ORCAD_POINT( const ORCAD_POINT& )>& aMap );
101
103void OrcadOffsetPrimitive( ORCAD_PRIMITIVE& aPrim, int aDx, int aDy );
104
106void OrcadForEachLeafPrimitive( const std::vector<ORCAD_PRIMITIVE>& aPrimitives,
107 const std::function<void( const ORCAD_PRIMITIVE&, int, int )>& aVisit );
108
109
111inline ORCAD_POINT OrcadInverseOrient( int aOrient, int aX, int aY )
112{
113 const ORCAD_ORIENT_ENTRY& e = ORCAD_ORIENT_TABLE[aOrient & 7];
114 int det = e.a * e.d - e.b * e.c;
115
116 return { ( e.d * aX - e.b * aY ) / det, ( -e.c * aX + e.a * aY ) / det };
117}
118
119
121{
122public:
133 ORCAD_CONVERTER( ORCAD_DESIGN& aDesign, SCHEMATIC* aSchematic, REPORTER* aReporter,
134 PROGRESS_REPORTER* aProgressReporter = nullptr );
135
138
140 SCH_SHEET* Convert( SCH_SHEET* aRootSheet );
141
143 std::vector<LIB_SYMBOL*> BuildSymbolLibrary();
144
146 static constexpr const char* LIB_NICK = "orcad_import";
147
148private:
150
153 {
154 std::string letter;
155 const ORCAD_SYMBOL_DEF* symbol = nullptr;
156 const ORCAD_SYMBOL_DEF* convert = nullptr;
157 std::vector<std::string> pinNumbers;
158 std::vector<bool> pinNumberVisible;
159 std::vector<bool> pinIgnore;
160 std::vector<int> pinOffsets;
161 std::vector<bool> explicitPinNets;
162
163 bool operator==( const UNIT_INFO& ) const = default;
164 };
165
168 {
169 std::string name;
170 std::vector<UNIT_INFO> units;
171 bool isPower = false;
172 std::string powerNet;
173 std::string refPrefix = "U";
174 std::string footprint;
175 std::unique_ptr<LIB_SYMBOL> kicadSymbol;
176 };
177
180 {
181 int index = 0;
182 std::string net;
183 int x = 0;
184 int y = 0;
185 };
186
189 using PKG_KEY = std::tuple<std::string, std::string, int, std::string>;
190
193 {
194 const ORCAD_OCC_SCOPE* occ = nullptr;
195 std::string flatNetSuffix;
196 bool namedFlatNets = false;
197 bool generatedFlatNets = false;
198 std::map<std::string, std::string> unconnectedInterfaceNetNames;
199 std::map<std::string, std::string> interfaceNetAliases;
200 std::map<std::string, std::string> occurrenceNetAliases;
201 std::set<std::string> connectorInterfaceNetAliases;
202 std::map<std::string, size_t> electricalKeyCounts;
203 };
204
207 {
208 const ORCAD_RAW_PAGE* page = nullptr;
209 std::map<std::pair<int, int>, std::vector<const ORCAD_WIRE*>> wireEndpoints;
210 std::map<const ORCAD_PIN_INST*, std::set<uint32_t>> pinNets;
211 std::vector<VECTOR2I> junctions;
212
214 std::map<uint32_t, std::set<const std::string*>> occurrenceNamesByNetId;
215
217 mutable std::map<const ORCAD_GRAPHIC_INST*, std::string> powerNets;
218 };
219
222 {
223 size_t placements = 0;
224 std::map<std::string, std::pair<std::string, size_t>> targets;
225 };
226
230 {
231 int pageIndex = 1;
232 size_t sourcePageIndex = 0;
233 size_t sourcePageCount = 0;
234 bool numberSourcePages = true;
235 bool occurrenceAliases = true;
236 bool interfaceAliases = false;
237 bool nestedFlatSuffix = true;
238 bool folderSheetNames = true;
240 };
241
250
252
254 static constexpr int PIN_LEN_DBU = 10;
255
257 static constexpr int MARGIN_L_DBU = 60;
258 static constexpr int MARGIN_T_DBU = 60;
259 static constexpr int MARGIN_R_DBU = 60;
260 static constexpr int MARGIN_B_DBU = 100;
261
263
265 void warn( const wxString& aMsg );
266
268 void note( const wxString& aMsg );
269
272
274 std::string canonicalGlobalNetName( const std::string& aName ) const;
275
277 std::string canonicalGlobalNetKey( const std::string& aName ) const;
278
279 std::string effectiveInterfaceNetName( const std::string& aName ) const;
280
281 void enterScope( PAGE_SCOPE aScope );
282 std::string occurrenceBaseNetName( const std::string& aName ) const;
283 std::string occurrenceElectricalNetName( uint32_t aOccurrenceId, const std::string& aName ) const;
284 bool isPowerNetName( const std::string& aName ) const;
285 bool isOffpageNetName( const std::string& aName ) const;
286
287
288 void prepareSymbols();
289
291 LIB_ENTRY buildPackageEntry( const ORCAD_PACKAGE& aPackage ) const;
292
294 ORCAD_SYMBOL_DEF synthesizeSymbol( const std::string& aPkgName,
295 const std::vector<const ORCAD_PLACED_INSTANCE*>& aInstances ) const;
296
298 std::string unitLetter( const ORCAD_PLACED_INSTANCE& aInst ) const;
299
301 std::pair<const ORCAD_SYMBOL_DEF*, int> pickVariant( const ORCAD_PLACED_INSTANCE& aInst ) const;
302
304 std::pair<std::string, int> libForInstance( const ORCAD_PLACED_INSTANCE& aInst,
305 const PKG_KEY** aSourceUnit = nullptr );
307
309 std::optional<uint32_t> occurrenceNetIdFor( const std::string* aName ) const;
310
312 void finishConversion();
313
315 std::string powerLibFor( const std::string& aSymbolName, const std::string& aNetName );
316
317
318 LIB_SYMBOL* kicadSymbolFor( const std::string& aLibName );
319
320
321 void addSymbolPrimitive( LIB_SYMBOL* aSymbol, const ORCAD_PRIMITIVE& aPrim, int aUnit, int aColor,
322 int aOffsetX = 0, int aOffsetY = 0 );
323
325 void addSymbolArc( LIB_SYMBOL* aSymbol, const ORCAD_PRIMITIVE& aPrim, int aUnit, int aColor, int aOffsetX = 0,
326 int aOffsetY = 0 );
327
328
330 struct PIN_EMIT
331 {
332 wxString number;
333 int unit = 1;
334 bool power = false;
335 std::string nameOverride;
336 bool nameVisible = false;
337 bool showPinNumbers = false;
338 bool numberVisible = true;
339 bool hidden = false;
340 bool explicitNet = false;
341 };
342
343 void addSymbolPin( LIB_SYMBOL* aSymbol, const ORCAD_SYMBOL_PIN& aPin, const BOX2I& aBodyBox, PIN_EMIT aEmit );
344
346 std::string uniqueLibName( const std::string& aBase,
347 const std::function<bool( const LIB_ENTRY& )>& aReusable ) const;
348
350 SCH_SYMBOL* instantiateSymbol( const LIB_SYMBOL& aLibSymbol, const std::string& aLibName, int aUnit, int aOrient,
351 const VECTOR2I& aPos, const SCH_SHEET_PATH& aSheetPath ) const;
352
353
354 void placeInstance( ORCAD_RAW_PAGE& aPage, const ORCAD_PLACED_INSTANCE& aInst, SCH_SCREEN* aScreen,
355 const SCH_SHEET_PATH& aSheetPath );
356
359 void applyCisVariants( SCH_SYMBOL* aSymbol, const ORCAD_PLACED_INSTANCE& aInst,
360 const SCH_SHEET_PATH& aSheetPath, const std::string& aValue );
361
363 wxString resolveReference( const ORCAD_PLACED_INSTANCE& aInst ) const;
364
365
366 void placePowerSymbol( ORCAD_RAW_PAGE& aPage, const ORCAD_GRAPHIC_INST& aInst, const std::string& aNet,
367 SCH_SCREEN* aScreen, const SCH_SHEET_PATH& aSheetPath );
368
369
370 void placeSymbolFields( SCH_SYMBOL* aSymbol, const ORCAD_PLACED_INSTANCE& aInst, const ORCAD_SYMBOL_DEF& aDef,
371 int aOrient, const std::string& aValue, const std::string& aFootprint );
372
374 const ORCAD_PACKAGE* packageFor( const ORCAD_PLACED_INSTANCE& aInst ) const;
375
377 std::map<std::string, std::string> effectiveProps( const ORCAD_PLACED_INSTANCE& aInst,
378 const ORCAD_SYMBOL_DEF& aDef ) const;
379
380
381 static int toKicadOrientation( int aOrient );
382
383 void computeFontBaseline();
384
385 int displayFontId( const ORCAD_DISPLAY_PROP& aProp ) const;
386 bool displayUsesTemplateFont( const ORCAD_DISPLAY_PROP& aProp ) const;
387
389 VECTOR2I displayPropPosition( const ORCAD_DISPLAY_PROP& aDisplay, const VECTOR2I& aAnchorIu ) const;
390
392 void applyDisplayProp( SCH_FIELD& aField, const ORCAD_DISPLAY_PROP& aDisplay, const VECTOR2I& aAnchorIu,
393 bool aSymbolFlips, bool aApplyVisibility = true ) const;
394 int wireAliasFontId( const ORCAD_ALIAS& aAlias ) const;
395 int textBaselineOffset( int aTextSize, int aFontIdx, bool aTemplateFont = true ) const;
396
398 int resolveFontIndex( int aFontIdx ) const;
399
401 int fontHeightDbu( int aFontIdx, bool aTemplateFont = true ) const;
402
403
404 int textSizeIU( int aFontIdx, bool aTemplateFont = true ) const;
405
407 VECTOR2I textSize( int aFontIdx, bool aTemplateFont = true ) const;
408
409 void applyFont( EDA_TEXT* aText, int aFontIdx, bool aTemplateFont = true ) const;
410 void applyMultilineSpacing( SCH_TEXT* aText, int aFontIdx, bool aTemplateFont = true ) const;
411
413 static std::string SymbolId( const std::string& aName );
414
415
416 void convertPage( ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen, const SCH_SHEET_PATH& aSheetPath,
417 bool aContainerPage = false, bool aSharedFolderPage = false );
419 const std::string& aChildFolder );
421 void appendNetIntent( SCH_SCREEN* aScreen, SCH_LABEL* aLabel, bool aExplicitName, uint32_t aNetId = 0 );
422 void minimizeNetLabels();
423 void finalizeNetNames();
424 void recordNetNameMap();
426
428
431
433 PAGE_SCOPE occurrenceScope( const ORCAD_OCC_SCOPE& aOcc ) const;
434
436 std::map<std::string, std::string> unconnectedInterfaceNetNames( const ORCAD_DRAWN_INSTANCE& aBlock,
437 const std::string& aFlatNetSuffix ) const;
438
440 SCH_SHEET* createBlockSheet( SCH_SHEET* aParentSheet, const ORCAD_RAW_PAGE& aParentPage,
441 const ORCAD_DRAWN_INSTANCE& aBlock, const ORCAD_OCC_BLOCK& aOccurrence,
442 const wxString& aName, const std::string& aFilePageName, int aPageIndex );
443
446 std::vector<SCH_SHEET*> createTopLevelSheets( const std::vector<std::pair<wxString, wxString>>& aNamesAndFiles,
447 bool aReuseRoot, bool aOrdinalSheetUuids );
448
449 void recordPowerAlias( std::map<std::string, POWER_ALIAS_EVIDENCE>& aCandidates, const std::string& aSourceName,
450 const std::string& aElectricalName ) const;
451
453 void acceptPowerAliases( const std::map<std::string, POWER_ALIAS_EVIDENCE>& aCandidates );
454
456 bool canBuildNativeHierarchy( const ORCAD_RAW_PAGE& aPage, const ORCAD_OCC_SCOPE& aScope ) const;
457
459 bool canBuildFolderHierarchy( const std::vector<ORCAD_RAW_PAGE>& aPages, const ORCAD_OCC_SCOPE& aScope ) const;
460 void convertFolderHierarchy( const SCH_SHEET_PATH& aRootPath, bool aNative );
461 void addChildOccurrenceAliases( const ORCAD_RAW_PAGE& aParentPage, const ORCAD_OCC_SCOPE& aParentScope,
462 const ORCAD_DRAWN_INSTANCE& aDrawn, const ORCAD_OCC_SCOPE& aChildScope );
463 void collectFolderPowerAliases( std::map<std::string, POWER_ALIAS_EVIDENCE>& aCandidates,
464 std::vector<ORCAD_RAW_PAGE>& aPages, const ORCAD_OCC_SCOPE& aScope );
465 void placeFolder( FOLDER_WALK& aWalk, std::vector<ORCAD_RAW_PAGE>& aPages, const ORCAD_OCC_SCOPE& aScope,
466 SCH_SHEET* aFolderSheet, const SCH_SHEET_PATH& aFolderPath,
467 const std::string& aOccurrenceSuffix, bool aRepeatedFolder,
468 const std::map<std::string, std::string>& aUnconnectedInterfaceNetNames,
469 std::map<std::string, std::string> aInterfaceNetAliases );
470
472 void convertFlatPages( const SCH_SHEET_PATH& aRootPath );
473
475 void forEachDesignPage( const std::function<void( const ORCAD_RAW_PAGE& )>& aVisit,
476 bool aUnreferenced = false ) const;
477
479 wxString uniqueSheetName( const wxString& aBase );
480
483 std::set<const std::string*> pinOccurrenceTargets( const ORCAD_RAW_PAGE& aPage, const ORCAD_BLOCK_PIN& aPin,
484 const std::map<uint32_t, std::string>& aScopeNets,
485 bool aSkipGenerated,
486 std::set<std::string>* aSourceKeys = nullptr ) const;
487
489 SCH_SHEET_PATH topLevelPath( SCH_SHEET* aSheet, size_t aPageNumber ) const;
490
491 KIID deterministicUuid( const std::string& aRole, size_t aOrdinal ) const;
492
494 void assignPinUuids( SCH_SYMBOL* aSymbol, const std::string& aRole ) const;
495
498
502 void appendPageItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
503 void assignPageItemUuids( size_t aPageOrdinal );
504
505
506 static wxString MakePageFileName( int aPageIndex, const std::string& aPageName );
507
509 void applyPageSettings( ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
510 void placePageFrame( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
511
513 static BOX2I pageExtentDbu( const ORCAD_RAW_PAGE& aPage );
514
516 static void offsetPage( ORCAD_RAW_PAGE& aPage, int aDx, int aDy );
517
518
519 void applyTitleBlock( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
520
522 void buildNetLookup( const ORCAD_RAW_PAGE& aPage );
523
525 const std::set<uint32_t>& pinNetIds( const ORCAD_PIN_INST& aPin ) const;
526
528 std::string netAt( const ORCAD_RAW_PAGE& aPage, int aX, int aY ) const;
529
530
532 std::string powerNet( const ORCAD_RAW_PAGE& aPage, const ORCAD_GRAPHIC_INST& aInst ) const;
533 std::string resolvePowerNet( const ORCAD_RAW_PAGE& aPage, const ORCAD_GRAPHIC_INST& aInst ) const;
534
536 const ORCAD_SYMBOL_DEF* graphicDefinition( const ORCAD_GRAPHIC_INST& aInst ) const;
537
539 VECTOR2I graphicPinPos( const ORCAD_GRAPHIC_INST& aInst ) const;
540
542 VECTOR2I namedGraphicPinPos( const ORCAD_RAW_PAGE& aPage, const ORCAD_GRAPHIC_INST& aInst ) const;
543
545 VECTOR2I powerPinPos( const ORCAD_RAW_PAGE& aPage, const ORCAD_GRAPHIC_INST& aInst ) const;
546
547 std::vector<int> placedStackedPinOffsets( const ORCAD_PLACED_INSTANCE& aInstance ) const;
548 VECTOR2I placedPinElectricalPosition( const ORCAD_PLACED_INSTANCE& aInstance, size_t aPinIndex ) const;
549 bool hasImplicitPowerPinName( const ORCAD_PLACED_INSTANCE& aInstance, size_t aPinIndex,
550 const std::string& aNetName ) const;
551
553 std::vector<OFFPAGE_NET> offpageNets( const ORCAD_RAW_PAGE& aPage ) const;
554
556 std::vector<VECTOR2I> computeJunctions( const ORCAD_RAW_PAGE& aPage ) const;
557
559 void placeJunctions( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
560
561
562 void placeWires( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen, bool aHierarchical,
563 bool aNestedHierarchy, bool aSharedFolderPage );
564
566 void placeBusEntries( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
567
569 void placeGraphicDisplayText( const ORCAD_GRAPHIC_INST& aGraphic, const ORCAD_DISPLAY_PROP& aDisplay,
570 const std::string& aText, SCH_SCREEN* aScreen );
571
573 void placeOffpageConnectors( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen,
574 const SCH_SHEET_PATH& aSheetPath, bool aHierarchical );
575
576
577 void placePorts( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen, bool aHierarchical );
578
580 SPIN_STYLE spinAwayFromWire( const VECTOR2I& aPosDbu ) const;
581
585 const std::vector<SEG>& aSourceWires, SCH_SCREEN* aScreen );
586
587
588 void placeGraphics( const ORCAD_RAW_PAGE& aPage, SCH_SCREEN* aScreen );
589
591 void placeBitmap( const ORCAD_PRIMITIVE& aPrim, SCH_SCREEN* aScreen, int aOrient = 0,
592 bool* aUsedEmbeddedEmf = nullptr );
593
594 void placeDefinitionImages( const ORCAD_SYMBOL_DEF& aDefinition, int aBaseX, int aBaseY, int aOrient,
595 SCH_SCREEN* aScreen );
596
597 void placeDefinitionVectors( const ORCAD_SYMBOL_DEF& aDefinition, int aBaseX, int aBaseY, int aOrient,
598 SCH_SCREEN* aScreen, double aTextScaleX = 1.0, double aTextScaleY = 1.0,
599 bool aUseGenericTextBaseline = false );
600
602 static VECTOR2I snapToWire( int aX, int aY, const ORCAD_WIRE& aWire );
603
605 static bool onSegment( int aX, int aY, const ORCAD_WIRE& aWire );
606
607
608 static wxString SanitizeFileName( const std::string& aName );
609
610private:
616
617 std::map<std::string, LIB_ENTRY> m_libSymbols;
618 std::map<PKG_KEY, std::pair<std::string, int>> m_pkgToLib;
619 std::map<PKG_KEY, std::pair<std::string, int>> m_preparedPkgToLib;
620 std::map<std::string, std::vector<UNIT_INFO>> m_preparedLibUnits;
621 std::vector<PLACED_PACKAGE_UNIT> m_placedPackageUnits;
622 std::set<std::string> m_nativePowerFamilies;
623 std::map<std::string, std::string> m_globalNetNames;
624 std::map<std::string, std::string> m_globalNetAliases;
625 std::set<std::string> m_powerNetNames;
626 std::set<std::string> m_offpageNetNames;
627 std::set<std::string> m_connectedBlockInterfaceNames;
628 std::map<std::string, size_t> m_occurrenceNetNameScopeCounts;
629 std::map<std::string, size_t> m_occurrenceNetNameMinDepth;
630 std::map<std::string, size_t> m_occurrenceFolderCounts;
632
634 std::map<std::string, std::string> m_baseOccurrenceNetAliases;
635 std::map<const std::map<uint32_t, std::string>*, std::map<std::string, std::string>> m_occurrenceAliasesByScope;
638 size_t m_pageOrdinal = 0;
639 size_t m_screenOrdinal = 1;
641 std::vector<SCH_ITEM*> m_pageItems;
642 std::set<SCH_SCREEN*> m_importedScreens;
643 std::set<const SCH_ITEM*> m_preExistingItems;
644
646 std::set<const ORCAD_PIN_INST*> m_currentImplicitPowerPins;
647 std::map<std::string, std::map<std::string, std::string>> m_hierBusNamesByScreen;
648
655
657 {
660 std::vector<SCH_LINE*> wires;
661 };
662
664 const std::vector<SEG>& aSourceWires );
665
666 std::vector<INTERFACE_LABEL_SOURCE> m_interfaceLabelSources;
667 std::vector<NET_LABEL_INTENT> m_netLabelIntents;
668 std::vector<std::pair<SCH_LABEL_BASE*, std::pair<SCH_SCREEN*, uint32_t>>> m_labelSourceNets;
669 std::map<SCH_SCREEN*, const ORCAD_RAW_PAGE*> m_sourcePages;
670 std::map<std::pair<SCH_SCREEN*, uint32_t>, std::vector<SCH_ITEM*>> m_sourceNetItems;
671 std::map<std::pair<SCH_SCREEN*, uint32_t>, std::set<std::string>> m_sourceNetNames;
672 std::map<std::pair<SCH_SCREEN*, uint32_t>, std::string> m_sourceGeneratedNetNames;
674 {
675 wxString number;
677 std::optional<KIID> libraryPin;
678 bool ignored = false;
679 };
680
681 std::map<SCH_SYMBOL*, std::vector<SOURCE_PIN_IDENTITY>> m_sourcePinIdentities;
682 std::map<SCH_SYMBOL*, const ORCAD_PLACED_INSTANCE*> m_sourceInstances;
683 std::map<SCH_SCREEN*, std::vector<wxString>> m_sourceOccurrences;
684 std::map<std::tuple<SCH_SCREEN*, const ORCAD_PLACED_INSTANCE*, size_t>, std::pair<uint32_t, std::string>> m_wirelessNetNames;
685
687 std::set<wxString> m_usedSheetNames;
688
690};
691
692#endif // ORCAD_CONVERTER_H_
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Definition kiid.h:46
Define a library symbol object.
Definition lib_symbol.h:114
void placePowerSymbol(ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst, const std::string &aNet, SCH_SCREEN *aScreen, const SCH_SHEET_PATH &aSheetPath)
void placePageFrame(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
void placeJunctions(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
Append computed junctions as SCH_JUNCTION items.
std::string uniqueLibName(const std::string &aBase, const std::function< bool(const LIB_ENTRY &)> &aReusable) const
aBase, or aBase_pinsN for the first N >= 2 whose existing entry is absent or passes aReusable.
bool displayUsesTemplateFont(const ORCAD_DISPLAY_PROP &aProp) const
std::map< std::string, size_t > m_occurrenceFolderCounts
std::vector< VECTOR2I > computeJunctions(const ORCAD_RAW_PAGE &aPage) const
Use both geometry and net IDs; a crossing alone does not create a junction.
int displayFontId(const ORCAD_DISPLAY_PROP &aProp) const
std::vector< OFFPAGE_NET > offpageNets(const ORCAD_RAW_PAGE &aPage) const
Resolve every off-page connector on the page to (index, net, pin position).
void addChildOccurrenceAliases(const ORCAD_RAW_PAGE &aParentPage, const ORCAD_OCC_SCOPE &aParentScope, const ORCAD_DRAWN_INSTANCE &aDrawn, const ORCAD_OCC_SCOPE &aChildScope)
std::string netAt(const ORCAD_RAW_PAGE &aPage, int aX, int aY) const
Prefer endpoint nets, then intersecting wires, then endpoint aliases.
static constexpr int MARGIN_B_DBU
LIB_ENTRY buildPackageEntry(const ORCAD_PACKAGE &aPackage) const
One unit per package device; a Convert view becomes the unit's DeMorgan body.
PROGRESS_REPORTER * m_progressReporter
SCH_SHEET * Convert(SCH_SHEET *aRootSheet)
aRootSheet must have a screen and be registered on the schematic.
void assignPageItemUuids(size_t aPageOrdinal)
void buildNetLookup(const ORCAD_RAW_PAGE &aPage)
Rebuild m_netIndex for a page in the current scope.
std::map< SCH_SYMBOL *, std::vector< SOURCE_PIN_IDENTITY > > m_sourcePinIdentities
void assignPinUuids(SCH_SYMBOL *aSymbol, const std::string &aRole) const
Name-based UUIDs for a symbol's raw pins, derived from aRole and each pin's number,...
std::set< const ORCAD_PIN_INST * > m_currentImplicitPowerPins
std::vector< int > placedStackedPinOffsets(const ORCAD_PLACED_INSTANCE &aInstance) const
void rememberInterfaceLabelSource(SCH_SCREEN *aScreen, SCH_LABEL_BASE *aLabel, const std::vector< SEG > &aSourceWires)
void forEachDesignPage(const std::function< void(const ORCAD_RAW_PAGE &)> &aVisit, bool aUnreferenced=false) const
Visit root pages, then child-folder pages, then unreferenced folder pages if asked.
static constexpr int PIN_LEN_DBU
– constants (calibrated; do not change) -------------------------------------—
static constexpr int MARGIN_R_DBU
std::map< SCH_SCREEN *, std::vector< wxString > > m_sourceOccurrences
std::pair< const ORCAD_SYMBOL_DEF *, int > pickVariant(const ORCAD_PLACED_INSTANCE &aInst) const
Match cached variants to placed pin positions; use the first entry if none matches.
std::map< SCH_SCREEN *, const ORCAD_RAW_PAGE * > m_sourcePages
std::map< SCH_SYMBOL *, const ORCAD_PLACED_INSTANCE * > m_sourceInstances
void acceptPowerAliases(const std::map< std::string, POWER_ALIAS_EVIDENCE > &aCandidates)
Rename a power symbol to the net most of its placements resolve to.
bool canBuildFolderHierarchy(const std::vector< ORCAD_RAW_PAGE > &aPages, const ORCAD_OCC_SCOPE &aScope) const
Every occurrence block is drawn exactly once on its parent folder's pages.
SCH_SCREEN * newScreen()
A new screen with the next deterministic screen UUID, recorded as created by this import.
PAGE_SCOPE occurrenceScope(const ORCAD_OCC_SCOPE &aOcc) const
A scope for aOcc carrying the occurrence aliases known so far.
std::string occurrenceBaseNetName(const std::string &aName) const
std::set< SCH_SCREEN * > m_importedScreens
std::vector< SCH_SHEET * > createTopLevelSheets(const std::vector< std::pair< wxString, wxString > > &aNamesAndFiles, bool aReuseRoot, bool aOrdinalSheetUuids)
Top-level sheets named by aNamesAndFiles.
bool isOffpageNetName(const std::string &aName) const
void placeBitmap(const ORCAD_PRIMITIVE &aPrim, SCH_SCREEN *aScreen, int aOrient=0, bool *aUsedEmbeddedEmf=nullptr)
Skip undecodable images with a warning.
VECTOR2I graphicPinPos(const ORCAD_GRAPHIC_INST &aInst) const
Use the transformed cache pin position, or the instance anchor if no pin is available.
SCH_SHEET_PATH topLevelPath(SCH_SHEET *aSheet, size_t aPageNumber) const
The hierarchy path ending at a top-level sheet, numbered aPageNumber.
const ORCAD_PACKAGE * packageFor(const ORCAD_PLACED_INSTANCE &aInst) const
The cache package backing a placement, or nullptr when the design has none.
std::map< std::string, std::vector< UNIT_INFO > > m_preparedLibUnits
void applyPageSettings(ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
Shift content on the 10-DBU grid to preserve connectivity.
VECTOR2I displayPropPosition(const ORCAD_DISPLAY_PROP &aDisplay, const VECTOR2I &aAnchorIu) const
Capture's display-property origin sits on the font baseline; return the KiCad text origin.
SPIN_STYLE spinAwayFromWire(const VECTOR2I &aPosDbu) const
Point an interface label at aPosDbu away from the wire that ends there.
std::set< const SCH_ITEM * > m_preExistingItems
already on the root screen
ORCAD_CONVERTER(ORCAD_DESIGN &aDesign, SCHEMATIC *aSchematic, REPORTER *aReporter, PROGRESS_REPORTER *aProgressReporter=nullptr)
static bool onSegment(int aX, int aY, const ORCAD_WIRE &aWire)
True when the point lies strictly INSIDE (not at an endpoint of) an H/V wire.
wxString uniqueSheetName(const wxString &aBase)
aBase, or "aBase (N)" for the first N >= 2 not already used by a sibling sheet.
std::map< std::tuple< SCH_SCREEN *, const ORCAD_PLACED_INSTANCE *, size_t >, std::pair< uint32_t, std::string > > m_wirelessNetNames
~ORCAD_CONVERTER()
Out-of-line: LIB_ENTRY holds LIB_SYMBOL by unique_ptr.
void placeGraphicDisplayText(const ORCAD_GRAPHIC_INST &aGraphic, const ORCAD_DISPLAY_PROP &aDisplay, const std::string &aText, SCH_SCREEN *aScreen)
One displayed property attached to a placed page symbol, preserving source text geometry.
int resolveFontIndex(int aFontIdx) const
Resolve a Design Template font ID to its 1-based LOGFONT index.
void applyCisVariants(SCH_SYMBOL *aSymbol, const ORCAD_PLACED_INSTANCE &aInst, const SCH_SHEET_PATH &aSheetPath, const std::string &aValue)
Record each CIS variant's installed state and property overrides as KiCad symbol variants.
SCH_SHEET * m_rootSheet
VECTOR2I namedGraphicPinPos(const ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst) const
Graphic-symbol connection point, corrected to a nearby endpoint of its named wire.
static wxString MakePageFileName(int aPageIndex, const std::string &aPageName)
LIB_SYMBOL * kicadSymbolFor(const std::string &aLibName)
static BOX2I pageExtentDbu(const ORCAD_RAW_PAGE &aPage)
Free graphics use nested primitive bounds; their outer boxes do not describe page coordinates.
std::map< PKG_KEY, std::pair< std::string, int > > m_pkgToLib
void appendPageItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
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)
ORCAD_DESIGN & m_design
std::vector< NET_LABEL_INTENT > m_netLabelIntents
int textBaselineOffset(int aTextSize, int aFontIdx, bool aTemplateFont=true) const
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)
std::set< wxString > m_usedSheetNames
Lower-cased sheet names already emitted, to keep sibling sheet names unique.
void convertFlatPages(const SCH_SHEET_PATH &aRootPath)
Every page, each child occurrence expanded, becomes a top-level sheet.
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.
std::map< std::string, std::string > m_baseOccurrenceNetAliases
Occurrence net aliases shared by every scope, then those a parent block adds per child scope.
std::vector< INTERFACE_LABEL_SOURCE > m_interfaceLabelSources
PAGE_NET_INDEX m_netIndex
SCH_SCREEN * m_pageItemScreen
void placeFolder(FOLDER_WALK &aWalk, std::vector< ORCAD_RAW_PAGE > &aPages, const ORCAD_OCC_SCOPE &aScope, SCH_SHEET *aFolderSheet, const SCH_SHEET_PATH &aFolderPath, const std::string &aOccurrenceSuffix, bool aRepeatedFolder, const std::map< std::string, std::string > &aUnconnectedInterfaceNetNames, std::map< std::string, std::string > aInterfaceNetAliases)
void prepareGlobalNetNames()
Capture net names ignore case; KiCad net names do not.
std::map< std::string, LIB_ENTRY > m_libSymbols
keyed by emitted lib name
std::map< std::string, size_t > m_occurrenceNetNameScopeCounts
std::string resolvePowerNet(const ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst) const
static int toKicadOrientation(int aOrient)
int m_powerCount
"#PWR%04d" counter
void convertPage(ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen, const SCH_SHEET_PATH &aSheetPath, bool aContainerPage=false, bool aSharedFolderPage=false)
VECTOR2I powerPinPos(const ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst) const
Power-symbol connection point, corrected to a nearby endpoint of its named wire.
KIID deterministicUuid(const std::string &aRole, size_t aOrdinal) const
std::set< std::string > m_offpageNetNames
SCH_SYMBOL * instantiateSymbol(const LIB_SYMBOL &aLibSymbol, const std::string &aLibName, int aUnit, int aOrient, const VECTOR2I &aPos, const SCH_SHEET_PATH &aSheetPath) const
New placement of a library symbol, oriented by an OrCAD orientation code.
void applyTitleBlock(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
void finishConversion()
Run the shared finalization sequence that ends every conversion entry point.
std::map< std::pair< SCH_SCREEN *, uint32_t >, std::vector< SCH_ITEM * > > m_sourceNetItems
void placeDefinitionImages(const ORCAD_SYMBOL_DEF &aDefinition, int aBaseX, int aBaseY, int aOrient, SCH_SCREEN *aScreen)
wxString resolveReference(const ORCAD_PLACED_INSTANCE &aInst) const
Use the occurrence reference when the instance has an unannotated template.
std::string occurrenceElectricalNetName(uint32_t aOccurrenceId, const std::string &aName) const
std::map< std::pair< SCH_SCREEN *, uint32_t >, std::string > m_sourceGeneratedNetNames
void applyFont(EDA_TEXT *aText, int aFontIdx, bool aTemplateFont=true) const
std::map< std::pair< SCH_SCREEN *, uint32_t >, std::set< std::string > > m_sourceNetNames
SCH_SHEET * createBlockSheet(SCH_SHEET *aParentSheet, const ORCAD_RAW_PAGE &aParentPage, const ORCAD_DRAWN_INSTANCE &aBlock, const ORCAD_OCC_BLOCK &aOccurrence, const wxString &aName, const std::string &aFilePageName, int aPageIndex)
The child sheet for a hierarchical block, with its pins, appended to aParentSheet's screen.
std::pair< std::string, int > libForInstance(const ORCAD_PLACED_INSTANCE &aInst, const PKG_KEY **aSourceUnit=nullptr)
Returns the registered library name and unit number.
static void offsetPage(ORCAD_RAW_PAGE &aPage, int aDx, int aDy)
aDx and aDy must be multiples of the 10-DBU grid.
void recordPowerAlias(std::map< std::string, POWER_ALIAS_EVIDENCE > &aCandidates, const std::string &aSourceName, const std::string &aElectricalName) const
void convertFolderHierarchy(const SCH_SHEET_PATH &aRootPath, bool aNative)
VECTOR2I textSize(int aFontIdx, bool aTemplateFont=true) const
Preserve an explicit LOGFONT width while retaining natural font aspect when it is zero.
std::string unitLetter(const ORCAD_PLACED_INSTANCE &aInst) const
The unit key includes a non-Normal view so DeMorgan graphics remain distinct.
static std::string SymbolId(const std::string &aName)
LIB_ID-safe symbol name: ':', '"', '/' and whitespace runs -> '_'; "SYM" if empty.
bool isPowerNetName(const std::string &aName) const
bool hasImplicitPowerPinName(const ORCAD_PLACED_INSTANCE &aInstance, size_t aPinIndex, const std::string &aNetName) const
std::map< PKG_KEY, std::pair< std::string, int > > m_preparedPkgToLib
std::vector< std::pair< SCH_LABEL_BASE *, std::pair< SCH_SCREEN *, uint32_t > > > m_labelSourceNets
void addSymbolPrimitive(LIB_SYMBOL *aSymbol, const ORCAD_PRIMITIVE &aPrim, int aUnit, int aColor, int aOffsetX=0, int aOffsetY=0)
std::vector< PLACED_PACKAGE_UNIT > m_placedPackageUnits
ORCAD_SYMBOL_DEF synthesizeSymbol(const std::string &aPkgName, const std::vector< const ORCAD_PLACED_INSTANCE * > &aInstances) const
Use placed pin positions to keep uncached symbols connected.
std::string canonicalGlobalNetKey(const std::string &aName) const
Case-folded canonicalGlobalNetName() for use as a map key.
std::tuple< std::string, std::string, int, std::string > PKG_KEY
(sourcePackage-or-pkgName, pkgName, variant index, unit discriminator) -> (lib name,...
static constexpr int MARGIN_T_DBU
void placeHierarchicalBlockFields(SCH_SHEET *aSheet, const ORCAD_DRAWN_INSTANCE &aBlock, const std::string &aChildFolder)
SCHEMATIC * m_schematic
void placeGraphics(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
std::map< std::string, std::string > unconnectedInterfaceNetNames(const ORCAD_DRAWN_INSTANCE &aBlock, const std::string &aFlatNetSuffix) const
No-connect block pins whose names are wired elsewhere become per-occurrence nets.
std::string powerLibFor(const std::string &aSymbolName, const std::string &aNetName)
Key power symbols by net name because users can rename their ports.
void placeHierarchicalBlockPinFill(SCH_SCREEN *aScreen, SCH_SHEET_PIN *aPin)
void collectFolderPowerAliases(std::map< std::string, POWER_ALIAS_EVIDENCE > &aCandidates, std::vector< ORCAD_RAW_PAGE > &aPages, const ORCAD_OCC_SCOPE &aScope)
std::vector< SCH_ITEM * > m_pageItems
void placeWires(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen, bool aHierarchical, bool aNestedHierarchy, bool aSharedFolderPage)
int textSizeIU(int aFontIdx, bool aTemplateFont=true) const
std::map< std::string, std::map< std::string, std::string > > m_hierBusNamesByScreen
void assignRemainingUuids()
Give items created after page conversion, such as moved labels and cleanup junctions,...
void warn(const wxString &aMsg)
– reporting [orcad_converter_sheet.cpp] ---------------------------------------—
void placeDefinitionVectors(const ORCAD_SYMBOL_DEF &aDefinition, int aBaseX, int aBaseY, int aOrient, SCH_SCREEN *aScreen, double aTextScaleX=1.0, double aTextScaleY=1.0, bool aUseGenericTextBaseline=false)
std::map< std::string, std::string > m_globalNetAliases
std::string canonicalGlobalNetName(const std::string &aName) const
Return the design-wide spelling selected by prepareGlobalNetNames().
REPORTER * m_reporter
void applyMultilineSpacing(SCH_TEXT *aText, int aFontIdx, bool aTemplateFont=true) const
std::map< std::string, size_t > m_occurrenceNetNameMinDepth
std::map< const std::map< uint32_t, std::string > *, std::map< std::string, std::string > > m_occurrenceAliasesByScope
std::vector< LIB_SYMBOL * > BuildSymbolLibrary()
The caller owns the returned library symbols.
void placePorts(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen, bool aHierarchical)
static constexpr const char * LIB_NICK
Symbol library nickname used in every emitted LIB_ID.
void prepareOccurrenceNets()
– hierarchy [orcad_converter_sheet.cpp] --------------------------------------—
int wireAliasFontId(const ORCAD_ALIAS &aAlias) const
static VECTOR2I snapToWire(int aX, int aY, const ORCAD_WIRE &aWire)
Closest point (DBU) on a wire segment to (aX, aY); exact for H/V wires.
static constexpr int MARGIN_L_DBU
Page margins in DBU leave room for the KiCad frame and title block.
std::set< std::string > m_connectedBlockInterfaceNames
void addSymbolPin(LIB_SYMBOL *aSymbol, const ORCAD_SYMBOL_PIN &aPin, const BOX2I &aBodyBox, PIN_EMIT aEmit)
VECTOR2I placedPinElectricalPosition(const ORCAD_PLACED_INSTANCE &aInstance, size_t aPinIndex) const
void enterScope(PAGE_SCOPE aScope)
std::string powerNet(const ORCAD_RAW_PAGE &aPage, const ORCAD_GRAPHIC_INST &aInst) const
Memoized resolvePowerNet() for the indexed page.
std::set< const std::string * > pinOccurrenceTargets(const ORCAD_RAW_PAGE &aPage, const ORCAD_BLOCK_PIN &aPin, const std::map< uint32_t, std::string > &aScopeNets, bool aSkipGenerated, std::set< std::string > *aSourceKeys=nullptr) const
Occurrence nets in aScopeNets that a block pin on aPage reaches by name or by wire object id.
void placeBusEntries(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen)
SCH_BUS_WIRE_ENTRY per bus entry (position x1,y1; size x2-x1, y2-y1).
const std::set< uint32_t > & pinNetIds(const ORCAD_PIN_INST &aPin) const
Page nets a placed pin joins through its net id, its wire object id or a wire under it.
std::set< std::string > m_nativePowerFamilies
const ORCAD_SYMBOL_DEF * graphicDefinition(const ORCAD_GRAPHIC_INST &aInst) const
The cached variant a page graphic uses: its Source Library first, then its placed bounds,...
std::optional< uint32_t > occurrenceNetIdFor(const std::string *aName) const
Return the occurrence net id owning aName, which the table identifies by address.
static wxString SanitizeFileName(const std::string &aName)
std::map< std::string, std::string > m_globalNetNames
void applyDisplayProp(SCH_FIELD &aField, const ORCAD_DISPLAY_PROP &aDisplay, const VECTOR2I &aAnchorIu, bool aSymbolFlips, bool aApplyVisibility=true) const
Style a field from a display property.
int fontHeightDbu(int aFontIdx, bool aTemplateFont=true) const
|lfHeight| of a Design Template font ID; ID 0 selects the template default.
void appendNetIntent(SCH_SCREEN *aScreen, SCH_LABEL *aLabel, bool aExplicitName, uint32_t aNetId=0)
bool canBuildNativeHierarchy(const ORCAD_RAW_PAGE &aPage, const ORCAD_OCC_SCOPE &aScope) const
One root page whose every block opens a single-page child.
std::set< std::string > m_powerNetNames
std::string effectiveInterfaceNetName(const std::string &aName) const
const ORCAD_DISPLAY_PROP * finishInterfaceLabel(const ORCAD_GRAPHIC_INST &aGraphic, SCH_LABEL_BASE *aLabel, const std::vector< SEG > &aSourceWires, SCH_SCREEN *aScreen)
Style a port or off-page label from its source graphic, draw its stored IREF text and add it.
std::map< std::string, std::string > effectiveProps(const ORCAD_PLACED_INSTANCE &aInst, const ORCAD_SYMBOL_DEF &aDef) const
Empty package and placement values must not clear a library property.
void placeOffpageConnectors(const ORCAD_RAW_PAGE &aPage, SCH_SCREEN *aScreen, const SCH_SHEET_PATH &aSheetPath, bool aHierarchical)
Keep computed intersheet references hidden; display the stored OrCAD IREF text.
A progress reporter interface for use in multi-threaded environments.
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
Holds all the data relating to one schematic.
Definition schematic.h:149
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
Schematic symbol object.
Definition sch_symbol.h:73
Spin style for labels of all kinds on schematics.
Definition sch_label.h:38
FILL_T
Definition eda_fill.h:29
int OrcadDisplayType(const ORCAD_DISPLAY_PROP &aProp)
VECTOR2I OrcadDbuToIu(int aX, int aY)
bool OrcadDisplayPropShowsName(const ORCAD_DISPLAY_PROP &aProp)
FILL_T OrcadFillType(int aFillStyle, int aHatchStyle)
ORCAD_POINT OrcadInverseOrient(int aOrient, int aX, int aY)
Undo the orientation matrix of OrcadTransformPoint.
int OrcadLineWidthIu(int aWidth)
std::pair< double, double > OrcadDashRatios(int aFormatVersionMajor)
int OrcadTextBaselineOffset(int aTextSize)
std::vector< SEG > OrcadHatchLines(const EDA_SHAPE &aShape, int aHatchStyle, int aPitch)
int OrcadPageOrder(wxString &aName)
Return a numeric page prefix (or -1); strip only the "N - title" convention.
int OrcadHatchPitchIu(uint32_t aModifyTimestamp)
bool OrcadDisplayPropShowsValue(const ORCAD_DISPLAY_PROP &aProp)
int OrcadHatchLineWidthIu(uint32_t aModifyTimestamp)
void OrcadTransformPrimitivePoints(ORCAD_PRIMITIVE &aPrim, const std::function< ORCAD_POINT(const ORCAD_POINT &)> &aMap)
Map the point members of a primitive: points, arc start and arc end.
KIGFX::COLOR4D OrcadColor(int aColorIndex)
void OrcadOffsetPrimitive(ORCAD_PRIMITIVE &aPrim, int aDx, int aDy)
Translate a primitive, box included.
int OrcadDisplayFontId(const ORCAD_DISPLAY_PROP &aProp)
wxString OrcadPinNameMarkup(const wxString &aName)
void OrcadForEachLeafPrimitive(const std::vector< ORCAD_PRIMITIVE > &aPrimitives, const std::function< void(const ORCAD_PRIMITIVE &, int, int)> &aVisit)
Visit every non-group primitive in drawing order with the accumulated offset of its enclosing groups.
constexpr int ORCAD_IU_PER_DBU
Schematic internal units per OrCAD DBU: 10 mil * 254 IU/mil.
bool OrcadDisplayPropVisible(const ORCAD_DISPLAY_PROP &aProp)
LINE_STYLE OrcadLineStyle(int aStyle)
int OrcadPageGraphicLineWidthIu(int aWidth)
VECTOR2I OrcadStretchedImageSize(int aWidth, int aHeight, int aBoxWidth, int aBoxHeight)
constexpr ORCAD_ORIENT_ENTRY ORCAD_ORIENT_TABLE[8]
Indexed by orientation bits: angle, mirror, offset selectors, then matrix coefficients.
LINE_STYLE
Dashed line types.
The owning wire defines the connection.
One interface pin of a hierarchical block, at its absolute page position.
Page counters and rules threaded through a folder hierarchy walk.
bool folderSheetNames
name an unreferenced block after its folder, else its page
bool occurrenceAliases
learn power and child occurrence aliases before placing pages
bool rootSharedFolderPage
convert the root page as a shared folder page
bool numberSourcePages
fill title-block page numbers from the walk order
bool nestedFlatSuffix
suffix by block path; else only in simple repeated leaf designs
bool interfaceAliases
alias a child's interface nets to the parent occurrence net
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::string footprint
bool isPower
std::vector< UNIT_INFO > units
sorted by letter; unit numbers are 1-based indices
std::string refPrefix
std::string powerNet
power symbols are keyed by NET name
One resolved off-page connector: index into page.offpage, net, pin position.
Lookups for the page and scope being converted, rebuilt by buildNetLookup().
std::vector< VECTOR2I > junctions
std::map< const ORCAD_PIN_INST *, std::set< uint32_t > > pinNets
std::map< std::pair< int, int >, std::vector< const ORCAD_WIRE * > > wireEndpoints
std::map< uint32_t, std::set< const std::string * > > occurrenceNamesByNetId
Scope occurrence nets owned by a page net through a wire or part object id.
std::map< const ORCAD_GRAPHIC_INST *, std::string > powerNets
powerNet() depends on the scope, so the memo lives only as long as this index.
Occurrence context of the page being converted.
std::map< std::string, std::string > interfaceNetAliases
std::set< std::string > connectorInterfaceNetAliases
std::map< std::string, std::string > unconnectedInterfaceNetNames
std::map< std::string, size_t > electricalKeyCounts
std::map< std::string, std::string > occurrenceNetAliases
const ORCAD_OCC_SCOPE * occ
null when the page has no occurrence
Per-pin choices kicadSymbolFor() makes before emitting a pin.
Placements of a power symbol name and the power nets they resolved to.
std::map< std::string, std::pair< std::string, size_t > > targets
– shared bookkeeping types ------------------------------------------------—
std::vector< int > pinOffsets
hidden duplicate-pin electrical offsets, DBU
std::vector< bool > pinIgnore
package pins suppressed for this unit
const ORCAD_SYMBOL_DEF * convert
DeMorgan view sharing this unit's pin map.
const ORCAD_SYMBOL_DEF * symbol
std::vector< bool > explicitPinNets
placed pins whose source net overrides implicit power naming
std::vector< std::string > pinNumbers
device pin-number map for this unit
std::string letter
unit discriminator, e.g. "A", "-16", "B:Convert"
bool operator==(const UNIT_INFO &) const =default
std::vector< bool > pinNumberVisible
nonblank source package pin numbers
Child-folder pages are instantiated for each occurrence, with that occurrence's references.
Display positions use symbol coordinates; rotFont combines the font index and quarter turns.
The inline LibraryPart defines the block interface; placed pin records supply absolute positions.
Free graphics use nested primitive coordinates.
Repeated child folders have separate scopes and reference designators.
Each scope holds the references and child blocks for one instantiation path.
OrCAD rotates about the bounding box; KiCad rotates about the anchor.
int8_t c
int8_t a
int8_t d
int8_t b
Pin positions are absolute page connection points.
The placed box includes displayed text.
Integer point in OrCAD DBU.
Primitive byte lengths can include or exclude the eight-byte size envelope.
One parsed 'Views/<folder>/Pages/<page>' stream, raw structure lists in stream order.
The bounding box occupies the final eight bytes before the next prefix stop.
Pin coordinates use symbol space with Y down.
The wire ID refers to the page net table.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708