KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_converter.h File Reference

ORCAD_CONVERTER turns a parsed ORCAD_DESIGN into KiCad schematic objects. More...

#include <cstdint>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <wx/string.h>
#include <math/box2.h>
#include <math/vector2d.h>
#include <gal/color4d.h>
#include <eda_shape.h>
#include <sch_io/orcad/orcad_records.h>

Go to the source code of this file.

Classes

struct  ORCAD_ORIENT_ENTRY
 One entry of the 8-orientation placement table. More...
 
class  ORCAD_CONVERTER
 Builds the KiCad schematic from a parsed OrCAD design. More...
 
struct  ORCAD_CONVERTER::UNIT_INFO
 One unit of an emitted multi-unit symbol. More...
 
struct  ORCAD_CONVERTER::LIB_ENTRY
 One emitted KiCad lib symbol (possibly multi-unit). More...
 
struct  ORCAD_CONVERTER::OFFPAGE_NET
 One resolved off-page connector: index into page.offpage, net, pin position. More...
 

Functions

KIGFX::COLOR4D OrcadColor (int aColorIndex)
 
int OrcadLineWidthIu (int aWidth)
 
LINE_STYLE OrcadLineStyle (int aStyle)
 
FILL_T OrcadFillType (int aFillStyle, int aHatchStyle)
 
int OrcadPageOrder (wxString &aName)
 Return a numeric page prefix (or -1); strip only the "N - title" convention.
 
VECTOR2I OrcadDbuToIu (int aX, int aY)
 
int OrcadOrientOf (int aRotation, bool aMirror)
 Compose the 3-bit orientation code from the rotation bits and mirror bit.
 
int OrcadOrientDim (int aSelector, int aWidth, int aHeight)
 
VECTOR2I OrcadOrientOffset (int aOrient, int aWidth, int aHeight)
 Bbox re-anchoring offset for the given orientation and body size (DBU).
 
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 (aBaseX, aBaseY), orientation aOrient and body size (aWidth, aHeight).
 

Variables

constexpr int ORCAD_IU_PER_DBU = 2540
 Schematic internal units per OrCAD DBU: 10 mil * 254 IU/mil.
 
constexpr ORCAD_ORIENT_ENTRY ORCAD_ORIENT_TABLE [8]
 Orientation table, indexed by the 3-bit orientation code.
 

Detailed Description

ORCAD_CONVERTER turns a parsed ORCAD_DESIGN into KiCad schematic objects.

The class is implemented across two translation units:

  • orcad_converter_symbols.cpp: LIB_SYMBOL building from cache definitions, variant selection, placeholder synthesis, SCH_SYMBOL/power-symbol placement and field placement.
  • orcad_converter_sheet.cpp: root/page sheet assembly, wires, buses, labels, junctions, no-connects, page graphics, title blocks, page sizing and bitmaps.

Each private method below is tagged with the translation unit that implements it. Only these two files may define ORCAD_CONVERTER members.

Coordinate model: 1 OrCAD DBU = 10 mil, Y down on both sides, so IU = DBU * 2540 with no axis flip anywhere: KiCad's in-memory LIB_SYMBOL space is Y-down like the canvas (only the .kicad_sch writer flips symbol bodies into the file's Y-up space), so cache definition coordinates are used unchanged. Electrical points land on a 100-mil grid natively.

Definition in file orcad_converter.h.

Function Documentation

◆ OrcadColor()

◆ OrcadDbuToIu()

◆ OrcadFillType()

FILL_T OrcadFillType ( int aFillStyle,
int aHatchStyle )

◆ OrcadLineStyle()

LINE_STYLE OrcadLineStyle ( int aStyle)

◆ OrcadLineWidthIu()

int OrcadLineWidthIu ( int aWidth)

◆ OrcadOrientDim()

int OrcadOrientDim ( int aSelector,
int aWidth,
int aHeight )
inline

Definition at line 151 of file orcad_converter.h.

Referenced by OrcadOrientOffset().

◆ OrcadOrientOf()

int OrcadOrientOf ( int aRotation,
bool aMirror )
inline

◆ OrcadOrientOffset()

VECTOR2I OrcadOrientOffset ( int aOrient,
int aWidth,
int aHeight )
inline

Bbox re-anchoring offset for the given orientation and body size (DBU).

Definition at line 158 of file orcad_converter.h.

References ORCAD_ORIENT_TABLE, OrcadOrientDim(), ORCAD_ORIENT_ENTRY::txSel, and ORCAD_ORIENT_ENTRY::tySel.

Referenced by OrcadTransformPoint(), ORCAD_CONVERTER::placeInstance(), ORCAD_CONVERTER::placePowerSymbol(), and ORCAD_CONVERTER::synthesizeSymbol().

◆ OrcadPageOrder()

int OrcadPageOrder ( wxString & aName)

Return a numeric page prefix (or -1); strip only the "N - title" convention.

Definition at line 197 of file orcad_converter_sheet.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and ORCAD_CONVERTER::Convert().

◆ OrcadTransformPoint()

VECTOR2I OrcadTransformPoint ( int aOrient,
int aWidth,
int aHeight,
int aBaseX,
int aBaseY,
int aPx,
int aPy )
inline

Absolute canvas position (DBU) of symbol-space point (aPx, aPy) for an instance with transform base (aBaseX, aBaseY), orientation aOrient and body size (aWidth, aHeight).

For placed parts the base is the instance anchor; for power/off-page/port symbols it is the placed bbox min corner, NOT the anchor.

Definition at line 172 of file orcad_converter.h.

References ORCAD_ORIENT_ENTRY::a, ORCAD_ORIENT_ENTRY::b, ORCAD_ORIENT_ENTRY::c, ORCAD_ORIENT_ENTRY::d, ORCAD_ORIENT_TABLE, OrcadOrientOffset(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ORCAD_CONVERTER::graphicPinPos(), ORCAD_CONVERTER::pickVariant(), ORCAD_CONVERTER::placeDefinitionImages(), ORCAD_CONVERTER::placeDefinitionVectors(), ORCAD_CONVERTER::placeInstance(), and ORCAD_CONVERTER::placeSymbolFields().

Variable Documentation

◆ ORCAD_IU_PER_DBU

int ORCAD_IU_PER_DBU = 2540
inlineconstexpr

◆ ORCAD_ORIENT_TABLE

ORCAD_ORIENT_ENTRY ORCAD_ORIENT_TABLE[8]
inlineconstexpr
Initial value:
= {
{ 0, 0, 0, 0, 1, 0, 0, 1 },
{ 90, 0, 0, 1, 0, 1, -1, 0 },
{ 180, 0, 1, 2, -1, 0, 0, -1 },
{ 270, 0, 2, 0, 0, -1, 1, 0 },
{ 0, 'y', 1, 0, -1, 0, 0, 1 },
{ 90, 'x', 0, 0, 0, 1, 1, 0 },
{ 0, 'x', 0, 2, 1, 0, 0, -1 },
{ 270, 'x', 2, 1, 0, -1, -1, 0 }
}

Orientation table, indexed by the 3-bit orientation code.

KiCad angle/mirror pairs and bbox anchor offsets:

ori : (angle, mirror) offset(w, h) matrix (a b c d) 0 : ( 0, -) (0, 0) ( 1 0 0 1) 1 : ( 90, -) (0, w) ( 0 1 -1 0) 2 : (180, -) (w, h) (-1 0 0 -1) 3 : (270, -) (h, 0) ( 0 -1 1 0) 4 : ( 0, y) (w, 0) (-1 0 0 1) 5 : ( 90, x) (0, 0) ( 0 1 1 0) 6 : ( 0, x) (0, h) ( 1 0 0 -1) 7 : (270, x) (h, w) ( 0 -1 -1 0)

Definition at line 132 of file orcad_converter.h.

Referenced by OrcadOrientOffset(), OrcadTransformPoint(), ORCAD_CONVERTER::placeBitmap(), ORCAD_CONVERTER::placeSymbolFields(), and ORCAD_CONVERTER::synthesizeSymbol().