diff --git a/src/Mod/Path/PathScripts/post/centroid_post.py b/src/Mod/Path/PathScripts/post/centroid_post.py index 4dae5462f0..1c2640c250 100644 --- a/src/Mod/Path/PathScripts/post/centroid_post.py +++ b/src/Mod/Path/PathScripts/post/centroid_post.py @@ -51,7 +51,6 @@ Arguments for centroid: --axis-precision=4 ... number of digits of precision for axis moves. Default=4 --inches ... Convert output for US imperial mode (G20) """ -now = datetime.datetime.now() # These globals set common customization preferences OUTPUT_COMMENTS = True @@ -79,13 +78,19 @@ SPINDLE_DECIMALS = 0 COMMENT = ";" -HEADER = """ -;Exported by FreeCAD +# gCode header with information about CAD-software, post-processor +# and date/time +if FreeCAD.ActiveDocument: + cam_file = FreeCAD.ActiveDocument.FileName +else: + cam_file = "" + +HEADER = """;Exported by FreeCAD ;Post Processor: {} ;CAM file: {} ;Output Time: {} """.format( - __name__, FreeCAD.ActiveDocument.FileName, str(now) + __name__, cam_file, str(datetime.datetime.now()) ) # Preamble text will appear at the beginning of the GCODE output file. diff --git a/src/Mod/Path/PathScripts/post/nccad_post.py b/src/Mod/Path/PathScripts/post/nccad_post.py index f931e58db0..ab9a03cdf1 100644 --- a/src/Mod/Path/PathScripts/post/nccad_post.py +++ b/src/Mod/Path/PathScripts/post/nccad_post.py @@ -21,7 +21,7 @@ # * * # ****************************************************************************/ """Postprocessor to output real GCode for Max Computer GmbH nccad9.""" -import FreeCAD as App +import FreeCAD from PathScripts import PostUtils import datetime @@ -43,10 +43,8 @@ import nccad_post nccad_post.export([object], "/path/to/file.knc", "") """ - MACHINE_NAME = """Max Computer GmbH nccad9 MCS/KOSY""" - # gCode for changing tools # M01 ; Displays and waits for user interaction TOOL_CHANGE = """G77 ; Move to release position @@ -63,12 +61,17 @@ M10 O6.0 ; Stop spindle""" # gCode header with information about CAD-software, post-processor # and date/time +if FreeCAD.ActiveDocument: + cam_file = FreeCAD.ActiveDocument.FileName +else: + cam_file = "" + HEADER = """;Exported by FreeCAD ;Post Processor: {} ;CAM file: {} ;Output Time: {} """.format( - __name__, App.ActiveDocument.FileName, str(datetime.datetime.now()) + __name__, FreeCAD.ActiveDocument.FileName, str(datetime.datetime.now()) ) @@ -116,7 +119,7 @@ def export(objectslist, filename, argstring): gcode += POSTAMBLE + "\n" # Open editor window - if App.GuiUp: + if FreeCAD.GuiUp: dia = PostUtils.GCodeEditorDialog() dia.editor.setText(gcode) result = dia.exec_()