mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-01 02:22:00 +08:00
Merge branch 'cura-1811' of github.com:Ultimaker/Cura
This commit is contained in:
commit
2e058abde9
@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
from UM.Scene.SceneNode import SceneNode
|
from UM.Scene.SceneNode import SceneNode
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
@ -19,6 +20,10 @@ catalog = i18nCatalog("cura")
|
|||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
|
||||||
|
# Setting for clearance around the prime
|
||||||
|
PRIME_CLEARANCE = 10
|
||||||
|
|
||||||
|
|
||||||
## Build volume is a special kind of node that is responsible for rendering the printable area & disallowed areas.
|
## Build volume is a special kind of node that is responsible for rendering the printable area & disallowed areas.
|
||||||
class BuildVolume(SceneNode):
|
class BuildVolume(SceneNode):
|
||||||
VolumeOutlineColor = Color(12, 169, 227, 255)
|
VolumeOutlineColor = Color(12, 169, 227, 255)
|
||||||
@ -215,6 +220,29 @@ class BuildVolume(SceneNode):
|
|||||||
disallowed_areas = self._active_container_stack.getProperty("machine_disallowed_areas", "value")
|
disallowed_areas = self._active_container_stack.getProperty("machine_disallowed_areas", "value")
|
||||||
areas = []
|
areas = []
|
||||||
|
|
||||||
|
# Add extruder prime locations as disallowed areas.
|
||||||
|
# Probably needs some rework after coordinate system change.
|
||||||
|
machine_definition = self._active_container_stack.getBottom()
|
||||||
|
current_machine_id = machine_definition.getId()
|
||||||
|
extruder_manager = ExtruderManager.getInstance()
|
||||||
|
extruders = extruder_manager.getMachineExtruders(current_machine_id)
|
||||||
|
machine_width = machine_definition.getProperty("machine_width", "value")
|
||||||
|
machine_depth = machine_definition.getProperty("machine_depth", "value")
|
||||||
|
for single_extruder in extruders:
|
||||||
|
extruder_prime_pos_x = single_extruder.getProperty("extruder_prime_pos_x", "value")
|
||||||
|
extruder_prime_pos_y = single_extruder.getProperty("extruder_prime_pos_y", "value")
|
||||||
|
# TODO: calculate everything in CuraEngine/Firmware/lower left as origin coordinates.
|
||||||
|
# Here we transform the extruder prime pos (lower left as origin) to Cura coordinates
|
||||||
|
# (center as origin, y from back to front)
|
||||||
|
prime_x = extruder_prime_pos_x - machine_width / 2
|
||||||
|
prime_y = machine_depth / 2 - extruder_prime_pos_y
|
||||||
|
disallowed_areas.append([
|
||||||
|
[prime_x - PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE],
|
||||||
|
[prime_x + PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE],
|
||||||
|
[prime_x + PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE],
|
||||||
|
[prime_x - PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE],
|
||||||
|
])
|
||||||
|
|
||||||
skirt_size = self._getSkirtSize(self._active_container_stack)
|
skirt_size = self._getSkirtSize(self._active_container_stack)
|
||||||
|
|
||||||
if disallowed_areas:
|
if disallowed_areas:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user