Grasshopper

algorithmic 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 

Views: 3825

Replies to This Discussion

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)

 

i will try that, thanks :)
but is there something in grasshopper, that translates the string? 

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

Hi, We have released an add-on called "Quokka" to get Kinect data to grasshopper (quokkalab.com) , Give it a try! 

thanks, its awesome, like one month on the trash ;)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service