mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Merge pull request #18669 from Ultimaker/CURA-11758-Crash-on-front-end-on-playing-the-preview-simulation
Fix crash in similation view Validated on the build from the branch. Issue is resolved.
This commit is contained in:
commit
460dbb5816
2 changed files with 5 additions and 2 deletions
|
@ -153,7 +153,8 @@ class SimulationPass(RenderPass):
|
||||||
# In the current layer, we show just the indicated paths
|
# In the current layer, we show just the indicated paths
|
||||||
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()) if self._layer_view.getCurrentPath() else 0
|
index = int(self._layer_view.getCurrentPath()) if not math.isnan(
|
||||||
|
self._layer_view.getCurrentPath()) else 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.
|
||||||
|
|
|
@ -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
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQt6.QtCore import Qt
|
from PyQt6.QtCore import Qt
|
||||||
|
@ -216,7 +217,8 @@ class SimulationView(CuraView):
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
f"Binary search error (out of bounds): index {i}: left value {left_value} right value {right_value} and current time is {self._current_time}")
|
f"Binary search error (out of bounds): 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)
|
segment_duration = right_value - left_value
|
||||||
|
fractional_value = 0.0 if segment_duration == 0.0 else (self._current_time - left_value) / segment_duration
|
||||||
|
|
||||||
self.setPath(i + fractional_value)
|
self.setPath(i + fractional_value)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue