Problems creating the pcb profile for a new part

Is anyone else having the problem I’m having with the parts editor? I’m trying to create a new part by adapting an existing part and then importing a new plain SVG file, made in Inkscape as the PCB profile. No matter what I do the import changes the file. The groups ‘silkscreen’ and ‘copper1’ get changed to random new names likes g124. If I save the project it seems to do all sorts of weird things like creating groups within groups. If I go back to the SVG file (using the view file in folder function) and change the naming back it just renames it again after I’ve saved it. Whatever happens, I’m getting error messages about the copper layers and if I add the part to my design it draws a PCB component with a red line through it. Can anyone help?

The best bet is to upload the original part .fzpz file and the svg you are trying to replace its pcb svg with (you may need to zip the svg and append a .fzpz to the end as the forum sometimes has trouble uploading svg files) and one of us will look at it. Which Fritzing version you are using would also be useful (0.9.6 is newly released).)

Peter

Peter, thanks for your reply. I’ve just managed a workaround for now. I have learned that if you add elements to an svg and then upload it using the parts editor it really doesn’t like it. It’s best to work with the elements that are already in the file and just change them. I managed to find another part that I could modify and it worked. Good advice for the future though. I want to make a pcb of a design so I think it’s important to get the pcb accurate. Thanks again

I rarely use parts editor (it was not finished when development stopped 1n 2016) and tend to edit the underlying files. A tutorial on doing so is available here:

that said, a correctly formatted svg should load fine. Most likely there was a format error in the svg.

Peter

Peter

Brilliant, thanks, when I get a spare moment I’ll look through that.

Mike

Like Peter, I do not use parts editor for creating parts. However, that group name looks like something automatically added by Inkscape. It adds groups around blocks of elements in a lot of situations. Including those groups in groups in groups … It is possible (likely) that the silkscreen and copper1 names did not get “changed”. Instead, new group elements were wrapped around them, making them difficult to see in the Inkscape xml editor. When you then changed the added group element to silkscreen or copper, 2 of them existed, which is not valid. Inkscape likely replaced one of them again when saving.

Various methods are available to ‘cleanup’ the multiple nested groups. Selecting one of the top / outer level groups (either graphically or in xml editor), then doing ungroup multiple times works. Ungroup is on the object menu, with a keyboard shortcut of «shift»«ctrl»«g». Keep ungrouping (without changing the selection) until there are no more in the selection, then group «ctrl»«g» one time, and change the name of that group to silkscreen. For the copper groups, of a through-hole part, group 2 times, changing the outer group name to copper1 and the one inside that to copper0.

If the file is large and complex, and the groups include transforms (scaling, rotation, translations), the ungroup steps can be slow. Inkscape needs to recalculate coordinates of all of the elements in the group when removing the group wrapper.

I also use File | Save As, setting the type to Optimized SVG, with a set of options that helps keep the resulting file cleaner for Frtizing. The settings I currently use are:

  • Options tab
    • Convert CSS attributes to XML attributes
    • Collapse groups
    • Create groups for similar attributes
    • Work around rendering bugs
  • SVG Output tab
    • Remove metadata
    • Format output with line-breaks and indentation
    • Depth of indentation: 2
    • Strip the “xml:space” attribute from the root SVG element
  • IDs tab
    • Remove unused IDs
    • Preseve the following IDs: breadboard,copper0,copper1,silkscreen,schematic
    • Preseve IDs starting with: connect

The “best” option and settings to use to save Inkscape svg files has changed over time, as Inkscape itself has gone through versions, as well as the “Scour” export optimized tool. It can also be affected by the complexity of the particular file, and which view it is for. The option to “create groups” could cause problems in certain cases. The desired configuration only needs to be set once, unless different settings are needed. Inkscape remembers the last used values across restarts.

The FritzingCheckPart tool can help cleanup some things as well. Fritzing does not handle (well; sometimes) text with a font size specified in pixels (px units). FritzingCheckPart will remove the px units, among other things. It also does some of the things from the “Scour” settings for optimized svg. Some of this information, and variations, will be found in the howto information Peter referenced, but this could (if I guessed right) cover the specific problem you had.