Merge branch 'main' into jalapenopuzzle/cam_snapmaker_machine_types

This commit is contained in:
jalapenopuzzle
2025-04-18 22:05:47 +10:00
committed by GitHub
216 changed files with 15880 additions and 3504 deletions

View File

@@ -72,6 +72,7 @@
#include <App/Application.h>
#include <App/Document.h>
#include <Base/Exception.h>
#include <Base/Tools.h>
#include <Mod/Part/App/CrossSection.h>
#include <Mod/Part/App/FaceMakerBullseye.h>
#include <Mod/Part/App/FuzzyHelper.h>
@@ -2632,7 +2633,7 @@ TopoDS_Shape Area::makePocket(int index, PARAM_ARGS(PARAM_FARG, AREA_PARAMS_POCK
for (int j = 0; j < steps; ++j, offset += stepover) {
Point p1(-r, offset), p2(r, offset);
if (a > Precision::Confusion()) {
double r = a * std::numbers::pi / 180.0;
double r = Base::toRadians(a);
p1.Rotate(r);
p2.Rotate(r);
}

View File

@@ -25,6 +25,7 @@
#include <App/Application.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>
#include "PathSegmentWalker.h"
@@ -187,7 +188,7 @@ void PathSegmentWalker::walk(PathSegmentVisitor& cb, const Base::Vector3d& start
if (nrot != lrot) {
double amax = std::max(fmod(fabs(a - A), 360),
std::max(fmod(fabs(b - B), 360), fmod(fabs(c - C), 360)));
double angle = amax / 180 * std::numbers::pi;
double angle = Base::toRadians(amax);
int segments = std::max(ARC_MIN_SEGMENTS, 3.0 / (deviation / angle));
double da = (a - A) / segments;
@@ -329,7 +330,7 @@ void PathSegmentWalker::walk(PathSegmentVisitor& cb, const Base::Vector3d& start
if (nrot != lrot) {
double amax = std::max(fmod(fabs(a - A), 360),
std::max(fmod(fabs(b - B), 360), fmod(fabs(c - C), 360)));
double angle = amax / 180 * std::numbers::pi;
double angle = Base::toRadians(amax);
int segments = std::max(ARC_MIN_SEGMENTS, 3.0 / (deviation / angle));
double da = (a - A) / segments;

View File

@@ -25,6 +25,7 @@
#endif
#include <Base/Vector3D.h>
#include <Base/Tools.h>
#include "Voronoi.h"
@@ -291,7 +292,7 @@ bool Voronoi::diagram_type::segmentsAreConnected(int i, int j) const
void Voronoi::colorColinear(Voronoi::color_type color, double degree)
{
using std::numbers::pi;
double rad = degree * pi / 180;
double rad = Base::toRadians(degree);
Voronoi::diagram_type::angle_map_t angle;
int psize = vd->points.size();

View File

@@ -146,6 +146,8 @@ class ObjectArray:
self.setEditorModes(obj)
obj.Proxy = self
self.FirstRun = True
def dumps(self):
return None
@@ -205,19 +207,19 @@ class ObjectArray:
self.setEditorModes(obj)
def execute(self, obj):
if FreeCAD.GuiUp:
if FreeCAD.GuiUp and self.FirstRun:
self.FirstRun = False
QtGui.QMessageBox.warning(
None,
QT_TRANSLATE_NOOP("CAM_ArrayOp", "Operation is depreciated"),
QT_TRANSLATE_NOOP("CAM_ArrayOp", "Operation is deprecated"),
QT_TRANSLATE_NOOP(
"CAM_ArrayOp",
(
"CAM -> Path Modification -> Array operation is depreciated "
"CAM -> Path Modification -> Array operation is deprecated "
"and will be removed in future FreeCAD versions.\n\n"
"Please use CAM -> Path Dressup -> Array instead.\n\n"
"DO NOT USE CURRENT ARRAY OPERATION WHEN MACHINING WITH COOLANT!\n"
"Due to a bug - collant will not be enabled for array paths."
"Due to a bug - coolant will not be enabled for array paths."
),
),
)

View File

@@ -68,11 +68,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="%\\nG17 G21 G40 G49 G80 G90\\nM08"',
help='set commands to be issued before the first command, default="%\\nG17 G21 G40 G49 G80 G90\\nM08\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05 M09\\nG17 G90 G80 G40\\nM30"',
help='set commands to be issued after the last command, default="M05 M09\\nG17 G90 G80 G40\\nM30\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -202,7 +202,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -247,8 +247,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -193,8 +193,8 @@ def export(objectslist, filename, argstring):
):
gcode += ";T{}={}\n".format(item.ToolNumber, item.Name)
gcode += linenumber() + ";begin preamble\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -221,8 +221,8 @@ def export(objectslist, filename, argstring):
gcode += linenumber() + line
for line in SAFETYBLOCK.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -59,11 +59,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40"',
help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30"',
help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G70)"
@@ -225,8 +225,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(T)" + "BEGIN PREAMBLE$\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
for obj in objectslist:
@@ -289,8 +289,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(T)" + "BEGIN POSTAMBLE$\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# Following is required by Dynapath Controls to signify "EOF" when loading in to control
# from external media. The control strips the "E" off as part of the load process.
gcode += "E\n"

View File

@@ -86,11 +86,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40"',
help='set commands to be issued before the first command, default="G17\\nG90\\nG80\\nG40\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30"',
help='set commands to be issued after the last command, default="M09\\nM05\\nG80\\nG40\\nG17\\nG90\\nM30\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -231,8 +231,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
for obj in objectslist:
@@ -255,8 +255,8 @@ def export(objectslist, filename, argstring):
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
print("show editor: {}".format(SHOW_EDITOR))
if FreeCAD.GuiUp and SHOW_EDITOR:

View File

@@ -114,11 +114,11 @@ parser.add_argument(
)
parser.add_argument(
"--preamble",
help="set commands to be issued before the first command",
help='set commands to be issued before the first command, default=""',
)
parser.add_argument(
"--postamble",
help="set commands to be issued after the last command",
help='set commands to be issued after the last command, default="M5\\n"',
)
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument("--inches", action="store_true", help="convert output for US imperial mode")
@@ -235,8 +235,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# verify if PREAMBLE have changed UNITS
if "G21" in PREAMBLE:
UNITS = "G21"
@@ -310,8 +310,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# show the gCode result dialog
if FreeCAD.GuiUp and SHOW_EDITOR:

View File

@@ -160,8 +160,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
for obj in objectslist:
@@ -183,8 +183,8 @@ def export(objectslist, filename, argstring):
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -65,11 +65,11 @@ parser.add_argument(
)
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble", help='set commands to be issued before the first command, default="G90"'
"--preamble", help='set commands to be issued before the first command, default="G90\\n"'
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M8\\nG90 G40\\nM2"',
help='set commands to be issued after the last command, default="M8\\nG90 G40\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -207,7 +207,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -251,8 +251,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -60,11 +60,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"',
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM6 T0\\nM2"',
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM6 T0\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -220,7 +220,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(BEGIN PREAMBLE)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -276,8 +276,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(BEGIN POSTAMBLE)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += "%\n"
if FreeCAD.GuiUp and SHOW_EDITOR:

View File

@@ -123,11 +123,11 @@ parser.add_argument(
)
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17 G90"',
help='set commands to be issued before the first command, default="G17 G90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M5\\nG17 G90\\nM2"',
help='set commands to be issued after the last command, default="M5\\nG17 G90\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -283,8 +283,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# verify if PREAMBLE have changed MOTION_MODE or UNITS
if "G90" in PREAMBLE:
MOTION_MODE = "G90"
@@ -370,8 +370,8 @@ def export(objectslist, filename, argstring):
gcode += linenumber() + "(Block-enable: 1)\n"
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# show the gCode result dialog
if FreeCAD.GuiUp and SHOW_EDITOR:

View File

@@ -56,11 +56,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="M05 S0\\nG90"',
help='set commands to be issued before the first command, default="M05 S0\\nG90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05 S0\\nM2"',
help='set commands to be issued after the last command, default="M05 S0\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -198,7 +198,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -221,8 +221,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -56,11 +56,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"',
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"',
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -196,7 +196,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -252,8 +252,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
final = gcode

View File

@@ -56,11 +56,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"',
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"',
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -196,7 +196,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
@@ -255,8 +255,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -156,7 +156,7 @@ parser.add_argument(
"--preamble", help='set commands to be issued before the first command, default=""'
)
parser.add_argument(
"--postamble", help='set commands to be issued after the last command, default="M5"'
"--postamble", help='set commands to be issued after the last command, default="M5\\n"'
)
parser.add_argument("--tool-change", action="store_true", help="Insert M6 for all tool changes")
parser.add_argument(
@@ -334,8 +334,8 @@ def export(objectslist, filename, argstring):
# Write the preamble:
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# Write these settings AFTER the preamble,
# to prevent the preamble from changing these:
@@ -409,8 +409,8 @@ def export(objectslist, filename, argstring):
gcode += linenumber() + "(Block-enable: 1)\n"
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# Optionally add a final XYZ position to the end of the gcode:
if RETURN_TO:

View File

@@ -154,7 +154,7 @@ parser.add_argument(
"--preamble", help='set commands to be issued before the first command, default=""'
)
parser.add_argument(
"--postamble", help='set commands to be issued after the last command, default="M5"'
"--postamble", help='set commands to be issued after the last command, default="M5\\n"'
)
parser.add_argument("--tool-change", action="store_true", help="Insert M6 for all tool changes")
parser.add_argument(
@@ -332,8 +332,8 @@ def export(objectslist, filename, argstring):
# Write the preamble:
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# Write these settings AFTER the preamble,
# to prevent the preamble from changing these:
@@ -407,8 +407,8 @@ def export(objectslist, filename, argstring):
gcode += linenumber() + "(Block-enable: 1)\n"
if OUTPUT_COMMENTS:
gcode += linenumber() + "(Begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
# Optionally add a final XYZ position to the end of the gcode:
if RETURN_TO:

View File

@@ -68,11 +68,11 @@ parser.add_argument(
parser.add_argument("--precision", default="4", help="number of digits of precision, default=4")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17\\nG90"',
help='set commands to be issued before the first command, default="G17\\nG90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\\nG17 G90\\nM2"',
help='set commands to be issued after the last command, default="M05\\nG17 G90\\nM2\\n"',
)
parser.add_argument("--IP_ADDR", help="IP Address for machine target machine")
parser.add_argument(
@@ -228,8 +228,8 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + "(begin preamble)\n"
for line in PREAMBLE.splitlines(True):
gcode += linenumber() + line
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
gcode += linenumber() + UNITS + "\n"
for obj in objectslist:
@@ -252,8 +252,8 @@ def export(objectslist, filename, argstring):
if OUTPUT_COMMENTS:
gcode += "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if SHOW_EDITOR:
dia = PostUtils.GCodeEditorDialog()

View File

@@ -256,11 +256,11 @@ parser.add_argument(
parser.add_argument("--precision", default="3", help="number of digits of precision, default=3")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17\nG90\nG54"',
help='set commands to be issued before the first command, default="G17\\nG54\\G40\\nG49\\nG90\\nG80\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\nM30"',
help='set commands to be issued after the last command, default="M05\\nG17\\nG54\\nG0\\nG90\\nG80\\nM30\\n"',
)
parser.add_argument("--inches", action="store_true", help="lengths in [in], G20")
parser.add_argument("--metric", action="store_true", help="lengths in [mm], G21")
@@ -443,7 +443,7 @@ def export(objectslist, filename, argstring):
# if isinstance(obj.Proxy, Path.Tool.Controller.ToolController):
# gcode += append("(T{}={})\n".format(obj.ToolNumber, item.Name))
# error: global name 'PathScripts' is not defined
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += append(line + "\n")
if OUTPUT_COMMENTS:
gcode += append("(preamble: done)\n")

View File

@@ -68,11 +68,11 @@ parser.add_argument("--precision", default="3", help="number of digits of precis
parser.add_argument("--fixed-length", default="0", help="use fixed length coordinates, default=0")
parser.add_argument(
"--preamble",
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90"',
help='set commands to be issued before the first command, default="G17 G54 G40 G49 G80 G90\\n"',
)
parser.add_argument(
"--postamble",
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2"',
help='set commands to be issued after the last command, default="M05\\nG17 G54 G90 G80 G40\\nM2\\n"',
)
parser.add_argument(
"--inches", action="store_true", help="Convert output for US imperial mode (G20)"
@@ -271,7 +271,7 @@ def export(objectslist, filename, argstring):
# Write the preamble
if OUTPUT_COMMENTS:
gcode += linenumber() + COMMENT_CHAR + "(begin preamble)\n"
for line in PREAMBLE.splitlines(False):
for line in PREAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if not OMIT_UNITS:
gcode += linenumber() + UNITS + ENDLINE + "\n"
@@ -353,8 +353,8 @@ def export(objectslist, filename, argstring):
# do the post_amble
if OUTPUT_COMMENTS:
gcode += linenumber() + COMMENT_CHAR + "(begin postamble)\n"
for line in POSTAMBLE.splitlines(True):
gcode += linenumber() + line
for line in POSTAMBLE.splitlines():
gcode += linenumber() + line + "\n"
if FreeCAD.GuiUp and SHOW_EDITOR:
final = gcode