mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-17 04:05:54 +08:00
Merge branch 'Ultimaker:main' into main
This commit is contained in:
commit
863f854e6e
@ -1,5 +1,6 @@
|
|||||||
# Copyright (c) 2021 Ultimaker B.V.
|
# Copyright (c) 2021 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 math
|
||||||
|
|
||||||
from UM.Math.Color import Color
|
from UM.Math.Color import Color
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
@ -148,24 +149,23 @@ class SimulationPass(RenderPass):
|
|||||||
if layer == self._layer_view._current_layer_num:
|
if layer == self._layer_view._current_layer_num:
|
||||||
# We look for the position of the head, searching the point of the current path
|
# We look for the position of the head, searching the point of the current path
|
||||||
index = int(self._layer_view.getCurrentPath())
|
index = int(self._layer_view.getCurrentPath())
|
||||||
offset = 0
|
|
||||||
for polygon in layer_data.getLayer(layer).polygons:
|
for polygon in layer_data.getLayer(layer).polygons:
|
||||||
# The size indicates all values in the two-dimension array, and the second dimension is
|
# The size indicates all values in the two-dimension array, and the second dimension is
|
||||||
# always size 3 because we have 3D points.
|
# always size 3 because we have 3D points.
|
||||||
if index >= polygon.data.size // 3 - offset:
|
if index >= polygon.data.size // 3 :
|
||||||
index -= polygon.data.size // 3 - offset
|
index -= polygon.data.size // 3
|
||||||
offset = 1 # This is to avoid the first point when there is more than one polygon, since has the same value as the last point in the previous polygon
|
|
||||||
continue
|
continue
|
||||||
# The head position is calculated and translated
|
# The head position is calculated and translated
|
||||||
ratio = self._layer_view.getCurrentPath() - index
|
ratio = self._layer_view.getCurrentPath() - math.floor(self._layer_view.getCurrentPath())
|
||||||
pos_a = Vector(polygon.data[index + offset][0], polygon.data[index + offset][1],
|
pos_a = Vector(polygon.data[index][0], polygon.data[index][1],
|
||||||
polygon.data[index + offset][2])
|
polygon.data[index][2])
|
||||||
if ratio <= 0.0001 or index + offset < len(polygon.data):
|
if ratio <= 0.0001 or index + 1 == len(polygon.data):
|
||||||
|
# in case there multiple polygons and polygon changes, the first point has the same value as the last point in the previous polygon
|
||||||
head_position = pos_a + node.getWorldPosition()
|
head_position = pos_a + node.getWorldPosition()
|
||||||
else:
|
else:
|
||||||
pos_b = Vector(polygon.data[index + offset + 1][0],
|
pos_b = Vector(polygon.data[index + 1][0],
|
||||||
polygon.data[index + offset + 1][1],
|
polygon.data[index + 1][1],
|
||||||
polygon.data[index + offset + 1][2])
|
polygon.data[index + 1][2])
|
||||||
vec = pos_a * (1.0 - ratio) + pos_b * ratio
|
vec = pos_a * (1.0 - ratio) + pos_b * ratio
|
||||||
head_position = vec + node.getWorldPosition()
|
head_position = vec + node.getWorldPosition()
|
||||||
break
|
break
|
||||||
|
@ -57,7 +57,7 @@ class SimulationView(CuraView):
|
|||||||
LAYER_VIEW_TYPE_LINE_TYPE = 1
|
LAYER_VIEW_TYPE_LINE_TYPE = 1
|
||||||
LAYER_VIEW_TYPE_FEEDRATE = 2
|
LAYER_VIEW_TYPE_FEEDRATE = 2
|
||||||
LAYER_VIEW_TYPE_THICKNESS = 3
|
LAYER_VIEW_TYPE_THICKNESS = 3
|
||||||
SIMULATION_FACTOR = 3
|
SIMULATION_FACTOR = 2
|
||||||
|
|
||||||
_no_layers_warning_preference = "view/no_layers_warning"
|
_no_layers_warning_preference = "view/no_layers_warning"
|
||||||
|
|
||||||
@ -211,7 +211,8 @@ class SimulationView(CuraView):
|
|||||||
left_value = cumulative_line_duration[i - 1] if i > 0 else 0.0
|
left_value = cumulative_line_duration[i - 1] if i > 0 else 0.0
|
||||||
right_value = cumulative_line_duration[i]
|
right_value = cumulative_line_duration[i]
|
||||||
|
|
||||||
assert (left_value <= self._current_time <= right_value)
|
if not (left_value <= self._current_time <= right_value):
|
||||||
|
Logger.debug(f"At index {i}: left value {left_value} right value {right_value} and current time is {self._current_time}")
|
||||||
|
|
||||||
fractional_value = (self._current_time - left_value) / (right_value - left_value)
|
fractional_value = (self._current_time - left_value) / (right_value - left_value)
|
||||||
|
|
||||||
@ -255,6 +256,8 @@ class SimulationView(CuraView):
|
|||||||
for line_duration in list((polyline.lineLengths / polyline.lineFeedrates)[0]):
|
for line_duration in list((polyline.lineLengths / polyline.lineFeedrates)[0]):
|
||||||
total_duration += line_duration / SimulationView.SIMULATION_FACTOR
|
total_duration += line_duration / SimulationView.SIMULATION_FACTOR
|
||||||
self._cumulative_line_duration[self.getCurrentLayer()].append(total_duration)
|
self._cumulative_line_duration[self.getCurrentLayer()].append(total_duration)
|
||||||
|
# for tool change we add an extra tool path
|
||||||
|
self._cumulative_line_duration[self.getCurrentLayer()].append(total_duration)
|
||||||
|
|
||||||
return self._cumulative_line_duration[self.getCurrentLayer()]
|
return self._cumulative_line_duration[self.getCurrentLayer()]
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ UM.PreferencesPage
|
|||||||
var idx = -1;
|
var idx = -1;
|
||||||
for(var i = 0; i < settingVisibilityPresetsModel.items.length; ++i)
|
for(var i = 0; i < settingVisibilityPresetsModel.items.length; ++i)
|
||||||
{
|
{
|
||||||
if(settingVisibilityPresetsModel.items[i].presetId == settingVisibilityPresetsModel.activePreset)
|
if(settingVisibilityPresetsModel.items[i].presetId === settingVisibilityPresetsModel.activePreset)
|
||||||
{
|
{
|
||||||
idx = i;
|
idx = i;
|
||||||
break;
|
break;
|
||||||
@ -159,7 +159,7 @@ UM.PreferencesPage
|
|||||||
id: definitionsModel
|
id: definitionsModel
|
||||||
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||||
showAll: true
|
showAll: true
|
||||||
exclude: ["machine_settings", "command_line_settings"]
|
exclude: ["machine_settings", "command_line_settings", "ppr"]
|
||||||
showAncestors: true
|
showAncestors: true
|
||||||
expanded: ["*"]
|
expanded: ["*"]
|
||||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
||||||
@ -173,13 +173,13 @@ UM.PreferencesPage
|
|||||||
id: loader
|
id: loader
|
||||||
|
|
||||||
width: settingsListView.width - scrollBar.width
|
width: settingsListView.width - scrollBar.width
|
||||||
height: model.type != undefined ? UM.Theme.getSize("section").height : 0
|
height: model.type !== undefined ? UM.Theme.getSize("section").height : 0
|
||||||
|
|
||||||
property var definition: model
|
property var definition: model
|
||||||
property var settingDefinitionsModel: definitionsModel
|
property var settingDefinitionsModel: definitionsModel
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: model.type != undefined
|
active: model.type !== undefined
|
||||||
sourceComponent:
|
sourceComponent:
|
||||||
{
|
{
|
||||||
switch (model.type)
|
switch (model.type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user