Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"preferred_quality_type": "normal",
"preferred_material": "generic_pla",
"exclude_materials": [],
"visible": true
"visible": true,
"platform": "snapmaker-artisan-bed.stl"
},
"overrides": {
"machine_name": {
Expand Down
Binary file not shown.
13 changes: 13 additions & 0 deletions settings_plugin/SnapmakerSettingsPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ def __installMachineSettings(self, machine_dirname: str) -> None:
plugin_machine_dir = os.path.join(machine_settings_dir, "definitions")
plugin_extruder_dir = os.path.join(machine_settings_dir, "extruders")
plugin_quality_dir = os.path.join(machine_settings_dir, "quality")
plugin_meshes_dir = os.path.join(machine_settings_dir, "meshes")

definition_dir = Resources.getStoragePath(Resources.DefinitionContainers)
extruder_dir = Resources.getStoragePath(CuraApplication.ResourceTypes.ExtruderStack)
quality_dir = Resources.getStoragePath(CuraApplication.ResourceTypes.QualityInstanceContainer)
# For some reason meshes does not have a __types_storage, so we use the resources parent directory
meshes_dir = os.path.join(os.path.dirname(definition_dir), "meshes")

# copy machine definitions
if os.path.exists(plugin_machine_dir):
Expand All @@ -92,6 +95,16 @@ def __installMachineSettings(self, machine_dirname: str) -> None:
if os.path.isdir(file_path): # machine quality folder
shutil.copytree(file_path, os.path.join(quality_dir, filename), dirs_exist_ok=True)

# copy meshes
if os.path.exists(plugin_meshes_dir):
# create meshes directory if not exist as we're not using the getStoragePath method
if not os.path.exists(meshes_dir):
os.makedirs(meshes_dir)
for filename in os.listdir(plugin_meshes_dir):
if filename.endswith(".stl"):
file_path = os.path.join(plugin_meshes_dir, filename)
shutil.copy2(file_path, meshes_dir)

def __updateMaterials(self) -> None:
plugin_material_dir = os.path.join(self._plugin_path, "resources", "materials")

Expand Down