mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 20:14:04 +02:00
fab/drl2gerber: support metric drill files
This commit is contained in:
parent
c5c1b18b5a
commit
d70dc71cfe
@ -12,32 +12,51 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
sub begin
|
||||||
|
{
|
||||||
|
return if $began;
|
||||||
|
$began = 1;
|
||||||
|
|
||||||
print "G04 MACHINE-GENERATED FROM DRILL FILE*\n" || die;
|
print "G04 MACHINE-GENERATED FROM DRILL FILE*\n" || die;
|
||||||
print "G01*\n" || die; # linear Interpolation
|
print "G01*\n" || die; # linear Interpolation
|
||||||
print "G70*\n" || die; # inch units
|
print "G70*\n" || die; # inch units
|
||||||
print "G90*\n" || die; # absolute Mode
|
print "G90*\n" || die; # absolute Mode
|
||||||
|
if ($mm) {
|
||||||
|
print "%MOMM*%*\n" || die; # millimeters, RS274X-style
|
||||||
|
} else {
|
||||||
print "%MOIN*%*\n" || die; # inches, RS274X-style
|
print "%MOIN*%*\n" || die; # inches, RS274X-style
|
||||||
|
}
|
||||||
print "%FSLAX34Y34*%\n" || die; # format
|
print "%FSLAX34Y34*%\n" || die; # format
|
||||||
|
}
|
||||||
|
|
||||||
while (<>) {
|
while (<>) {
|
||||||
chop;
|
chop;
|
||||||
|
if (/^METRIC/) {
|
||||||
|
$mm = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
if (/^T(\d+)C/) {
|
if (/^T(\d+)C/) {
|
||||||
|
&begin;
|
||||||
print "%ADD", $1 + 10, "C,$'*%\n" || die;
|
print "%ADD", $1 + 10, "C,$'*%\n" || die;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^T(\d+)$/) {
|
if (/^T(\d+)$/) {
|
||||||
|
&begin;
|
||||||
print "G54D", $1 + 10, "*\n" || die;
|
print "G54D", $1 + 10, "*\n" || die;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^X([-0-9.]+)Y([-0-9.]+)$/) {
|
if (/^X([-0-9.]+)Y([-0-9.]+)$/) {
|
||||||
|
&begin;
|
||||||
printf("X%dY%dD03*\n", $1 * 10000, $2 * 10000) || die;
|
printf("X%dY%dD03*\n", $1 * 10000, $2 * 10000) || die;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^X([-0-9.]+)Y([-0-9.]+)G85X([-0-9.]+)Y([-0-9.]+)$/) {
|
if (/^X([-0-9.]+)Y([-0-9.]+)G85X([-0-9.]+)Y([-0-9.]+)$/) {
|
||||||
|
&begin;
|
||||||
printf("X%dY%dD02*\nX%dY%dD01*\n",
|
printf("X%dY%dD02*\nX%dY%dD01*\n",
|
||||||
$1 * 10000, $2 * 10000, $3 * 10000, $4 * 10000) || die;
|
$1 * 10000, $2 * 10000, $3 * 10000, $4 * 10000) || die;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&begin;
|
||||||
print "M02*\n" || die;
|
print "M02*\n" || die;
|
||||||
|
Loading…
Reference in New Issue
Block a user