Skip to content
This repository has been archived by the owner on Jul 23, 2018. It is now read-only.

Commit

Permalink
fix flipped pad hole dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed Aug 11, 2014
1 parent 83d80e2 commit 27cbe49
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
16 changes: 8 additions & 8 deletions dist/gerber-to-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,8 @@ parseAD = function(block) {
};
if (mods.length > 2) {
params.hole = {
width: parseFloat(mods[2]),
height: parseFloat(mods[1])
width: parseFloat(mods[1]),
height: parseFloat(mods[2])
};
} else if (mods.length > 1) {
params.hole = {
Expand All @@ -1106,8 +1106,8 @@ parseAD = function(block) {
};
if (mods.length > 3) {
params.hole = {
width: parseFloat(mods[3]),
height: parseFloat(mods[2])
width: parseFloat(mods[2]),
height: parseFloat(mods[3])
};
} else if (mods.length > 2) {
params.hole = {
Expand All @@ -1124,8 +1124,8 @@ parseAD = function(block) {
};
if (mods.length > 3) {
params.hole = {
width: parseFloat(mods[3]),
height: parseFloat(mods[2])
width: parseFloat(mods[2]),
height: parseFloat(mods[3])
};
} else if (mods.length > 2) {
params.hole = {
Expand All @@ -1146,8 +1146,8 @@ parseAD = function(block) {
}
if (mods.length > 4) {
params.hole = {
width: parseFloat(mods[4]),
height: parseFloat(mods[3])
width: parseFloat(mods[3]),
height: parseFloat(mods[4])
};
} else if (mods.length > 3) {
params.hole = {
Expand Down
2 changes: 1 addition & 1 deletion dist/gerber-to-svg.min.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions lib/plotter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/plotter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ parseAD = (block) ->
mods = block[4+code.length..].split 'X'
params = { dia: parseFloat mods[0] }
if mods.length > 2 then params.hole = {
width: parseFloat mods[2]
height: parseFloat mods[1]
width: parseFloat mods[1]
height: parseFloat mods[2]
}
else if mods.length > 1 then params.hole = { dia: parseFloat mods[1] }
ad = tool code, params
when 'R,'
mods = block[4+code.length..].split 'X'
params = { width: parseFloat(mods[0]), height: parseFloat(mods[1]) }
if mods.length > 3 then params.hole = {
width: parseFloat mods[3]
height: parseFloat mods[2]
width: parseFloat mods[2]
height: parseFloat mods[3]
}
else if mods.length > 2 then params.hole = { dia: parseFloat mods[2] }
ad = tool code, params
when 'O,'
mods = block[4+code.length..].split 'X'
params = { width: parseFloat(mods[0]), height: parseFloat(mods[1]) }
if mods.length > 3 then params.hole = {
width: parseFloat mods[3]
height: parseFloat mods[2]
width: parseFloat mods[2]
height: parseFloat mods[3]
}
else if mods.length > 2 then params.hole = { dia: parseFloat mods[2] }
params.obround = true
Expand All @@ -56,8 +56,8 @@ parseAD = (block) ->
}
if mods[2]? then params.degrees = parseFloat mods[2]
if mods.length > 4 then params.hole = {
width: parseFloat mods[4]
height: parseFloat mods[3]
width: parseFloat mods[3]
height: parseFloat mods[4]
}
else if mods.length > 3 then params.hole = { dia: parseFloat mods[3] }
ad = tool code, params
Expand Down
16 changes: 8 additions & 8 deletions test/plotter_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ describe 'Plotter class', ->
{ circle: { r: 0.7 } }
]
(p.tools.D12?).should.be.false
p.parameter [ '%', 'ADD12C,1.6X0.5X0.5', '%' ]
p.parameter [ '%', 'ADD12C,1.6X0.6X0.5', '%' ]
(p.tools.D12?).should.be.true
p.defs.should.containDeep [
{ mask: { _: [ { rect: {} }, { rect: {} } ] } }
{ mask: { _: [ { rect: {} }, { rect: {width:0.6, height:0.5} } ] } }
{ circle: { r: 0.8 } }
]
it 'should add standard rectangles to the tools list', ->
Expand All @@ -110,7 +110,7 @@ describe 'Plotter class', ->
'%'
'ADD10R,1X1'
'ADD11R,1.1X1.1X0.5'
'ADD12R,1.2X1.2X0.5X0.5'
'ADD12R,1.2X1.2X0.6X0.5'
'%'
]
(p.tools.D10?).should.be.true
Expand All @@ -120,7 +120,7 @@ describe 'Plotter class', ->
{ rect: { width: 1 } }
{ mask: { _: [ { circle: { r: 0.25 } } ] } }
{ rect: { width: 1.1 } }
{ mask: { _: [ { rect: {} }, { rect: {} } ] } }
{ mask: { _: [ { rect: {} }, { rect: {width:0.6, height:0.5} } ] } }
{ rect: { width: 1.2 } }
]

Expand All @@ -132,7 +132,7 @@ describe 'Plotter class', ->
'%'
'ADD10O,1X1'
'ADD11O,1.2X1.2X0.5'
'ADD12O,1.4X1.4X0.5X0.5'
'ADD12O,1.4X1.4X0.6X0.5'
'%'
]
(p.tools.D10?).should.be.true
Expand All @@ -142,7 +142,7 @@ describe 'Plotter class', ->
{ rect: { width: 1, rx: 0.5 } }
{ mask: { _: [ { circle: { r: 0.25 } } ] } }
{ rect: { width: 1.2, rx: 0.6 } }
{ mask: { _: [ { rect: {} }, { rect: {} } ] } }
{ mask: { _: [ { rect: {} }, { rect: {width:0.6, height:0.5} } ] } }
{ rect: { width: 1.4, rx: 0.7 } }
]
it 'should add standard polygons to the tools list', ->
Expand All @@ -155,7 +155,7 @@ describe 'Plotter class', ->
'ADD10P,5X3'
'ADD11P,5X4X45'
'ADD12P,5X4X0X0.6'
'ADD13P,5X4X0X0.6X0.6'
'ADD13P,5X4X0X0.6X0.5'
'%'
]
(p.tools.D10?).should.be.true
Expand All @@ -167,7 +167,7 @@ describe 'Plotter class', ->
{ polygon: {} }
{ mask: { _: [ { circle: { r: 0.3 } } ] } }
{ polygon: {} }
{ mask: { _: [ { rect: {} }, { rect: {} } ] } }
{ mask: { _: [ { rect: {} }, { rect: {width:0.6, height:0.5} } ] } }
{ polygon: {} }
]

Expand Down

0 comments on commit 27cbe49

Please sign in to comment.