Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #extruder
- # rev 01
- from pymel.core import*
- def getPiv(s):
- select(s)
- setToolTo('Move')
- piv = manipMoveContext('Move', q=True, p=True,m=2)
- return piv
- sl = selected()
- def grpr(name):
- g = ls(name)
- if not g:
- g = group(n=name,em=1)
- else:
- g = g[0]
- return g
- def grprk(name):
- g = ls(name)
- if g:
- delete(g)
- g = group(n=name,em=1)
- return g
- grp = grprk("neuronConnections_grp")
- slList = []
- for s in sl:
- crv = s
- mult = .3
- cLenght = arclen(s)
- baseWidth = .02
- extruded = polyPlane(sh=1,sw=1,w=cLenght*baseWidth*mult, h=cLenght*baseWidth*mult)
- setAttr(extruded[0].displaySmoothMesh , 2)
- parent(extruded,grp)
- slList.append(extruded)
- piv = getPiv(crv.cv[0])
- move(extruded[0], piv)
- tl = spaceLocator(n="tempLocation")
- piv2 = getPiv(crv.cv[1])
- move(tl,piv2)
- ac = aimConstraint(tl, extruded, u = [0,1,0], wu = [0,1,0],wut = "vector",aim = [0,1,0])
- pe = polyExtrudeFacet(crv,extruded[0].f[0], pvx = piv[0], pvy = piv[1], pvz = piv[2],ch=1, kft=1, d =40,tp=1)
- connectAttr(str(crv.getShape())+".worldSpace[0]", str(pe[0])+".inputProfile",f=1)
- delete(tl)
- #setAttr(s.visibility, 0)#_______________________________
- if cLenght > 2:
- cLenght = cLenght/4
- offR = r.uniform(-.3,.3)
- offestMAmnt = offR
- ends = 10 #* cLenght
- widthM = r.uniform(2,3)#* cLenght
- middle = 12 #* cLenght
- extrudeList = [["p1",ends, 0],["p2",ends-ends/2, 0.01],["p2.5",ends-ends/2, 0.05],["p3",widthM, .1],["p4",widthM, .45+offestMAmnt],
- ["p5",middle, 0.48+offestMAmnt],["p2.6",middle, 0.52+offestMAmnt],
- ["p7",widthM, .55+offestMAmnt],["p8",widthM, .9],["p9",ends-ends/2, .95],["p10",ends, 0.995],["p11",0, 1]]
- #extrudeList = [["p1",ends*2, 0],["p2",ends/2, .5],["p2.5",ends*2, 1]]
- x = 2
- i = 0
- for ex in extrudeList:
- #print i, ex[1],ex[2]
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_FloatValue".format(i), ex[1])
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_Position".format(i), ex[2])
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_Interp".format(i), 2)
- x += 1
- i += 1
- #delete(extruded,ch=1)
- #wD = wire(extruded[0],dds=[(0,100),(1,100)],en=1,gw=0,ce=0,li=0, w = s, n = s+"_extruededWire")
- #wire -gw false -en 1.000000 -ce 0.000000 -li 0.000000 -w curve1 pPlane1;
- select(cl=1)
- select(sl,add=1)
- """
- #extruder
- from pymel.core import*
- def getPiv(s):
- select(s)
- setToolTo('Move')
- piv = manipMoveContext('Move', q=True, p=True,m=2)
- return piv
- sl = selected()
- def grpr(name):
- g = ls(name)
- if not g:
- g = group(n=name,em=1)
- else:
- g = g[0]
- return g
- grp = grpr("neuronConnections_grp")
- slList = []
- for s in sl:
- crv = s
- mult = .1
- cLenght = arclen(s)
- baseWidth = .02
- extruded = polyPlane(sh=1,sw=1,w=cLenght*baseWidth*mult, h=cLenght*baseWidth*mult)
- setAttr(extruded[0].displaySmoothMesh , 2)
- #parent(extruded,grp)
- slList.append(extruded)
- piv = getPiv(crv.cv[0])
- move(extruded[0], piv)
- tl = spaceLocator(n="tempLocation")
- piv2 = getPiv(crv.cv[1])
- move(tl,piv2)
- ac = aimConstraint(tl, extruded, u = [0,1,0], wu = [0,1,0],wut = "vector",aim = [0,1,0])
- pe = polyExtrudeFacet(crv,extruded[0].f[0], pvx = piv[0], pvy = piv[1], pvz = piv[2],ch=1, kft=1, d =40,tp=1)
- connectAttr(str(crv.getShape())+".worldSpace[0]", str(pe[0])+".inputProfile",f=1)
- delete(tl)
- #setAttr(s.visibility, 0)#_______________________________
- if cLenght > 2:
- cLenght = cLenght/4
- offR = r.uniform(-.2,.2)
- offestMAmnt = offR
- ends = 10 * cLenght
- widthM = 3 * cLenght
- middle = 12 * cLenght
- extrudeList = [["p1",ends, 0],["p12",ends- ends/2, 0.05],["p4",widthM, .2],["p6",widthM, .4+offestMAmnt],["p2",middle, 0.5+offestMAmnt],["p7",widthM, .6+offestMAmnt]
- ,["p5",widthM, .8],["p13",ends- ends/2, 0.95],["p3",ends, 1]]
- x = 2
- i = 0
- for ex in extrudeList:
- #print i, ex[1],ex[2]
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_FloatValue".format(i), ex[1])
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_Position".format(i), ex[2])
- setAttr(pe[0]+".taperCurve[{0}].taperCurve_Interp".format(i), 2)
- x += 1
- i += 1
- delete(extruded,ch=1)
- print extruded[0]
- wD = wire(extruded[0],dds=[(0,100),(1,100)],en=1,gw=0,ce=0,li=0, w = s, n = s+"_extruededWire")
- #wire -gw false -en 1.000000 -ce 0.000000 -li 0.000000 -w curve1 pPlane1;
- """
Add Comment
Please, Sign In to add comment