Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
mods
Commits
091fde0d
Commit
091fde0d
authored
Aug 20, 2021
by
Neil Gershenfeld
Browse files
outline working
parent
e289a87c
Changes
1
Show whitespace changes
Inline
Side-by-side
modules/path/formats/gerber
View file @
091fde0d
...
...
@@ -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*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment