I am doing a small bit of work on an open source project whose PCB is designed in KiCad – making a mechanical envelope drawing of the corresponding PCB enclosure. I’ve written an OpenSCAD script that extracts 2D DXF views for the top, bottom, and side views which are imported into KiCad. I am using user layers 1 and 2 for the imported DXF views, and layers 3 and 4 for the dimensioning (all the user layers are unused in the basic PCB design). It’s not a perfect solution, but the path of least resistance and works well enough for the purpose.
I implemented the OpenSCAD script in a separate file so that it is (mostly) independent from the basic enclosure script. One imports the DXF files to user layers 1 and 2, and I have hand drafted the dimensions on layers 3 and 4. I would like to provide these layers without pushing to the underlying KiCad PCB design, such that a user could import the mechanical layers only if needed.
The DXF layers are no big deal, they are easy enough to import as it is. But the dimension layers have be baffled. I could somehow export them to a DXF file, but upon reimportation, the dimensions would no longer be dimension objects to KiCad, so changes would be difficult.
Q: Is there a way to import a KiCad PCB file, assuming there are no conflicting layers? That is, for each of the non-empty layers being imported, the corresponding layer of the basic PCB being modified must be empty. Say, for example, the PCB design doesn’t have User layers (or they are blank), and the PCB file being imported only has four user layers and nothing else. In the menus, I see the option to import a non-KiCad PCB file, but not to import a KiCad PCB file.
I should probably add that one advantage to putting this enclosure drawing in the KiCad file is that several key features not reflected in the mechanical files are easily available. For example, pin 1 of several pin header connectors. I’ll also note that the physical PCB and enclosure design are fairly mature and won’t be changing dramatically down the road. If I have to hard code this into the main PCB design files, it’s no big deal.
I’ve never tried using it in production, but there is File > Append Board which apparently will Open another board and append its contents to this board
.
Seems worth a shot! (with careful backups of everything involved)
1 Like
A brief test and that works. I notice that there is no control over the placement of the board so appended. It immediately presents you with a cursor and you have to position it by eye. In contrast, the import graphics operation allows both interactive and manually entered coordinates. This isn’t perfect, but should work for my needs. Thanks.
That seems like a good feature request if you have time to write it up! Easiest way to start is in KiCad go to Help > Report a bug, which will partially fill in the issue template on Gitlab. If you do write it up, please paste a link here so others can give it a thumbs up.
So the final arrangement…
Main design PCB files have the normal collection of layers, but nothing on the User layers (in fact, they don’t even exist).
A second mechanical PCB design that only has User layers (well, the other normal layers exist, but are blank). Those user layers have the mechanical envelope drawings for the PCB’s enclosure.
In order for the PCB append command to work, I added a fiducial cross mark on the mechanical drawing which can be used to grip the whole thing after appending it. The fiducial corresponds to an auxiliary grid origin in the real PCB file, making it easy to perfectly overlay the appended files.