def PLAN():
1)Create primitive (6 angle for ex-le)
2)Use this primitive as a path (curve)
3)Define the random amount of primitives(within Fibonacci numbers 1,1,3,5,8,13,21,44,65...)
4)Dulicate them
5)Pick a random point within pritive length
6)Move them on it
7)Scale primitives random
8)enjoy)
PLAN()
###RECURSION STUFF#####
##
def primitives(numSides, radius):
#create a circle
myCircle = cmds.circle(radius = 30)
#get param steps, I will take 6 for ex-le
paramSteps = 1./6
#loop and get points coordinates
points = []
for i in range(0, 8, 1):
points.append( cmds.pointOnCurve(myCircle[0], p=1, pr=paramSteps*i, top=1) )
#create a curve connecting points
myPrimitive = cmds.curve(ep=points, d=1)
#close the curve
cmds.closeCurve(n="p_"+str(numSides)+"_sides", rpo=1)
#delete the circle
cmds.delete(myCircle)
#return the name of the primitive
return myPrimitive
primitives(6, 30)
from random import *
def Whatamess():
#define the random amount of primitives
randomAmount = randint(21,44) # fibonachi number 1,1,3,5,8,13,21,44,65... and so on
for i in range (0,randomAmount,1):
#duplicate my primitiv
myDupObj2 = cmds.duplicate( 'curve1' )
# get the center of the duplicated object
myCenter = cmds.xform(myDupObj2, q=1, t=1, ws=1)
# get the maximun "length" of the curve, so we can pick a random point within this length
#I wanna use my Primitive as a curve. Why not?)
myCurveParam = cmds.getAttr("curve1.maxValue")
# select a random point on the curve
myPoint = cmds.pointOnCurve( 'curve1', pr = uniform(0,myCurveParam), p=True)
# select the previously duplicated object
cmds.select(myDupObj2)
# move it to the new location
cmds.move(myPoint[0],myPoint[1],myPoint[2])
#scales it
cmds.scale(uniform(1,1.5),uniform(1,1.5),uniform(1,1.5),a=1)
Whatamess()
### As You can see, I changed my consept a bit,
### from controlled variant to random, because I dont know how to put
### mathematical formulas (Fibonacci x3 = x2+x1) But I included one of your "helpful" scripts and I like the result) after all
def PLAN1():
1)Create primitive (6 angle for ex-le)
2)Use this primitive as a path (curve)
3)Define the random amount of primitives(within Fibonacci numbers 1,1,3,5,8,13,21,44,65...)
4)Dulicate them
5)Pick a point within pritive length ( I dont know how to pick different
points with Fibonacci proporsion-divide curve propotionally [1,1,3,5...])
6)Move them on it (I dont know how to put them, so they will not intersect)
7)Scale primitives (but I dont know how to scale them proportionally)
8)enjoy more)
PLAN1()
No comments:
Post a Comment