A xyLength parameter was separated into two separate variables.

use <../../shapes/open-cylinder/open-cylinder.scad>

module waterPumpFilter(baseHeight = 30,
					   innerRadius = 25)
{
	union()
	{
		zTranslate = baseHeight / 2.0;
		translate([0,0, zTranslate-0.1])
		waterPumpFilter_connector(innerRadius = innerRadius);

		xyLength = (innerRadius * 2) + 4;
		waterPumpFilter_base(height = baseHeight,
							 innerRadius = innerRadius,
							 xLength = xyLength,
							 yLength = xyLength);
	}
}

module waterPumpFilter_connector(innerRadius)
{
	openCylinder(height = 5,
				 innerRadius = innerRadius,
				 outerRadius = innerRadius + 2);
}

module waterPumpFilter_base(height,
														innerRadius,
														xLength,
														yLength)
{
	difference()
	{
		// this is the outer cube
		cube([xLength, yLength, height], center = true);

		color("pink")
		translate([0,0,10])
		cylinder(r=innerRadius, h=30, center=true);

		innerCubeDifference = 4;
		color("green")
		waterPumpFilter_base_innerCube(xLength - innerCubeDifference, height - innerCubeDifference);

		cutoutHeight = height - 4;

		waterPumpFilter_xCutouts(height = cutoutHeight);

		waterPumpFilter_yCutouts(height = cutoutHeight);
	}
}

module waterPumpFilter_base_innerCube(xyLength, height)
{
	cube([xyLength, xyLength, height], center = true);
}

module waterPumpFilter_xCutouts(height)
{
	step = 5;

	for(x = [-20 : step : 20])
	{
		translate([x, 0, 0])
		cube([2, 100, height], center = true);
	}
}

module waterPumpFilter_yCutouts(height)
{
	step = 5;

	for(y = [-20 : step : 20])
	{
		translate([0, y, 0])
		cube([100, 2, height], center = true);
	}
}

use <../../shapes/open-cylinder/open-cylinder.scad>

module waterPumpFilter(baseHeight = 30,
					   innerRadius = 25)
{
	union()
	{
		zTranslate = baseHeight / 2.0;
		translate([0,0, zTranslate-0.1])
		waterPumpFilter_connector(innerRadius = innerRadius);

		xyLength = (innerRadius * 2) + 4;
		waterPumpFilter_base(height = baseHeight,
							 innerRadius = innerRadius,
							 xyLength = xyLength);
	}
}

module waterPumpFilter_connector(innerRadius)
{
	openCylinder(height = 5,
				 innerRadius = innerRadius,
				 outerRadius = innerRadius + 2);
}

module waterPumpFilter_base(height, innerRadius, xyLength)
{
	difference()
	{
		// this is the outer cube
		cube([xyLength, xyLength, height], center = true);

		color("pink")
		translate([0,0,10])
		cylinder(r=innerRadius, h=30, center=true);

		innerCubeDifference = 4;
		color("green")
		waterPumpFilter_base_innerCube(xyLength - innerCubeDifference, height - innerCubeDifference);
//		waterPumpFilter_base_innerCube(xyLength-2, height-2);

		cutoutHeight = height - 4;

		waterPumpFilter_xCutouts(height = cutoutHeight);

		waterPumpFilter_yCutouts(height = cutoutHeight);
	}
}

module waterPumpFilter_base_innerCube(xyLength, height)
//module waterPumpFilter_base_innerCube(xyLength, height)
{
	cube([xyLength, xyLength, height], center = true);
}

module waterPumpFilter_xCutouts(height)
{
	step = 5;

	for(x = [-20 : step : 20])
	{
		translate([x, 0, 0])
		cube([2, 100, height], center = true);
	}
}

module waterPumpFilter_yCutouts(height)
{
	step = 5;

	for(y = [-20 : step : 20])
	{
		translate([0, y, 0])
		cube([100, 2, height], center = true);
	}
}


transforms: fix mx/my/mz

transforms: fix mx/my/mz

/*include <../scad-utils/transformations.scad>*/

include <system.scad>
use <misc.scad>

module t(dist)
{
    assert(dist!=U, "t(): dist==U");
    assert(is_list(dist), dist);
    assert(len(dist)==3, "t(): len(dist)!=3");
    translate(dist)
    children();
}

module tx(dist)
{
    assert(dist!=U, "tx(): dist==U");
    assert(is_num(dist), "tx(): dist is not a number");
    translate(X*dist)
    children();
}

module ty(dist)
{
    assert(dist!=U, "ty(): dist==U");
    assert(is_num(dist), "ty(): dist is not a number");
    translate(Y*dist)
    children();
}

module tz(dist)
{
    assert(dist!=U, "tz(): dist==U");
    assert(is_num(dist), "tz(): dist is not a number");
    translate(Z*dist)
    children();
}

module txy(off)
{
    assert(off!=U, "txy(): off==U");
    assert(len(off)==3, "txy(): len(off)!=3");
    tx(off.x)
    ty(off.y)
    children();
}

module txz(off)
{
    assert(off!=U, "txz(): off==U");
    assert(len(off)==3, "txz(): len(off)!=3");
    tx(off.x)
    tz(off.z)
    children();
}

module tyz(off)
{
    assert(off!=U, "tyz(): off==U");
    assert(len(off)==3, "tyz(): len(off)!=3");
    ty(off.y)
    tz(off.z)
    children();
}

module r(a, v)
{
    if(is_list(a))
    {
        assert(is_undef(v), v);
        assert_v3n(a);
        rotate(a)
        children();
    }
    else
    {
        assert(is_num(a), a);
        assert_v3n(v);
        rotate(a,v)
        children();
    }
}

module rx(degrees)
{
    rotate(X*degrees)
    children();
}

module ry(degrees)
{
    rotate(Y*degrees)
    children();
}

module rz(degrees)
{
    rotate(Z*degrees)
    children();
}

module mx(m=true)
{
    assert(!is_undef(m));
    assert(is_bool(m));
    mirror(X*(m?1:0))
    children();
}

module my(m=true)
{
    assert(!is_undef(m));
    assert(is_bool(m));
    mirror(Y*(m?1:0))
    children();
}

module mz(m=true)
{
    assert(!is_undef(m));
    assert(is_bool(m));
    mirror(Z*(m?1:0))
    children();
}

// translate children
module position(positions)
{
    assert(positions!=U, "positions==U");
    for(pos=positions)
    translate(pos)
    children();
}

// translate children
module linup(arr=U)
{
    if($children>0)
    {
        for (i = [0 : $children-1])
        translate(arr[i]) children(i);
    }
}

module stack(dist=10, distances=U, axis=Z)
{
    if($children>0)
    {
        if(dist == U && distances != U)
        {
            for (i = [0:len(distances)-1])
            {
                offset = v_sum(distances,i);
                translate(axis*offset)
                    child(i);
            }
        }
        else if(dist != U && distances == U)
        {
            for (i = [0 : $children-1])
                translate(axis*(dist*i))
                    children(i);
        }
    }
}

module spread(axis=N, dist=0, iter=[-1,1])
{
    assert(is_list(axis));
    assert(is_num(dist));
    assert(is_list(iter));

    for(i=iter)
    translate(i*axis*dist)
    children();
}

module spreadx(dist=0)
{
    spread(axis=X,dist=dist)
    children();
}

module spready(dist=0)
{
    spread(axis=Y,dist=dist)
    children();
}

module spreadz(dist=0)
{
    spread(axis=Z,dist=dist)
    children();
}

module orient(axis=U, axis_ref=U, roll=0, extra_roll, extra_roll_orient)
{
    rotate(extra_roll_orient==U||extra_roll==U?0:extra_roll*extra_roll_orient)

    // orient to reference axis
    /*rotate(axis_ref==U?0:_orient_angles(axis_ref))*/
    /*multmatrix(axis_ref==U?0:v_rotate(90, axis_ref))*/
    rotate(axis_ref==U?0:_orient_angles(axis_ref))

    // roll around orient axis
    rotate(axis==U?0:roll*axis)

    // orient to axis
    /*multmatrix(axis==U?0:v_rotate(90, axis))*/
    rotate(axis==U?0:_orient_angles(axis))
    children();
}

module orient_(axis=U, axis_ref=U, roll=0, extra_roll, extra_roll_orient)
{
    rotate(extra_roll_orient==U||extra_roll==U?0:extra_roll*extra_roll_orient)

    // orient to reference axis
    multmatrix(axis_ref==U?0:v_rotate(90, axis_ref))

    // roll around orient axis
    rotate(axis==U?0:roll*axis)

    // orient to axis
    multmatrix(axis_ref==U?0:v_rotate(90, axis))
    children();
}

function _orient_bounds(orient, size) =
    (_rotate_matrix(_orient_angles(orient)) * [size.x,size.y,size.z,1]);

function _orient_t(orient, align, size) =
    let(bounds = _orient_bounds(orient, size))
    (hadamard(align, [abs(bounds.x/2),abs(bounds.y/2),abs(bounds.z/2)]));

module size_align(size=[10,10,10], extra_size=N, align=N, extra_align=N, orient=Z, orient_ref=Z, roll=0, extra_roll, extra_roll_orient)
{
    assert(orient != N);
    assert_v3n(align);
    assert_v3n(orient);
    assert_v3n(size);
    t = orient==U?N:_orient_t(orient, align, size);
    extra_t = (orient==U||extra_size==U||extra_size==[U,U,U]||extra_size==[0,0,0]||extra_align==U) ?
        N : _orient_t(orient, extra_align, extra_size);
    assert_v3n(t);
    assert_v3n(extra_t);
    /*assert(extra_t[0] < 0 && extra_t[0] == 0 && extra_t[0] > 0 || extra_t[);*/
    translate(t+extra_t)
    {
        orient(axis=orient, axis_ref=orient_ref, roll=roll, extra_roll=extra_roll, extra_roll_orient=extra_roll_orient)
        {
            children();
        }
    }
}

module hull_pairwise()
{
    for (i= [1:1:$children-1])
    {
        hull()
        {
            children(i-1);
            children(i);
        }
    }
}

module proj_extrude_axis(axis=Z, h=1, offset=0, cut=false)
{
    translate(-offset*axis)
    hull()
    {
        orient_(axis=axis, axis_ref=Z)
        {
            linear_extrude(h, center=false)
            projection(cut=cut)
            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();

            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();
        }
    }
}

module all_axes()
{
    for($axis=concat(AXES,-AXES))
    {
        $color = v_abs($axis*.3 + v_clamp(v_sign($axis),0,1)*.7);
        children();
    }
}

// test proj_extruder_axis
if(false)
{
    all_axes()
    color($color)
    translate(5*$axis)
    proj_extrude_axis(axis=$axis)
    translate(20*$axis)
    sphere(d=10);
}

if(false)
{
    translate(Y*10)
    proj_extrude_axis(axis=Y, offset=10)
    {
        sphere(d=10);
    }
}

module proj_extrude_axis_part(axis=Z, h=1, offset=0, cut=false)
{
    translate(-offset*axis)
    {
        orient_(axis=axis, axis_ref=Z)
        {
            hull()
            linear_extrude(offset, center=false)
            projection(cut=cut)
            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();

            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();
        }
    }
}

if(false)
{
    tz(10)
    proj_extrude_axis_part(axis=Z, offset=10)
    {
        x = 15;
        cylinder(d=5, h=20);

        tx(x)
        cylinder(d=5, h=20);
    }
}

// translate by pos, with extra (depending on the sign of pos)
// an "explode" function
module te(pos, extra=[0,0,0])
{
    assert(len(pos) == 3);
    assert(len(extra) == 3);

    t(pos + v_mul(extra , v_sign(pos)))
    children();
}

/*include <../scad-utils/transformations.scad>*/

include <system.scad>
use <misc.scad>

module t(dist)
{
    assert(dist!=U, "t(): dist==U");
    assert(is_list(dist), dist);
    assert(len(dist)==3, "t(): len(dist)!=3");
    translate(dist)
    children();
}

module tx(dist)
{
    assert(dist!=U, "tx(): dist==U");
    assert(is_num(dist), "tx(): dist is not a number");
    translate(X*dist)
    children();
}

module ty(dist)
{
    assert(dist!=U, "ty(): dist==U");
    assert(is_num(dist), "ty(): dist is not a number");
    translate(Y*dist)
    children();
}

module tz(dist)
{
    assert(dist!=U, "tz(): dist==U");
    assert(is_num(dist), "tz(): dist is not a number");
    translate(Z*dist)
    children();
}

module txy(off)
{
    assert(off!=U, "txy(): off==U");
    assert(len(off)==3, "txy(): len(off)!=3");
    tx(off.x)
    ty(off.y)
    children();
}

module txz(off)
{
    assert(off!=U, "txz(): off==U");
    assert(len(off)==3, "txz(): len(off)!=3");
    tx(off.x)
    tz(off.z)
    children();
}

module tyz(off)
{
    assert(off!=U, "tyz(): off==U");
    assert(len(off)==3, "tyz(): len(off)!=3");
    ty(off.y)
    tz(off.z)
    children();
}

module r(a, v)
{
    if(is_list(a))
    {
        assert(is_undef(v), v);
        assert_v3n(a);
        rotate(a)
        children();
    }
    else
    {
        assert(is_num(a), a);
        assert_v3n(v);
        rotate(a,v)
        children();
    }
}

module rx(degrees)
{
    rotate(X*degrees)
    children();
}

module ry(degrees)
{
    rotate(Y*degrees)
    children();
}

module rz(degrees)
{
    rotate(Z*degrees)
    children();
}

module mx(m=true)
{
    assert(is_bool(m));
    mirror(X*m)
    children();
}

module my(m=true)
{
    assert(is_bool(m));
    mirror(Y*m)
    children();
}

module mz(m=true)
{
    assert(is_bool(m));
    mirror(Z*m)
    children();
}

// translate children
module position(positions)
{
    assert(positions!=U, "positions==U");
    for(pos=positions)
    translate(pos)
    children();
}

// translate children
module linup(arr=U)
{
    if($children>0)
    {
        for (i = [0 : $children-1])
        translate(arr[i]) children(i);
    }
}

module stack(dist=10, distances=U, axis=Z)
{
    if($children>0)
    {
        if(dist == U && distances != U)
        {
            for (i = [0:len(distances)-1])
            {
                offset = v_sum(distances,i);
                translate(axis*offset)
                    child(i);
            }
        }
        else if(dist != U && distances == U)
        {
            for (i = [0 : $children-1])
                translate(axis*(dist*i))
                    children(i);
        }
    }
}

module spread(axis=N, dist=0, iter=[-1,1])
{
    assert(is_list(axis));
    assert(is_num(dist));
    assert(is_list(iter));

    for(i=iter)
    translate(i*axis*dist)
    children();
}

module spreadx(dist=0)
{
    spread(axis=X,dist=dist)
    children();
}

module spready(dist=0)
{
    spread(axis=Y,dist=dist)
    children();
}

module spreadz(dist=0)
{
    spread(axis=Z,dist=dist)
    children();
}

module orient(axis=U, axis_ref=U, roll=0, extra_roll, extra_roll_orient)
{
    rotate(extra_roll_orient==U||extra_roll==U?0:extra_roll*extra_roll_orient)

    // orient to reference axis
    /*rotate(axis_ref==U?0:_orient_angles(axis_ref))*/
    /*multmatrix(axis_ref==U?0:v_rotate(90, axis_ref))*/
    rotate(axis_ref==U?0:_orient_angles(axis_ref))

    // roll around orient axis
    rotate(axis==U?0:roll*axis)

    // orient to axis
    /*multmatrix(axis==U?0:v_rotate(90, axis))*/
    rotate(axis==U?0:_orient_angles(axis))
    children();
}

module orient_(axis=U, axis_ref=U, roll=0, extra_roll, extra_roll_orient)
{
    rotate(extra_roll_orient==U||extra_roll==U?0:extra_roll*extra_roll_orient)

    // orient to reference axis
    multmatrix(axis_ref==U?0:v_rotate(90, axis_ref))

    // roll around orient axis
    rotate(axis==U?0:roll*axis)

    // orient to axis
    multmatrix(axis_ref==U?0:v_rotate(90, axis))
    children();
}

function _orient_bounds(orient, size) =
    (_rotate_matrix(_orient_angles(orient)) * [size.x,size.y,size.z,1]);

function _orient_t(orient, align, size) =
    let(bounds = _orient_bounds(orient, size))
    (hadamard(align, [abs(bounds.x/2),abs(bounds.y/2),abs(bounds.z/2)]));

module size_align(size=[10,10,10], extra_size=N, align=N, extra_align=N, orient=Z, orient_ref=Z, roll=0, extra_roll, extra_roll_orient)
{
    assert(orient != N);
    assert_v3n(align);
    assert_v3n(orient);
    assert_v3n(size);
    t = orient==U?N:_orient_t(orient, align, size);
    extra_t = (orient==U||extra_size==U||extra_size==[U,U,U]||extra_size==[0,0,0]||extra_align==U) ?
        N : _orient_t(orient, extra_align, extra_size);
    assert_v3n(t);
    assert_v3n(extra_t);
    /*assert(extra_t[0] < 0 && extra_t[0] == 0 && extra_t[0] > 0 || extra_t[);*/
    translate(t+extra_t)
    {
        orient(axis=orient, axis_ref=orient_ref, roll=roll, extra_roll=extra_roll, extra_roll_orient=extra_roll_orient)
        {
            children();
        }
    }
}

module hull_pairwise()
{
    for (i= [1:1:$children-1])
    {
        hull()
        {
            children(i-1);
            children(i);
        }
    }
}

module proj_extrude_axis(axis=Z, h=1, offset=0, cut=false)
{
    translate(-offset*axis)
    hull()
    {
        orient_(axis=axis, axis_ref=Z)
        {
            linear_extrude(h, center=false)
            projection(cut=cut)
            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();

            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();
        }
    }
}

module all_axes()
{
    for($axis=concat(AXES,-AXES))
    {
        $color = v_abs($axis*.3 + v_clamp(v_sign($axis),0,1)*.7);
        children();
    }
}

// test proj_extruder_axis
if(false)
{
    all_axes()
    color($color)
    translate(5*$axis)
    proj_extrude_axis(axis=$axis)
    translate(20*$axis)
    sphere(d=10);
}

if(false)
{
    translate(Y*10)
    proj_extrude_axis(axis=Y, offset=10)
    {
        sphere(d=10);
    }
}

module proj_extrude_axis_part(axis=Z, h=1, offset=0, cut=false)
{
    translate(-offset*axis)
    {
        orient_(axis=axis, axis_ref=Z)
        {
            hull()
            linear_extrude(offset, center=false)
            projection(cut=cut)
            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();

            orient_(axis=Z, axis_ref=axis)
            translate(offset*axis)
            children();
        }
    }
}

if(false)
{
    tz(10)
    proj_extrude_axis_part(axis=Z, offset=10)
    {
        x = 15;
        cylinder(d=5, h=20);

        tx(x)
        cylinder(d=5, h=20);
    }
}

// translate by pos, with extra (depending on the sign of pos)
// an "explode" function
module te(pos, extra=[0,0,0])
{
    assert(len(pos) == 3);
    assert(len(extra) == 3);

    t(pos + v_mul(extra , v_sign(pos)))
    children();
}


dimentions tunned to match brush's hole

dimentions tunned to match brush's hole

/*
 * Brown Orla-B brush holder (wall-attached).
 */
$fn=30;

corrners = [ [-1,-1,0], [-1,+1,0], [+1,-1,0], [+1,+1,0] ];

// wall-mounted part
module wall(tr, size)
{
  translate(tr)
    hull()
      difference()
      {
        for(t = corrners)
        {
          assign( off = [size[0]/2*t[0], size[1]/2*t[1], 0*t[2]] )
            translate(off)
              sphere(size[2]);
        };
        translate([0,0,-size[2]]) cube(2*size, center=true);
      }
}

// water drops catching plane
module plane(tr, size)
{
  rotate([90,0,0])
    translate(tr)
      hull()
        for(t = corrners)
        {
          assign( off = [size[0]/2*t[0], size[1]/2*t[1], 0*t[2]] )
            translate(off)
              sphere(size[2]);
        };
}

// element for holding a single brush
module holder(tr, size)
{
  translate(tr)
  {
    cube([size[0], 7, size[2]]);
    translate([0, 7, size[2]-6])
      cube([size[0], size[1]-7, 6]);
  }
}

wall([0,0,0], [36,50,2]);
plane([0,16.5,50/2-2], [36-2*2,29,2]);
holder([20/2-1,-1,2], [3,25,18]);
holder([-20/2-1,-1,2], [3,25,18]);

/*
 * Brown Orla-B brush holder (wall-attached).
 */
$fn=30;

corrners = [ [-1,-1,0], [-1,+1,0], [+1,-1,0], [+1,+1,0] ];

// wall-mounted part
module wall(tr, size)
{
  translate(tr)
    hull()
      difference()
      {
        for(t = corrners)
        {
          assign( off = [size[0]/2*t[0], size[1]/2*t[1], 0*t[2]] )
            translate(off)
              sphere(size[2]);
        };
        translate([0,0,-size[2]]) cube(2*size, center=true);
      }
}

// water drops catching plane
module plane(tr, size)
{
  rotate([90,0,0])
    translate(tr)
      hull()
        for(t = corrners)
        {
          assign( off = [size[0]/2*t[0], size[1]/2*t[1], 0*t[2]] )
            translate(off)
              sphere(size[2]);
        };
}

// element for holding a single brush
module holder(tr, size)
{
  translate(tr)
  {
    cube([size[0], 7, size[2]]);
    translate([0, 7, size[2]-6])
      cube([size[0], size[1]-7, 6]);
  }
}

wall([0,0,0], [36,50,2]);
plane([0,16.5,50/2-2], [36-2*2,29,2]);
holder([20/2-1,-1,2], [4,25,18]);
holder([-20/2-1,-1,2], [4,25,18]);


Colour and extrude PCB board

Colour and extrude PCB board

/*
  Vitamin: Pro Micro
  Model of an Arduino Pro Micro

  Derived from: https://github.com/sparkfun/Pro_Micro/
           and: https://github.com/sparkfun/Arduino_Pro_Mini_328/

  Authors:
    Jamie Osborne (@jmeosbn)

  Local Frame:
    Point of origin is the centre of the bottom left pin (9)

  Parameters:
    FIXME: type: can be "mini", or "micro";
           otherwise returns a blank board with header pin holes

  Returns:
    FIXME: Model of an Arduino Pro Mini/Micro with header holes
*/

// PCB Variables
holeDiam  = 1.25;         // The hole diameter in mm
holeSpace = 2.54;         // The spacing of the holes in mm
holeInset = holeSpace/2;  // The spacing of the holes in mm
pcbHeight = .063 * 25.4;  // The thickness of the PCB in mm
pcbLength =  1.3 * 25.4;  // The length of the PCB in mm
pcbWidth  =  0.7 * 25.4;  // The width of the PCB in mm

module ArduinoPro_PCB() {
  // Bare PCB, origin at location for bottom left hole
  translate([-holeInset, -holeInset, 0]) {
    square(size = [pcbWidth, pcbLength]);
  }
}

module ArduinoPro_Headers() {
  // distance between the two header rows
  rowpitch  = pcbWidth - holeInset*2;
  // length for holes, leaving room for end header and insets
  rowlength = pcbLength - holeSpace - holeInset*2;

  // Add headers to either side (along y)
  for (x = [0, rowpitch], y = [0 : holeSpace : rowlength]) {
    translate([x, y, 0]) {
      // Standard PCB hole
      circle(r = holeDiam/2);
    }
  }

}

module ArduinoPro_Serial_Header() {
  // y position for header
  header_y = pcbLength - holeInset*2;
  // width for holes, leaving room for insets
  rowwidth = pcbWidth - holeInset*2;

  // Add serial header along top of board (along x)
  for (x = [holeInset : holeSpace : rowwidth]) {
    translate([x, header_y, 0]) {
      // Standard PCB hole
      circle(r = holeDiam/2);
    }
  }

}

module ArduinoPro(type = "mini") {
  color([26/255, 90/255, 160/255])
  linear_extrude(height=pcbHeight)
  difference() {
    // Common Features for Pro Mini/Micro
    ArduinoPro_PCB();
    ArduinoPro_Headers();

    // Features for Pro Mini
    if (type == "mini") {
      // Pro Mini Serial Header
      ArduinoPro_Serial_Header();
    }
  }

  // Features for Pro Micro
  if (type == "micro") {
  }
}

ArduinoPro("mini");
*ArduinoPro("micro");

/*
  Vitamin: Pro Micro
  Model of an Arduino Pro Micro

  Derived from: https://github.com/sparkfun/Pro_Micro/
           and: https://github.com/sparkfun/Arduino_Pro_Mini_328/

  Authors:
    Jamie Osborne (@jmeosbn)

  Local Frame:
    Point of origin is the centre of the bottom left pin (9)

  Parameters:
    FIXME: type: can be "mini", or "micro";
           otherwise returns a blank board with header pin holes

  Returns:
    FIXME: Model of an Arduino Pro Mini/Micro with header holes
*/

// PCB Variables
holeDiam  = 1.25;         // The hole diameter in mm
holeSpace = 2.54;         // The spacing of the holes in mm
holeInset = holeSpace/2;  // The spacing of the holes in mm
pcbHeight = .063 * 25.4;  // The thickness of the PCB in mm
pcbLength =  1.3 * 25.4;  // The length of the PCB in mm
pcbWidth  =  0.7 * 25.4;  // The width of the PCB in mm

module ArduinoPro_PCB() {
  // Bare PCB, origin at location for bottom left hole
  translate([-holeInset, -holeInset, 0]) {
    square(size = [pcbWidth, pcbLength]);
  }
}

module ArduinoPro_Headers() {
  // distance between the two header rows
  rowpitch  = pcbWidth - holeInset*2;
  // length for holes, leaving room for end header and insets
  rowlength = pcbLength - holeSpace - holeInset*2;

  // Add headers to either side (along y)
  for (x = [0, rowpitch], y = [0 : holeSpace : rowlength]) {
    translate([x, y, 0]) {
      // Standard PCB hole
      circle(r = holeDiam/2);
    }
  }

}

module ArduinoPro_Serial_Header() {
  // y position for header
  header_y = pcbLength - holeInset*2;
  // width for holes, leaving room for insets
  rowwidth = pcbWidth - holeInset*2;

  // Add serial header along top of board (along x)
  for (x = [holeInset : holeSpace : rowwidth]) {
    translate([x, header_y, 0]) {
      // Standard PCB hole
      circle(r = holeDiam/2);
    }
  }

}

module ArduinoPro(type = "mini") {
  difference() {
    // Common Features for Pro Mini/Micro
    ArduinoPro_PCB();
    ArduinoPro_Headers();

    // Features for Pro Mini
    if (type == "mini") {
      // Pro Mini Serial Header
      ArduinoPro_Serial_Header();
    }
  }

  // Features for Pro Micro
  if (type == "micro") {
  }
}

ArduinoPro("mini");
*ArduinoPro("micro");