I am trying to make a python script that creates a 3-d graph and automatically puts certain edges in a freestyle line group. So far I am able to create a surface with the code
import bpy
from bpy.types import Operator
from bpy.props import FloatVectorProperty
from bpy_extras.object_utils import AddObjectHelper, object_data_add
from mathutils import Vector
import bpy
import bmesh
import numpy as np
xmin,xmax,ymin,ymax = -3,3,-3,3
N = 30
def f(x,y):
return (np.sin(2*x)+np.sin(2*y))/2
verts = [Vector((x,y,f(x,y))) for y in np.linspace(ymin, ymax, N) for x in np.linspace(xmin, xmax, N)]
faces = [(i+j*N, i+1+j*N, i+1+(j+1)*N, i+(j+1)*N) for i in range(N-1) for j in range(N-1)]
mesh = bpy.data.meshes.new(name="New Object Mesh")
mesh.from_pydata(verts, [], faces)
mesh.update(calc_edges=True)
obj = bpy.data.objects.new('new object', mesh)
obj.location = Vector([0,0,0])
scene = bpy.context.scene
scene.objects.link(obj)
scene.objects.active = obj
obj.select = True
I would like every other line of edges to be marked as a freestyle edge. By hand, I would go to edit mode > edges, alt+click on every other edge (to select the whole line of edges) and then do a "Mark Freestyle Edge". However, I would like my script to automatically mark the edges when the mesh is created.
object.data.edges[0].use_freestyle_mark
$\endgroup$