Work In Progress: Native CADSTAR Importer

Hi all,

Some of you might have already noticed this but for those that haven’t, I thought I’d post in the forum to highlight some work I’ve been doing on the KiCad codebase: a native Zuken CADSTAR importer for KiCad.

My motivation for doing so is that in my company we have been looking to change EDA tools (since CADSTAR is really quite dated and clunky to use). The main hurdle with switching design tools is that most of the designs in my company have been done in CADSTAR so the new tool would need to be able to import our existing designs. I spent time looking at Altium, since their literature claims they are able to convert CADSTAR designs, however this proved to not be quite true. To summarise: I spent 18 months back and forth with the Altium representative trying different versions of Altium to find a significant number of import errors that required a lot of manual rework. They fixed some of the errors but left the most time consuming ones with the excuse that the CADSTAR importer is a low priority development for them since not many users request it. The current state of the Altium importer meant we had to spend 2-3 hours of manual effort after the automatic import, which was not acceptable (given we have hundreds of designs).

So that left me in a difficult position: basically I was stuck with using CADSTAR forever (nightmare!). I really like KiCad and used it several times for personal projects with the latest version being in many ways superior to CADSTAR. I came to the conclusion to move away from CADSTAR at work I would have to spend my free time developing an importer for KiCad

I have spent the last two months working on this and have now finalised a CADSTAR PCB Archive importer (see https://gitlab.com/kicad/code/kicad/-/merge_requests/279 ). This is waiting for code review before the code gets merged in to master. In parallel to this am working offline on a schematic importer which I hope to also finish before v6 feature freeze (this will be a stretch but luckily most of the elements in the schematic file format are exact copies of those in the PCB, so half the work is done).

I think the PCB importer works reasonably well but it does need more extensive testing and it is very possible that it will fail with some designs. However I have tried it with several complex designs from my company (with 6 layers and FPGAs) and in all of them the import was excellent.

Unfortunately I can’t share designs boards from my company, but just to give you an idea, I imported below a design from the CADSTAR “self teach” tutorial (Chapter_11_-2019.0-_rev21.cpa|attachment (169.3 KB) ).

I exported this design to a “.cpa” file inside CADSTAR (File -> Export…) and imported into KiCad using the CADSTAR importer in pcbnew (File -> Import -> Non-KiCad Board File -> CADSTAR PCB Archive Files). The result is below:

Does anyone else also use CADSTAR?

8 Likes

Before someone asks: WIP stands for Work In Progress.

Thanks - I changed the title now.

Yes - just to clarify: this is not yet a feature of KiCad and not available in the nightlies either. If you want to test it, unfortunately, it requires compiling the code in the merge request from source.

@Qbort great work, and soon KiCad has one importer more :slight_smile:

To my knowledge, you did not had any prior informations about the file format, and reversing this from scratch is always lots of work. Kudos for not only starting this project, but actually finishing it.

1 Like

We did and later ran into dongle licensing problems
I could have really done with your work a few years ago

Back in the UK at Racal, we used Visula

Yes. I am finding this issue already. My colleague has a more advanced license than me and in the office we’d normally be exchanging dongles whenever each needed to do something more advanced. Unfortunately in pandemic times, he has kept the advanced Dongle.

Unfortunately as it stands you still need a CADSTAR license to convert the binary .pcb format into a .cpa format.

In future I hope to also reverse engineer the .pcb format, but that will take a lot longer and the brief time I spent looking at it, I didn’t even know where to start.

UPDATE: The CADSTAR PCB Archive importer has now been merged into the master branch.This should trickle through into the nightly builds within the next few days.

Thanks to all the developers that have helped me along the way with my annoying questions and thanks especially to Seth Hillbrand (@Seth_h) for spending the time to do the final review on the code before merging!

I’ll now crack on with the CADSTAR Schematic Archive importer.

6 Likes

Call for Testers! (CADSTAR license not required)

The Windows nightly builds now include the CADSTAR PCB Archive importer (anything after r17389) and can be downloaded here: https://kicad-downloads.s3.cern.ch/index.html?prefix=windows/nightly/ (Remember nightly builds are just for experimentation / testing and should not be used for production environments). To use the importer, you need to open Pcbnew standalone (not via the project manager) and go to File -> Import Non-Kicad Board File… -> Choose “CADSTAR PCB Archive files (*.cpa)”

I am in process of writing the CADSTAR schematic archive importer and should hopefully finish before feature freeze. During feature freeze, I plan on spending all my time fixing any bugs/innacuracies of the importer as I want the importer to be as accurate as possible.

In the meantime, I’d really appreciate it if anyone is able to do some testing of the importer.

Zuken provides a free CADSTAR design viewer here: https://www.zuken.com/en/resource/cadstar-viewer/ (Windows only, and need an email address to download). There are several *.cpa design files freely available on the internet. An advanced search Github shows a few of them: https://github.com/search?q=cadstarpcb+"format+layout"+extension%3Acpa&type=Code&ref=advsearch&l=&l= ( thanks @Seth_h for the tip!)

It would be great if anyone would be able to open the design files in the Design viewer, import the design into KiCad and do a side-by-side comparison. During feature freeze (i.e. after 30th September) I’ll go through all the reports and fix them as best as possible.

2 Likes

After downloading and installing the cadstar viewer, do the following steps to open a design with it:

start design viewer
file-open (type = Archive files)
Close the warnings
Click on the pallet icon (just below current design)
set all layers to visible

Importing this file causes an error, and nothing is being imported.

CC112xEM.cpa (375.3 KB)

Versions:
Application: Pcbnew
Version: (5.99.0-3347-g98339cd5eb), release build
Libraries:
wxWidgets 3.0.5
libcurl/7.71.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Sep 15 2020 09:04:57
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.73.0
OCE: 6.9.1
Curl: 7.71.0
ngspice: 32
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

Windows 7 professional service pack 1

Importing this file causes an error, and nothing is being imported.
CC1101EM_1_0.cpa (179.7 KB)

This file generates a different error, and nothing is imported:
CC2540EM_discrete.cpa (312.2 KB)

Versions:
Application: Pcbnew
Version: (5.99.0-3347-g98339cd5eb), release build
Libraries:
wxWidgets 3.0.5
libcurl/7.71.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Sep 15 2020 09:04:57
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.73.0
OCE: 6.9.1
Curl: 7.71.0
ngspice: 32
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

Windows 7 professional service pack 1

@cedric. Thank you very much for testing! I will fix this later tonight.

Actually, looking at the error messages, I believe I already fixed it. Could you try with the latest nightly version and let me know if you can now open them?

I was bored, so I tried to run the cadstar viewer in arch linux - wine. It installs OK, but throws some errors while opening the board, and shows nothing.

Edit: filed a bugreport about it:
https://bugs.winehq.org/show_bug.cgi?id=49864

@cedric Yes, I don’t think Zuken are particularly interested in getting Cadstar working in linux…

Just for interest, did you get a chance to try the latest nightly build? I think the error you were seeing about design being too large (when it actually wasn’t) should be fixed with commit 54677296. Please do let me know if there are other issues.

I’m most interested in knowing about conversion inaccuracies such as incorrect size or position of elements compared to the Cadstar design.

I can’t imagine Zuken to care. But it does sound like you don’t have windows or don’t want to run windows.

That’s one of the reasons why I wanted to see if it’s possible to do your test without having windows. it turns out it’s not possible.

The server that serves the nighties is down, so I can’t test at the moment:
https://kicad-downloads.s3.cern.ch/index.html?prefix=windows/nightly/

Zukens flagship was Visula, which was Unix on Suns.
I suspect Cadstar was meant to be a cut down Windows version

Sorry if I gave that impression. It is actually the opposite: I am running everything on Windows (I can’t get my head around Linux). I was just asking for some help in testing the importer as I am only one guy and struggling to do everything on my own.

During feature freeze I plan on doing extensive testing with as many designs as I can, opening in Cadstar and next to it the result from the importer.

That is quite interesting. I didn’t know the history.

They used to be Racal-Redac from the UK, then Zuken-Redac and finally Zuken in Japan
I used to be with Racal Research, so we used Visula

1 Like

Retested
CC112xEM.cpa (375.3 KB)

Versions:
Application: Pcbnew
Version: (5.99.0-3450-g2becd368d9), release build
Libraries:
wxWidgets 3.0.5
libcurl/7.71.0 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Sep 20 2020 22:15:05
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.73.0
OCE: 6.9.1
Curl: 7.71.0
ngspice: 32
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

1 Like

Was it good? (sorry, but I have only used Target, Eagle, KiCad, Protel and the first version of Altium and I have no experience with professional packages, so I do not know what I am missing).