# Straight Lines with no Face, Freestyle

I have a rather lenghty question. Following situation:

I have a external tool, which can submit data via a TCP-Socket to a modal operator running in Blender-Python.

For normal Meshes and primitives this works just fine. But the tool offers the possibility to render so called PolyLine which is just a number of vertices with edges which are drawn as screen-space lines. There are used for highlighting constraints for different algorithms.

I want Blender to emulate these lines but I cannot think of a way that works good.

I tried to use the "skin" modifier on the face-less lines which works but has the big problem of thickness. I cannot say how big the transmitted mesh is so the skin-thickness is hard to determine.

Then I tried using the Freestyle-Module but encountered a problem with visibility. Sometimes the lines are just ignored or they are drawn eventhough they are occluded.

Is there a way to draw lines with Blender that I missed?

I'm sorry, I know this is a very vague question and I don't really know how to explain it.

Greetings, Dragonseel

P.S. a picture of the PolyLine as they appear in the external tool.

I would use a curve to show the lines. Setting the bevel_depth of a line gives a simple tube like result. By default this uses only four sides but you can increase the bevel_resolution to get a rounder result.

import bpy

def createLine(lineName, pointList, thickness):
# setup basic line data
theLineData = bpy.data.curves.new(name=lineName,type='CURVE')
theLineData.dimensions = '3D'
theLineData.fill_mode = 'FULL'
theLineData.bevel_depth = thickness
# define points that make the line
polyline = theLineData.splines.new('POLY')
for idx in range(len(pointList)):
polyline.points[idx].co = (pointList[idx])+(1.0,)

# create an object that uses the linedata
theLine = bpy.data.objects.new('LineOne',theLineData)
theLine.location = (0.0,0.0,0.0)

# setup a material
lmat = bpy.data.materials.new('Linematerial')
lmat.diffuse_color = (0.0,0.0,1.0)