1
$\begingroup$

The idea was to use this script below from Convert Curves to Grease Pencil? to generate gpencil strokes from curves (poly spline type) and use them with a Bsurfaces addon (ver 1.5) to make a mesh in Blender 2.74.

import bpy
from mathutils import Vector
def convert_curve_to_gp(obj):
    #---- CHANGED ----
    scene = bpy.context.scene
    mesh = obj.data
    layer = scene.grease_pencil.layers.new("layer", set_active=True)
    frame = layer.frames.new(scene.frame_current)
    #---- /CHANGED ----
    mesh = obj.to_mesh(scene, apply_modifiers=False, settings='PREVIEW')
    for edge in mesh.edges:
        stroke = frame.strokes.new()
        stroke.draw_mode = '3DSPACE'
        stroke.points.add(2)
        stroke.points[0].co = obj.matrix_world * Vector(mesh.vertices[edge.vertices[0]].co)
        stroke.points[1].co = obj.matrix_world * Vector(mesh.vertices[edge.vertices[1]].co)
    bpy.data.meshes.remove(mesh)

obj = bpy.context.object
convert_curve_to_gp(obj)

When Bsurfaces is used by clicking on its Add surface button it generates an error:

AttributeError: 'GPENCIL_OT_SURFSK_add_surface' object has no attribute 'original_curve'

and it creates a new curve object.

$\endgroup$
  • $\begingroup$ See if my answer here helps. Different problem, but may help. $\endgroup$ – David Apr 5 '16 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.