Change infill gridsize to infill percentage

#31
This commit is contained in:
casperlamboo 2018-01-16 18:52:03 +01:00
parent 7b59ba1108
commit f20f5b95b8
4 changed files with 12 additions and 12 deletions

View File

@ -144,7 +144,7 @@ class Settings extends React.Component {
case 'settings.innerShell.flowRate':
case 'settings.outerShell.speed':
case 'settings.outerShell.flowRate':
case 'settings.innerInfill.gridSize':
case 'settings.innerInfill.precentage':
case 'settings.innerInfill.speed':
case 'settings.innerInfill.flowRate':
case 'settings.outerInfill.speed':
@ -306,7 +306,7 @@ class Settings extends React.Component {
<TextField name="settings.outerShell.speed" fullWidth floatingLabelText="Speed" type="number" />
<TextField name="settings.outerShell.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
<p>Inner infill</p>
<TextField name="settings.innerInfill.gridSize" fullWidth floatingLabelText="Grid size" type="number" />
<TextField name="settings.innerInfill.precentage" fullWidth floatingLabelText="Percentage" type="number" />
<TextField name="settings.innerInfill.speed" fullWidth floatingLabelText="Speed" type="number" />
<TextField name="settings.innerInfill.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
<p>Outer infill</p>

View File

@ -39,7 +39,7 @@ outerShell:
innerInfill:
flowRate: 1.0
speed: 80.0
gridSize: 15.0
precentage: 20.0
outerInfill:
flowRate: 1.0
speed: 50.0

View File

@ -15,7 +15,7 @@ low:
speed: 70.0
innerInfill:
speed: 80.0
gridSize: 25.0
precentage: 10.0
medium:
title: "Medium"
layerHeight: .15
@ -33,7 +33,7 @@ medium:
speed: 40.0
innerInfill:
speed: 80.0
gridSize: 25.0
precentage: 10.0
high:
title: "High"
thickness:
@ -51,4 +51,4 @@ high:
speed: 30.0
innerInfill:
speed: 70.0
gridSize: 10.0
precentage: 20.0

View File

@ -5,7 +5,7 @@ import Shape from 'clipper-js';
export default function generateInfills(slices, settings) {
let {
layerHeight,
innerInfill: { gridSize: infillGridSize },
innerInfill: { precentage: infillPercentage },
thickness: {
top: topThickness,
bottom: bottomThickness
@ -13,11 +13,11 @@ export default function generateInfills(slices, settings) {
nozzleDiameter
} = settings;
infillGridSize /= PRECISION;
infillPercentage /= 100;
nozzleDiameter /= PRECISION;
const bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
const topSkinCount = Math.ceil(topThickness/layerHeight);
const bidirectionalInfill = infillPercentage < 0.8;
const infillGridSize = nozzleDiameter * (bidirectionalInfill ? 2 : 1) / infillPercentage;
const nozzleRadius = nozzleDiameter / 2;
const outerFillTemplateSize = Math.sqrt(2 * Math.pow(nozzleDiameter, 2));
@ -32,6 +32,7 @@ export default function generateInfills(slices, settings) {
}
for (let i = 0; i < slice.parts.length; i ++) {
const even = (layer % 2 === 0);
const part = slice.parts[i];
if (!part.closed) continue;
@ -52,14 +53,13 @@ export default function generateInfills(slices, settings) {
if (innerFillArea && innerFillArea.paths.length > 0) {
const bounds = innerFillArea.shapeBounds();
const innerFillTemplate = getFillTemplate(bounds, infillGridSize, true, true);
const innerFillTemplate = getFillTemplate(bounds, infillGridSize, bidirectionalInfill || even, bidirectionalInfill || !even);
part.innerFill.join(innerFillTemplate.intersect(innerFillArea));
}
if (outerFillArea.paths.length > 0) {
const bounds = outerFillArea.shapeBounds();
const even = (layer % 2 === 0);
const outerFillTemplate = getFillTemplate(bounds, outerFillTemplateSize, even, !even);
part.outerFill.join(outerFillTemplate.intersect(outerFillArea));