this is a scripted version, i made to NOT use the gui-interface

for some already known shapes.

Paste it into the text-editor in blender and run the script

(needs the extra-meshes-addon enabled …)

Not all are working, some are tryouts … and i never completed the settings

for those - for example there are different tests to generate

a “klein bottle” made out of 2 parts.

and some of those meshes were used in my “treadmill-video” and blend-file

in the python-part of the forum.

```
# a lot of samples are taken from
# http://www.3d-meier.de/tut3/Seite0.html
# and different samples from other (not noted) internet-resources ...
# --- ! needs the addon -extra-meshes- activated
#
import bpy
def create_mesh_object(context, verts, edges, faces, name):
mesh = bpy.data.meshes.new(name)
mesh.from_pydata(verts, edges, faces)
mesh.update()
from bpy_extras import object_utils
obj = object_utils.object_data_add(context, mesh, operator=None)
return obj
import add_mesh_extra_objects
# makePyramid( initialSize, stepHeight, stepWidth, numberSteps)
#(verts, faces) = add_mesh_extra_objects.add_mesh_pyramid.makePyramid(6., 0.2, 0.3, 10)
class helper:
report = print
from math import pi
h = helper()
h.report("dummy")
(verts, faces) = add_mesh_extra_objects.add_mesh_3d_function_surface.xyz_function_surface_faces(
h, "u", "v", "u*v", 0., 2., 32, False, 0., 2., 32, False,
"0", "0", "0", "0", "0", "0", 1, False)
print(faces)
#create_mesh_object(bpy.context, verts, [], faces, "dummy")
#some samples are taken from the wiki-page of the addon
# http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Add_Mesh/Add_3d_Function_Surface
# while others are selected from different sources
#
samples=[]
samples.append( {"name":"Moebius",
"x":"cos(u)*(1+v/2 *cos(u/2))",
"y":"sin(u)*(1+v/2 *cos(u/2))",
"z":"v/2 *sin(u/2)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": -1,
"vmax": 1,
"vwrap": True,
} )
samples.append( {"name":"horn",
"x":"(4+3*sin(v/3)*sin(u))*cos(v)",
"y":"(4+3*sin(v/3)*sin(u))*sin(v)",
"z":"3*sin(v/3)*cos(u)",
"umin": 0,
"umax": 2*pi,
"uwrap": False,
"vmin": 0,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"pillow",
"x":"sin(u)*cos(v)",
"y":"sin(v)",
"z":"cos(u)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"tyre_torus",
"x":"(5+cos(u))*cos(v)",
"y":"(5+cos(u))*sin(v)",
"z":"2*sin(u)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"8flat",
"x":"sin(u)*sin(u)",
"y":"sin(v)*cos(v)",
"z":"cos(v)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"WhitneyUmbrella",
"x":"u*v",
"y":"u",
"z":"v*v",
"umin": -1.5,
"umax": 1.5,
"uwrap": False,
"vmin": -1.5,
"vmax": 1.5,
"vwrap": False,
} )
samples.append( {"name":"RightConoid",
"x":"v*cos(u)",
"y":"v*sin(u)",
"z":"2*sin(u)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"RomanSurface",
"x":"3*cos(u)*cos(v)*sin(v)",
"y":"3*sin(u)*cos(v)*sin(v)",
"z":"3*cos(u)*sin(u)*cos(v)*cos(v)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"UmbilicTorus",
"x":"sin(u)*(7+cos(u/3-2*v)+2*cos(u/3+v))",
"y":"cos(u)*(7+cos(u/3-2*v)+2*cos(u/3+v))",
"z":"sin(u/3-2*v)+2*sin(u/3+v)",
"umin": -pi,
"umax": pi,
"uwrap": True,
"vmin": -pi,
"vmax": pi,
"vwrap": True,
} )
samples.append( {"name":"escargout",
"afunc": "3",
"bfunc": "6",
"cfunc":"exp(u/(7*pi))",
"x":"a*(1-c)*cos(u)*cos(.5*v)**2",
"y":"1-exp(u/(c*pi))-sin(v)+c*sin(v)",
"z":"a*(-1+c)*sin(u)*cos(.5*v)**2",
"umin": 0,
"umax": 6*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"TrianglePillow",
"x":"cos(u)",
"y":"cos(v)",
"z":"cos(u+v)",
"umin": -pi,
"umax": pi,
"uwrap": True,
"vmin": -pi,
"vmax": pi,
"vwrap": True,
} )
samples.append( {"name":"SnailSurface",
"x":"u*cos(v)*sin(u)",
"y":"u*cos(u)*cos(v)",
"z":"-u*sin(v)",
"umin": 0,
"umax": 2*pi,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"Horn",
"afunc":"2",
"bfunc":"1.5",
"cfunc":"3",
"x":"(a+u*cos(v))*sin(b*pi*u)",
"y":"(a+u*cos(v))*cos(b*pi*u)+c*u",
"z":"u*sin(v)",
"umin": 0,
"umax": 1,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"AppleSurface",
"x":"cos(u)*(4+3.8*cos(v))",
"y":"sin(u)*(4+3.8*cos(v))",
"z":"(cos(v)+sin(v)-1)*(1+sin(v))*log(1-pi*v/10)+7.5*sin(v)",
"umin": 0,
"umax": 2*pi,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"Trefoil",
"x":"2*sin(3*u)/(2+cos(v))",
"y":"2*(sin(u)+2*sin(2*u))/(2+cos(v+2*pi/3))",
"z":"(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+2*pi/3))/4",
"umin": -pi,
"umax": pi,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"Kranz",
"x":"cos(u+4)/3",
"y":"cos(u)*sin(v)*cos(v)*sin(u)*cos(v)+0.5*cos(u)",
"z":"cos(v)*sin(u)*cos(u)*sin(v)",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.append( {"name":"AstrocerasShell",
"afunc":"1.25", #a
"bfunc":"1.25", #b
"cfunc":"1.0", #c
"ffunc":"3.5", #h
"gfunc":"0.", #k
"hfunc":".12", #w
"x":"exp(h*u)*(f+a*cos(v))*cos(c*u)",
"y":"1*exp(h*u)*(f+a*cos(v))*sin(c*u)",
"z":"exp(h*u)*(g+b*sin(v))",
"umin": -40,
"umax": -1,
"uwrap": False,
"vmin": 0,
"vmax": 2*pi,
"vwrap": False,
"resolution": 128
} )
samples.append( {"name":"MyaArenariaShell",
"afunc":"0.85", #a
"bfunc":"1.6", #b
"cfunc":"3.0", #c
"ffunc":"0.9", #h
"gfunc":"0.", #k
"hfunc":"2.5", #w
"x":"exp(h*u)*(f+a*cos(v))*cos(c*u)",
"y":"1*exp(h*u)*(f+a*cos(v))*sin(c*u)",
"z":"exp(h*u)*(g+b*sin(v))",
"umin": -1,
"umax": 0.52,
"uwrap": False,
"vmin": 0,
"vmax": 2*pi,
"vwrap": False,
"resolution": 32
} )
samples.append( {"name":"NaticaStellataShell",
"afunc":"2.6", #a
"bfunc":"2.4", #b
"cfunc":"1.0", #c
"ffunc":"1.25", #h
"gfunc":"-2.8", #k
"hfunc":".18", #w
"x":"exp(h*u)*(f+a*cos(v))*cos(c*u)",
"y":"1*exp(h*u)*(f+a*cos(v))*sin(c*u)",
"z":"exp(h*u)*(g+b*sin(v))",
"umin": -20,
"umax": 1,
"uwrap": False,
"vmin": 0,
"vmax": 2*pi,
"vwrap": False,
"resolution": 128
} )
samples.append( {"name":"PseudohelicerasShell", #subcatenatum
"afunc":"1.6", #a
"bfunc":"1.6", #b
"cfunc":"1.0", #c
"ffunc":"1.5", #h
"gfunc":"-7.", #k
"hfunc":"0.075", #w
"x":"exp(h*u)*(f+a*cos(v))*cos(c*u)",
"y":"1*exp(h*u)*(f+a*cos(v))*sin(c*u)",
"z":"exp(h*u)*(g+b*sin(v))",
"umin": -50,
"umax": -1,
"uwrap": False,
"vmin": 0,
"vmax": 2*pi,
"vwrap": False,
"resolution": 128
} )
samples.append( {"name":"BulletNose",
"afunc": "0.9",
"bfunc": "1.2",
"x":"a*cos(v)*cos(u)",
"y":"-b/tan(v)",
"z":"a*cos(v)*sin(u)",
"umin": 0,
"umax": 2*pi,
"uwrap": False,
"vmin": 0.25,
"vmax": pi/2,
"vwrap": False,
} )
samples.append( {"name":"Paprika",
"afunc": "2",
"bfunc": "1.9",
"x":"cos(u)*(a+b*cos(v))+pow(v/pi,20)",
"y":"sin(u)*(a+b*cos(v))+0.25*cos(5*u)",
"z":"-2.3*log(1-v*0.3157)+6*sin(v)+2*cos(v)",
"umin": -pi,
"umax": pi,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
"resolution": 64
} )
samples.append( {"name":"Apple2",
"afunc": "5",
"bfunc": "4.8",
"x":"cos(u)*(a+b*cos(v))+pow(v/pi,20)",
"y":"sin(u)*(a+b*cos(v))+0.25*cos(5*u)",
"z":"-2.3*log(1-v*0.3157)+6*sin(v)+2*cos(v)",
"umin": -pi,
"umax": pi,
"uwrap": False,
"vmin": -pi,
"vmax": pi,
"vwrap": False,
"resolution": 64
} )
samples.append( {"name":"TrefoilKnot",
"afunc":"2",
"bfunc":"0.3",
"x":"(a+b*cos(u/2))*cos(u/3)+ b*cos(u/3)*cos(v-pi)",
"y":"(a+b*cos(u/2))*sin(u/3) + b*sin(u/3)*cos(v-pi)",
"z":"b+sin(u/2)+b*sin(v-pi)",
"umin": 0,
"umax": 12*pi,
"uwrap": False,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
"resolution": 128
} )
samples.append( {"name":"Soucoupoid",
"x":"cos(u)*cos(v)",
"y":"pow(sin(u),3)",
"z":"cos(u)*sin(v)",
"umin": -pi,
"umax": pi,
"uwrap": False,
"vmin": 0,
"vmax": pi,
"vwrap": False,
} )
samples.append( {"name":"Shell",
"x":"",
"y":"",
"z":"",
"umin": 0,
"umax": 2*pi,
"uwrap": True,
"vmin": 0,
"vmax": 2*pi,
"vwrap": True,
} )
samples.pop()
def add_xyz_object(helper=h, param=samples[0], resolution=32):
p = param
afunc = "0"
bfunc = "0"
cfunc = "0"
ffunc = "0"
gfunc = "0"
hfunc = "0"
if "afunc" in p:
afunc = p["afunc"]
if "bfunc" in p:
bfunc = p["bfunc"]
if "cfunc" in p:
cfunc = p["cfunc"]
if "ffunc" in p:
ffunc = p["ffunc"]
if "gfunc" in p:
gfunc = p["gfunc"]
if "hfunc" in p:
hfunc = p["hfunc"]
if "resolution" in p:
resolution = p["resolution"]
(verts, faces) = add_mesh_extra_objects.add_mesh_3d_function_surface.xyz_function_surface_faces(
h, p["x"], p["y"], p["z"], p["umin"], p["umax"], resolution, False, p["vmin"], p["vmax"], resolution, False,
afunc, bfunc, cfunc, ffunc, gfunc, hfunc, 1, False)
create_mesh_object(bpy.context, verts, [], faces, p["name"])
obj = bpy.context.active_object
print(p)
return(obj)
add_xyz_object(param=samples[-1])
for i in range(len(samples)):
if True or "NoDrop" in samples[i]["name"]:
o = add_xyz_object(param=samples[i])
print("this was:", o.name)
if "Klein_" in o.name:
print("2 parts .. no move")
else:
o.location[1] = 5 - (i % 5) * 2
o.location[0] = -3
o.location[2] = int(i/5)
```