Date:2010-11-02 00:14:43 (8 years 7 months ago)
Author:Werner Almesberger
Commit:9103ae0aec52dd2d72ae1bcc6ed70c2b72b8d912
Message:Make toolpath cameo-friendly and use cameo for tool size compensation.

- cntr/cam/doit: use cameo
- cntr/cam/pcb.pl (cut): use exact value of pi, to make sure arcs meet
with lines connecting to them
- cntr/cam/pcb.pl (hhole): force cut to be continuous
- cntr/cam/pcb.pl (arc, hhole, pcb): don't compensate for the tool size.
Cameo now does this for us.
- cntr/cam/pcb.pl: switch to 2nd piece position
Files: cntr/cam/doit (2 diffs)
cntr/cam/pcb.pl (5 diffs)

Change Details

cntr/cam/doit
44ALIGN=$DIR/align/align
55ZMAP=$DIR/zmap/zmap
66GP2RML=$DIR/gp2rml/gp2rml
7CAMEO=../../../cae-tools/cameo/cameo
78
89GEN=${1:-./pcb.pl}
910
...... 
1617
1718$GEN |
1819  awk '{ if ($3 != "") $3 += '$Z'; print $0; }' |
20  $CAMEO -d 0.4445 |
1921  $ALIGN 0 1 $rect |
2022    # angle, reference (lower left corner), rect
2123  $GP2RML 2 0.5 0.5
cntr/cam/pcb.pl
11#!/usr/bin/perl
22
3$PI = atan2(1, 1)*4;
4
35$d = 25.4/1000*35;
46$r = $d/2-0.1; # compensate deflection of board
57$steps = 24;
...... 
4446sub arc
4547{
4648    local ($xc, $yc, $d, $a0, $a1) = @_;
47    local ($rr) = $d/2-$r;
49    local ($rr) = $d/2;
4850    local $n = int(abs($a1-$a0)/360*$steps+0.5);
4951
5052    $rr = 0 if $rr < 0;
5153    for ($i = 0; $i <= $n; $i++) {
52    my $a = ($a0+($a1-$a0)/$n*$i)*3.1415926/180;
54    my $a = ($a0+($a1-$a0)/$n*$i)*$PI/180;
5355    $x = $x0+$xc-$rr*sin($a);
5456    $y = $y0+$yc+$rr*cos($a);
5557    print "$x $y $z\n";
...... 
7072sub hhole
7173{
7274    local ($xc0, $xc1, $yc, $d) = @_;
73    local ($rr) = $d/2-$r;
75    local ($rr) = $d/2;
7476
7577    &cut($xc0, $yc+$rr, $xc1, $yc+$rr);
7678    &arc($xc1, $yc, $d, 0, -180);
79    undef $x;
7780    &cut($xc1, $yc-$rr, $xc0, $yc-$rr);
7881    &arc($xc0, $yc, $d, 180, 0);
7982}
...... 
8285sub pcb
8386{
8487    &cut(
85      &mil( 0)-$r, &mil( 0)-$r,
86      &mil(1180)+$r, &mil( 0)-$r,
87      &mil(1180)+$r, &mil( 240)+$r,
88      &mil(1000)+$r, &mil( 240)+$r,
89      &mil(1000)+$r, &mil( 380)-$r,
90      &mil(1180)+$r, &mil( 380)-$r,
91      &mil(1180)+$r, &mil( 620)+$r,
92      &mil( 0)-$r, &mil( 620)+$r,
93      &mil( 0)-$r, &mil( 0)-$r);
88      &mil( 0), &mil( 0),
89      &mil(1180), &mil( 0),
90      &mil(1180), &mil( 240),
91      &mil(1000), &mil( 240),
92      &mil(1000), &mil( 380),
93      &mil(1180), &mil( 380),
94      &mil(1180), &mil( 620),
95      &mil( 0), &mil( 620),
96      &mil( 0), &mil( 0));
9497}
9598
9699
...... 
111114# x: corner offset, compensation for rotation, array position
112115# y: corner offet
113116
114&orig(35*0, 45);
117&orig(35*1, 45);
115118
116119$r = $d/2; # no compensation. don't wanna risk making holes too big.
117120&holes;

Archive Download the corresponding diff file



interactive