Skip to content

Commit

Permalink
Merge pull request #18 from benvanmierloo/master
Browse files Browse the repository at this point in the history
Adding Bambu/Orca slicer support
  • Loading branch information
markballew authored Feb 8, 2025
2 parents 99331c0 + 8347cb8 commit 5f8a221
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea/
/tmpfile
__pycache__/**
**/__pycache__/**
build/**
dist/**
5 changes: 3 additions & 2 deletions P2PP.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import p2pp.variables as v
import version as ver
import traceback
from packaging import version as semver_version
import p2pp.gui as gui

v.version = ver.Version
Expand All @@ -41,7 +42,7 @@
MASTER_VERSION = checkversion.get_version(checkversion.MASTER)

if MASTER_VERSION != "0.0":
if v.version < MASTER_VERSION:
if semver_version.parse(v.version) < semver_version.parse(MASTER_VERSION):
v.version = "Version Check: New release {} available (Current version {})".format(MASTER_VERSION, ver.Version)
color = "red"
else:
Expand All @@ -51,7 +52,7 @@
gui.create_logitem(v.version, color)
gui.app.sync()
gui.create_emptyline()
gui.create_logitem("Line to be used in PrusaSlicer [Print Settings][Output Options][Post Processing Script]",
gui.create_logitem("Line to be used in PrusaSlicer (or other PrusaSlicer based slicers) [Print Settings][Output Options][Post Processing Script]",
"blue")
gui.create_emptyline()
gui.app.sync()
Expand Down
2 changes: 1 addition & 1 deletion p2pp/mcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def find_alternative_tower():
for i in range(len(v.input_gcode)):
line = v.input_gcode[i]
if line.startswith(";"):
if line.startswith(";TYPE:Wipe tower"):
if line.startswith(";TYPE:Prime tower") or line.startswith(";TYPE:Wipe tower"):
state = 1
continue
if state == 1 and line.startswith(";TYPE"):
Expand Down
3 changes: 2 additions & 1 deletion p2pp/p2ppparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import p2pp.gui as gui
import p2pp.variables as v
from packaging import version as semver_version

# SECTION Helper functions

Expand Down Expand Up @@ -507,7 +508,7 @@ def check_config_parameters(keyword, value):
import version
latest = cv.get_version(cv.MASTER)
if latest:
if latest > version.Version:
if semver_version.parse(latest) > semver_version.parse(version.Version):
gui.create_logitem("New version of P2PP available ({})".format(latest), "red", False, "2.0")

# co be removed ?
Expand Down
23 changes: 12 additions & 11 deletions p2pp/psconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def parse_config_parameters():
except (IndexError, ValueError):
v.p3_bedtemp = [0, 0, 0, 0, 0, 0, 0, 0]

if gcode_line.startswith("; max_print_height"):
if gcode_line.startswith("; max_print_height") or gcode_line.startswith("; printable_height"):

parameter_start = gcode_line.find("=")
if parameter_start != -1:
Expand All @@ -227,7 +227,7 @@ def parse_config_parameters():

if gcode_line.startswith("; wipe_tower_x"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
if parameter_start != -1 and gcode_line.find(",") == -1:
v.wipe_tower_posx = float(gcode_line[parameter_start + 1:].strip())
continue

Expand All @@ -237,25 +237,25 @@ def parse_config_parameters():
v.skirtsize = float(gcode_line[parameter_start + 1:].strip())
continue

if gcode_line.startswith("; skirts"):
if gcode_line.startswith("; skirts") or gcode_line.startswith("; skirt_loops"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
v.skirts = float(gcode_line[parameter_start + 1:].strip())
continue

if gcode_line.startswith("; wipe_tower_width"):
if gcode_line.startswith("; wipe_tower_width") or gcode_line.startswith("; prime_tower_width"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
v.wipe_tower_width = float(gcode_line[parameter_start + 1:].strip())
continue

if gcode_line.startswith("; wipe_tower_y"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
if parameter_start != -1 and gcode_line.find(",") == -1:
v.wipe_tower_posy = float(gcode_line[parameter_start + 1:].strip())
continue

if gcode_line.startswith("; extrusion_width"):
if gcode_line.startswith("; extrusion_width") or gcode_line.startswith("; line_width"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
parm = gcode_line[parameter_start + 1:].strip()
Expand All @@ -276,7 +276,7 @@ def parse_config_parameters():
v.yy_offset = 2 + 8 * v.extrusion_width
continue

if gcode_line.startswith("; infill_speed"):
if gcode_line.startswith("; infill_speed") or gcode_line.startswith("; internal_solid_infill_speed"):
parameter_start = gcode_line.find("=")
if parameter_start != -1:
v.infill_speed = float(gcode_line[parameter_start + 1:].strip()) * 60
Expand Down Expand Up @@ -323,7 +323,7 @@ def parse_config_parameters():
v.nozzle_diameter = tmp
continue

if gcode_line.startswith("; start_filament_gcode "):
if gcode_line.startswith("; start_filament_gcode ") or gcode_line.startswith("; filament_start_gcode "):
parameter_start = gcode_line.find("=")
gcode_value = gcode_line[parameter_start + 2:].strip()
fields = split_csv_strings(gcode_value)
Expand All @@ -337,7 +337,8 @@ def parse_config_parameters():
v.used_filament_types = list(dict.fromkeys(v.used_filament_types))
continue

if gcode_line.startswith("; start_gcode "):
# start_gcode -> prusaslicer, machine_start_gcode -> bambu/orcaslicer
if gcode_line.startswith("; start_gcode ") or gcode_line.startswith("; machine_start_gcode "):
parameter_start = gcode_line.find("=")
gcode_value = gcode_line[parameter_start + 2:].strip()
lines = gcode_value.split("\\n")
Expand Down Expand Up @@ -392,7 +393,7 @@ def parse_config_parameters():

continue

if gcode_line.startswith("; retract_length = "):
if gcode_line.startswith("; retract_length = ") or gcode_line.startswith("; retract_length_toolchange"):
retract_error = False
parameter_start = gcode_line.find("=")
if parameter_start != -1:
Expand Down Expand Up @@ -429,7 +430,7 @@ def parse_config_parameters():
gui.log_warning("P2PP requires input file with RELATIVE extrusion")
continue

if gcode_line.startswith("; wiping_volumes_matrix"):
if gcode_line.startswith("; wiping_volumes_matrix") or gcode_line.startswith("; flush_volumes_matrix"):
wiping_info = []
_warning = False
parameter_start = gcode_line.find("=")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
APP = ['P2PP.py']
DATA_FILES = ['p2pp.ui', 'p2ppconf.ui', "SendError.ui", "p3browser.ui"]
OPTIONS = {
'argv_emulation': True,
'argv_emulation': False,
"iconfile": "icons/icon.icns",
"includes": [
'PyQt5.QtWidgets',
Expand Down

0 comments on commit 5f8a221

Please sign in to comment.