mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 10:45:54 +08:00
Fix: cura does not profile form G-code
CURA-4776
This commit is contained in:
parent
bcd6f6c12c
commit
d633a4c112
@ -202,7 +202,6 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
for plugin_id, meta_data in self._getIOPlugins("profile_reader"):
|
for plugin_id, meta_data in self._getIOPlugins("profile_reader"):
|
||||||
if meta_data["profile_reader"][0]["extension"] != extension:
|
if meta_data["profile_reader"][0]["extension"] != extension:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
profile_reader = plugin_registry.getPluginObject(plugin_id)
|
profile_reader = plugin_registry.getPluginObject(plugin_id)
|
||||||
try:
|
try:
|
||||||
profile_or_list = profile_reader.read(file_name) # Try to open the file with the profile reader.
|
profile_or_list = profile_reader.read(file_name) # Try to open the file with the profile reader.
|
||||||
@ -215,6 +214,20 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
name_seed = os.path.splitext(os.path.basename(file_name))[0]
|
name_seed = os.path.splitext(os.path.basename(file_name))[0]
|
||||||
new_name = self.uniqueName(name_seed)
|
new_name = self.uniqueName(name_seed)
|
||||||
|
|
||||||
|
# if the loaded profile comes from g-code then the instance cointaners should be
|
||||||
|
# defined differently
|
||||||
|
file_extension = os.path.splitext(file_name)[1][1:]
|
||||||
|
if file_extension == "gcode":
|
||||||
|
for item in profile_or_list:
|
||||||
|
item.metaData["name"] = new_name
|
||||||
|
|
||||||
|
if item.getMetaDataEntry("extruder") is None:
|
||||||
|
temp_defintion = item.getMetaDataEntry("definition")
|
||||||
|
item.metaData["id"] = temp_defintion + "_" + new_name
|
||||||
|
elif item.getMetaDataEntry("extruder") is not None:
|
||||||
|
temp_extruder = item.getMetaDataEntry("extruder")
|
||||||
|
item.metaData["id"] = temp_extruder + "_" + new_name
|
||||||
|
|
||||||
# Ensure it is always a list of profiles
|
# Ensure it is always a list of profiles
|
||||||
if type(profile_or_list) is not list:
|
if type(profile_or_list) is not list:
|
||||||
profile_or_list = [profile_or_list]
|
profile_or_list = [profile_or_list]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user