After grafting the curves to animate the movement, I computed them into a list. I have achieved it, but the parallel list operations are not visible in the rhino environment. How can I animate all the curves at a time and visualize them? The code and GH file are attached.
def updateComponent(interval):
""" Update this component similar to using a grasshopper timer """
def callBack(e):
ghenv.Component.ExpireSolution(False)
ghenv.Component.OnPingDocument().ScheduleSolution(interval,
gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))
# Instantiate or reset persistent variables
if "count" not in globals() or not Run:
count = 0
paths = []
path = ghcomp.Explode(flowpaths,True)[0]
if type(path) != list:
path = [path, path]
# Update the variable and component
if Run:
if count < len(path):
count += 1
paths.append(path[len(path) - count])
updateComponent(100)
elif count == len(path):
count = 0
# Output variables
Count = count
animate = paths
I could not find how to run a parallel code, but I made it work like this.
count = 0
paths = []
flow = []
pathlen = []
anim = []
for i in range(len(flowpaths)):
path = ghcomp.Explode(flowpaths[i],True)[0]
paths.append(ghcomp.ReverseList(path))
pathlen.append(len(path))
ktotal = max(pathlen)
lenpaths = len(paths)
for j in range(len(paths)):
for k in range(ktotal):
for l in range(len(paths)):
try:
flow.append(paths[l][k])
except:
pass
target = len(flow)
and animating it by,
import Grasshopper as gh
import Rhino.Geometry as rg
def updateComponent(interval):
""" Update this component similar to using a grasshopper timer """
def callBack(e):
ghenv.Component.ExpireSolution(False)
ghenv.Component.OnPingDocument().ScheduleSolution(interval,
gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))
# Instantiate or reset persistent variables
if "count" not in globals() or not Run:
count = 0
crv = []
# Update the variable and component
if Run:
if count < len(flow):
count +=1
seg = flow[count]
crv.append(seg)
updateComponent(100)
elif count == len(flow):
count = 0
# Output variables
Count = count
Points = crv