generative modeling for Rhino
I and a teammate tried to collect the xyz data of the kinect and then we tried to import through a tcp client written in rhino.python to grasshopper. The problem is that the data comes as a string, is there any string to number add-on or anyone can help us, we are new in grasshopper and python, we will be very happy for every answer.
Best greetings,
richard and sebastian
Tags: grasshopper, kinect, line, string
Permalink Reply by Benjamin Golder on December 5, 2011 at 4:54pm Can you post an example of the data coming in?
I can't see much detail in that image.
if the data is a series of XYZ numbers, delimited by commas:
2,4,3
2,4.2,3.5
2.3,4.5,4.1
then you can convert one line into a point like so:
import Rhino
numbers = [float(n) for n in incomingXYZstring.split(',')]
point = Rhino.Geometry.Point3d(*numbers)
Permalink Reply by Richard Gomez on December 6, 2011 at 7:41am i will try that, thanks :)
but is there something in grasshopper, that translates the string?
Permalink Reply by Benjamin Golder on December 7, 2011 at 1:02pm I don't think that Grasshopper has an ascii to string converter, but this is generally very easy in python, or any other programming language. In python if 'x' represents the integer of an ascii character, then 'chr(x)' will return the corresponding letter/character.

The [Read File] component has a Parser... item in the menu that allows you to write a VB script that parses the entire file or every individual line.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by Suleiman Alhadidi on February 5, 2012 at 10:03pm Hi, We have released an add-on called "Quokka" to get Kinect data to grasshopper (quokkalab.com) , Give it a try!
Permalink Reply by Richard Gomez on February 8, 2012 at 10:53am thanks, its awesome, like one month on the trash ;)
Added by David Stasiuk 8 Comments 24 Likes
Added by stefano 5 Comments 8 Likes
© 2013 Created by Scott Davidson.
Powered by