Skip to content
Snippets Groups Projects
Commit 091fde0d authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

outline working

parent e289a87c
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,6 @@ var interface = function(div){
input.type = 'radio'
input.name = mod.div.id+'format'
input.id = mod.div.id+'outline'
input.disabled = true
formats.appendChild(input)
mod.outline = input
formats.appendChild(document.createTextNode('outline'))
......@@ -104,13 +103,15 @@ function format(x) {
function plot() {
var imgwidth = mod.imageInfo.width/parseFloat(mod.imageInfo.dpi)
var imgheight = mod.imageInfo.height/parseFloat(mod.imageInfo.dpi)
var x,y
//
str = ''
str += "%MOIN*%\n" // inch units
str += "%LPD*%\n" // layer dark
str += "%FSLAX66Y66*%\n" // format absolute 6.6
str += "G01*\n" // linear interpolation
//
var x,y
if (mod.fill.checked == true) {
for (var seg = 0; seg < mod.path.length; ++seg) {
str += "G36*\n"
x = imgwidth*mod.path[seg][0][0]/(mod.imageInfo.width-1)
......@@ -127,19 +128,37 @@ function plot() {
str += "G37*\n"
}
str += "M02*\n"
//
var obj = {}
obj.type = 'file'
obj.name = mod.imageInfo.name+'.gbr'
//var xml = new XMLSerializer().serializeToString(str)
//obj.contents = xml
obj.name = mod.imageInfo.name+'.gtl'
obj.contents = str
outputs.Gerber.event(obj)
}
else if (mod.outline.checked == true) {
str += "%ADD10C,0.001*%\n"
str += "D10*\n"
for (var seg = 0; seg < mod.path.length; ++seg) {
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*mod.path[seg][pt][1]/(mod.imageInfo.height-1)
str += 'X'+format(x)+'Y'+format(y)+'D01*\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)+'D01*\n'
}
str += "M02*\n"
var obj = {}
obj.type = 'file'
obj.name = mod.imageInfo.name+'.gko'
obj.contents = str
outputs.Gerber.event(obj)
}
}
/*
%ADD11C,0.1*%
%LPC*%
G01*
D11*
X1000Y1000D02*
X1000Y2000D01*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment