From ba5904dd3b5d429a1be87804f70ffc4c258053ae Mon Sep 17 00:00:00 2001 From: Droog71 <71droog71@gmail.com> Date: Sat, 1 Jan 2022 11:00:53 -0500 Subject: [PATCH] Fixed inability to cut in a straight line using two distant points. Removed support structures from example gcode files. Added simple square engraving example. --- mods/gnode/gcode/boat.gcode | 55 -------------------------------- mods/gnode/gcode/bunny.gcode | 59 ----------------------------------- mods/gnode/gcode/cat.gcode | 4 +-- mods/gnode/gcode/cube.gcode | 55 -------------------------------- mods/gnode/gcode/files.json | 4 +++ mods/gnode/gcode/square.gcode | 10 ++++++ mods/gnode/src/machine.lua | 15 ++++++--- 7 files changed, 27 insertions(+), 175 deletions(-) create mode 100644 mods/gnode/gcode/square.gcode diff --git a/mods/gnode/gcode/boat.gcode b/mods/gnode/gcode/boat.gcode index 39c1f6a..d4d9c6c 100644 --- a/mods/gnode/gcode/boat.gcode +++ b/mods/gnode/gcode/boat.gcode @@ -1,58 +1,3 @@ -; generated by Slic3r 1.3.0 on 2021-12-29 at 00:23:07 - -; external perimeters extrusion width = 0.55mm (4.37mm^3/s) -; perimeters extrusion width = 0.70mm (11.44mm^3/s) -; infill extrusion width = 0.62mm (13.45mm^3/s) -; solid infill extrusion width = 0.70mm (3.81mm^3/s) -; top infill extrusion width = 0.70mm (2.86mm^3/s) - -M107 -M104 S200 ; set temperature -G28 ; home all axes -G1 Z5 F5000 ; lift nozzle - -; Filament gcode - -M109 S200 ; set temperature and wait for it to be reached -G21 ; set units to millimeters -G90 ; use absolute coordinates -M82 ; use absolute distances for extrusion -G92 E0 -G1 Z0.350 F7800.000 -G1 E-2.00000 F2400.00000 -G92 E0 -G1 X71.068 Y86.674 F7800.000 -G1 E2.00000 F2400.00000 -G1 F1800 -G1 X73.892 Y85.795 E2.09151 -G1 X93.392 Y84.295 E2.69665 -G1 X93.900 Y84.275 E2.71238 -G1 X104.600 Y84.275 E3.04345 -G1 X107.563 Y84.975 E3.13764 -G1 X113.563 Y87.975 E3.34520 -G1 X115.285 Y89.215 E3.41087 -G1 X118.285 Y92.215 E3.54214 -G1 X119.601 Y94.093 E3.61311 -G1 X120.225 Y96.900 E3.70206 -G1 X120.225 Y101.600 E3.84749 -G1 X119.525 Y104.563 E3.94168 -G1 X118.025 Y107.563 E4.04546 -G1 X115.775 Y110.112 E4.15068 -G1 X111.275 Y113.112 E4.31803 -G1 X109.175 Y114.035 E4.38899 -G1 X107.600 Y114.225 E4.43808 -G1 X77.400 Y114.225 E5.37251 -G1 X74.437 Y113.525 E5.46670 -G1 X71.437 Y112.025 E5.57048 -G1 X69.594 Y110.660 E5.64144 -G1 X68.328 Y108.748 E5.71240 -G1 X67.775 Y106.100 E5.79611 -G1 X67.775 Y92.400 E6.22001 -G1 X68.172 Y90.141 E6.29097 -G1 X69.315 Y88.153 E6.36193 -G1 X71.011 Y86.722 E6.43058 -G1 E4.43058 F2400.00000 -G92 E0 G1 X106.000 Y104.500 F7800.000 G1 E2.00000 F2400.00000 G1 F1800 diff --git a/mods/gnode/gcode/bunny.gcode b/mods/gnode/gcode/bunny.gcode index 3a0d3a0..d463941 100644 --- a/mods/gnode/gcode/bunny.gcode +++ b/mods/gnode/gcode/bunny.gcode @@ -1,62 +1,3 @@ -; generated by Slic3r 1.3.0 on 2021-12-29 at 00:23:16 - -; external perimeters extrusion width = 0.55mm (4.37mm^3/s) -; perimeters extrusion width = 0.70mm (11.44mm^3/s) -; infill extrusion width = 0.62mm (13.45mm^3/s) -; solid infill extrusion width = 0.70mm (3.81mm^3/s) -; top infill extrusion width = 0.70mm (2.86mm^3/s) - -M107 -M104 S200 ; set temperature -G28 ; home all axes -G1 Z5 F5000 ; lift nozzle - -; Filament gcode - -M109 S200 ; set temperature and wait for it to be reached -G21 ; set units to millimeters -G90 ; use absolute coordinates -M82 ; use absolute distances for extrusion -G92 E0 -G1 Z0.350 F7800.000 -G1 E-2.00000 F2400.00000 -G92 E0 -G1 X82.215 Y80.215 F7800.000 -G1 E2.00000 F2400.00000 -G1 F1800 -G1 X84.440 Y78.749 E2.08243 -G1 X94.440 Y74.749 E2.41568 -G1 X96.900 Y74.275 E2.49321 -G1 X101.100 Y74.275 E2.62316 -G1 X102.707 Y74.473 E2.67325 -G1 X110.707 Y76.473 E2.92840 -G1 X111.195 Y76.615 E2.94413 -G1 X117.195 Y78.615 E3.13982 -G1 X119.785 Y80.215 E3.23401 -G1 X125.785 Y86.215 E3.49656 -G1 X127.101 Y88.093 E3.56752 -G1 X127.725 Y90.900 E3.65648 -G1 X127.725 Y99.100 E3.91020 -G1 X127.328 Y101.359 E3.98116 -G1 X125.785 Y103.785 E4.07012 -G1 X117.785 Y111.785 E4.42018 -G1 X115.195 Y113.385 E4.51437 -G1 X109.195 Y115.385 E4.71006 -G1 X107.100 Y115.725 E4.77573 -G1 X92.900 Y115.725 E5.21510 -G1 X90.641 Y115.328 E5.28606 -G1 X88.215 Y113.785 E5.37502 -G1 X78.215 Y103.785 E5.81259 -G1 X76.899 Y101.907 E5.88356 -G1 X76.275 Y99.100 E5.97251 -G1 X76.275 Y96.900 E6.04058 -G1 X76.404 Y95.601 E6.08098 -G1 X78.404 Y85.601 E6.39652 -G1 X79.236 Y83.464 E6.46748 -G1 X80.215 Y82.215 E6.51658 -G1 X82.162 Y80.269 E6.60177 -G1 E4.60177 F2400.00000 -G92 E0 G1 X111.500 Y103.500 F7800.000 G1 E2.00000 F2400.00000 G1 F1800 diff --git a/mods/gnode/gcode/cat.gcode b/mods/gnode/gcode/cat.gcode index 6d3f843..2fd2efb 100644 --- a/mods/gnode/gcode/cat.gcode +++ b/mods/gnode/gcode/cat.gcode @@ -15,7 +15,7 @@ ; single wall width = 0.56mm M104 S180 ; set temperature -M92 X78.7402 Y78.7402 E926 ;Set the right speed +M92 X78.7402 Y78.7402 E-1 G28 ;home all axes M106 ;turn fan on M109 S180 ; wait for temperature to be reached @@ -24,7 +24,7 @@ G21 ; set units to millimeters G92 E0 ; reset extrusion distance M82 ; use absolute distances for extrusion M106 S254 -G1 Z0.100 F5400.000 +G0 Z0.100 F5400.000 G1 X94.574 Y95.403 G1 G1 X94.746 Y95.307 F360.000 E0.00156 diff --git a/mods/gnode/gcode/cube.gcode b/mods/gnode/gcode/cube.gcode index 449114d..79276da 100644 --- a/mods/gnode/gcode/cube.gcode +++ b/mods/gnode/gcode/cube.gcode @@ -1,58 +1,3 @@ -; generated by Slic3r 1.3.0 on 2021-12-29 at 00:19:45 - -; external perimeters extrusion width = 0.55mm (4.37mm^3/s) -; perimeters extrusion width = 0.70mm (11.44mm^3/s) -; infill extrusion width = 0.62mm (13.45mm^3/s) -; solid infill extrusion width = 0.70mm (3.81mm^3/s) -; top infill extrusion width = 0.70mm (2.86mm^3/s) - -M107 -M104 S200 ; set temperature -G28 ; home all axes -G1 Z5 F5000 ; lift nozzle - -; Filament gcode - -M109 S200 ; set temperature and wait for it to be reached -G21 ; set units to millimeters -G90 ; use absolute coordinates -M82 ; use absolute distances for extrusion -G92 E0 -G1 Z0.350 F7800.000 -G1 E-2.00000 F2400.00000 -G92 E0 -G1 X84.915 Y85.753 F7800.000 -G1 E2.00000 F2400.00000 -G1 F1800 -G1 X86.668 Y84.274 E2.07096 -G1 X88.820 Y83.481 E2.14192 -G1 X90.000 Y83.375 E2.17858 -G1 X110.000 Y83.375 E2.79740 -G1 X112.259 Y83.772 E2.86836 -G1 X114.247 Y84.915 E2.93933 -G1 X115.726 Y86.668 E3.01029 -G1 X116.519 Y88.820 E3.08125 -G1 X116.625 Y90.000 E3.11790 -G1 X116.625 Y110.000 E3.73673 -G1 X116.228 Y112.259 E3.80769 -G1 X115.085 Y114.247 E3.87865 -G1 X113.332 Y115.726 E3.94962 -G1 X111.180 Y116.519 E4.02058 -G1 X110.000 Y116.625 E4.05723 -G1 X90.000 Y116.625 E4.67606 -G1 X87.741 Y116.228 E4.74702 -G1 X85.753 Y115.085 E4.81798 -G1 X84.274 Y113.332 E4.88894 -G1 X83.481 Y111.180 E4.95990 -G1 X83.375 Y110.000 E4.99656 -G1 X83.375 Y90.000 E5.61538 -G1 X83.772 Y87.741 E5.68634 -G1 X84.878 Y85.818 E5.75499 -G1 E3.75499 F2400.00000 -G92 E0 -G1 X108.400 Y108.400 F7800.000 -G1 E2.00000 F2400.00000 -G1 F1800 G1 X91.600 Y108.400 E2.51983 G1 X91.600 Y91.600 E3.03966 G1 X108.400 Y91.600 E3.55948 diff --git a/mods/gnode/gcode/files.json b/mods/gnode/gcode/files.json index 72e06e3..eb90f50 100644 --- a/mods/gnode/gcode/files.json +++ b/mods/gnode/gcode/files.json @@ -11,6 +11,10 @@ { "name":"face.gcode", "type":"cut" + }, + { + "name":"square.gcode", + "type":"cut" }, { "name":"cat.gcode", diff --git a/mods/gnode/gcode/square.gcode b/mods/gnode/gcode/square.gcode new file mode 100644 index 0000000..6032c70 --- /dev/null +++ b/mods/gnode/gcode/square.gcode @@ -0,0 +1,10 @@ +% +G00 X0 Y0 F70 +G01 Z-1 F50 +G01 X0 Y20 F50 +G01 X20 Y20 +G01 X20 Y0 +G01 X0 Y0 +G00 Z0 F70 +M30 +% diff --git a/mods/gnode/src/machine.lua b/mods/gnode/src/machine.lua index 17ab198..7bf9440 100644 --- a/mods/gnode/src/machine.lua +++ b/mods/gnode/src/machine.lua @@ -208,16 +208,23 @@ minetest.register_globalstep(function(dtime) if height_to_depth then machine_pos.y = machine_pos.y - depth_offset end - for height = machine_pos.y, 1, 1 do - minetest.remove_node(vector.new(machine_pos.x, height, machine_pos.z)) + local next_pos = machine_path[path_index + 1] + local x_dir = next_pos.x >= machine_pos.x and 1 or -1 + for x = machine_pos.x,next_pos.x,x_dir do + local z_dir = next_pos.z >= machine_pos.z and 1 or -1 + for z = machine_pos.z,next_pos.z,z_dir do + for height = machine_pos.y, 1, 1 do + minetest.remove_node(vector.new(x, height, z)) + end + end end elseif machine_motion[path_index] == 1 and machine_extrusion[path_index] >= 0 then local next_pos = machine_path[path_index + 1] if next_pos then if next_pos.y == machine_pos.y then - local x_dir = next_pos.x > machine_pos.x and 1 or -1 + local x_dir = next_pos.x >= machine_pos.x and 1 or -1 for x = machine_pos.x,next_pos.x,x_dir do - local z_dir = next_pos.z > machine_pos.z and 1 or -1 + local z_dir = next_pos.z >= machine_pos.z and 1 or -1 for z = machine_pos.z,next_pos.z,z_dir do minetest.set_node(vector.new(x,next_pos.y,z),{name="gnode:plastic"}) end