Editing Staircase Attributes After Creation Problem

Editing Staircase Attributes After Creation Problem

Anonymous
Not applicable
818 Views
1 Reply
Message 1 of 2

Editing Staircase Attributes After Creation Problem

Anonymous
Not applicable

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'
step1.JPG

Problem 2 - changing subdivtionsHeight for stair count confuses Maya
step2.JPG

0 Likes
Accepted solutions (1)
819 Views
1 Reply
Reply (1)
Message 2 of 2

sean.heasley
Alumni
Alumni
Accepted solution

Hi @Anonymous 

 

Changing subdivisions after the model is created isn't really ideal and this can be scene even with basic geometry modeling for example if you take a cube and extrude a face then try to add divisions its going to break the model.

 

As for the height, why not use the height flags instead of scaleY?

 

I'd also recommend looking at some similar free tools and compare/contrast their set up to yours so you can learn how they built their script etc.

Here's a free stair script you could download and look at to compare to your own.

 

 

If one or more of these posts helped answer your question, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

 

Kudos are greatly appreciated. Everyone likes a thumbs up!

 

 

 

0 Likes