I'm a beginner as well, but it worked when I tried like below.

import maya.cmds as cmds

nameGear = "anyname"

setTeeth = 6

gearSize = 5

thickness = 4

gear = cmds.polyCylinder(n=(nameGear + "_" + str(setTeeth) +
"T-"),r=gearSize, h=thickness, sx=setTeeth, sy=1, sz=1, ax=(0, 1, 0), tx=1,
ch=1)





extrudeOne = cmds.polyExtrudeFacet((gear[0] + ".f[0:"+ str(getTeeth) + "]"),
ch=1, kft=1, pvx=0, pvy=0, pvz=0,tx=0, ty=0, tz=0, rx=0, ry=0, rz=0, sx=1,
sy=1, sz=1, ran=0,divisions=1, twist=0, taper=1, off=0, ltz=1, ws=0, ltx=0,
lty=0,lrx=0, lry=0, lrz=0, lsx=1, lsy=1, lsz=1, ldx=1, ldy=0, ldz=0,
w=0,gx=0, gy=-1, gz=0, att=0, mx=0, my=0, mz=0, sma=30)



cmds.setAttr((extrudeOne[0] + ".localTranslate"), 3,2,0 , type = "double3")

cmds.setAttr((extrudeOne[0] + ".localScaleX"), 2)

cmds.setAttr((extrudeOne[0] + ".localScaleY"), 1)





thanks,

-Jun

On Wed, Apr 20, 2011 at 8:15 AM, Mark Naidenkov <[email protected]>wrote:

> Hi, I'm trying to translate MEL code to Python to get to it and I have
> couple of problems and I'm kind of new to maya programming/scripting
> and to these programming languages maybe someone could help me and
> tell where are the mistakes and how to solve it. I would be very
> grateful, Thanks for attention and your time (;
>
> and here is the piece of the script with which I'm having truobles ;/
>
> gear[] = cmds.polyCylinder(n=(nameGear + "_" + setTeeth + "T-"),
> r=gearSize, h=thickness, sx=setTeeth, sy=1, sz=1, ax=(0, 1, 0), tx=1,
> ch=1)
>   cmds.rotate(0, 0.5, 0)
>
> extrudeOne[] = cmds.polyExtrudeFacet(ch=1, kft=1, pvx=0, pvy=0, pvz=0,
> tx=0, ty=0, tz=0, rx=0, ry=0, rz=0, sx=1, sy=1, sz=1, ran=0,
> divisions=1, twist=0, taper=1, off=0, ltz=1, ws=0, ltx=0, lty=0,
> lrx=0, lry=0, lrz=0, lsx=1, lsy=1, lsz=1, ldx=1, ldy=0, ldz=0, w=0,
> gx=0, gy=-1, gz=0, att=0, mx=0, my=0, mz=0, sma=30, (gear[0] + ".f[0:"
> + getTeeth + "]"))
>
> cmds.setAttr(extrudeOne[0] + ".localTranslate"), type=double(3, 0, 0)
> trans1)
> cmds.setAttr(extrudeOne[0] + ".localScaleX"), scaleX1)
> cmds.setAttr(extrudeOne[0] + ".localScaleY"), scaleY1)
>
>
> cmds.polyCylinder(n=(gear[0] + "cutter"), r=holeSize, h=(thickness +
> 1), sx=setTeeth, sy=1, sz=1, ax=(0, 1, 0), tx=1, ch=1)
>   cmds.polyBoolOp(n=(nameGear + "_" + $setTeeth + "T-"), op=2, ch=1,
> gear[0], (gear[0] + "cutter")
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to