Skip to content

Commit

Permalink
don't export settings object
Browse files Browse the repository at this point in the history
  • Loading branch information
mith committed Jul 11, 2017
1 parent d47c8ca commit f87a9c0
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
12 changes: 12 additions & 0 deletions jspm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ SystemJS.config({
"github:*/*.json"
],
map: {
"js-yaml": "npm:[email protected]",
"clipper-js": "github:Doodle3D/[email protected]",
"three.js": "github:mrdoob/three.js@r83",
"assert": "npm:[email protected]",
Expand Down Expand Up @@ -421,6 +422,17 @@ SystemJS.config({
"map": {
"Breush/clipper-lib": "github:Breush/clipper-lib@patch-1"
}
},
"npm:[email protected]": {
"map": {
"argparse": "npm:[email protected]",
"esprima": "npm:[email protected]"
}
},
"npm:[email protected]": {
"map": {
"sprintf-js": "npm:[email protected]"
}
}
}
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dependencies": {
"Doodle3D/clipper-js": "github:Doodle3D/clipper-js@master",
"clipper-js": "github:Doodle3D/[email protected]",
"js-yaml": "npm:js-yaml@^3.9.0",
"json": "github:systemjs/plugin-json@^0.1.2",
"three.js": "github:mrdoob/three.js@r83",
"worker": "github:casperlamboo/plugin-worker@master"
Expand Down Expand Up @@ -77,7 +78,9 @@
}
}
},
"dependencies": {},
"dependencies": {
"js-yaml": "^3.9.0"
},
"devDependencies": {
"jspm": "^0.17.0-beta.28"
}
Expand Down
5 changes: 3 additions & 2 deletions src/Slicer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as THREE from 'three.js';
import Settings from './Settings.js';
import slice from './sliceActions/slice.js';
import SlicerWorker from './slicerWorker.js!worker';

Expand Down Expand Up @@ -28,13 +29,13 @@ export default class {
return this;
}
sliceSync(settings) {
return slice(this.geometry, settings);
return slice(this.geometry, new Settings(settings));
}
slice(settings) {
const slicerWorker = new SlicerWorker();

const geometry = this.geometry.toJSON();
const { config } = settings;
const { config } = new Settings(settings);

return new Promise((resolve, reject) => {
slicerWorker.onerror = reject;
Expand Down
20 changes: 16 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import Slicer from './Slicer.js';
import Settings from './Settings.js';
import printerSettings from './settings/printer_settings.json!json';
import userSettings from './settings/user_settings.json!json';
import defaultSettings from './settings/default.yml!text';
import printerSettings from './settings/printer.yml!text';
import materialSettings from './settings/material.yml!text';
import qualitySettings from './settings/quality.yml!text';
import yaml from 'js-yaml';

export { Slicer, Settings, printerSettings, userSettings };
const ds = {
base: yaml.safeLoad(defaultSettings),
printer: yaml.safeLoad(printerSettings),
material: yaml.safeLoad(materialSettings),
quality: yaml.safeLoad(qualitySettings)
};

export {
Slicer,
ds as defaultSettings
};
3 changes: 3 additions & 0 deletions src/settings/quality.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
low:
title: "Low"
layerHeight: .2
medium:
title: "Medium"
layerHeight: .15
height:
title: "High"
layerHeight: .1
2 changes: 1 addition & 1 deletion src/sliceActions/calculateLayersIntersections.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as THREE from 'three.js';
export default function calculateLayersIntersections(lines, settings) {
console.log('calculating layer intersections');

const { layerHeight, dimensionsZ } = settings.config;
const { layerHeight, dimensions: { z: dimensionsZ } } = settings.config;

const numLayers = Math.floor(dimensionsZ / layerHeight);

Expand Down

0 comments on commit f87a9c0

Please sign in to comment.