Face Extrusion Examples

Example 1

import maya.cmds as cmds
#create a polygonal sphere
cmds.polySphere()
#delete faces , from 160 to the end
cmds.delete('pSphere1.f[160:]')
#extrude all remaining faces
#extrusion distance 0.1
# faces are pulled independently
cmds.polyExtrudeFacet('pSphere1.f[:]',kft=False, ltz=.1)

Example 2

import maya.cmds as cmds
cmds.polySphere()

# extrude one face 20 times
# for every extrusion we perform a rotation and a translation
for i in range(1,20):
if i%2 ==0:
cmds.polyExtrudeFacet(‘pSphere1.f[0]’,rx=60,ty=2)
else:
cmds.polyExtrudeFacet(‘pSphere1.f[0]’,rx=-60,ty=2)

Example 3

#create a polygonal sphere having 10 subdivisions on x , 10 on y and radius equal to 5
cmds.polySphere(n=’sfera’,sx=10,sy=10,r=5)
#find out the number of faces
nrFete=cmds.polyEvaluate(f=True)
#extrude the faces with an even number , pulling them independently
for i in range(1,nrFete):
if i%2 ==0:
cmds.polyExtrudeFacet(‘sfera.f[%d]’%i,ltz=2,kft=False)