
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created a stair case using the following code:
from maya import cmds
class Stair(object):
"""
import stairCreator as sc
reload(sc)
stair = sc.Stair()
stair.createStair()
stair.changeStair(steps=05, height=1)
"""
# init sets up default vales
def __init__(self):
self.transform = None
self.extrude = None
self.constructor = None
def createStair(self, steps=20, height=1, length=24, width=10):
self.transform, self.constructor = cmds.polyPlane(subdivisionsHeight=steps, subdivisionsWidth=1, width=width, height=length)
self.frontFaces = range(steps)
for face in self.frontFaces:
self.extrude = cmds.polyExtrudeFacet('%s.f[%s:%s]' % (self.transform, face, steps-1), localTranslateZ=height)[0]
# changeing shape after creation----------------------------------
def changeStair(self, steps=20, height=1, length=24, width=10):
cmds.polyPlane(self.constructor, edit=True, subdivisionsHeight=steps, width=width, height=length, scaleY=height)
I have two problems occurring In the changeStair function towards the bottom of the code page:
Problem 1 - Maya gives error saying 'scaleY' is a invalid flag. I think this is because it's under pPlane not polyPlane but I don't know how to specify that. I would like to be able to change the height and this seems easiest way.
Problem 2- Editing the subdivionsHeight to change the step count causes weird things to happen. Is there another way to change the amount of extruded stairs after their created?
I feel like there's a simple fix for problem #1, but I don't know If fixing problem #2 is possible.
All help and thoughts appreciated thanks!
Problem 1 - Invalid flag 'scaleY'
Problem 2 - changing subdivtionsHeight for stair count confuses Maya
Solved! Go to Solution.