Skip to content

Commit

Permalink
convert 4 tab space to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ansonl committed Feb 10, 2025
1 parent 82888b7 commit fabc02a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[python]": {
"editor.formatOnType": true,
"editor.defaultFormatter": "ms-python.autopep8",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.detectIndentation": true,
}
}
15 changes: 10 additions & 5 deletions src/mfm_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
from mfm.line_ending import *
from mfm.map_post_process import *


class LineEndingCommandLineParameter(enum.Enum):
AUTODETECT = "AUTO"
WINDOWS = "WINDOWS"
UNIX = "UNIX"


TEMP_OUTPUT_GCODE_FILE = 'mfm-output.gcode'

# python ./src/mfm_cmd.py ./sample_models/dual_color_dice/tests/dice_multiple_bambu_prime.gcode -o dice-export.gcode -c ./sample_models/dual_color_dice/config-dice-test.json -t ./minimal_toolchanges/bambu-p1-series.gcode
Expand All @@ -32,20 +34,23 @@ class LineEndingCommandLineParameter(enum.Enum):
# Slicer Post-processing Scripts (windows) (put project folder in user home folder)
# "C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\python3.11.exe" "C:\Users\USERNAME\topo-map-post-processing\src\mfm_cmd.py" -c "C:\Users\USERNAME\topo-map-post-processing\sample_models\dual_color_dice\config-dice-test.json" -t "C:\Users\USERNAME\topo-map-post-processing\minimal_toolchanges\bambu-p1-series.gcode";


def setupLogging():
redirectSTDERR = open(os.path.join(
os.path.expanduser('~'), 'mfm-script-stderr.log'), "w")
sys.stderr.write = redirectSTDERR.write

'''
redirectSTDOUT = open(os.path.join(os.path.expanduser('~'), 'mfm-script-stdout.log'), "w")
sys.stdout.write = redirectSTDOUT.write
'''
redirectSTDOUT = open(os.path.join(os.path.expanduser('~'), 'mfm-script-stdout.log'), "w")
sys.stdout.write = redirectSTDOUT.write
'''

log_file_path = os.path.join(os.path.expanduser('~'), 'mfm-script.log')
try:
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', filename=log_file_path, filemode='w')
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
filename=log_file_path,
filemode='w')
console = logging.StreamHandler(stream=sys.stdout)
console.setLevel(logging.DEBUG)
formatter = logging.Formatter(
Expand Down Expand Up @@ -91,7 +96,7 @@ def worker():
parser.add_argument('-t', '--toolchange', required=True,
help='Toolchange G-code file')
parser.add_argument('-le', choices=[LineEndingCommandLineParameter.AUTODETECT.value, LineEndingCommandLineParameter.WINDOWS.value,
LineEndingCommandLineParameter.UNIX.value], default=LineEndingCommandLineParameter.AUTODETECT, help='Line ending style')
LineEndingCommandLineParameter.UNIX.value], default=LineEndingCommandLineParameter.AUTODETECT, help='Line ending style')
parser.add_argument('--disable', type=int,
choices=[0, 1], default=0, help='Disable post processing')

Expand Down

0 comments on commit fabc02a

Please sign in to comment.