Here is the Gerber file mentioned: (donut.zip).
Yep, that is really weird…
Try adding a third layer, “silkscreen0”; silkscreen0 is the bottom contour. Just duplicate “silkscreen” and name it “silkscreen0”. It should look like this:
If that doesn’t work, I will send you an svg.
Try this, it might not be exactly as you would like it to be. But I’m sure this will give you a better general idea of the layout structure during an .svg board edit. I used inkscape to do my modifications to your board file. Have fun!
also a test file that was exported to gerber, all seemed to be working…
I forgot to one thing on your donut, This is a complex shape, you need to add the sublayer “boardoutline”. See attached link to Andys Donut: http://tinyurl.com/je3gubo
It takes awhile to generate copper layers.
Hello Steelgoose and Landracer,
You guys rock. Both of you have supplied svg files that indeed generate proper cutouts! Thank you, it is amazing to have such an active and helpful community!
I have been inspecting your svg files to try to understand what is wrong with mine, and I think I found what was the problem. What I think is happening is that Fritzing expects to see lower cap “closepath” command “z” and not upper cap “closepath” command “Z”. According to the official documentation, there should be no difference between lower and upper cap “closepath” commands. It turns out that Inkscape only generates upper cap “closepath” command “Z” therefore the second path which represents the cutout is ignored by Fritzing. In fact Fritzing does not completely ignore a cutout with capital “Z” as it produces an image that seems to have the hole in it as seen in the illustration above, but during the importation of the svg file it does say that it does not see any cutout and indeed the Gerber files produced don’t have the cutout.
To be able to work with Fritzing and Inkscape (on a Mac anyway) one has to manually edit the svg file produced by Inkscape using a text editor to replace the “Z” for “z” in the board object, prior to importing in Fritzing.
That was an interesting investigation!
Creating custom board shapes
After strugging with this task, I created a procedure for our company. I decided to share it with you and hopefully save you some trouble. My configuration was working in Mac OSX El Capitan 10.11.2. I prepared the files with InkScape 0.91. Some of the content here may be OS and software specific. Hope it can help the community.
Prepare the document
- Start Inkscape
- Select File/Save as… to save document with the name of your choice using the file type “Inkscape.svg” in the lower right hand corner pull down menu
- Select the “Page” tab under File/Document properties… and select the default units. It is preferable to use “px” because this is the native unit.
- If you board is going to be larger than the default size (sheet of paper), in the same tab under Custom size select the outer dimension of the board you want to create. Choose the dimensions of the enclosing rectangle.
- If you want to work with grids, select the “Grids” tab under File/Document properties… Select “Rectangular grid” under Creation and press “New”. Choose the units, “Spacing X” and “Spacing X”. In general inches, 0.1 and 0.1 are often used. Deselect “Snap to visible grid lines only” if dealing with an irregular board size and shape.
- NOTE: In Mac OSX, under XQuartz/Preferences… deselect “Update Pasteboard when CLIPBOARD changes” or else copied objects will be converted to images in Inkscape.
Prepare the layers
The file layers and the XML structure are two different concepts. Although the layers are not required per se, the use of sublayer make for a tidy file. The XML structure requirements are as follows: the board, top and bottom silkscreens “svg:g” objects need to be nested under a unique “svg:g” object, itself being nested under the main “svg:svg” object. The id of this “svg:g” object can be anything. The names of the board, top and bottom silkscreens “svg:g” objects need to be set according to the instructions below.
- View the layers and sublayer by selecting Layer/Layers…
- Board sublayer. First select the top layer (usually Layer 1) and press on the “+” sign in the Layers window. Choose “Add sublayer to current” in the drop down menu. Rename this sublayer as “Board sublayer”, by double-clicking of the automatically generated name.
- IMPORTANT. The id of the board “svg:g” sublayer you just created has to be change to “board”.
- Top Silkscreen sublayer. First select the top layer (usually Layer 1) and press on the “+” sign in the Layers window. Choose “Add sublayer to current” in the drop down menu. Rename this sublayer as “Top Silkscreen sublayer”, by double-clicking of the automatically generated name.
- IMPORTANT. The id of the top silkscreen “svg:g” sublayer you just created has to be change to “silkscreen”.
- Bottom Silkscreen sublayer. First select the top layer (usually Layer 1) and press on the “+” sign in the Layers window. Choose “Add sublayer to current” in the drop down menu. Rename this sublayer as “Bottom Silkscreen sublayer”, by double-clicking of the automatically generated name.
- IMPORTANT. The id of the bottom silkscreen “svg:g” sublayer you just created has to be change to “silkscreen0”.
Creating the board shape
- Select the ‘Board sublayer’ in the Layers window
- Choose the geometrical figure of your choice, e.g. Stars and Polygon tool, Circle, Rectangle or any other.
- Draw the figure.
- Select the “Select” tool and select the object.
- Select Object/Fill and Stroke to see what are the fill and stroke parameters. Under the Fill tab, set the Fill color RGBA to 33804080. Under the Stroke paint tab, select “no paint”.
- You can set the object position and dimensions precisely by using the position and dimensions fields in the tool bar above the canvas. Set the units to your preference. You can click on the lock to constrain proportions.
- Note that in the XML editor under Edit/XML Editor…, the center (cx,cy) and radius ® of geometrical figures are expressed in pixels.
Creating composite shapes
It is possible to merge multiple shapes by using the union operation by using the Path/Union operator.
- Draw and position multiple objects of interest on the same layer or sublayer using the previous procedure
- Select all objects that are to be merged
- Select Path/Union. The object has been converted to a path. The path can be inspected in the “d” item in the XML window under Edit/XML Editor…
Creating cutouts (holes) in a board
It is possible to create holes in PCB by subtracting a shape to another by using the Path/Difference operator.
- Draw and position two objects of interest on the same layer or sublayer using the previous procedure. The object on top creates a hole in the bottom object.
- Select the objects that are to operated
- Select Path/Difference. The subtracted object is converted to a path. In fact the subtraction occurs by the addition of a second path in the “d” item in the XML. Each path are bound by the “M” and “z” commands.
Draw the silkscreens
In these steps, we create silkscreen objects as outline copies of the board shape.
- Select and copy the board shape object you just created. The simplest way to do this is to use the XML window. Select the board shape object and press on the “Duplicate node” icon. Using the other XML tools, press promote, down and demote buttons. This has transferred the copied object to the top silkscreen sublayer. You can also use copy from the board sublayer, select the top silkscreen sublayer and paste.
- Select the fill tab under Object/Fill and Stroke and disable the Fill
- Select the Stroke paint tab enable Flat color and set RGBA to ffffffff (this maybe hard to see, but if the silkscreen layer has a tiny white border)
- Select the Stroke style tab
- Set width to Inch and set it to 1 mill (0.001 Inch) or 1 px or similar value
- You can repeat these steps to generate the bottom silkscreen object. If you copy the top silkscreen object, you won’t have to change its Fill and Stroke attributes.
- Select the “Page” tab under File/Document properties… and click on “Resize page to content…”. Press on the “Resize page to drawing or selection”.
- NOTE. In some cases, Inkscape generates upper cap “closepath” command “Z”. According to the official documentation, there should be no difference between lower and upper cap “closepath” commands. I believe Fritzing expects to see lower cap “closepath” command “z” and not upper cap “closepath” command “Z”. Therefore the second path which represents the cutout is ignored by Fritzing. In fact Fritzing does not completely ignore a cutout with capital “Z” as it produces an image that seems to have the hole in it, but during the importation of the svg file it does say that it does not see any cutout and indeed the Gerber files produced don’t have the cutout. When this happens, one has to manually edit the svg file produced by Inkscape using a text editor to replace the “Z” for “z” in the board object, prior to importing in Fritzing.
Importing the custom board shape in Fritzing
- Start Fritzing
- Select the “PCB view” tab
- Select the PCB. In the inspector window press on “Load image file”
- Select the svg file you created
- Et voilà
You make it sound difficult… I don’t use Inkscape, I used CorelDRAW X6, it wasn’t nearly that much trouble. Rumor is that corelDRAW X8 is coming out next month… be worth looking into. Made two circles and a rectangle, created two copies, changed the colors and names, then exported as svg, and I was done… Fritzing is pretty forgiving, keep the code as simple as possible…
Thanks for the wonderful write-up in-regards to making custom cut-out boards using inkscape. Hopefully this can help folks with their future endeavors. Great job! Thanks for using fritzing!
niceone! Thank you.
The devil is in the details. And also nice to see how the keyboard commands are used in inkscape
Maybe a few things can be done in a less complicated is this in any way related to the absence of the rightclick on a mac?
Please add save as plain SVG
@AndyPhil Thanks for your comprehensive step by step tutorial!
I cannot get it to work…
I have downloaded andys_donut.svg. made a pcb, saved as gerber.
Uploaded to easy gerber viewer.
However I still do not see the cutout, same with my own files:
Any clue what I am doing wrong?
I don’t know anything about making cutout PCBs, but from here it looks cutout.
In Gerbv it shows the internal square in the contour layer, but I don’t know if it’s a hole.
Any experts out there.
I clicked the fabricate button in Fritzing and uploaded the test.fzz file and Aisler produced a rendering of a board with a large square cut out. So i would say your board works unless this is not what they are supposed to look like.
Thanks @sublimeartistry that is what it should look like.
Strange that seeedstudio fusion PCB is not rendering it like this, maybe they do not support cutouts like this.
I will contact them, but now I know that it is not me
I don’t know if anyone can help me with this - it’s been driving me nuts for a few days now, and similar to Andy’s donut problem.
When importing this svg, I get the no cutouts detected message. Here’s roughly what it should look like…
…I’ve tried everything in this thread, plus this…both several times. I’m honestly just considering a drill and a hacksaw at this stage!
If anyone can see what’s wrong with the xml, it’d be much appreciated.
Try this one instead. From looking at the format of andys_donut above I think your grouping is wrong and you need two paths (I duplicated the original path for the second one).
Note this has the same file name as your current one, so you probably want to rename it to something new to compare the two. If not perhaps someone that actually knows what they are doing will comment .
Your board does not have any cutouts so it says it has no cutouts. Your board is just an outline and it appears to work as expected.
Aisler (Fritzing Fab) shows this as the outline.
I was just about to ask whether you had a link to the actual svg, but I think sublimeartistry (below) has answered already…and it is VERY embarrassing…
…well this is a bit embarrasing…I’d assumed that due to the way I’d created the shape (using difference in inkscape), the notches in the corners etc should be interpreted as cutouts in fritzing.
I’ve never been so happy to discover what an idiot I’ve been though!
The svg is there, to down load it you need to right click it and save tmage as. The forum renders svg files (sometimes it can’t though).
No worries. The term cutouts is a little ambiguous but in the case of Fritzing PCBs it only refers to holes in the board not notches and indents etc.
Two things I did notice when I checked out the file in Inkscape were the fact you did not have a stroke set for the silkscreen and it seems to have a refs2 group with gradient data in it. Neither cause an issue but if you intended to have a silkscreen boarder you will want to set it to have a stroke (boards look better WITHOUT an outline). The refs2 group can have all of its data removed without any problem. I am not sure what they are for and Fritzing seems to ignore them.