I would use the formula directly in python. It is the better approach to not use operator, but rather "absolute" calculations when creating objects in python.
Here is a rather messy mockup code for the funnel.
import bpy, math, bmesh
import numpy as np
def create_new_mesh(name = "myObj"):
me = bpy.data.meshes.new(name + "_GEO")
ob = bpy.data.objects.new(name, me)
scn = bpy.context.scene
scn.objects.link(ob)
scn.objects.active = ob
ob.select = True
ob.show_name = True
return ob, me
def funnel_vert_at(x, y, a = 1):
p = float(x**2+y**2)
return 0.5 * a * np.log(p)
def funnel_iteration(iteration_start, iteration_end, iteration_steps, i, exp = 8):
i_s = iteration_start**(1/exp)
i_e = iteration_end**(1/exp)
iteration_step = (i_e - i_s)/(iteration_steps-1)
return (iteration_step * i + i_s)**exp
def create_funnel_loops(iteration_start = 0.1, iteration_end = 1, iteration_steps = 9,rotation_steps = 24, iteration_exp = 8, a = 1):
verts = []
for i in range(0, iteration_steps):
for s in range(0, rotation_steps):
rad = math.pi*2 / rotation_steps * s
dist = funnel_iteration(iteration_start, iteration_end, iteration_steps, i, iteration_exp)
print(i, dist)
x = math.sin(rad) * dist
y = math.cos(rad) * dist
verts.append((x, y, funnel_vert_at(x, y, a)))
edges = []
for a in range(0, iteration_steps):
for b in range(0, rotation_steps):
next = 1
if b is rotation_steps - 1:
next = -b
b = b + a*rotation_steps
edges.append([b, b + next])
return verts, edges
me = create_new_mesh("Funnel")[1]
verts, edges = create_funnel_loops(
iteration_start = 0.1,
iteration_end = 1,
iteration_steps = 7,
rotation_steps = 9,
iteration_exp = 8,
a = 1
)
me.from_pydata(verts, edges, [])
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.bridge_edge_loops()
bpy.ops.object.mode_set(mode='OBJECT')
The main formula is in the function funnel_vert_at()
. X and Y are created in create_funnel_loops
with the circle functions sin and cos.
Since I was too lazy to implement it, the script uses the internal Bridge Edge Loops function, in the final solution, the faces should be calculated as well.
I also calculated the funnel_iteration
s very roughly with the power function. You should reverse the funnel formula so that the spacing between the loops is more even.