Fix when there is no object loaded, remove debug print.
This commit is contained in:
parent
183304d975
commit
edba844794
2 changed files with 27 additions and 26 deletions
|
@ -242,7 +242,6 @@ class DimensionSkein:
|
||||||
distance -= 10.0
|
distance -= 10.0
|
||||||
e = self.getExtrusionDistanceString(10.0, splitLine)
|
e = self.getExtrusionDistanceString(10.0, splitLine)
|
||||||
extra += self.distanceFeedRate.getLinearGcodeMovementWithFeedRate(self.feedRateMinute, self.oldLocation.dropAxis(), self.oldLocation.z) + e + '\n'
|
extra += self.distanceFeedRate.getLinearGcodeMovementWithFeedRate(self.feedRateMinute, self.oldLocation.dropAxis(), self.oldLocation.z) + e + '\n'
|
||||||
print extra, line, distance
|
|
||||||
line = extra + line
|
line = extra + line
|
||||||
self.oldLocation = location
|
self.oldLocation = location
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -429,17 +429,18 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
self.objColor[3] = profile.getPreferenceColour('model_colour3')
|
self.objColor[3] = profile.getPreferenceColour('model_colour3')
|
||||||
|
|
||||||
def OnMouseMotion(self,e):
|
def OnMouseMotion(self,e):
|
||||||
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
if self.parent.objectsMaxV != None:
|
||||||
sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
|
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
||||||
|
sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
|
||||||
|
|
||||||
p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))
|
p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))
|
||||||
p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))
|
p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))
|
||||||
cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))
|
cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))
|
||||||
cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))
|
cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))
|
||||||
if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
|
if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
|
||||||
self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
|
self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
|
||||||
else:
|
else:
|
||||||
self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
|
self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
|
||||||
|
|
||||||
if e.Dragging() and e.LeftIsDown():
|
if e.Dragging() and e.LeftIsDown():
|
||||||
if self.dragType == '':
|
if self.dragType == '':
|
||||||
|
@ -701,20 +702,21 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)
|
glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)
|
||||||
|
|
||||||
#Draw the rotate circle
|
#Draw the rotate circle
|
||||||
glDisable(GL_LIGHTING)
|
if self.parent.objectsMaxV != None:
|
||||||
glDisable(GL_CULL_FACE)
|
glDisable(GL_LIGHTING)
|
||||||
glEnable(GL_BLEND)
|
glDisable(GL_CULL_FACE)
|
||||||
glBegin(GL_TRIANGLE_STRIP)
|
glEnable(GL_BLEND)
|
||||||
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
glBegin(GL_TRIANGLE_STRIP)
|
||||||
sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
|
size = (self.parent.objectsMaxV - self.parent.objectsMinV)
|
||||||
for i in xrange(0, 64+1):
|
sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
|
||||||
f = i if i < 64/2 else 64 - i
|
for i in xrange(0, 64+1):
|
||||||
glColor4ub(255,int(f*255/(64/2)),0,128)
|
f = i if i < 64/2 else 64 - i
|
||||||
glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)
|
glColor4ub(255,int(f*255/(64/2)),0,128)
|
||||||
glColor4ub( 0,128,0,128)
|
glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)
|
||||||
glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)
|
glColor4ub( 0,128,0,128)
|
||||||
glEnd()
|
glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)
|
||||||
glEnable(GL_CULL_FACE)
|
glEnd()
|
||||||
|
glEnable(GL_CULL_FACE)
|
||||||
|
|
||||||
glPopMatrix()
|
glPopMatrix()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue