mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +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.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
||||
<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.flowRate" fullWidth floatingLabelText="Flow rate" type="number" />
|
||||
<p>First layer</p>
|
||||
|
@ -44,7 +44,7 @@ outerInfill:
|
||||
flowRate: 1.0
|
||||
speed: 50.0
|
||||
brim:
|
||||
offset: 4.0
|
||||
size: 4.0
|
||||
flowRate: 1.0
|
||||
speed: 40.0
|
||||
firstLayer:
|
||||
|
@ -4,21 +4,33 @@ import { PRECISION } from '../constants.js';
|
||||
const offsetOptions = {
|
||||
jointType: 'jtRound',
|
||||
miterLimit: 2.0,
|
||||
roundPrecision: 0.25
|
||||
roundPrecision: 0.25,
|
||||
endType: 'etClosedPolygon'
|
||||
};
|
||||
|
||||
export default function addBrim(slices, settings) {
|
||||
let {
|
||||
brim: { offset: brimOffset }
|
||||
brim: { size: brimSize },
|
||||
nozzleDiameter
|
||||
} = settings;
|
||||
brimOffset /= PRECISION;
|
||||
|
||||
nozzleDiameter /= PRECISION;
|
||||
brimSize /= PRECISION;
|
||||
const nozzleRadius = nozzleDiameter / 2;
|
||||
|
||||
const [firstLayer] = slices;
|
||||
|
||||
firstLayer.brim = firstLayer.parts.reduce((brim, { shape }) => (
|
||||
brim.join(shape.offset(brimOffset, {
|
||||
const brim = firstLayer.parts.reduce((brim, { shape }) => (
|
||||
brim.join(shape.offset(nozzleRadius, {
|
||||
...offsetOptions,
|
||||
endType: shape.closed ? 'etClosedPolygon' : 'etOpenRound'
|
||||
}))
|
||||
), 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