# vertices[:][vnum+3] = vertices[:][vnum-nfaces*4 + 4] # 4 -> 16+4 # vertices[:][vnum+3+1] = vertices[:][vnum-nfaces*4 + 4 + 1] # vertices[:][vnum+3*2] = vertices[:][vnum-nfaces*4 + 4*2] # vertices[:][vnum+3*2+1] = vertices[:][vnum-nfaces*4 + 4*2 + 1] # vertices[:][vnum+3*3] = vertices[:][vnum-nfaces*4 + 4*3] # vertices[:][vnum+3*3+1] = vertices[:][vnum-nfaces*4 + 4*3 + 1] # vertices[:][vnum+3*4+1] = vertices[:][vnum-nfaces*4 + 4*3 + 1] meshname = 'mymesh' meshlocation = (0,0,0) plot_index = 0 # now, generate mesh... hopefully deselect_all() nftype = [("f1","int"),("f2","int"),("f3","int"),("f4","int")] #newfaces = np.empty(int(len(vertices)/3.), dtype=nftype) # store sets of face colors newfaces = np.empty(int(len(vertices)/4.), dtype=nftype) cc = 0 for i in range(0,int(len(vertices)/4.)): newfaces[i] = (cc, cc+1, cc+2, cc+3) cc = cc+4 me = bpy.data.meshes.new(meshname+"Mesh") ob = bpy.data.objects.new(meshname,me) ob.location = meshlocation # position object at 3d-cursor bpy.context.scene.objects.link(ob) # Link object to scene # Fill the mesh with verts, edges, faces me.from_pydata(vertices.tolist(),[],newfaces.tolist()) me.update(calc_edges=True) # Update mesh with new data
MakePolyLine(sname, ssname, tuple(map(tuple,stream))) obj = bpy.data.objects[sname] obj.data.fill_mode = 'FULL' obj.data.bevel_depth = 0.1 obj.data.bevel_resolution = 15 # don't think we want this part #solidify = obj.modifiers.new(type='SOLIDIFY', name="make_solid") #solidify.thickness = -0.02 # now, we need to make this thing into a mesh # (1) select object science.deselect_all() bpy.data.objects[sname].select = True bpy.context.scene.objects.active = bpy.data.objects[sname] # (2) make sure you are in object mode bpy.ops.object.mode_set(mode='OBJECT') # (3) alt-c -> then convert to mesh : bpy.ops.object.convert(target='MESH') # -> note - you can't see the faces unless you are in edit mode bpy.ops.object.convert(target='MESH') def duplicateObject(scene, name, copyobj): # Create new mesh mesh = bpy.data.meshes.new(name)