Part creation howto part12-slots-in-parts

this is a continuation of

To some extent the title is incorrect. This does not allow slots in standard parts, but rather enables the creation of a part which contains a board outline (which is still a very useful thing to do!) That means you can have a part which will create a pcb with slots in it without having to (for every new sketch) load the outline file. The template for this is in Fritzing in File->Open example->Shields->ComposedArduinoR4WifiShield. But that part assumes you know how it works and what you need to change (which isn’t necessarily easy) thus this howto. I just made a file to add slots and a board outline in this forum post

now I am going to simplify that procedure by making this in to a part that can be loaded in to Fritzing without having to do the load image file operation. The secret to getting this to work is in the .fzp file, where the family needs to be special. This is from the

arduino-shield_r4_two_layer.fzp

file in core parts for the ComposedArduinoR4WifiShield part.

<properties>
  <property name="layers">2</property>
  <property name="Shape">Arduino Shield w. R4 Cut </property>
  <property name="family">Plain Vanilla PCB</property>
  <property name="filename" ></property>
</properties>

we need to be sure to change the

  <property name="Shape">Arduino Shield w. R4 Cut </property>

line to specify a unique name for our new board in this case I used

  <property name="Shape">aliexpress-box-outline-100mmx68mm</property>

Then on to the svg for the slots. The format is much the same as for an svg used to set slots by load image file (and can be tested that way) but with a few changes. The boardoutline path is identical. It needs to be generated either by making the path outline proceed clockwise and the interior paths (for the slots) counterclockwise which is what I did here as I couldn’t make the Inkscape path difference option generate all the slots. It would do the first one then skip all the rest. I don’t know why. I used SVG path visualizer from

to hand generate the combined path (which is a real pain but at least works!) There should be a way to do this in Inscape because I have done it before but I can’t remember what I did (and have just started with Inkscape 1.4 so what I did before may no longer work!)
The layout of the groups has either changed or the old rules as set in the circle.svg image in core pcb aren’t really rules. I chose to use the values that Kjell did in the ComposedArduinoR4WifiShield because they work with this and others may not.

So we have a group board with the path including the slots in it like this:

  <g
     id="board">
    <path
       id="boardoutline"
       d="m 3204.9252,1906.1885 c 0,36.5858 -29.6586,66.2444 -66.2444,66.2444 -36.5858,0 -66.2445,-29.6586 -66.2445,-66.2444 0,-36.5858 29.6587,-66.2444 66.2445,-66.2444 36.5858,0 66.2444,29.6586 66.2444,66.2444 z m 181.3117,-792.9158 c 0,36.5858 -29.6586,66.2444 -66.2444,66.2444 -36.5858,0 -66.2444,-29.6586 -66.2444,-66.2444 0,-36.5858 29.6586,-66.2444 66.2444,-66.2444 36.5858,0 66.2444,29.6586 66.2444,66.2444 z m -181.3117,-779.30375 c 0,36.58577 -29.6586,66.2444 -66.2444,66.24441 -36.5858,5e-5 -66.2445,-29.6586 -66.2445,-66.24441 0,-36.58581 29.6587,-66.24446 66.2445,-66.24441 36.5858,1e-5 66.2444,29.65864 66.2444,66.24441 z m -595.6458,-185.94912 c 50.5307,-4.13988 93.6264,20.15539 93.8898,73.02532 l -67.8092,88.67371 c -48.5451,0.84196 -90.2567,-29.57363 -88.6737,-78.24154 z m 92.8555,1844.81267 c 4.1398,50.5307 -20.1554,93.6264 -73.0254,93.8898 l -88.6737,-67.8093 c -0.8419,-48.545 29.5737,-90.2566 78.2414,-88.6737 z m -1835.22881,-58.1994 c 50.53071,-4.1399 93.62641,20.1554 93.88979,73.0253 l -67.80923,88.6737 c -48.5451,0.842 -90.25669,-29.5736 -88.67371,-78.2415 z m -426.7586,-28.4446 c -1e-5,36.5858 -29.65864,66.2444 -66.24441,66.2444 -36.58577,0 -66.2444,-29.6586 -66.24441,-66.2444 1e-5,-36.5858 29.65864,-66.2444 66.24441,-66.2444 36.58577,0 66.2444,29.6586 66.24441,66.2444 z m -193.97515,-792.9158 c -1e-5,36.5858 -29.65864,66.2444 -66.24441,66.2444 -36.58577,0 -66.2444,-29.6586 -66.24441,-66.2444 1e-5,-36.5858 29.65864,-66.2444 66.24441,-66.2444 36.58577,0 66.2444,29.6586 66.24441,66.2444 z m 183.76595,-779.30375 c 0,36.58578 -29.65863,66.24441 -66.24441,66.24441 -36.58578,0 -66.24442,-29.65863 -66.24442,-66.24441 0,-36.58578 29.65864,-66.24441 66.24442,-66.24441 36.58578,0 66.24441,29.65863 66.24441,66.24441 z m 529.82323,-120.94362 c 4.13991,50.53071 -20.15532,93.62641 -73.02534,93.8898 l -88.67362,-67.80924 c -0.84198,-48.5451 29.57362,-90.25668 78.24144,-88.67371 z m -615.49924,-213.02533 h 2780.96102 c 30.582,244.36729 150.528,335.80962 374.7765,370.60357 v 1489.50813 c -216.8228,16.5314 -367.0879,167.0174 -374.7765,362.2578 h -2765.31273 c 3.04402,-182.6352 -120.7881,-317.5439 -359.91057,-362.2578 v -1489.50813 c 214.16641,-24.30892 348.31905,-145.17861 344.26228,-370.60357 z"
       fill-opacity="0.5"
       fill="#ffffff" />
  </g>

The fill-opacity is set to 0.05 and the fill to #ffffff (white) unlike the original which was green. As noted I used what the working file did without knowing why. In the original instructions the path above was added to the group silkscreen with a different set of stroke and fill values. This setup doesn’t appear to want that. The silkscreen path is only the black perimeter of the board without any of the slots in the path like this:

  <g
     id="silkscreen">
    <path
       stroke="#000000"
       id="path1"
       d="m 344.76228,0.5 h 2780.96102 c 30.582,244.36729 150.528,335.80962 374.7765,370.60357 v 1489.50813 c -216.8228,16.5314 -367.0879,167.0174 -374.7765,362.2578 h -2765.31273 c 3.04402,-182.6352 -120.7881,-317.5439 -359.91057,-362.2578 v -1489.50813 c 214.16641,-24.30892 348.31905,-145.17861 344.26228,-370.60357 z"
       stroke-width="10"
       fill="none" />
  </g>

then there is a new group silkscreen0 (the bottom silkscreen usually) that has the paths for the slots with the fill set to #000000 (white) so they will appear in silkscreen in Fritzing so we can see where the holes are.

     id="silkscreen0">
    <path
       stroke="#ffffff"
       id="path3"
       d="m 344.76228,0.5 h 2780.96102 c 30.582,244.36729 150.528,335.80962 374.7765,370.60357 v 1489.50813 c -216.8228,16.5314 -367.0879,167.0174 -374.7765,362.2578 h -2765.31273 c 3.04402,-182.6352 -120.7881,-317.5439 -359.91057,-362.2578 v -1489.50813 c 214.16641,-24.30892 348.31905,-145.17861 344.26228,-370.60357 z"
       stroke-width="10"
       fill="none" />
    <path
       id="path9"
       style="fill:#ffffff;stroke:none;stroke-width:0"
       d="m 2702.0927,1992.275 c 4.1398,50.5307 -20.1554,93.6264 -73.0254,93.8898 l -88.6737,-67.8093 c -0.8419,-48.545 29.5737,-90.2566 78.2414,-88.6737 z" />
    <path
       id="path7"
       style="fill:#ffffff;stroke:none;stroke-width:0"
       d="m 960.05479,212.76005 c 4.1398,50.5307 -20.1554,93.6264 -73.0254,93.8898 l -88.6737,-67.8093 c -0.8419,-48.545 29.5737,-90.2566 78.2414,-88.6737 z" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="circle6"
       cx="3138.1316"
       cy="334.76312"
       r="65" />
    <path
       id="path8"
       style="fill:#ffffff&#10;stroke:none;stroke-width:0"
       d="m 2611.6667,146.84466 c 50.5307,-4.1399 93.6264,20.1554 93.8898,73.0253 l -67.8092,88.6737 c -48.5451,0.842 -90.2567,-29.5736 -88.6738,-78.2415 z" />
    <path
       id="path6"
       style="fill:#ffffff;stroke:none;stroke-width:0"
       d="m 867.0442,1935.4058 c 50.53071,-4.1399 93.62641,20.1554 93.88979,73.0253 l -67.80923,88.6737 c -48.5451,0.842 -90.25669,-29.5736 -88.67371,-78.2415 z" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="circle5"
       cx="3319.0647"
       cy="1113.3235"
       r="65" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="circle4"
       cx="3139.9592"
       cy="1906.5048"
       r="65" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="circle3"
       cx="374.40939"
       cy="1904.9907"
       r="65" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="circle2"
       cx="180.56245"
       cy="1114.0952"
       r="65" />
    <circle
       style="fill:#ffffff;stroke:none;stroke-width:0"
       id="path2"
       cx="364.07089"
       cy="333.53818"
       r="65" />
  </g>
</svg>

This is all contained in the pcb svg file for the part as usual (although the format is very different than a standard pcb svg!)

  <properties>
    <property name="layers">2</property>
    <property name="Shape">aliexpress box-outline 100mmx68mm</property>
    <property name="family">Plain Vanilla PCB</property>
    <property name="filename"/>
  </properties>
  <taxonomy>discreteParts.pcb.plain.aliexpress-boxes-100mmx68mm</taxonomy>
  <description>board to fit aliexpress boxes 100mmx68mm</description>
  <views>
    <defaultUnits>mm</defaultUnits>
    <iconView>
      <layers image="icon/plain_pcb.svg">
        <layer layerId="icon"/>
      </layers>
    </iconView>
    <breadboardView>
      <layers image="icon/plain_pcb.svg">
        <layer layerId="unknown"/>
      </layers>
    </breadboardView>
    <schematicView>
      <layers image="icon/plain_pcb.svg">
        <layer layerId="unknown"/>
      </layers>
    </schematicView>
    <pcbView>
      <layers image="pcb/aliexpress-box-outline-100mmx68mm_1.pcb.svg">
        <layer layerId="silkscreen" sticky="true"/>
        <layer layerId="silkscreen0" sticky="true"/>
        <layer layerId="board" sticky="true"/>
      </layers>
    </pcbView>
  </views>
  <connectors/>
  <buses/>
</module>

as you see there are no breadboard or schematic svgs (they are replaced by the icon/plain_pcb.svg in core parts) and only the pcb svg that we created with the slots in it. Zipping the .fzp and pcb .svg file (the loader will find icon/plain_pcb.svg for itself in core parts!) We get a part that can be loaded in to Fritzing. That part when dragged in to a sketch will create the pcb outline with the slots configured (you need to delete the default pcb grey rectangle before or after loading the part or you will have to select the new pcb before being allowed to export it for gerbers.) You can now proceed to place and route your ciruitry in breadboard, schematic and pcb as normal and when you export the result as gebers the slots will appear in the gerber output. Making these isn’t simple but using them is. Also you can only drag the part in to the pcb view, it won’t load in either breadbroard or schematic only pcb.

edit:

forgot the most important part! The actual part so you have it to play with.

aliexpress-box-outline-100mmx68mm.fzpz (2.4 KB)