mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Move getting diagonal size out to separate function
This commit is contained in:
parent
aab0cded0e
commit
da39e842f1
1 changed files with 7 additions and 2 deletions
|
@ -171,6 +171,12 @@ class BuildVolume(SceneNode):
|
||||||
if shape:
|
if shape:
|
||||||
self._shape = shape
|
self._shape = shape
|
||||||
|
|
||||||
|
## Get the length of the 3D diagonal through the build volume.
|
||||||
|
#
|
||||||
|
# This gives a sense of the scale of the build volume in general.
|
||||||
|
def getDiagonalSize(self) -> float:
|
||||||
|
return math.sqrt(self._width * self._width + self._height * self._height + self._depth * self._depth)
|
||||||
|
|
||||||
def getDisallowedAreas(self) -> List[Polygon]:
|
def getDisallowedAreas(self) -> List[Polygon]:
|
||||||
return self._disallowed_areas
|
return self._disallowed_areas
|
||||||
|
|
||||||
|
@ -553,10 +559,9 @@ class BuildVolume(SceneNode):
|
||||||
if self._engine_ready:
|
if self._engine_ready:
|
||||||
self.rebuild()
|
self.rebuild()
|
||||||
|
|
||||||
diagonal_size = math.sqrt(self._width * self._width + self._height * self._height + self._depth * self._depth)
|
|
||||||
camera = Application.getInstance().getController().getCameraTool()
|
camera = Application.getInstance().getController().getCameraTool()
|
||||||
if camera:
|
if camera:
|
||||||
camera.setZoomRange(min = 1, max = diagonal_size * 5) #You can zoom out up to 5 times the diagonal across your screen (to see models bigger than your volume).
|
camera.setZoomRange(min = 1, max = self.getDiagonalSize() * 5) #You can zoom out up to 5 times the diagonal. This gives some space around the volume.
|
||||||
|
|
||||||
def _onEngineCreated(self):
|
def _onEngineCreated(self):
|
||||||
self._engine_ready = True
|
self._engine_ready = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue