def unitcube(x=0,y=0,z=0):
obj= MQSystem.newObject()
num=doc.numObject
a=num
obj.name="cube_%d" % a
obj.addVertex(x-1/2.0,y-1/2.0,z+1/2.0)
obj.addVertex(x+1/2.0,y-1/2.0,z+1/2.0)
obj.addVertex(x+1/2.0,y+1/2.0,z+1/2.0)
obj.addVertex(x-1/2.0,y+1/2.0,z+1/2.0)
obj.addVertex(x-1/2.0,y-1/2.0,z-1/2.0)
obj.addVertex(x-1/2.0,y+1/2.0,z-1/2.0)
obj.addVertex(x+1/2.0,y+1/2.0,z-1/2.0)
obj.addVertex(x+1/2.0,y-1/2.0,z-1/2.0)
obj.addFace([0,3,2,1])
obj.addFace([1,2,6,7])
obj.addFace([4,7,6,5])
obj.addFace([0,4,5,3])
obj.addFace([3,5,6,2])
obj.addFace([0,1,7,4])
続きを表示...
doc.addObject( obj )
mat1=MQSystem.newMaterial()
doc.addMaterial(mat1)
num0 = doc.numMaterial
numm=num0-1
for face in obj.face:
face.material=numm
doc.material[numm].textureMap = "D:/1.png"
doc.material[numm].mapType = 0
unitcube(1,1,1)
------------------------------------------------------
when apply a texture map for the cube, the cube just slightly changes to darker color,no texture effect is showing.
You can use the code above it can create a cube but the texture cannot show on the model