adapt pcb export to new pad definition

This commit is contained in:
King Kévin 2015-09-02 23:17:09 +02:00
parent 77a8a32bcc
commit 5bbc5441ac
1 changed files with 15 additions and 1 deletions

View File

@ -339,7 +339,21 @@ function json2pcb(json) {
pcb += 'ElementArc['+element.x+''+json.unit+' '+element.y+''+json.unit+' '+element.radius+''+json.unit+' '+element.radius+''+json.unit+' '+((((180-element.start)%360)+360)%360)+' '+(-1*(element.angle))+' '+element.thickness+''+json.unit+']\n'
break
case 'pad':
pcb += 'Pad['+element.x1+''+json.unit+' '+element.y1+''+json.unit+' '+element.x2+''+json.unit+' '+element.y2+''+json.unit+' '+element.thickness+''+json.unit+' '+element.clearance*2+''+json.unit+' '+element.soldermask+''+json.unit+' "" "'+element.number+'" "'
var x1, y1, x2, y2, thickness
if (element.width>element.height) {
x1 = element.x-element.width/2+element.height/2
y1 = element.y
x2 = element.x+element.width/2-element.height/2
y2 = element.y
thickness = element.height
} else {
x1 = element.x
y1 = element.y-element.height/2+element.width/2
x2 = element.x
y2 = element.y+element.height/2-element.width/2
thickness = element.width
}
pcb += 'Pad['+x1+''+json.unit+' '+y1+''+json.unit+' '+x2+''+json.unit+' '+y2+''+json.unit+' '+thickness+''+json.unit+' '+element.clearance*2+''+json.unit+' '+Math.max(thickness+element.soldermask,0)+''+json.unit+' "" "'+element.number+'" "'
if (!element.round) {
pcb += 'square'
}