From: daid303 Date: Fri, 5 Oct 2012 13:07:20 +0000 (+0200) Subject: Add a 3D view of the Ultimaker build platform for better scale reference. X-Git-Tag: 13.03~271 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b46aeca9615187c78114e729b2d09349efa6b815;p=cura.git Add a 3D view of the Ultimaker build platform for better scale reference. --- diff --git a/Cura/gui/opengl.py b/Cura/gui/opengl.py index b2a6571c..f8077ab8 100644 --- a/Cura/gui/opengl.py +++ b/Cura/gui/opengl.py @@ -1,5 +1,6 @@ -import math, time +import math, time, os +from util import meshLoader from util import util3d from util import profile @@ -46,7 +47,24 @@ def InitGL(window, view3D, zoom): glLoadIdentity() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT) +platformMesh = None + def DrawMachine(machineSize): + if profile.getPreference('machine_type') == 'ultimaker': + glPushMatrix() + glEnable(GL_LIGHTING) + glTranslate(100,120,-285) + glLightfv(GL_LIGHT0, GL_DIFFUSE, [0.8,0.8,0.8]) + glLightfv(GL_LIGHT0, GL_AMBIENT, [0.3,0.3,0.3]) + + global platformMesh + if platformMesh == None: + platformMesh = meshLoader.loadMesh(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../images", 'ultimaker_platform.stl'))) + platformMesh.setRotateMirror(0, False, True, False, False, True) + + DrawMesh(platformMesh) + glPopMatrix() + glDisable(GL_LIGHTING) if False: glColor3f(0.7,0.7,0.7) @@ -110,7 +128,7 @@ def DrawMachine(machineSize): glVertex3f(min(x+10, machineSize.x), min(y+10, machineSize.y), -0.01) glVertex3f(x, min(y+10, machineSize.y), -0.01) glEnd() - glColor4ub(5,171,231,64) + glColor4ub(5/2,171/2,231/2,128) glBegin(GL_QUADS) for x in xrange(10, int(machineSize.x), 20): for y in xrange(0, int(machineSize.y), 20): diff --git a/Cura/gui/preview3d.py b/Cura/gui/preview3d.py index 053ed722..47f39a12 100644 --- a/Cura/gui/preview3d.py +++ b/Cura/gui/preview3d.py @@ -429,6 +429,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas): def OnMouseMotion(self,e): cursorXY = 100000 + sizeXY = 0 if self.parent.objectsMaxV != None: size = (self.parent.objectsMaxV - self.parent.objectsMinV) sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1])) @@ -697,6 +698,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas): glVertex3f(err[1].x, err[1].y, err[1].z) glEnd() glEnable(GL_DEPTH_TEST) + opengl.DrawMachine(machineSize) glPushMatrix() diff --git a/Cura/images/ultimaker_platform.stl b/Cura/images/ultimaker_platform.stl new file mode 100644 index 00000000..63116857 Binary files /dev/null and b/Cura/images/ultimaker_platform.stl differ