KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_records.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_RECORDS_H_
26#define ORCAD_RECORDS_H_
27
28#include <cstdint>
29#include <functional>
30#include <map>
31#include <memory>
32#include <optional>
33#include <string>
34#include <utility>
35#include <vector>
36
37#include <wx/string.h>
38
40using ORCAD_WARN_FN = std::function<void( const wxString& aMsg )>;
41
42
43enum ORCAD_ST : int
44{
93};
94
95
111
112
127
128
141
142
145{
146 int x = 0;
147 int y = 0;
148
149 bool operator==( const ORCAD_POINT& aOther ) const { return x == aOther.x && y == aOther.y; }
150 bool operator!=( const ORCAD_POINT& aOther ) const { return !( *this == aOther ); }
151};
152
153
156{
157 int x1 = 0;
158 int y1 = 0;
159 int x2 = 0;
160 int y2 = 0;
161};
162
163
166{
167 uint32_t nameIdx = 0;
168 std::string name;
169 int x = 0;
170 int y = 0;
171 int rotation = 0;
172 int fontIdx = 0;
173 int color = 0;
174 int dispMode = 0;
175};
176
177
180{
181 std::string name;
182 int x = 0;
183 int y = 0;
184 int rotation = 0;
185 int color = 0;
186 int fontIdx = 0;
187};
188
189
192{
193 uint32_t dbId = 0;
194 uint32_t id = 0;
195 int x1 = 0;
196 int y1 = 0;
197 int x2 = 0;
198 int y2 = 0;
199 bool isBus = false;
200 int color = 0;
201 int lineWidth = 3;
202 int lineStyle = 5;
203 std::vector<ORCAD_ALIAS> aliases;
204};
205
206
209{
210 int16_t pinIndex = 0;
211 int x = 0;
212 int y = 0;
213 uint32_t wordA = 0;
214 uint32_t wordB = 0;
215 std::vector<ORCAD_DISPLAY_PROP> displayProps;
216
217 bool IsNoConnect() const { return pinIndex < 0; }
218};
219
220
223{
224 std::string pkgName;
225 uint32_t dbId = 0;
226 int x = 0;
227 int y = 0;
228 std::string reference;
229 std::string value;
230 std::map<std::string, std::string> props;
231 std::vector<ORCAD_DISPLAY_PROP> displayProps;
232 int color = 0;
233 int rotation = 0;
234 bool mirror = false;
235 uint8_t partIndex = 0;
236 uint8_t partByte = 0;
238 std::string sourcePackage;
239 std::string sourceLibrary;
240 uint16_t unitIndex = 0;
241 std::vector<ORCAD_PIN_INST> pins;
242};
243
244
245struct ORCAD_SYMBOL_DEF; // defined below (ORCAD_GRAPHIC_INST holds one by pointer)
246
247
250{
251 int typeId = 0;
252 std::string name;
253 uint32_t dbId = 0;
254 int x = 0;
255 int y = 0;
257 int color = 0;
258 std::map<std::string, std::string> props;
259 std::vector<ORCAD_DISPLAY_PROP> displayProps;
260 std::unique_ptr<ORCAD_SYMBOL_DEF> nested;
261 int rotation = 0;
262 bool mirror = false;
263 std::string logicalName;
264 double textScaleX = 1.0;
265 double textScaleY = 1.0;
268 std::string textFaceOverride;
269};
270
271
275{
277 int x1 = 0;
278 int y1 = 0;
279 int x2 = 0;
280 int y2 = 0;
281 std::optional<ORCAD_POINT> start;
282 std::optional<ORCAD_POINT> end;
283 std::vector<ORCAD_POINT> points;
284 std::string text;
285 int fontIdx = 0;
286 std::optional<ORCAD_POINT> textBoundsStart;
287 int lineStyle = 5;
288 int lineWidth = 3;
289 int fillStyle = 1;
290 int hatchStyle = 0;
291 std::vector<uint8_t> data;
292 std::vector<ORCAD_PRIMITIVE> children;
293};
294
295
298{
299 std::string name;
300 int position = -1;
301 int startX = 0;
302 int startY = 0;
303 int hotptX = 0;
304 int hotptY = 0;
306 int shapeBits = 0;
307 std::vector<ORCAD_DISPLAY_PROP> displayProps;
308};
309
310
313{
314 int typeId = 0;
315 std::string name;
316 std::string sourceLib;
317 int color = 0;
318 std::vector<ORCAD_PRIMITIVE> primitives;
319 std::vector<ORCAD_SYMBOL_PIN> pins;
320 std::optional<ORCAD_BBOX> bbox;
321 std::map<std::string, std::string> props;
322
324 std::vector<ORCAD_SYMBOL_DEF> variants;
325
328 int generalFlags = -1;
329
330 bool synthesized = false;
331};
332
333
336{
337 std::string unitRef;
338 std::string refDes;
339 std::vector<std::string> pinNumbers;
340 std::vector<bool> pinIgnore;
341};
342
343
345{
346 std::string name;
347 std::string sourceLib;
348 std::string refDes;
349 std::string pcbFootprint;
350 std::vector<ORCAD_DEVICE> devices;
351 std::vector<ORCAD_PACKAGE> variants;
352
355 std::map<std::string, std::string> props;
356};
357
358
361{
362 std::string name;
364 int x = 0;
365 int y = 0;
366 bool noConnect = false;
367};
368
369
372{
373 uint32_t dbId = 0;
374 std::string name;
375 std::string reference;
376 std::map<std::string, std::string> props;
377 int x1 = 0;
378 int y1 = 0;
379 int w = 0;
380 int h = 0;
381 std::vector<ORCAD_BLOCK_PIN> pins;
382 std::vector<ORCAD_DISPLAY_PROP> displayProps;
383 std::string childName;
384};
385
386
388{
389 int x1 = 0;
390 int y1 = 0;
391 int x2 = 0;
392 int y2 = 0;
393 int color = 0;
394};
395
396
399{
400 int height = 0;
401 int width = 0;
402 int escapement = 0;
403 int orientation = 0;
404 uint8_t pitchAndFamily = 0;
405 std::string face;
406 bool italic = false;
407 bool bold = false;
408};
409
410
413{
414 uint32_t createTimestamp = 0;
415 uint32_t modifyTimestamp = 0;
416 uint32_t width = 0;
417 uint32_t height = 0;
418 uint32_t pinToPin = 100;
419 uint16_t horizontalCount = 0;
420 uint16_t verticalCount = 0;
421 uint32_t horizontalWidth = 0;
422 uint32_t verticalWidth = 0;
423 bool horizontalChar = false;
425 bool verticalChar = false;
426 bool verticalAscending = false;
427 bool isMetric = false;
428 bool borderDisplayed = false;
429 bool borderPrinted = false;
430 bool gridRefDisplayed = false;
431 bool gridRefPrinted = false;
433 bool titleblockPrinted = false;
434 bool ansiGridRefs = false;
435};
436
437
439{
440 uint32_t id = 0;
441 std::string name;
442 std::vector<uint32_t> members;
443};
444
445
447{
448 std::string introduction;
451 uint32_t createTimestamp = 0;
452 uint32_t modifyTimestamp = 0;
453 std::vector<ORCAD_FONT> fonts;
454 std::vector<int> templateFonts;
455 int pinNameFont = 0;
457 std::vector<std::string> partFields;
458 std::vector<std::string> strings;
459 std::vector<std::pair<std::string, std::string>> partAliases;
460 std::string schematicName;
461 uint32_t pinToPin = 100;
462};
463
464
467{
469 ORCAD_RAW_PAGE() = default;
470 ORCAD_RAW_PAGE( const ORCAD_RAW_PAGE& ) = delete;
474
475 std::string name;
476 std::string pageSize;
477 size_t sourcePageNumber = 0;
478 size_t sourcePageCount = 0;
479 std::map<std::string, std::string> props;
480 uint32_t createTimestamp = 0;
481 uint32_t modifyTimestamp = 0;
482 uint32_t width = 0;
483 uint32_t height = 0;
484 bool isMetric = false;
485 uint16_t horizontalCount = 0;
486 uint16_t verticalCount = 0;
487 uint32_t horizontalWidth = 0;
488 uint32_t verticalWidth = 0;
489 bool horizontalChar = false;
491 bool verticalChar = false;
492 bool verticalAscending = false;
493 bool borderPrinted = false;
494 bool gridRefPrinted = false;
495 std::vector<ORCAD_GRAPHIC_INST> titleBlocks;
496 std::vector<ORCAD_WIRE> wires;
497 std::vector<ORCAD_PLACED_INSTANCE> instances;
498 std::vector<ORCAD_GRAPHIC_INST> ports;
499 std::vector<ORCAD_GRAPHIC_INST> globals;
500 std::vector<ORCAD_GRAPHIC_INST> offpage;
501 std::vector<ORCAD_GRAPHIC_INST> ercObjects;
502 std::vector<ORCAD_BUS_ENTRY> busEntries;
503 std::vector<ORCAD_GRAPHIC_INST> graphics;
504 std::map<uint32_t, std::string> netmap;
505 std::map<uint32_t, std::vector<std::string>> netAliases;
506 std::vector<ORCAD_NET_GROUP> netGroups;
507 std::vector<ORCAD_DRAWN_INSTANCE> blocks;
508};
509
510
511struct ORCAD_OCC_BLOCK; // defined below (a scope owns child block occurrences)
512
513
516{
517 std::map<uint32_t, std::string> partRefs;
518 std::map<uint32_t, std::string> partUnitRefs;
519 std::map<uint32_t, std::map<std::string, std::string>> partProps;
520 std::map<uint32_t, std::string> netNames;
521 std::vector<ORCAD_OCC_BLOCK> blocks;
522};
523
524
527{
528 uint32_t targetDbId = 0;
529 std::string childFolder;
531};
532
533
536{
537 std::string sourceId;
538 std::string name;
540 std::map<std::string, ORCAD_SYMBOL_DEF> symbols;
541 std::map<std::string, ORCAD_PACKAGE> packages;
542 std::vector<ORCAD_RAW_PAGE> pages;
543
546 std::map<std::string, std::vector<ORCAD_RAW_PAGE>> childFolderPages;
547
550 std::map<std::string, std::vector<ORCAD_RAW_PAGE>> unreferencedFolderPages;
551
554
555 bool hasHierarchyBlocks = false;
556};
557
558#endif // ORCAD_RECORDS_H_
Generic cubic Bezier representation.
Plain ellipse / elliptical-arc data.
Definition ellipse.h:32
Manage an 8-bit channel image.
Definition image.h:86
Definition line.h:32
std::function< void(const wxString &aMsg)> ORCAD_WARN_FN
Coordinates use DBU with Y down.
ORCAD_PRIM
Primitive types appear as a doubled byte pair before each body.
@ ORCAD_PRIM_ARC
@ ORCAD_PRIM_BEZIER
@ ORCAD_PRIM_POLYLINE
@ ORCAD_PRIM_COMMENT_TEXT
@ ORCAD_PRIM_LINE
@ ORCAD_PRIM_ELLIPSE
@ ORCAD_PRIM_BITMAP
plain DIB (BITMAPINFOHEADER + pixels)
@ ORCAD_PRIM_OLE_IMAGE
OLE compound document embed.
@ ORCAD_PRIM_POLYGON
@ ORCAD_PRIM_RECT
@ ORCAD_PRIM_SYMBOL_VECTOR
nested prefix-framed vector graphic
ORCAD_PORT_TYPE
Map unknown electrical type codes to PASSIVE.
ORCAD_ST
@ ORCAD_ST_HIERARCHY_LINK
block dbId -> child folder link
@ ORCAD_ST_STH_IN_PAGES0
nested symbol body inside Graphic*Inst
@ ORCAD_ST_T0X34
raw record, not prefix-framed
@ ORCAD_ST_PORT_SYMBOL
@ ORCAD_ST_TITLEBLOCK_SYMBOL
@ ORCAD_ST_T0X10
scalar pin instance (absolute pos)
@ ORCAD_ST_T0X35
raw record, not prefix-framed
@ ORCAD_ST_WIRE_SCALAR
@ ORCAD_ST_PLACED_INSTANCE
@ ORCAD_ST_GRAPHIC_ARC_INST
@ ORCAD_ST_SYMBOL_PIN_SCALAR
@ ORCAD_ST_PART_CELL
@ ORCAD_ST_DRAWN_INSTANCE
hierarchical block instance
@ ORCAD_ST_TITLEBLOCK
@ ORCAD_ST_SYMBOL_VECTOR
@ ORCAD_ST_GLOBAL
placed power symbol
@ ORCAD_ST_PAGE
@ ORCAD_ST_GRAPHIC_BITMAP_INST
@ ORCAD_ST_LIBRARY_PART
@ ORCAD_ST_OFFPAGE_CONNECTOR
@ ORCAD_ST_DEVICE
@ ORCAD_ST_PORT
@ ORCAD_ST_GRAPHIC_LINE_INST
@ ORCAD_ST_GLOBAL_SYMBOL
power symbol definition
@ ORCAD_ST_BOOKMARK_SYMBOL
@ ORCAD_ST_PACKAGE
@ ORCAD_ST_GRAPHIC_COMMENT_TEXT_INST
@ ORCAD_ST_GRAPHIC_ELLIPSE_INST
@ ORCAD_ST_GRAPHIC_BOX_INST
@ ORCAD_ST_ERC_OBJECT
saved design-rule-check marker
@ ORCAD_ST_SYMBOL_PIN_BUS
@ ORCAD_ST_GRAPHIC_POLYLINE_INST
@ ORCAD_ST_BOOKMARK_INST
@ ORCAD_ST_GRAPHIC_BEZIER_INST
@ ORCAD_ST_GRAPHIC_POLYGON_INST
@ ORCAD_ST_ALIAS
net alias attached to a wire
@ ORCAD_ST_WIRE_BUS
@ ORCAD_ST_SCH_LIB
@ ORCAD_ST_SYMBOL_DISPLAY_PROP
@ ORCAD_ST_T0X11
bus pin instance (absolute pos)
@ ORCAD_ST_ERC_SYMBOL
@ ORCAD_ST_BUS_ENTRY
@ ORCAD_ST_GRAPHIC_OLE_INST
@ ORCAD_ST_OFFPAGE_SYMBOL
@ ORCAD_ST_PART_INSTANCE
@ ORCAD_ST_NET_GROUP
@ ORCAD_ST_PIN_SHAPE_SYMBOL
@ ORCAD_ST_DSN_STREAM
ORCAD_PRIM_KIND
Decoded primitive kind after parsing.
The owning wire defines the connection.
std::string name
int rotation
0..3 quarter turns
Axis-aligned box in OrCAD DBU; corner order as stored (not normalized).
One interface pin of a hierarchical block, at its absolute page position.
ORCAD_PORT_TYPE portType
std::string name
int y1
int color
int x2
int y2
int x1
Child-folder pages are instantiated for each occurrence, with that occurrence's references.
ORCAD_LIBRARY_INFO library
std::string sourceId
stable checksum of the input file
ORCAD_OCC_SCOPE occurrenceRoot
Occurrence references distinguish repeated placements of a child schematic.
std::map< std::string, ORCAD_SYMBOL_DEF > symbols
cache, keyed by cache name
bool hasHierarchyBlocks
std::map< std::string, std::vector< ORCAD_RAW_PAGE > > unreferencedFolderPages
Schematic folder pages not instantiated by the active hierarchy.
std::map< std::string, ORCAD_PACKAGE > packages
keyed by package name
std::string name
design (root schematic) name
std::map< std::string, std::vector< ORCAD_RAW_PAGE > > childFolderPages
Child schematic folder pages, keyed by lower-cased folder name; instantiated once per hierarchical bl...
std::vector< ORCAD_RAW_PAGE > pages
root schematic folder pages
Device unit names omit the view suffix.
std::vector< std::string > pinNumbers
std::string refDes
std::vector< bool > pinIgnore
std::string unitRef
Display positions use symbol coordinates; rotFont combines the font index and quarter turns.
int fontIdx
1-based into ORCAD_LIBRARY_INFO::fonts; 0 = default
int rotation
0..3 quarter turns
std::string name
resolved property name (empty when index invalid)
The inline LibraryPart defines the block interface; placed pin records supply absolute positions.
std::string name
intrinsic Name property used for flat-net scoping
int x1
block rectangle top-left, page DBU
std::vector< ORCAD_BLOCK_PIN > pins
std::vector< ORCAD_DISPLAY_PROP > displayProps
std::string childName
child folder, when embedded
std::map< std::string, std::string > props
Font indices are one-based; zero selects the default.
uint8_t pitchAndFamily
bool bold
lfWeight >= 600
int orientation
glyph direction in tenths of a degree
int width
raw lfWidth; zero lets the font choose its natural aspect ratio
std::string face
int escapement
baseline direction in tenths of a degree
int height
raw lfHeight (typically negative)
Free graphics use nested primitive coordinates.
std::unique_ptr< ORCAD_SYMBOL_DEF > nested
SthInPages0 body, else nullptr.
std::map< std::string, std::string > props
int rotation
0..3 quarter turns
std::string name
cache symbol name
std::string textFaceOverride
std::vector< ORCAD_DISPLAY_PROP > displayProps
std::string logicalName
ports: resolved net/port name
int typeId
ORCAD_ST value.
std::string introduction
fixed 32-byte NUL-terminated buffer
std::vector< std::string > strings
global string table
std::vector< ORCAD_FONT > fonts
int pinNumberFont
Design Template font ID (slot 11)
std::vector< std::pair< std::string, std::string > > partAliases
std::vector< int > templateFonts
template font ID -> 1-based LOGFONT index
std::string schematicName
root schematic folder name
int pinNameFont
Design Template font ID (slot 10)
std::vector< std::string > partFields
the 8 named part fields
std::vector< uint32_t > members
std::string name
Repeated child folders have separate scopes and reference designators.
uint32_t targetDbId
type-12 drawn-instance dbId on the parent page
ORCAD_OCC_SCOPE scope
the child's occurrences under this path
std::string childFolder
child schematic folder name
Each scope holds the references and child blocks for one instantiation path.
std::vector< ORCAD_OCC_BLOCK > blocks
hierarchical block occurrences
std::map< uint32_t, std::map< std::string, std::string > > partProps
dbId -> occurrence properties
std::map< uint32_t, std::string > netNames
occurrence net id -> effective net name
std::map< uint32_t, std::string > partRefs
type-13 dbId -> occurrence refdes
std::map< uint32_t, std::string > partUnitRefs
dbId -> package unit reference
std::string refDes
std::map< std::string, std::string > props
Part-level properties shared by every placement (Description, Tolerance, ...).
std::vector< ORCAD_PACKAGE > variants
later same-name cache entries in stream order
std::string sourceLib
std::vector< ORCAD_DEVICE > devices
std::string pcbFootprint
std::string name
Dimensions use mils when isMetric is zero, otherwise micrometres.
Pin positions are absolute page connection points.
std::vector< ORCAD_DISPLAY_PROP > displayProps
uint32_t wordA
two flag/id words after (x, y)
bool IsNoConnect() const
The placed box includes displayed text.
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
uint16_t unitIndex
zero-based package device index
std::map< std::string, std::string > props
short-prefix property pairs
bool mirror
orientation bit 2
std::string sourceLibrary
source library path from the placed-instance header
std::string value
resolved Part Value
std::vector< ORCAD_PIN_INST > pins
successfully parsed T0x10 records
Integer point in OrCAD DBU.
bool operator==(const ORCAD_POINT &aOther) const
bool operator!=(const ORCAD_POINT &aOther) const
Primitive byte lengths can include or exclude the eight-byte size envelope.
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
std::optional< ORCAD_POINT > textBoundsStart
ORCAD_PRIM_KIND kind
std::vector< uint8_t > data
kind == IMAGE: raw embedded payload
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.
uint32_t verticalWidth
ORCAD_RAW_PAGE & operator=(ORCAD_RAW_PAGE &&)=default
uint32_t horizontalWidth
std::vector< ORCAD_GRAPHIC_INST > ports
ORCAD_RAW_PAGE(ORCAD_RAW_PAGE &&)=default
size_t sourcePageCount
pages in the OrCAD folder
std::map< uint32_t, std::vector< std::string > > netAliases
every name recorded for a net db id
std::string name
std::vector< ORCAD_GRAPHIC_INST > globals
placed power symbols
ORCAD_RAW_PAGE(const ORCAD_RAW_PAGE &)=delete
ORCAD_RAW_PAGE()=default
Explicit moves prevent vector growth from selecting a copy of the unique_ptr members.
ORCAD_RAW_PAGE & operator=(const ORCAD_RAW_PAGE &)=delete
std::map< uint32_t, std::string > netmap
net db id -> net name
std::map< std::string, std::string > props
std::vector< ORCAD_WIRE > wires
size_t sourcePageNumber
1-based within the OrCAD folder
uint32_t width
mils, or um when isMetric
std::vector< ORCAD_NET_GROUP > netGroups
bus net id -> member net ids
std::vector< ORCAD_DRAWN_INSTANCE > blocks
hierarchical blocks (detection only)
std::vector< ORCAD_PLACED_INSTANCE > instances
uint16_t horizontalCount
std::vector< ORCAD_GRAPHIC_INST > graphics
free comment text/shapes/images
std::vector< ORCAD_GRAPHIC_INST > offpage
off-page connectors
std::vector< ORCAD_GRAPHIC_INST > titleBlocks
std::vector< ORCAD_BUS_ENTRY > busEntries
uint16_t verticalCount
std::string pageSize
page-size name string, e.g. "B"
std::vector< ORCAD_GRAPHIC_INST > ercObjects
saved design-rule-check markers
uint32_t createTimestamp
uint32_t modifyTimestamp
The bounding box occupies the final eight bytes before the next prefix stop.
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
std::map< std::string, std::string > props
int typeId
ORCAD_ST value.
std::string sourceLib
std::optional< ORCAD_BBOX > bbox
symbol-space body box
std::vector< ORCAD_SYMBOL_DEF > variants
Variant zero is this entry.
int generalFlags
LibraryPart GeneralProperties flags (-1 = absent); bit0 = pin names visible, bit1 = pin text rotates ...
Pin coordinates use symbol space with Y down.
int position
slot in the parent symbol pin vector
std::vector< ORCAD_DISPLAY_PROP > displayProps
ORCAD_PORT_TYPE portType
The wire ID refers to the page net table.
uint32_t dbId
bool isBus
true for structure type 21
std::vector< ORCAD_ALIAS > aliases