Skip to content

Commit f87a9c0

Browse files
committed
don't export settings object
1 parent d47c8ca commit f87a9c0

File tree

6 files changed

+39
-8
lines changed

6 files changed

+39
-8
lines changed

jspm.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ SystemJS.config({
159159
"github:*/*.json"
160160
],
161161
map: {
162+
"js-yaml": "npm:[email protected]",
162163
"clipper-js": "github:Doodle3D/[email protected]",
163164
"three.js": "github:mrdoob/three.js@r83",
164165
"assert": "npm:[email protected]",
@@ -421,6 +422,17 @@ SystemJS.config({
421422
"map": {
422423
"Breush/clipper-lib": "github:Breush/clipper-lib@patch-1"
423424
}
425+
},
426+
427+
"map": {
428+
"argparse": "npm:[email protected]",
429+
"esprima": "npm:[email protected]"
430+
}
431+
},
432+
433+
"map": {
434+
"sprintf-js": "npm:[email protected]"
435+
}
424436
}
425437
}
426438
});

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dependencies": {
99
"Doodle3D/clipper-js": "github:Doodle3D/clipper-js@master",
1010
"clipper-js": "github:Doodle3D/[email protected]",
11+
"js-yaml": "npm:js-yaml@^3.9.0",
1112
"json": "github:systemjs/plugin-json@^0.1.2",
1213
"three.js": "github:mrdoob/three.js@r83",
1314
"worker": "github:casperlamboo/plugin-worker@master"
@@ -77,7 +78,9 @@
7778
}
7879
}
7980
},
80-
"dependencies": {},
81+
"dependencies": {
82+
"js-yaml": "^3.9.0"
83+
},
8184
"devDependencies": {
8285
"jspm": "^0.17.0-beta.28"
8386
}

src/Slicer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as THREE from 'three.js';
2+
import Settings from './Settings.js';
23
import slice from './sliceActions/slice.js';
34
import SlicerWorker from './slicerWorker.js!worker';
45

@@ -28,13 +29,13 @@ export default class {
2829
return this;
2930
}
3031
sliceSync(settings) {
31-
return slice(this.geometry, settings);
32+
return slice(this.geometry, new Settings(settings));
3233
}
3334
slice(settings) {
3435
const slicerWorker = new SlicerWorker();
3536

3637
const geometry = this.geometry.toJSON();
37-
const { config } = settings;
38+
const { config } = new Settings(settings);
3839

3940
return new Promise((resolve, reject) => {
4041
slicerWorker.onerror = reject;

src/index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import Slicer from './Slicer.js';
2-
import Settings from './Settings.js';
3-
import printerSettings from './settings/printer_settings.json!json';
4-
import userSettings from './settings/user_settings.json!json';
2+
import defaultSettings from './settings/default.yml!text';
3+
import printerSettings from './settings/printer.yml!text';
4+
import materialSettings from './settings/material.yml!text';
5+
import qualitySettings from './settings/quality.yml!text';
6+
import yaml from 'js-yaml';
57

6-
export { Slicer, Settings, printerSettings, userSettings };
8+
const ds = {
9+
base: yaml.safeLoad(defaultSettings),
10+
printer: yaml.safeLoad(printerSettings),
11+
material: yaml.safeLoad(materialSettings),
12+
quality: yaml.safeLoad(qualitySettings)
13+
};
14+
15+
export {
16+
Slicer,
17+
ds as defaultSettings
18+
};

src/settings/quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
low:
2+
title: "Low"
23
layerHeight: .2
34
medium:
5+
title: "Medium"
46
layerHeight: .15
57
height:
8+
title: "High"
69
layerHeight: .1

src/sliceActions/calculateLayersIntersections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as THREE from 'three.js';
33
export default function calculateLayersIntersections(lines, settings) {
44
console.log('calculating layer intersections');
55

6-
const { layerHeight, dimensionsZ } = settings.config;
6+
const { layerHeight, dimensions: { z: dimensionsZ } } = settings.config;
77

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

0 commit comments

Comments
 (0)