def _drawMachine(self): glEnable(GL_BLEND) machine = profile.getMachineSetting('machine_type') if machine.startswith('ciclop'): glEnable(GL_CULL_FACE) #-- Draw Platform if machine not in self._platformMesh: mesh = meshLoader.loadMesh(resources.getPathForMesh(machine + '_platform.stl')) if mesh is not None: self._platformMesh[machine] = mesh else: self._platformMesh[machine] = None self._platformMesh[machine]._drawOffset = numpy.array([0,0,8.05], numpy.float32) glColor4f(0.6,0.6,0.6,0.5) self._objectShader.bind() self._renderObject(self._platformMesh[machine]) self._objectShader.unbind() glDisable(GL_CULL_FACE) glDepthMask(False) size = numpy.array([profile.getProfileSettingFloat('roi_diameter'), profile.getProfileSettingFloat('roi_diameter'), profile.getProfileSettingFloat('roi_height')], numpy.float32) if profile.getProfileSettingBool('view_roi'): polys = profile.getSizePolygons(size) height = profile.getProfileSettingFloat('roi_height') circular = profile.getMachineSetting('machine_shape') == 'Circular' # Draw the sides of the build volume. glBegin(GL_QUADS) for n in xrange(0, len(polys[0])): if not circular: if n % 2 == 0: glColor4ub(5, 171, 231, 96) else: glColor4ub(5, 171, 231, 64) else: glColor4ub(5, 171, 231, 96) #glColor4ub(200, 200, 200, 150) glVertex3f(polys[0][n][0], polys[0][n][1], height) glVertex3f(polys[0][n][0], polys[0][n][1], 0) glVertex3f(polys[0][n-1][0], polys[0][n-1][1], 0) glVertex3f(polys[0][n-1][0], polys[0][n-1][1], height) glEnd() #Draw bottom and top of build volume. glColor4ub(5, 171, 231, 150)#128) #glColor4ub(200, 200, 200, 200) glBegin(GL_TRIANGLE_FAN) for p in polys[0][::-1]: glVertex3f(p[0], p[1], 0) glEnd() glBegin(GL_TRIANGLE_FAN) for p in polys[0][::-1]: glVertex3f(p[0], p[1], height) glEnd() quadric=gluNewQuadric(); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_TRUE); glColor4ub(0, 100, 200, 150) gluCylinder(quadric,6,6,1,32,16); gluDisk(quadric, 0.0, 6, 32, 1); glTranslate(0,0,height-1) gluDisk(quadric, 0.0, 6, 32, 1); gluCylinder(quadric,6,6,1,32,16); glTranslate(0,0,-height+1) polys = profile.getMachineSizePolygons() #-- Draw checkerboard if self._platformTexture is None: self._platformTexture = openglHelpers.loadGLTexture('checkerboard.png') glBindTexture(GL_TEXTURE_2D, self._platformTexture) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glColor4f(1,1,1,0.5) glBindTexture(GL_TEXTURE_2D, self._platformTexture) glEnable(GL_TEXTURE_2D) glBegin(GL_TRIANGLE_FAN) for p in polys[0]: glTexCoord2f(p[0]/20, p[1]/20) glVertex3f(p[0], p[1], 0) glEnd() glDisable(GL_TEXTURE_2D) glDepthMask(True) glDisable(GL_BLEND)
def _drawMachine(self): glEnable(GL_BLEND) machine = profile.getMachineSetting('machine_type') if machine.startswith('ciclop'): glEnable(GL_CULL_FACE) #-- Draw Platform if machine not in self._platformMesh: mesh = meshLoader.loadMesh( resources.getPathForMesh(machine + '_platform.stl')) if mesh is not None: self._platformMesh[machine] = mesh else: self._platformMesh[machine] = None self._platformMesh[machine]._drawOffset = numpy.array( [0, 0, 8.05], numpy.float32) glColor4f(0.6, 0.6, 0.6, 0.5) self._objectShader.bind() self._renderObject(self._platformMesh[machine]) self._objectShader.unbind() glDisable(GL_CULL_FACE) glDepthMask(False) size = numpy.array([ profile.getProfileSettingFloat('roi_diameter'), profile.getProfileSettingFloat('roi_diameter'), profile.getProfileSettingFloat('roi_height') ], numpy.float32) if profile.getProfileSettingBool('view_roi'): polys = profile.getSizePolygons(size) height = profile.getProfileSettingFloat('roi_height') circular = profile.getMachineSetting('machine_shape') == 'Circular' # Draw the sides of the build volume. glBegin(GL_QUADS) for n in xrange(0, len(polys[0])): if not circular: if n % 2 == 0: glColor4ub(5, 171, 231, 96) else: glColor4ub(5, 171, 231, 64) else: glColor4ub(5, 171, 231, 96) #glColor4ub(200, 200, 200, 150) glVertex3f(polys[0][n][0], polys[0][n][1], height) glVertex3f(polys[0][n][0], polys[0][n][1], 0) glVertex3f(polys[0][n - 1][0], polys[0][n - 1][1], 0) glVertex3f(polys[0][n - 1][0], polys[0][n - 1][1], height) glEnd() #Draw bottom and top of build volume. glColor4ub(5, 171, 231, 150) #128) #glColor4ub(200, 200, 200, 200) glBegin(GL_TRIANGLE_FAN) for p in polys[0][::-1]: glVertex3f(p[0], p[1], 0) glEnd() glBegin(GL_TRIANGLE_FAN) for p in polys[0][::-1]: glVertex3f(p[0], p[1], height) glEnd() #view center: center = self.getObjectCenterPos() quadric = gluNewQuadric() gluQuadricNormals(quadric, GLU_SMOOTH) gluQuadricTexture(quadric, GL_TRUE) glColor4ub(255, 0, 0, 255) #lower center: gluCylinder(quadric, 6, 6, 1, 32, 16) gluDisk(quadric, 0.0, 6, 32, 1) glTranslate(0, 0, height - 1) gluDisk(quadric, 0.0, 6, 32, 1) gluCylinder(quadric, 6, 6, 1, 32, 16) glTranslate(0, 0, -height + 1) polys = profile.getMachineSizePolygons() #-- Draw checkerboard if self._platformTexture is None: self._platformTexture = openglHelpers.loadGLTexture( 'checkerboard.png') glBindTexture(GL_TEXTURE_2D, self._platformTexture) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glColor4f(1, 1, 1, 0.5) glBindTexture(GL_TEXTURE_2D, self._platformTexture) glEnable(GL_TEXTURE_2D) glBegin(GL_TRIANGLE_FAN) for p in polys[0]: glTexCoord2f(p[0] / 20, p[1] / 20) glVertex3f(p[0], p[1], 0) glEnd() glDepthMask(True) glDisable(GL_BLEND)
setting('left_button', '', str, 'basic', _('Left'), False) setting('right_button', '', str, 'basic', _('Right'), False) setting('move_button', '', str, 'basic', _('Move'), False) setting('enable_button', '', str, 'basic', _('Enable'), False) setting('gcode_gui', '', str, 'advanced', _('Send'), False) setting('ldr_value', '', str, 'advanced', _('Send'), False) setting('machine_diameter', 200.0, float, 'machine_setting', _('Machine Diameter')) setting('machine_width', 200.0, float, 'machine_setting', _('Machine Width')) setting('machine_height', 200.0, float, 'machine_setting', _('Machine Height')) setting('machine_depth', 200.0, float, 'machine_setting', _('Machine Depth')) setting('machine_shape', 'Circular', ['Circular', 'Rectangular'], 'machine_setting', _('Machine Shape')) setting('machine_model_path', resources.getPathForMesh('ciclop_platform.stl'), str, 'machine_setting', _('Machine Model')) # TODO: Check if this path should be absolute setting('view_roi', False, bool, 'machine_setting', _('View ROI')) setting('roi_diameter', 200, int, 'machine_setting', _('Diameter')).setRange(0, 250) setting('roi_width', 200, int, 'machine_setting', _('Width')).setRange(0, 250) setting('roi_height', 200, int, 'machine_setting', _('Height')).setRange(0, 250) setting('roi_depth', 200, int, 'machine_setting', _('Depth')).setRange(0, 250) ##-- Preferences setting('language', 'English', str, 'preference', 'hidden').setLabel( _('Language'),