not certain here what does
a wrapped editmesh
means ?
is it like going into edit mode ?
i’ll experiment with these new examples
i did some testing with the example in wiki page
add a bmesh circle then it does a spin
a tried this with a cross section i did an it did not work
not certain what the process is here ?
i did find a way to make it work but it is proably not the proper way
##
class gabrielhorn1(bpy.types.Operator):
'''Add Gabrielhorn'''
bl_idname = "mesh.primitive_gabrielhorn_add"
bl_label = "Add Gabrielhorn"
bl_options = {'REGISTER', 'UNDO','BLOCKING'}
segh1 = IntProperty(name="Segments",description="Number segments",default=32, min=4, max=100)
segv1 = IntProperty(name="Segments",description="Number segments",default=12, min=4, max=100)
diammax= FloatProperty(name="diammax",description="diammax",default=2, min=1, max=100.0)
diammin= FloatProperty(name="diammin",description="diammin",default=0.1, min=0.01, max=100.0)
def execute(self, context):
global layers
verts,edges,faces,vid= [],[],[],0
bm = bmesh.new() # Create new Bmesh mesh
named1="Gabrielhorn"
segh1 = self.properties.segh1
segv1 = self.properties.segv1
diammax= self.properties.diammax
diammin= self.properties.diammin
# Y = 1/ x then Spin around X axis to get Gabriel horn
minag,maxag=diammax,1/diammin
step1=(maxag-minag)/(segh1)
print ('minag =',minag,'maxag =',maxag,' step1 =',step1)
for n1 in float2_range(minag, maxag, step1):
XC=n1
YC=1/XC
ZC=0
print ('N1 =',n1,'XC=',XC,'YC=',YC,' vid=',vid)
verts.append(bm.verts.new((XC,YC,ZC))) # Add vertices
if vid > 0: # Add edges
print (' vid=',vid,' vid-1=',vid-1)
edges.append(bm.edges.new((bm.verts[vid-1], bm.verts[vid])))
vid+= 1
# SPIN 360
ret = bmesh.ops.duplicate(
bm,
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
geom_dupe = ret["geom"]
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
del ret
bmesh.ops.rotate(
bm,
verts=verts_dupe,
cent=(0.0, 0.0, 0.0),
matrix=Matrix.Rotation(radians(360.0), 3, 'X'))
edges_start_a = bm.edges[:]
geom_start_a = bm.verts[:] + edges_start_a
ret = bmesh.ops.spin(
bm,
geom=geom_start_a,
angle=radians(360.0),
steps=8,
axis=(1.0, 0.0, 0.0),
cent=(0.0, 0.5, 0.0))
edges_end_a = [ele for ele in ret["geom_last"]
if isinstance(ele, bmesh.types.BMEdge)]
del ret
adddata1(bm,named1,verts)
return {'FINISHED'}
here i simplified the script
and added a function to add ob/mesh to scene
is there a shorter way to make the spin 360 degrees around an axis
with the spin command or may be use the other command for rotate around an axis?
thanks