use deconstructs

This commit is contained in:
casperlamboo 2016-03-29 08:49:35 +02:00
parent e573a0662b
commit aa9de5ec47
4 changed files with 34 additions and 22 deletions

View File

@ -3,8 +3,7 @@ import THREE from 'three.js';
export default function calculateLayersIntersections(lines, settings) { export default function calculateLayersIntersections(lines, settings) {
console.log('calculating layer intersections'); console.log('calculating layer intersections');
var layerHeight = settings.config["layerHeight"]; const { layerHeight, dimensionsZ: height } = settings.config;
var height = settings.config["dimensionsZ"];
var numLayers = Math.floor(height / layerHeight); var numLayers = Math.floor(height / layerHeight);

View File

@ -1,18 +1,25 @@
import getFillTemplate from './getFillTemplate.js'; import getFillTemplate from './getFillTemplate.js';
import Paths from '../paths.js'; import Paths from '../paths.js';
const scale = 100;
export default function generateInfills(slices, settings) { export default function generateInfills(slices, settings) {
console.log("generating infills"); console.log("generating infills");
// need to scale up everything because of clipper rounding errors // need to scale up everything because of clipper rounding errors
var scale = 100;
var layerHeight = settings.config["layerHeight"]; let {
var fillGridSize = settings.config["fillGridSize"] * scale; layerHeight,
var bottomThickness = settings.config["bottomThickness"]; fillGridSize,
var topThickness = settings.config["topThickness"]; bottomThickness,
var nozzleDiameter = settings.config["nozzleDiameter"] * scale; topThickness,
var infillOverlap = settings.config["infillOverlap"] * scale; nozzleDiameter,
infillOverlap
} = settings.config;
fillGridSize *= scale;
nozzleDiameter *= scale;
infillOverlap *= scale;
var bottomSkinCount = Math.ceil(bottomThickness/layerHeight); var bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
var topSkinCount = Math.ceil(topThickness/layerHeight); var topSkinCount = Math.ceil(topThickness/layerHeight);

View File

@ -1,12 +1,12 @@
const scale = 100;
export default function generateInnerLines(slices, settings) { export default function generateInnerLines(slices, settings) {
console.log("generating outer lines and inner lines"); console.log("generating outer lines and inner lines");
// need to scale up everything because of clipper rounding errors // need to scale up everything because of clipper rounding errors
var scale = 100; let {layerHeight, nozzleDiameter, shellThickness} = settings.config;
nozzleDiameter *= scale;
var layerHeight = settings.config["layerHeight"]; shellThickness *= scale;
var nozzleDiameter = settings.config["nozzleDiameter"] * scale;
var shellThickness = settings.config["shellThickness"] * scale;
var nozzleRadius = nozzleDiameter / 2; var nozzleRadius = nozzleDiameter / 2;
var shells = Math.round(shellThickness / nozzleDiameter); var shells = Math.round(shellThickness / nozzleDiameter);

View File

@ -1,20 +1,26 @@
import getFillTemplate from './getFillTemplate.js'; import getFillTemplate from './getFillTemplate.js';
import Paths from '../paths.js'; import Paths from '../paths.js';
const scale = 100;
export default function generateSupport(slices, settings) { export default function generateSupport(slices, settings) {
console.log("generating support"); console.log("generating support");
// need to scale up everything because of clipper rounding errors // need to scale up everything because of clipper rounding errors
var scale = 100; let {
layerHeight,
supportGridSize,
supportAcceptanceMargin,
supportPlateSize: plateSize,
supportDistanceY,
nozzleDiameter
} = settings.config;
var layerHeight = settings.config["layerHeight"]; supportGridSize *= scale;
var supportGridSize = settings.config["supportGridSize"] * scale; supportMargin *= scale;
var supportAcceptanceMargin = settings.config["supportAcceptanceMargin"] * scale; plateSize *= scale;
var supportMargin = settings.config["supportMargin"] * scale; nozzleDiameter *= scale;
var plateSize = settings.config["supportPlateSize"] * scale;
var supportDistanceY = settings.config["supportDistanceY"];
var supportDistanceLayers = Math.max(Math.ceil(supportDistanceY / layerHeight), 1); var supportDistanceLayers = Math.max(Math.ceil(supportDistanceY / layerHeight), 1);
var nozzleDiameter = settings.config["nozzleDiameter"] * scale;
var supportAreas = new Paths([], true); var supportAreas = new Paths([], true);