#!/bin/sh

#@@example screw(3.2mm, 6mm, circle:hex)

#@@purpose Generic screw.

#@@desc Generate a "single pin" screw with optional head shapes
#@@params hole,head,shape,ring

#@@param:hole hole diameter or name of a standard screw (e.g. M3)
#@@dim:hole


#@@param:head head outmost diameter (or optional head name for a standard screw: pan, button, cheese, flat-washer, internal-lock-washer)
#@@dim:head

#@@param:ring copper ring outer diameter
#@@dim:ring
#@@optional:ring
#@@default:ring 80% of head diameter


#@@param:shape shape of the head drawn on silkmark; multiple values can be listed separated with colons, e.g. "shape=circle:hex"
#@@enum:shape:circle circle
#@@enum:shape:hex hexagon with straight line edges, size is from corner to corner
#@@enum:shape:tx "torx": hexagon with arced edges
#@@enum:shape:xzn "triple square"
#@@enum:shape:ph philips slot (cross) - useful together with circle
#@@enum:shape:slot a single straight line slot - useful together with circle
#@@default:shape circle
#@@preview_args:shape 3mm,6mm

#@@include common.awk

awk -f `dirname $0`/common.awk -f `dirname $0`/screw.awk -v "args=$*" -v gen=`basename $0`

