mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Implement API call to send material profile
It seems to work now. I don't know if the material actually arrives but from this end it seems to send it at least. Contributes to issue CURA-5034.
This commit is contained in:
parent
3b510af8f5
commit
63f5c8346a
1 changed files with 9 additions and 2 deletions
|
@ -544,7 +544,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
# if that has any performance impact. If not, we can try sending ALL
|
||||
# profiles. If it has, we may need to limit it to the profiles that are
|
||||
# active in the current machine.
|
||||
def sendMaterialProfiles(self):
|
||||
def sendMaterialProfiles(self) -> None:
|
||||
container_registry = ContainerRegistry.getInstance()
|
||||
|
||||
base_files = set()
|
||||
|
@ -556,7 +556,14 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
|
||||
for file in base_files:
|
||||
Logger.log("d", "Syncing material profile with printer: {file}".format(file = file))
|
||||
#TODO Call API to send profile.
|
||||
|
||||
parts = []
|
||||
material = container_registry.findContainers(id = file)[0]
|
||||
serialized_material = material.serialize().encode("utf-8")
|
||||
parts.append(self._createFormPart("name=\"file\"; filename=\"{file_name}.xml.fdm_material\"".format(file_name = file), serialized_material))
|
||||
parts.append(self._createFormPart("name=\"filename\"", (file + ".xml.fdm_material").encode("utf-8"), "text/plain"))
|
||||
|
||||
self.postFormWithParts(target = "/materials", parts = parts)
|
||||
|
||||
def loadJsonFromReply(reply):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue