Commit f63330f9 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

1st Gerber out

parent 61728050
......@@ -203,6 +203,9 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/ui/slider'>slider</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./modules/ui/text%20window'>text window</a><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;programs</i><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;formats</i><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gerber</i><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/formats/gerber/plot%20png'>plot png</a><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frep</i><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/frep/gears'>gears</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/frep/lattice%20torus'>lattice torus</a><br>
......@@ -228,8 +231,6 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/machines/G-code/mill%202D%20PCB%20svg'>mill 2D PCB svg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/machines/G-code/mill%202D%20png'>mill 2D png</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/machines/G-code/mill%202D%20svg'>mill 2D svg</a><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gerber</i><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/machines/Gerber/plot%20png'>plot png</a><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RNDMC</i><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./programs/machines/RNDMC/honeycomb%20connect'>honeycomb connect</a><br>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Roland</i><br>
......
......@@ -95,40 +95,40 @@ var interface = function(div){
//
// local functions
//
// plot
function format(x) {
var s = x.toFixed(6)
s = s.substr(0,s.length-7)+s.substr(-6,6)
return s
}
//
function plot() {
var imgwidth = mod.imageInfo.width/parseFloat(mod.imageInfo.dpi)
var imgheight = mod.imageInfo.height/parseFloat(mod.imageInfo.dpi)
str = ''
str += "%MOIN*%\n" // inch units
str += "%ASAXBY*%\n" // axes
str += "%IPPOS*%\n" // positive image
str += "%LPD*%\n" // dark layer
str += "%FSLAX33Y33*%\n" // format absolute 3.3
str += "%LPD*%\n" // layer dark
str += "%FSLAX66Y66*%\n" // format absolute 6.6
var x,y
for (var seg = 0; seg < mod.path.length; ++seg) {
for (var pt = 0; pt < mod.path[seg].length; ++pt) {
str += "G36*\n"
x = imgwidth*mod.path[seg][0][0]/(mod.imageInfo.width-1)
y = imgheight*mod.path[seg][0][1]/(mod.imageInfo.height-1)
str += 'X'+format(x)+'Y'+format(y)+'D02*\n'
for (var pt = 1; pt < mod.path[seg].length; ++pt) {
var x = imgwidth*mod.path[seg][pt][0]/(mod.imageInfo.width-1)
var y = imgheight*(1-mod.path[seg][pt][1]/(mod.imageInfo.height-1))
var y = imgheight*mod.path[seg][pt][1]/(mod.imageInfo.height-1)
str += 'X'+format(x)+'Y'+format(y)+'D01*\n'
}
var x = imgwidth*mod.path[seg][0][0]/(mod.imageInfo.width-1)
var y = imgheight*(1-mod.path[seg][0][1]/(mod.imageInfo.height-1))
console.log(parseFloat(x.toFixed(3)))
x = imgwidth*mod.path[seg][0][0]/(mod.imageInfo.width-1)
y = imgheight*mod.path[seg][0][1]/(mod.imageInfo.height-1)
str += 'X'+format(x)+'Y'+format(y)+'D01*\n'
str += "G37*\n"
}
str += "M02*\n"
console.log(str)
}
/*
%MOIN*%
%ASAXBY*%
%IPPOS*%
%FSLAX33Y33*%
%ADD11C,0.1*%
%LPD*%
G36*
X1000Y1000D02*
X2000Y2000D01*
X2000Y1000D01*
X1000Y1000D01*
G37*
%LPC*%
G01*
D11*
......
program_label('formats')
program_label('   gerber')
program_menu('      plot png','programs/formats/gerber/plot%20png')
program_label('frep')
program_menu('   gears','programs/frep/gears')
program_menu('   lattice torus','programs/frep/lattice%20torus')
......@@ -22,8 +25,6 @@ program_menu('      mill 2D PCB png','programs/machines/G-code/mill%202D%2
program_menu('      mill 2D PCB svg','programs/machines/G-code/mill%202D%20PCB%20svg')
program_menu('      mill 2D png','programs/machines/G-code/mill%202D%20png')
program_menu('      mill 2D svg','programs/machines/G-code/mill%202D%20svg')
program_label('   Gerber')
program_menu('      plot png','programs/machines/Gerber/plot%20png')
program_label('   RNDMC')
program_menu('      honeycomb connect','programs/machines/RNDMC/honeycomb%20connect')
program_label('   Roland')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment