mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 21:03:16 +08:00
Fix elliptic bedshapes (vs circular)
MeshBuilder.addArc only supports circular arcs, not elliptic arcs. To work around this, the resulting MeshData is scaled.
This commit is contained in:
parent
8651a9a902
commit
4756168178
@ -10,6 +10,7 @@ from UM.Application import Application
|
|||||||
from UM.Resources import Resources
|
from UM.Resources import Resources
|
||||||
from UM.Mesh.MeshBuilder import MeshBuilder
|
from UM.Mesh.MeshBuilder import MeshBuilder
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
|
from UM.Math.Matrix import Matrix
|
||||||
from UM.Math.Color import Color
|
from UM.Math.Color import Color
|
||||||
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
||||||
from UM.Math.Polygon import Polygon
|
from UM.Math.Polygon import Polygon
|
||||||
@ -218,10 +219,16 @@ class BuildVolume(SceneNode):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# Bottom and top 'ellipse' of the build volume
|
# Bottom and top 'ellipse' of the build volume
|
||||||
|
aspect = 1.0
|
||||||
|
scale_matrix = Matrix()
|
||||||
|
if self._width != 0:
|
||||||
|
# Scale circular meshes by aspect ratio if width != height
|
||||||
|
aspect = self._height / self._width
|
||||||
|
scale_matrix.compose(Vector(1, 1, aspect))
|
||||||
mb = MeshBuilder()
|
mb = MeshBuilder()
|
||||||
mb.addArc(max_w, Vector.Unit_Y, center = (0, min_h - 0.2, 0), color = self.VolumeOutlineColor)
|
mb.addArc(max_w, Vector.Unit_Y, center = (0, min_h - 0.2, 0), color = self.VolumeOutlineColor)
|
||||||
mb.addArc(max_w, Vector.Unit_Y, center = (0, max_h, 0), color = self.VolumeOutlineColor)
|
mb.addArc(max_w, Vector.Unit_Y, center = (0, max_h, 0), color = self.VolumeOutlineColor)
|
||||||
self.setMeshData(mb.build())
|
self.setMeshData(mb.build().getTransformed(scale_matrix))
|
||||||
|
|
||||||
# Build plate grid mesh
|
# Build plate grid mesh
|
||||||
mb = MeshBuilder()
|
mb = MeshBuilder()
|
||||||
@ -233,10 +240,8 @@ class BuildVolume(SceneNode):
|
|||||||
|
|
||||||
for n in range(0, mb.getVertexCount()):
|
for n in range(0, mb.getVertexCount()):
|
||||||
v = mb.getVertex(n)
|
v = mb.getVertex(n)
|
||||||
mb.setVertexUVCoordinates(n, v[0], v[2])
|
mb.setVertexUVCoordinates(n, v[0], v[2] * aspect)
|
||||||
self._grid_mesh = mb.build()
|
self._grid_mesh = mb.build().getTransformed(scale_matrix)
|
||||||
|
|
||||||
mb = MeshBuilder()
|
|
||||||
|
|
||||||
# Indication of the machine origin
|
# Indication of the machine origin
|
||||||
if self._global_container_stack.getProperty("machine_center_is_zero", "value"):
|
if self._global_container_stack.getProperty("machine_center_is_zero", "value"):
|
||||||
@ -244,6 +249,7 @@ class BuildVolume(SceneNode):
|
|||||||
else:
|
else:
|
||||||
origin = Vector(min_w, min_h, max_d)
|
origin = Vector(min_w, min_h, max_d)
|
||||||
|
|
||||||
|
mb = MeshBuilder()
|
||||||
mb.addCube(
|
mb.addCube(
|
||||||
width = self._origin_line_length,
|
width = self._origin_line_length,
|
||||||
height = self._origin_line_width,
|
height = self._origin_line_width,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user