1
0
mirror of git://projects.qi-hardware.com/f32xbase.git synced 2024-11-04 23:21:53 +02:00

hw/cam/: toolpath generation for cutting the PCB.

This commit is contained in:
Werner Almesberger 2010-10-08 02:05:51 -03:00
parent 807616f24b
commit c9f4c9b3db
3 changed files with 85 additions and 0 deletions

4
hw/cam/Makefile Normal file
View File

@ -0,0 +1,4 @@
.PHONY: pcb
pcb:
./doit >job

21
hw/cam/doit Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh -e
DIR=/home/moko/svn.openmoko.org/developers/werner/cncmap
RECT=$DIR/rect/rect
ALIGN=$DIR/align/align
ZMAP=$DIR/zmap/zmap
GP2RML=$DIR/gp2rml/gp2rml
GEN=${1:-./pcb.pl}
rdata="19.6 13.0 -56.2 19.6 53.1 -56.1 110.7 14.1 -56.2"
# lower Z by 0.5 mm relative to highest point
Z=-56.6
rect=`$RECT $rdata | awk '{$3 = ""; print}'`
$GEN |
awk '{ if ($3 != "") $3 += '$Z'; print $0; }' |
$ALIGN 0 1 $rect |
# angle, reference (lower left corner), rect
$GP2RML 3 0.1 0.1
# clearance, xy speed, z speed

60
hw/cam/pcb.pl Executable file
View File

@ -0,0 +1,60 @@
#!/usr/bin/perl
$d = 2.54/1000*12;
$r = $d/2+0.25;
sub orig
{
$x0 = $_[0];
$y0 = $_[1];
}
sub mil
{
return $_[0]/1000*25.4;
}
sub cut
{
if (defined $x) {
if ($x == $_[0]+$x0 && $y == $_[1]+$y0) {
shift @_;
shift @_;
} else {
print "\n";
}
}
while (@_) {
$x = shift @_;
$y = shift @_;
# ($x, $y) = (-$y, $x);
$x += $x0;
$y += $y0;
print "$x $y $z\n";
}
}
sub one
{
&cut(
&mil( 0)-$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 460),
&mil( -50)-$r, &mil( 510),
&mil( -50)-$r, &mil(1070)+$r,
&mil( 520)+$r, &mil(1070)+$r,
&mil( 520)+$r, &mil( 510),
&mil( 470)+$r, &mil( 460),
&mil( 470)+$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 0)-$r);
}
$z = -1.6; # full thickness of board
# x: corner offset, compensation for rotation, array position
# y: corner offet
&orig(1+1+17*1, 1)
&one;