Problems with importing data set in Blender 2.49

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Eine_Kleine_Hexe
Posts: 2
Joined: Wed Aug 22, 2012 3:19 pm

Problems with importing data set in Blender 2.49

Postby Eine_Kleine_Hexe » Wed Aug 22, 2012 3:28 pm

Hi,
I've just have started to work with Blender and have a problem with importing data in it...

I have a point cloud data and importing it to Blender via Python script

import cPickle
import Blender
import numpy as np


from deflectometry.geometry.mesh import Mesh


def visualize(fn):
pts = cPickle.load(open(fn,"rb"))

# Bring the points to blender
m = Mesh()
pts = np.asarray(pts)

# pts /= 1000.maybe when converting from mm to blender units
m.verts = pts
return m.to_blender(fn[:-4])
visualize("result.pck")

With the first variant of pts representation it gives an error. With the second one there is no error, but data is not displayed at all... What could be wrong here? :(

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Wed Aug 22, 2012 8:18 pm

Using a Code tag would help preserve the indentation.

I don't see what you mean by 1st & 2nd variants.

Eine_Kleine_Hexe
Posts: 2
Joined: Wed Aug 22, 2012 3:19 pm

Postby Eine_Kleine_Hexe » Wed Aug 22, 2012 10:43 pm

stiv wrote:Using a Code tag would help preserve the indentation.

I don't see what you mean by 1st & 2nd variants.


Under the first variant I mean not commented equation for pts _and under the second - commented instruction for calculation

In both cases Blender just doesn't react on the starting of the script....

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Wed Aug 22, 2012 11:58 pm

It looks like (hard to tell without the indentation) you are creating stuff inside a function which returns something, but you never assign that something to a variable. In the meantime, everything inside the function has gone out of scope and disappeared.


Return to “Python”

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests