Create gridlines in Python I'm making my own Python routines that distort space. I would like to visualise the effect of this distortion. To this end I want to create {x,y,z} aligned gridlines, so that I can observe the effect of the transformation on them.

So an x-aligned gridline would be say 1000 points between x=-50 and x=+50 with y=z=0, and the points would be joined to one another by line segments. 

How could I create such a gridline using Python?

I found resources such as: 


Scripts/Cookbook/Code_snippets/Three_ways_to_create_objects
askubuntu.com/..../how-to-make-a-mesh-by-using-python-script-on-blender
stackoverflow.com/.../how-to-create-a-simple-mesh-in-blender


but in each case it creates primitives from verts+faces, not verts+edges
You can create a grid primitive and remove the faces:
import bpy
import bmesh

sce = bpy.context.scene

me = bpy.data.meshes.new(&quot;Grid&quot;)
bm = bmesh.new()
bmesh.ops.create_grid(bm, x_segments=32, y_segments=32, size=50)
bmesh.ops.delete(bm, geom=bm.faces, context=3)
bm.to_mesh(me)

ob = bpy.data.objects.new(&quot;Grid&quot;, me)
sce.objects.link(ob)
sce.update()

This will give you a grid at origin, dimension x/y 100 and with 1024 vertices.

from_pydata():

it creates primitives from verts+faces, not verts+edges

You can either pass two sequences for verts and faces, or you give it verts and edges - it should work the same.