Work in progress: Native Altium Importer

Hi,
I’ve only been testing against the nightly builds. I’m only testing I haven’t been building the code at all.
I just cloned the main repo and I had a look at the merge request. There are 8 commits dated 05/05/20. I don’t think they would have made it into the nightly build yet. I also saw the commit for the hole offset. I’ll test it as soon as it’s in the nightly.
I thought the best way I could help was to test the nightly’s with some PCB’s to find errors and then report them and review the code too. I am only looking at the master branch. Is this the best way to review?

Well, I hope this merge request will be in the nightlies soon. Just keep in mind the nigthlies do not necessarily contain all bugfixes implemented yet.

I would suggest to create separated bug-reports for each issue on gitlab. Ideally, with a testfile+altium screenshot attached. This allows me to fix them one after another and ensures non of them is forgotten.

Hi Thomas, I checked out master and patched 177 against it. The designator orientation is now fixed, and the hole offset commit is also working :slight_smile:

1 Like

I have started testing the 3d model importer using the 177 patch, which seems to work well. I’m not sure if you know, but Altium allows you to use simple shapes (e.g. a box) when you don’t have proper step model. These don’t get imported, and it’s probably better that way. To recreate a PCB library from the imported files looks straight-forward. The directory location is ok, and it’s easy enough to export the library from the PCB and then move the files around to create a proper project library. I have a subdirectory in xxx.pretty called packages3d where I put all my step files. To create a PCB library I just exported the footprints into a project library, copied the ALTIUM_EMBEDDED_MODELS directory there, and changed the directory name in the .kicad_mod files. I am planning to write some scripts to automate some of this when it becomes stable. The idea would then be to rename the library in the .kicad_pcb file so that the PCB points to a library that exists, as if that was where it came from in the first place.

If that needs to be imported, a possible implementation would be to write a dummy STEP 1x1x1 cube file and then apply the correct scale/offset in the shape properties

Or even and idf file, there are idf tools bundled with kicad to create such simple shapes.

1 Like

You could do that, but I don’t think there’s much point. Step files are valuable and having them imported easily saves a lot of work. The simple blocks are placeholders for when there is no real model. The way the importer works is it just extracts the step files from the Altium PCB and puts them in a file. The footprint has a link that points to the file and describes its relative orientation. To go beyond that isn’t a lot of value. The aim of the importer should be to generate a PCB that has an accurate netlist, and a PCB file that can generate outputs (i.e gerbers) without modifying it. Apart from that its about data management so the imported PCB/components can be reused easily.
The most important next stage is being able to import schematics too, and then linking it all together as a project.

1 Like

Merge Request !177 was merged.

Bugfixes:

  • Set correct linewidth for polygons
  • Apply correct text rotation
  • Use case insensitive parsing for things like .Designator

Improvements:

  • Add STEP model import
  • Support Hole offset
  • Support non-copper pads
  • Assign layer type in Board Settings
3 Likes

Hi Thomas,
I tried replacing the convert function with the one below so it would match the floating point version of the same function. It did improve the rounding, but didn’t fix it completely. The 0.15mm and 0.2mm tracks are ok now, but 0.3mm (and larger) tracks are reporting as 0.299999 etc. Looking at the output file, accuracy has improved, but it looks like multiple calculations can still introduce errors. Have you got an ideas how these might be caused?

static int32_t ConvertToKicadUnit( const int32_t aValue )
{
int64_t tmp_aValue,rnd_aValue;

    tmp_aValue = ((int64_t) aValue ) * 254L;
    rnd_aValue = (tmp_aValue < 0) ? (tmp_aValue - 50) : (tmp_aValue + 50);
    return ( (int32_t)(rnd_aValue/100) );
}

I added some bugfixes for the board importer. Now, the Altium Schematic importer is the next target:

If some of the main devs could explain to me how to handle libraries (currenty, KiCad thinks I have a legacy library attached) I would be glad.

4 Likes

Thank you for all your efforts in this task pointhi and the others helping. I, for one, am desperate to leave Protel. (To be honest it isn’t just Protel … its Windows in general … Protel is one of the programs I have and do use that keeps me needing Windows … ) I would LOVE to see an importer of the schematic library files, the pcb footprint library files and my various projects of more than 20 years.

Can I buy you a beer ?

1 Like

This is a quite long thread. Skipping the middle section and reading about the schematic import in a thread from 2019, it sounds like while the board layout import is working pretty well, the schematic import is still in the throws of development. Is that a fair summary?

I am working with a team that has used Altium for both schematic and board layout. Another thread suggested PCAD as an exchange medium. I didn’t realize until I read the last few posts here that schematics are not included as part of this discussion and are being handled separately. It is mostly the schematics I am interested in at this time.

Yes, schematic is currently in work, but development stalled right now. I hope to continue with with it soon.

I assume you are talking about Altium schematic import. What about PCAD schematic import? Is that available? The 2019 thread on this is not clear. Or maybe I should ask how import is done? I checked the menus and found project import for Eagle, but nothing else. I suppose there is a tutorial about this. I’ll dig around a bit with Google.

Likely P-CAD would be handled separately, even though Altium and P-CAD have some common history. I don’t know if anyone working on this has access to P-CAD for testing purposes.

1 Like

Thank you for the reminder. There was some work done by a few developers to implement this but it never progressed to the merge request stage. I’ve reached out to them to see if they are still interested in this feature.

No response to your queries?

I’ve contacted them and they are amenable to our updating the plugin to current KiCad. Hopefully this will be feasible for KiCad v6

Great. This is good.

I attempted to test this feature using the latest nightly but for some reason I do not see the list box that shows the file types in the bottom right corner. So, I cannot select a PCBDOC Altium file. I have attached a screenshot.

The version info is:

Application: Pcbnew

Version: (5.99.0-2621-g42b8aaa8f), release build

Libraries:
	wxWidgets 3.0.4
	libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1

Platform: macOS Mojave Version 10.14.6 (Build 18G5033), 64 bit, Little endian, wxMac

Build Info:
	Date: Aug  9 2020 04:32:51
	wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
	Boost: 1.73.0
	OCE: 6.9.1
	Curl: 7.54.0
	ngspice: 31
	Compiler: Clang 10.0.1 with C++ ABI 1002

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