我正在制作一个C4D插件,我想知道:如何使用groupby根据包含的值拆分数组?
我把这段代码发送给splinebuilder函数,但是如果我按原样发送splinelist,就得到了行之间的连接,这是不需要的。你知道吗
因此,我需要发送单独的列表,以便splinebuilder创建这些行的集合,避免互连。你知道吗
#initial contains XYZ vectors
splinelist = [(-200, 0, -200), (0, 0, -200), (200, 0, -200), (-200, 0, 0), (0, 0, 0), (200, 0, 0), (-200, 0, 200), (0, 0, 200), (200, 0, 200)]
#desired handcoded for example separated based on Z value
la = [(-200, 0, -200), (0, 0, -200), (200, 0, -200)]
lb = [(-200, 0, 0), (0, 0, 0), (200, 0, 0)]
lc = [(-200, 0, 200), (0, 0, 200), (200, 0, 200)]
#desired list of lists based on Z value
desiredlist = [[(-200, 0, -200), (0, 0, -200), (200, 0, -200)],[(-200, 0, 0), (0, 0, 0), (200, 0, 0)],[(-200, 0, 200), (0, 0, 200), (200, 0, 200)]]
我想这正是你需要的:
输出:
相关问题 更多 >
编程相关推荐