This code is a script for importing points from the Mach3 Digitize Wizard to the Blender Environment. The code below should be copy and pasted into the Blender “Scripting” Window. Once pasted the path needs to be changed in the code. This path should point to your own digitized points file.
import bpy #import the blender module
############ PLEASE SPECIFY YOUR PATH AND FILE FOR DIGITIZING DATA ###################
#path='Insert Path here' eg 'C:\Users\Me\Documents\DigitizingData\Mydata.txt'
path='C:\\text.txt'
######################################################################################
#Open the file
try:
f=open(path, 'r')
except:
print ("Path is not Valid")
#Create an array of vertices
ve=[]
for line in f: #Go through file line by line
try:
read=f.readline().split(',') #Read a line, split it on the comma
ve.extend( [float(read[0]), float(read[1]), float(read[2])] ) #Extend the array
except:
print ("Could not use the line reading: %s"%read)
# Create a new mesh, it is now empty
mesh = bpy.data.meshes.new("Cube")
# Create empty vertices field in the mesh
mesh.vertices.add(len(ve)/3)
# Add vertices
mesh.vertices.foreach_set("co", ve)
#Add a new empty object named "My Digitized Data"
obj = bpy.data.objects.new("My Digitized Data", mesh)
# Link object to current scene
bpy.context.scene.objects.link(obj)