Add a 3D view of the Ultimaker build platform for better scale reference.
This commit is contained in:
parent
302266ef25
commit
b46aeca961
3 changed files with 22 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import math, time
|
import math, time, os
|
||||||
|
|
||||||
|
from util import meshLoader
|
||||||
from util import util3d
|
from util import util3d
|
||||||
from util import profile
|
from util import profile
|
||||||
|
|
||||||
|
@ -46,7 +47,24 @@ def InitGL(window, view3D, zoom):
|
||||||
glLoadIdentity()
|
glLoadIdentity()
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
|
||||||
|
|
||||||
|
platformMesh = None
|
||||||
|
|
||||||
def DrawMachine(machineSize):
|
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)
|
glDisable(GL_LIGHTING)
|
||||||
if False:
|
if False:
|
||||||
glColor3f(0.7,0.7,0.7)
|
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(min(x+10, machineSize.x), min(y+10, machineSize.y), -0.01)
|
||||||
glVertex3f(x, min(y+10, machineSize.y), -0.01)
|
glVertex3f(x, min(y+10, machineSize.y), -0.01)
|
||||||
glEnd()
|
glEnd()
|
||||||
glColor4ub(5,171,231,64)
|
glColor4ub(5/2,171/2,231/2,128)
|
||||||
glBegin(GL_QUADS)
|
glBegin(GL_QUADS)
|
||||||
for x in xrange(10, int(machineSize.x), 20):
|
for x in xrange(10, int(machineSize.x), 20):
|
||||||
for y in xrange(0, int(machineSize.y), 20):
|
for y in xrange(0, int(machineSize.y), 20):
|
||||||
|
|
|
@ -429,6 +429,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
|
|
||||||
def OnMouseMotion(self,e):
|
def OnMouseMotion(self,e):
|
||||||
cursorXY = 100000
|
cursorXY = 100000
|
||||||
|
sizeXY = 0
|
||||||
if self.parent.objectsMaxV != None:
|
if self.parent.objectsMaxV != None:
|
||||||
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
||||||
sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
|
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)
|
glVertex3f(err[1].x, err[1].y, err[1].z)
|
||||||
glEnd()
|
glEnd()
|
||||||
glEnable(GL_DEPTH_TEST)
|
glEnable(GL_DEPTH_TEST)
|
||||||
|
|
||||||
opengl.DrawMachine(machineSize)
|
opengl.DrawMachine(machineSize)
|
||||||
|
|
||||||
glPushMatrix()
|
glPushMatrix()
|
||||||
|
|
BIN
Cura/images/ultimaker_platform.stl
Normal file
BIN
Cura/images/ultimaker_platform.stl
Normal file
Binary file not shown.
Loading…
Reference in a new issue