Work in progress: Native Altium Importer

Hi, I’ve just been trying out the Altium importer from the nightly build. It’s very impressive.
I found 2 issues with the board I tried out. The first one the probably related to imperial<->metric conversion. I have lots of 0.15mm traces, and they are importing as 0.149999mm. PCBnew uses nanometer increments which give exact multiples of both inches and millimeters. I was wondering if the conversion process uses a metric to imperial conversion that causes the rounding error.
The second thing I found on my board was the nets of split planes get imported properly, but Kicad doesn’t recognise which pads are connected to the pour. The ratsnest of a completed board shouldn’t show anything, but on my board there are many lines (mostly Gnd) tied directly to the planes and these lines appear as being incomplete connections. I’m not sure if this is an importer issue or a Kicad issue because the concept of planes in Altium and Kicad is different.

2 Likes

When I recall correctly, Altium uses microinch internally. At the moment I rely on integer arithmetic to convert units, but there is probably a small rounding problem which needs to be fixed.

For plane connection, from what I found out it looks like thermal relief settings are not correctly imported yet. This should be partly fixed with the new rule system. Furthermore, I do not import thermal relief settings of pads yet. If someone could create some testfiles, I would be glad.

2 Likes

1 microinch = 25.4 nm, so expressing a value in microinches can lose precision if converted to KiCads native integer nm

thanks for the replies.
The rounding issue makes sense considering the history of Altium. One of the reasons I have a strong interest in the importer is that Altium originated as a layout tool called Protel in the 1990’s. It was developed at the university of Tasmania in Australia, so in Australia it’s used in 95% of commercial designs. For this reason I have to use it even though I would prefer to use Kicad. Protel would have originally used imperial units. Altium is now completely commercially oriented and has become very expensive, and the amount of real development is a lot less than they would have you believe.
Anyway I was quite surprised at how well my design imported. It’s an 8 layer board, and only one component on the board gave me any issues. Apart from the rounding and the plane issues, the only problem I had was aligning the board on to a 0.1mm grid. I fixed this by selecting the whole board and moving it in Kicad. Kicad has a fixed reference point so I don’t think this can be avoided.
Thomas, I would like to send you the PCB file I used to test the converter. It’s a good example of a board that converts well. Is there a way I can get an email address to send it to you. The file is 14MB, compresses to 6.5MB. I think it might be helpful for the plane connection problem.

1 Like

Greg, @pointhi can pass you an email address by personal message.

Twenty years ago Protel was the favourite tool in Malaysia too - both paid for and pirated.
They lost ground to Orcad 15 years ago as they took too long to move from their 16 bit DOS origins

1 Like

Is this link correct? -> https://kicad-downloads.s3.cern.ch/windows/testing/patched/kicad-patched-657-98b9c80eb-x86_64.exe
I would like to test it, so I’ve downloaded & installed it on Windows. The version shown in the info window is “Version: (5.99.0-1337-g98b9c80eb-dirty), release build”, what seems to be the same hash as in the file name.
But there is no option to import Altium files, just Eagle…
what am i doing wrong?

@Gerrit, you seem to refer to old discussion - have you tried the official nightly builds already to see if changes are there?

Directions for use have been given a couple of times in this thread. Pcbnew has to be opened standalone because only the layout can be imported.

1 Like

Thank you @eelik, this was the trick: I didn’t noticed that I have to start pcbnew directly… i must have overlooked it.
I’ve downloaded the newest nightly kicad build now, and imported a complex 6 layer design. It looks good so far! I got only a message that “complex pad stacks of kind 1” are not supported yet, but this is a minor problem.
I have to say that it works better than the most recent altium2kicad script files, where zones are not imported correcly.
Good job!

1 Like

I just had a small issue concerning footprint ids while convertig a complex 6 layer PCB
mb1272_bdp.zip.
The import works fine, but when I save the file as *.kicad_pcb and reopen it, I’m getting an error message: “Invalid footprint ID in file…”
The reason is quite simple:
The module names seems to be derived from a very long file path in the original Altium project, e.g.: (module "D__Virgil_Altium_STM_Library_Altium_Library_Altium_STM-LMS_MCD_PARTS.PcbLib:"
But some module names ends with a single colon ‘:’, and this is not accepted by KiCad.

I think it should be easy to remove the colon if it is the last character of the module name.

2 Likes

Maybe this is better suited as a proper bug report on https://gitlab.com/kicad/code/kicad/-/issues

I can confirm the issues with latest nightly. Version: (5.99.0-1530-ga06fa22b8), debug build

1 Like

Hi, I’m not having this problem. My board loads with no problems.
here’s what I see on an equivalent line:
(module “Avatar.IntLib:CAP-0805-10u” (layer “Top_Layer”) (tedit 0) (tstamp 35655b7d-4a7f-47ed-b0ef-3deb377823f5)

The reason the load is failing is because there is library name, but no component name.
For some reason the component name has been removed. It’s not a generic Kicad issue.
It may be because of the very long name. Correct me on this if I’m wrong but I have a vague memory that Kicad doesn’t accept underscores in it’s format. Another possible reason is that you may have the same component name with different parameters.

I think one of the reasons my boards import easily the way I use libraries. I don’t trust Altium, just an opinion but I think it’s flaky, so I take steps to work around its shortcomings. One of the things I often do is generate a PcbLib and SchLib from the PCB and schematics. I then compile them into an integrated library. Using the parameter manager, I cut and paste the library name into my schematics and update the PCB. Everything is local so I end up with simple names when importing. The other thing I do is never use generic libraries. There is no such thing as a generic capacitor. 1206 parts don’t fit on a 0402 footprint. A 10pF capacitor isn’t the same as a 100nF capacitor either. I find that many people don’t like the conventions I use, but I find PCB’s are more about data management than design.

Hi Thomas,
on the board I’ve been working with (the one I sent you), I noticed that the designators are all in the right place, but some of them are rotated by 180 degrees. In Kicad there is a properties field for designators called “keep upright”. If this box is checked then the orientation field is ignored. Using the rotate function (i.e r key), the designator moves back and forward between 0 and 90 degrees. If it’s unchecked then the designator can rotate 0, 90, 180 and 270 degrees. The other thing I found was that if the designator is imported upside down then you get 3 possiblities (0, 90 and 180). Have a play with D13 on the board I sent you if you’re not sure what I mean. When the board is imported, the “keep upright” field is always checked which may be the cause of some issues.

By default the designator looks like this

(fp_text reference "D13" (at 0.935358 -1.529745 -90) (layer "F.SilkS")

If it’s unlocked it looks like this

(fp_text reference "D13" (at 0.935358 -1.529745 90 unlocked) (layer "F.SilkS")

I found that the orientation in the GUI doesn’t match the .kicad_pcb file. I assume its because in the GUI its relative to the component, but in the PCB file its relative to the board. Have you tried setting the designators to being unlocked? I’m not sure if it will make a difference though.

Also I did find a footprint error in J5. Altium has a parameter called “Offset From Hole Center (X/Y). This function can be replicated in Kicad with the “Shape Offset X” and Shape Offset Y”. This parameter isn’t being picked up in the conversion.

@Greg_kutu did you test text rotation with https://gitlab.com/kicad/code/kicad/-/merge_requests/177? Because I fixed a lot of rotation issues in there.

1 Like

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