One of the things Altium Circuit maker current lacks (see a short review here: Altium) is the ability to import images into Altium’s board design.
There is a fairly painful way to do this via making an image into a font, installing the font to your computer, and then “typing” it in to get the image to appear. This is.. sub-optimal.
However, one can import/export from a .csv file into vertices of a polygon pour. This could enable importing images into Altium.
The rules for polygon pours seem to be as follow:
- polygons are filled when vertices form a (clockwise oriented) closed surface.
- Lines that cross back on themselves have a zero thickness, and hence don’t appear.
- The entire list must start and end on the same vertex.
So, we could make a script that generates a list of vertices, and import a (somewhat blocky, 1 bit color image) in this way.
Here is an example done by hand (note the thin lines do not appear in a gerber export!). The lower left square is drawn first, then the lower right, and lastly the center square.
The starting/ending point is always the lower left origin.
The vertices for just that simple shape are fairly lengthy:
|Index||X (mil)||Y (mil)||Arc Angle (Neg = CW)|
Notice above, we do have the ability to specify Arc angle for each segment, but that is a level of complexity I will likely avoid in the near term.
It speaks with a hiss
My favorite tool in the bag of tricks is Python, mostly due to avoiding the need to compile, and lots of good libraries. This is especially true of graphical manipulation, which we will need if we want to get images into Altium Circuit Maker.
I used Python 2.7 for this, on Windows. (you will need the python pillow library, execute “python -m pip install pillow”)
See the full code here:
Open the “ImGen.py” file, and change the file name, size and inversion as needed. Once the program is run, it will generate a .csv file with the same name as the image input. This can then be imported into the polygon pour.
The lines returning to the center can be seen above, however they do not appear on a Gerber file.
What’s the catch?
There’s a few downsides to this approach over the image-font-import method:
- Resolution is low. For your sanity and RAM usage, I don’t suggest using any image over 20×20 pixels.
- This looks much nicer with images that are blocky to start with. I’ve used this to generate QR codes, barcodes, etc.
- Images are placed at the origin, but can be moved later
- Use Arc Angle to make smoother images
- Generate triangle instead of squares, and take into account 50% filed cells, instead of only black and white.
- Automate generating multiple layers (top layer, top solder, top mask, silkscreen) to generate 4 color images
- Optimize path-ing algorithm to reduce path complexity