Commit 11a000e2 authored by sumpfralle's avatar sumpfralle

fixed axes' label drawing


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@184 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent d478707c
...@@ -50,6 +50,7 @@ def draw_string(x, y, z, p, s, scale=.01): ...@@ -50,6 +50,7 @@ def draw_string(x, y, z, p, s, scale=.01):
GL.glPushMatrix() GL.glPushMatrix()
GL.glTranslatef(x, y, z) GL.glTranslatef(x, y, z)
if p == 'xy': if p == 'xy':
GL.glRotatef(90, 1, 0, 0)
pass pass
elif p == 'yz': elif p == 'yz':
GL.glRotatef(90, 0, 1, 0) GL.glRotatef(90, 0, 1, 0)
...@@ -57,7 +58,7 @@ def draw_string(x, y, z, p, s, scale=.01): ...@@ -57,7 +58,7 @@ def draw_string(x, y, z, p, s, scale=.01):
elif p == 'xz': elif p == 'xz':
GL.glRotatef(90, 0, 1, 0) GL.glRotatef(90, 0, 1, 0)
GL.glRotatef(90, 0, 0, 1) GL.glRotatef(90, 0, 0, 1)
GL.glRotatef(-90, 0, 1, 0) GL.glRotatef(45, 0, 1, 0)
GL.glScalef(scale, scale, scale) GL.glScalef(scale, scale, scale)
for c in str(s): for c in str(s):
GLUT.glutStrokeCharacter(GLUT.GLUT_STROKE_ROMAN, ord(c)) GLUT.glutStrokeCharacter(GLUT.GLUT_STROKE_ROMAN, ord(c))
...@@ -69,28 +70,31 @@ def draw_axes(settings): ...@@ -69,28 +70,31 @@ def draw_axes(settings):
GL.glMatrixMode(GL.GL_MODELVIEW) GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glLoadIdentity() GL.glLoadIdentity()
#GL.glTranslatef(0, 0, -2) #GL.glTranslatef(0, 0, -2)
if settings.get("unit") == "mm": size_x = abs(settings.get("maxx"))
size = 100 size_y = abs(settings.get("maxy"))
else: size_z = abs(settings.get("maxz"))
size = 5 size = 2.0 * max(max(size_x, size_y), size_z)
# the divider is just based on playing with numbers
scale = size/1500.0
string_distance = 1.1 * size
GL.glBegin(GL.GL_LINES) GL.glBegin(GL.GL_LINES)
GL.glColor3f(1, 0, 0) GL.glColor3f(1, 0, 0)
GL.glVertex3f(0, 0, 0) GL.glVertex3f(0, 0, 0)
GL.glVertex3f(size, 0, 0) GL.glVertex3f(size, 0, 0)
GL.glEnd() GL.glEnd()
draw_string(size, 0, 0, 'xy', "X") draw_string(string_distance, 0, 0, 'xy', "X", scale=scale)
GL.glBegin(GL.GL_LINES) GL.glBegin(GL.GL_LINES)
GL.glColor3f(0, 1, 0) GL.glColor3f(0, 1, 0)
GL.glVertex3f(0, 0, 0) GL.glVertex3f(0, 0, 0)
GL.glVertex3f(0, size, 0) GL.glVertex3f(0, size, 0)
GL.glEnd() GL.glEnd()
draw_string(0, size, 0, 'yz', "Y") draw_string(0, string_distance, 0, 'yz', "Y", scale=scale)
GL.glBegin(GL.GL_LINES) GL.glBegin(GL.GL_LINES)
GL.glColor3f(0, 0, 1) GL.glColor3f(0, 0, 1)
GL.glVertex3f(0, 0, 0) GL.glVertex3f(0, 0, 0)
GL.glVertex3f(0, 0, size) GL.glVertex3f(0, 0, size)
GL.glEnd() GL.glEnd()
draw_string(0, 0, size, 'xz', "Z") draw_string(0, 0, string_distance, 'xz', "Z", scale=scale)
@keep_matrix @keep_matrix
def draw_bounding_box(minx, miny, minz, maxx, maxy, maxz): def draw_bounding_box(minx, miny, minz, maxx, maxy, maxz):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment