1. Пользоваться форумом на планшетах и телефонах стало удобнее благодаря Tapatalk

Maya scripting

Тема в разделе "Maya", создана пользователем чьубака, 24 апр 2011.

Модераторы: Dark™, Skif
  1. чьубака

    чьубака Пользователь сайта

    С нами с:
    20.04.2011
    Сообщения:
    1
    Симпатии:
    0
    Баллы:
    2
    здрасте может кто небуд могбы мне помоч откорегироват етот проклатый код?

    import maya.cmds as cmds

    Код:
    def gearbuild():
       setTeeth = cmds.intField(query=True, value=teeth)
       thickness = cmds.floatField(query=True, value =thickness)
       holeSize = cmds.floatField (query=True, value=hole)
       nameGear = cmds.textField (query=True, tx=gearName)
       
       trans1 = cmds.floatField(query=True, value=Trans1)
       scaleX1 = cmds.floatField(query=True, value= ScaleX1)
       scaleY1 = cmds.floatField(query=True, value= ScaleY1)
      
       
    #   math to size gear to number of teeth
    #   C=3.14*d
    
       gearSize = 0.785 * setTeeth / 3.14 / 2
       
    #   building the base cylinder
    
       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)
    
    #  building the base cylinder
    
       getTeeth = setTeeth-1
       
    #  extruding the teeth
    
    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)
    
    # cleaning and merging 0 extrudes
    
       cmds.polyMergeVertex()
       cmds.delete(ch=gear[0])
       cmds.rotate((0, 0, 0,), gear[0])
       
    #  cutting the center hole
    
       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")
    
    #  end edit
       
       cmds.delete(ch)
    
    #########
    
    def Gear():
    
        if(window(query=True, exists=True)):
            cmds.deleteUI(window, window=True)
     
        
        window_name = cmds.window(t= "Gear Builder")
        
        cmds.columnLayout( adjustableColumn=True, rowSpacing=5, columnWidth=250, columnAttach=('both', 5))
        cmds.window(h=249, w=120)
        cmds.text(w=100, label="Gear Name")
        cmds.textField(w=100, gearName)
        cmds.text("Teeth")
        cmds.floatField(value=2, thickness)
        cmds.text("Hole Size")
        cmds.floatField(value=1, hole)
        cmds.showWindow( window )
            
        extOpt = 0
    
        cmds.button(w=100, bgc=(1, .9, 0) label="Buld Gear" command=('gearBulid'))
        
        cmds.text("Extrude Options")
    
        cmds.button(w=100, h=11 bgc=(0, .5, 0), label="+" command=('gearBulid'))
        cmds.button(w=100, h=11 bgc=(1, .5, 0), label="-" command=('gearBulid'))
    
        cmds.text("NOTE: To Void an Extrude use:")
        cmds.text("Z=0m X=1, Y=1. (Infor in Readme")
        
        cmds.gridLayout(numberOfRowsColumns=(2, 3), cellWidthHeight=(60,20))
    
        cmds.text("(1) Trans Z")
        cmds.text("Scal X")
        cmds.text("Scale Y")
        
        cmds.floatField(value=.04 Trans1)
        cmds.floatField(value=1 ScaleX1)
        cmds.floatField(value=.6 ScaleY1)
    
    
        cmds.showWindow(window_name)
     
Модераторы: Dark™, Skif

Поделиться этой страницей