first layer extrusion
This commit is contained in:
parent
ae911884cc
commit
62dd49c6d2
2 changed files with 11 additions and 2 deletions
|
|
@ -105,6 +105,13 @@ class SLICENODE_SliceShells(SliceNode):
|
|||
if fl_height is not None:
|
||||
slices.first_layer_height = fl_height
|
||||
|
||||
if len(z_values) > 0 and fl_height is not None and layer_height > 0:
|
||||
mult = fl_height / layer_height
|
||||
z_first = z_values[0]
|
||||
for i, p in enumerate(slices):
|
||||
if len(p) > 0 and abs(p[0, 2] - z_first) < 1e-4:
|
||||
slices.extrusion_rate[i] = slices.extrusion_rate[i] * mult
|
||||
|
||||
if rotation and any(rotation):
|
||||
from mathutils import Euler
|
||||
mat_inv = np.array(Euler(rotation).to_matrix())
|
||||
|
|
|
|||
|
|
@ -528,9 +528,11 @@ class TestSlice(unittest.TestCase):
|
|||
node.resolve = lambda name: scoll if name == "Mesh" else (0.2 if name == "Layer Height" else (0.3 if name == "First Layer Height" else None))
|
||||
slices = node.evaluate_output("Paths")
|
||||
self.assertTrue(len(slices) > 0)
|
||||
# First slice Z should be 0.3 / 2 = 0.15
|
||||
self.assertAlmostEqual(slices[0][0, 2], 0.15)
|
||||
# First slice Z should be min_z + fl_height = 0.0 + 0.3 = 0.3
|
||||
self.assertAlmostEqual(slices[0][0, 2], 0.3)
|
||||
self.assertEqual(getattr(slices, "first_layer_height", None), 0.3)
|
||||
# First layer extrusion rates should be multiplied by 0.3 / 0.2 = 1.5
|
||||
np.testing.assert_allclose(slices.extrusion_rate[0], 1.5)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue