mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
implement brim
This commit is contained in:
parent
9a37e8a928
commit
1ebbe7fc6a
@ -147,7 +147,7 @@ class Settings extends React.Component {
|
|||||||
<TextField name="settings.outerInfill.speed" fullWidth floatingLabelText="Speed" type="number" />
|
<TextField name="settings.outerInfill.speed" fullWidth floatingLabelText="Speed" type="number" />
|
||||||
<TextField name="settings.outerInfill.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
<TextField name="settings.outerInfill.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
||||||
<p>Brim</p>
|
<p>Brim</p>
|
||||||
<TextField name="settings.brim.offset" fullWidth floatingLabelText="Offset" type="number" />
|
<TextField name="settings.brim.size" fullWidth floatingLabelText="Size" type="number" />
|
||||||
<TextField name="settings.brim.speed" fullWidth floatingLabelText="Speed" type="number" />
|
<TextField name="settings.brim.speed" fullWidth floatingLabelText="Speed" type="number" />
|
||||||
<TextField name="settings.brim.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
<TextField name="settings.brim.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
||||||
<p>First layer</p>
|
<p>First layer</p>
|
||||||
|
@ -44,7 +44,7 @@ outerInfill:
|
|||||||
flowRate: 1.0
|
flowRate: 1.0
|
||||||
speed: 50.0
|
speed: 50.0
|
||||||
brim:
|
brim:
|
||||||
offset: 4.0
|
size: 4.0
|
||||||
flowRate: 1.0
|
flowRate: 1.0
|
||||||
speed: 40.0
|
speed: 40.0
|
||||||
firstLayer:
|
firstLayer:
|
||||||
|
@ -4,21 +4,33 @@ import { PRECISION } from '../constants.js';
|
|||||||
const offsetOptions = {
|
const offsetOptions = {
|
||||||
jointType: 'jtRound',
|
jointType: 'jtRound',
|
||||||
miterLimit: 2.0,
|
miterLimit: 2.0,
|
||||||
roundPrecision: 0.25
|
roundPrecision: 0.25,
|
||||||
|
endType: 'etClosedPolygon'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function addBrim(slices, settings) {
|
export default function addBrim(slices, settings) {
|
||||||
let {
|
let {
|
||||||
brim: { offset: brimOffset }
|
brim: { size: brimSize },
|
||||||
|
nozzleDiameter
|
||||||
} = settings;
|
} = settings;
|
||||||
brimOffset /= PRECISION;
|
|
||||||
|
nozzleDiameter /= PRECISION;
|
||||||
|
brimSize /= PRECISION;
|
||||||
|
const nozzleRadius = nozzleDiameter / 2;
|
||||||
|
|
||||||
const [firstLayer] = slices;
|
const [firstLayer] = slices;
|
||||||
|
|
||||||
firstLayer.brim = firstLayer.parts.reduce((brim, { shape }) => (
|
const brim = firstLayer.parts.reduce((brim, { shape }) => (
|
||||||
brim.join(shape.offset(brimOffset, {
|
brim.join(shape.offset(nozzleRadius, {
|
||||||
...offsetOptions,
|
...offsetOptions,
|
||||||
endType: shape.closed ? 'etClosedPolygon' : 'etOpenRound'
|
endType: shape.closed ? 'etClosedPolygon' : 'etOpenRound'
|
||||||
}))
|
}))
|
||||||
), new Shape([], true)).simplify('pftNonZero');
|
), new Shape([], true)).simplify('pftNonZero');
|
||||||
|
|
||||||
|
firstLayer.brim = new Shape([], true);
|
||||||
|
|
||||||
|
for (let offset = 0; offset < brimSize; offset += nozzleDiameter) {
|
||||||
|
const brimPart = brim.offset(offset, offsetOptions);
|
||||||
|
firstLayer.brim = firstLayer.brim.join(brimPart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user