mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06: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
2 changed files with 30 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
# Copyright (c) 2021-2022 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
import os
|
||||
|
||||
import numpy
|
||||
from string import Formatter
|
||||
|
@ -301,6 +302,22 @@ class StartSliceJob(Job):
|
|||
for extruder_stack in global_stack.extruderList:
|
||||
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:
|
||||
group_message = self._slice_message.addRepeatedMessage("object_lists")
|
||||
parent = group[0].getParent()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue