Created
November 19, 2014 17:48
-
-
Save MetroWind/4ef42d74e0fe322ac7db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from mathutils import Vector | |
w = 1 # weight | |
Scale = 0.03 | |
def readCoords(filename): | |
with open(filename, 'r') as File: | |
Coords = [[float(x) * Scale for x in line.split()] for line in File] | |
return list(map(Vector, Coords)) | |
ListOfVectors = [Vector((0,0,0)),Vector((1,0,0)),Vector((2,0,0)),Vector((2,3,0)), | |
Vector((0,2,1))] | |
ListOfVectors = readCoords("/Volumes/Stuff/3d/Lorenz/3d-data.txt") | |
def makePolyLine(objname, curvename, cList): | |
curvedata = bpy.data.curves.new(name=curvename, type='CURVE') | |
curvedata.dimensions = '3D' | |
objectdata = bpy.data.objects.new(objname, curvedata) | |
objectdata.location = (0,0,0) #object origin | |
bpy.context.scene.objects.link(objectdata) | |
polyline = curvedata.splines.new('NURBS') | |
for i in range(len(cList)): | |
# bpy.context.scene.frame_set(i+1) | |
if i > 0: | |
polyline.points.add(1) | |
x, y, z = cList[i] | |
polyline.points[i].co = (x, y, z, w) | |
makePolyLine("NameOfMyCurveObject", "NameOfMyCurve", ListOfVectors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment