Skip to content

Commit

Permalink
Fix import scale issue for gerbers using imperial units (#17)
Browse files Browse the repository at this point in the history
* Fix import scale issue for gerbers using imperial units

* Remove logging. Fix .gitignore

* Update package version to 1.3.1

---------

Co-authored-by: errol t <[email protected]>
  • Loading branch information
errolt and errol t authored Mar 19, 2024
1 parent a34d4c5 commit 7e30439
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ yarn-debug.log*
yarn-error.log*

.tpm/
.tmp/

# Developer tools' files
.lite_workspace.lua
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "photonic-etcher",
"version": "1.3.0",
"version": "1.3.1",
"description": "Generate exposure masks for Anycubic printers from PCB Gerbers",
"homepage": ".",
"bugs": {
Expand Down
15 changes: 13 additions & 2 deletions src/renderer/render-to-photon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,19 @@ const {CanvasToImage} = require("./canvas_to_img");

for (const layer of layers) {
const svgXMLObj = parser.parse(layer.svg);
const board_width_mm = parseFloat(svgXMLObj.svg['@_width'].replace("mm", ""));
const board_height_mm = parseFloat(svgXMLObj.svg['@_height'].replace("mm", ""));
var board_width_mm;
var board_height_mm;
if(svgXMLObj.svg['@_width'].endsWith('in'))
{
board_width_mm = parseFloat(svgXMLObj.svg['@_width'].replace("in", ""))*25.4;
board_height_mm = parseFloat(svgXMLObj.svg['@_height'].replace("in", ""))*25.4;
}
else
{
board_width_mm = parseFloat(svgXMLObj.svg['@_width'].replace("mm", ""));
board_height_mm = parseFloat(svgXMLObj.svg['@_height'].replace("mm", ""));
}

const viewbox = svgXMLObj.svg['@_viewBox'].split(' ').map((str) => parseInt(str));
const exposureTime = options.exposureTimes[layer.id];
let outputFileName = ""
Expand Down

0 comments on commit 7e30439

Please sign in to comment.