Ejemplo n.º 1
0
 def quad(self, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, maxU, maxV):
     GL.glTexCoord2d(maxU, 0);
     GL.glVertex3d(prefs.cm(prefs.mm(x1)), prefs.cm(prefs.mm(y1)), prefs.cm(prefs.mm(z1)))
     GL.glTexCoord2d(maxU, maxV);
     GL.glVertex3d(prefs.cm(prefs.mm(x2)), prefs.cm(prefs.mm(y2)), prefs.cm(prefs.mm(z2)))
     GL.glTexCoord2d(0, maxV);
     GL.glVertex3d(prefs.cm(prefs.mm(x3)), prefs.cm(prefs.mm(y3)), prefs.cm(prefs.mm(z3)))
     GL.glTexCoord2d(0, 0);
     GL.glVertex3d(prefs.cm(prefs.mm(x4)), prefs.cm(prefs.mm(y4)), prefs.cm(prefs.mm(z4)))
Ejemplo n.º 2
0
    def makeObject(self):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)

        GL.glLineWidth(3.0)

        planeSizeX = prefs.current.printArea_mm.x

        GL.glBegin(GL.GL_QUADS)
        self.quad(
            -prefs.current.printArea_mm.x/2.0, -0.1, -prefs.current.printArea_mm.y/2.0, 
            -prefs.current.printArea_mm.x/2.0, -0.1,  prefs.current.printArea_mm.y/2.0, 
             prefs.current.printArea_mm.x/2.0, -0.1,  prefs.current.printArea_mm.y/2.0, 
             prefs.current.printArea_mm.x/2.0, -0.1, -prefs.current.printArea_mm.y/2.0,
             prefs.current.printArea_mm.x/100.0, prefs.current.printArea_mm.y/100.0)
        self.quad(
            -prefs.current.printArea_mm.x/2.0, prefs.current.printArea_mm.z, -prefs.current.printArea_mm.y/2.0, 
            -prefs.current.printArea_mm.x/2.0, prefs.current.printArea_mm.z,  prefs.current.printArea_mm.y/2.0, 
             prefs.current.printArea_mm.x/2.0, prefs.current.printArea_mm.z,  prefs.current.printArea_mm.y/2.0, 
             prefs.current.printArea_mm.x/2.0, prefs.current.printArea_mm.z, -prefs.current.printArea_mm.y/2.0,
             prefs.current.printArea_mm.x/100.0, prefs.current.printArea_mm.y/100.0)
        GL.glEnd()
        
        GL.glBegin(GL.GL_LINES)
        GL.glVertex3d(prefs.cm(prefs.mm(-prefs.current.printArea_mm.x/2.0)), -0.001, prefs.cm(prefs.mm(-prefs.current.printArea_mm.y/2.0)))
        GL.glVertex3d(prefs.cm(prefs.mm(-prefs.current.printArea_mm.x/2.0)), prefs.cm(prefs.current.printArea_mm.z), prefs.cm(prefs.mm(-prefs.current.printArea_mm.y/2.0)))

        GL.glVertex3d(prefs.cm(prefs.mm(-prefs.current.printArea_mm.x/2.0)), -0.001, prefs.cm(prefs.mm(prefs.current.printArea_mm.y/2.0)))
        GL.glVertex3d(prefs.cm(prefs.mm(-prefs.current.printArea_mm.x/2.0)), prefs.cm(prefs.current.printArea_mm.z), prefs.cm(prefs.mm(prefs.current.printArea_mm.y/2.0)))

        GL.glVertex3d(prefs.cm(prefs.mm(prefs.current.printArea_mm.x/2.0)), -0.001, prefs.cm(prefs.mm(prefs.current.printArea_mm.y/2.0)))
        GL.glVertex3d(prefs.cm(prefs.mm(prefs.current.printArea_mm.x/2.0)), prefs.cm(prefs.current.printArea_mm.z), prefs.cm(prefs.mm(prefs.current.printArea_mm.y/2.0)))

        GL.glVertex3d(prefs.cm(prefs.mm(prefs.current.printArea_mm.x/2.0)), -0.001, prefs.cm(prefs.mm(-prefs.current.printArea_mm.y/2.0)))
        GL.glVertex3d(prefs.cm(prefs.mm(prefs.current.printArea_mm.x/2.0)), prefs.cm(prefs.current.printArea_mm.z), prefs.cm(prefs.mm(-prefs.current.printArea_mm.y/2.0)))
        GL.glEnd()
        


#        self.extrude(x1, y1, x2, y2)
#        self.extrude(x2, y2, y2, x2)
#        self.extrude(y2, x2, y1, x1)
#        self.extrude(y1, x1, x1, y1)
#        self.extrude(x3, y3, x4, y4)
#        self.extrude(x4, y4, y4, x4)
#        self.extrude(y4, x4, y3, x3)

#        Pi = 3.14159265358979323846
#        NumSectors = 200

#        for i in range(NumSectors):
#            angle1 = (i * 2 * Pi) / NumSectors
#            x5 = 0.30 * math.sin(angle1)
#            y5 = 0.30 * math.cos(angle1)
#            x6 = 0.20 * math.sin(angle1)
#            y6 = 0.20 * math.cos(angle1)

#            angle2 = ((i + 1) * 2 * Pi) / NumSectors
#            x7 = 0.20 * math.sin(angle2)
#            y7 = 0.20 * math.cos(angle2)
#            x8 = 0.30 * math.sin(angle2)
#            y8 = 0.30 * math.cos(angle2)

#            self.quad(x5, y5, x6, y6, x7, y7, x8, y8)

#            self.extrude(x6, y6, x7, y7)
#            self.extrude(x8, y8, x5, y5)

#        GL.glEnd()
        GL.glEndList()

        return genList