Purpose of this project is to provide a C++17 library for parsing Cadence's OrCAD Capture binary file formats. This library can be linked to other software for reading/modifying?/writing? OrCAD binary files.
See also the complementary project OpenAllegroParser.
The focus lies on schematics (*.DSN
/*.DBK
) and symbol libraries (*.OLB
/*.OBK
), the second file format is just the extension for its corresponding backup file. Backups should be identical, just with a different file extension.
OrCAD allows exporting its designs to XML files which are easy to read and verify the interpretation of bytes in the DSN
/OLB
-files. E.g. enums are stored as a numeric value which should be the same that is used in the binary formats. However, it seems like not all information is stored in the XML.
The following two XSD files provide a good overview of the XML
file structure, types and much more. They can be used as a reference what features are actually stored in the binary file and which we do already parse and which not.
C:\Cadence\SPB_17.4\tools\capture\tclscripts\capDB\dsn.xsd
C:\Cadence\SPB_17.4\tools\capture\tclscripts\capDB\olb.xsd
- I plan on implementing a very basic XML exporter for
Package
- This allows to generate images by importing into KiCad via pyorlib2ki
- It's planned to finish the
Package
parser around spring 2023 - A PoC KiCad importer should follow in summer 2023
# Install and set up vcpkg
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
# Set path to vcpkg
VCPKG_DIR=$(realpath ./vcpkg)
# Get OpenOrCadParser
git clone https://github.com/Werni2A/OpenOrCadParser.git
cd OpenOrCadParser
# Build
cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake
cmake --build build
- Compiler with C++17 Support
- CMake >= 3.8
- Boost - Program Options
- compoundfilereader
- fmt
- Magic Enum
- Nameof
- spdlog
- TinyXML2
./cli/OpenOrCadParser-cli --help
Allowed options:
-h [ --help ] produce help message
-t [ --print_tree ] print container tree
-e [ --extract ] extract binary files from CFBF container
-i [ --input ] arg input file to parse
-o [ --output ] arg output path (required iff extract is set)
-v [ --verbosity ] arg (=4) verbosity level (0 = off, 6 = highest)
-s [ --stop ] stop parsing on low severity errors
-k [ --keep ] keep temporary files after parser completed
./cli/OpenOrCadParser-cli --input file.DSN
./cli/OpenOrCadParser-cli --input file.DSN --extract --output out/
./cli/OpenOrCadParser-cli --input file.DSN --print_tree
./cli/OpenOrCadParser-cli --input file.OLB --verbosity 6 --keep >> file.txt
pyorlib2ki makes it possible to import XML files into KiCad getting a graphical representation of the Package
.
Pictures make it easy to compare against OrCAD's original but do not expect much of it at the moment. The required XML export feature is still in a very early stage. See the following image as an example.
#!/bin/bash
# Generate XML file
./build/cli/OpenOrCadParser-cli -k -i "Library.OLB"
# Copy XML path to this variable
XML_PATH=/tmp/OpenOrCadParser/bffb65106f5b2365049dfc9de4a8b7e3/Package.OLB/xml/PackageName0.xml
SYM_PATH=PackageName0.kicad_sym
# Use https://github.com/fjullien/pyorlib2ki
python pyorlib2ki.py -i $XML_PATH -o $SYM_PATH
# Import symbol into KiCad and export graphical representation
orlib2ki (C based OrCAD XML Library to KiCad Converter)
pyorlib2ki (Python based OrCAD XML Library to KiCad Converter)
There are different ways to help this project forward. Some are
- provide test files (manually created or automated via Tcl/Tk),
- help reverse engineering/documenting the file format, or
- implement some unit tests.
In case you don't have access to OrCAD you can get
- OrCAD Viewer free of charge,
- OrCAD Trial with all its functionality for a trial period of 30 days or
- OrCAD Academic Program with all functionality for one semester.
What about OrCAD Lite? It was was replaced with OrCAD Viewer/Trial [1].