mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 22:29:41 +08:00
Allow Cura front-end to set plugins (port & address)
This can currently be done by setting the environment variables: - SIMPLIFY_ENABLE: default disabled, setting this to any value will enable the plugin - SIMPLIFY_ADDRESS: defaults to localhost - SIMPLIFY_PORT: defaults to 33700 - POSTPROCESS_ENABLE: default disabled, setting this to any value will enable the plugin - POSTPROCESS_ADDRESS: defaults to localhost - POSTPROCESS_PORT: defaults to 33701 Hacky for now Contributes to CURA-10475
This commit is contained in:
parent
e3123e80ca
commit
cccfebcc8e
@ -8,12 +8,25 @@ message ObjectList
|
|||||||
repeated Setting settings = 2; // meshgroup settings (for one-at-a-time printing)
|
repeated Setting settings = 2; // meshgroup settings (for one-at-a-time printing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum SlotID {
|
||||||
|
SIMPLIFY = 0;
|
||||||
|
POSTPROCESS = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EnginePlugin
|
||||||
|
{
|
||||||
|
SlotID id = 1;
|
||||||
|
optional string address = 2;
|
||||||
|
optional uint32 port = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message Slice
|
message Slice
|
||||||
{
|
{
|
||||||
repeated ObjectList object_lists = 1; // The meshgroups to be printed one after another
|
repeated ObjectList object_lists = 1; // The meshgroups to be printed one after another
|
||||||
SettingList global_settings = 2; // The global settings used for the whole print job
|
SettingList global_settings = 2; // The global settings used for the whole print job
|
||||||
repeated Extruder extruders = 3; // The settings sent to each extruder object
|
repeated Extruder extruders = 3; // The settings sent to each extruder object
|
||||||
repeated SettingExtruder limit_to_extruder = 4; // From which stack the setting would inherit if not defined per object
|
repeated SettingExtruder limit_to_extruder = 4; // From which stack the setting would inherit if not defined per object
|
||||||
|
repeated EnginePlugin engine_plugins = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Extruder
|
message Extruder
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Copyright (c) 2021-2022 Ultimaker B.V.
|
# Copyright (c) 2021-2022 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
import os
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
from string import Formatter
|
from string import Formatter
|
||||||
@ -301,6 +302,22 @@ class StartSliceJob(Job):
|
|||||||
for extruder_stack in global_stack.extruderList:
|
for extruder_stack in global_stack.extruderList:
|
||||||
self._buildExtruderMessage(extruder_stack)
|
self._buildExtruderMessage(extruder_stack)
|
||||||
|
|
||||||
|
# EnginePlugins
|
||||||
|
# TODO: don't hardcode them
|
||||||
|
# Ports: are chosen based on https://stackoverflow.com/questions/10476987/best-tcp-port-number-range-for-internal-applications
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
0: {"address": os.environ.get("SIMPLIFY_ADDRESS", "localhost"), "port": os.environ.get("SIMPLIFY_PORT", 33700)} if os.environ.get("SIMPLIFY_ENABLE") is not None else None,
|
||||||
|
1: {"address": os.environ.get("POSTPROCESS_ADDRESS", "localhost"), "port": os.environ.get("POSTPROCESS_PORT", 33701)} if os.environ.get("POSTPROCESS_ENABLE") is not None else None,
|
||||||
|
}
|
||||||
|
|
||||||
|
for plugin, connection in plugins.items():
|
||||||
|
plugin_message = self._slice_message.addRepeatedMessage("engine_plugins")
|
||||||
|
plugin_message.id = plugin
|
||||||
|
if connection:
|
||||||
|
plugin_message.address = connection["address"]
|
||||||
|
plugin_message.port = connection["port"]
|
||||||
|
|
||||||
for group in filtered_object_groups:
|
for group in filtered_object_groups:
|
||||||
group_message = self._slice_message.addRepeatedMessage("object_lists")
|
group_message = self._slice_message.addRepeatedMessage("object_lists")
|
||||||
parent = group[0].getParent()
|
parent = group[0].getParent()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user