Script to automate connector creation in the fzp file

I have cleaned up, documented and released on github a python script to add or modify terminal definitions in the fzp file. There are two major uses: renumber a fzp file whose pins are out of order / out of sequence or add more connectors to an existing fzp file. The script can be found here:

It creates a file with the xml boiler plate for connectors like this:

FritzingCreateFzpConnectors.py t 1

which creates file t (and complains if it already exists) which contains this:

  <connector id="connector0" type="male" name="">
    <description></description>
    <views>
      <breadboardView>
        <p svgId="connector0pin" layer="breadboard"/>
      </breadboardView>
      <schematicView>
        <p svgId="connector0pin" layer="schematic" terminalId="connector0terminal"/>
      </schematicView>
      <pcbView>
        <p svgId="connector0pin" layer="copper0"/>
        <p svgId="connector0pin" layer="copper1"/>
      </pcbView>
    </views>
  </connector>

The expectation is you will use a text editor to add/replace the connectors section of the fzp file with the contents of the file the script generated. If you increase the first number (the number of connectors to create) it will create more in sequence. If you add another number after the count such as:

FritzingCreateFzpConnectors.py t 10 4

it will create connectors 4 to 14 in sequence. Getopt type flags allow you to modify the output in various ways I find useful. Note that the name and description fields are blank, ready to have appropriate text either copied in to them from an existing fzp file (if you are renumbering the fzp) or have values appropriate to the pin added manually. You can also suppress the pcb view section of the connector (you need to manually remove the view definition though) if you don’t want or need a pcb view in the part. This assumes you are manually editing the part files (which is what I usually do).

Peter