Grasshopper

algorithmic modeling for Rhino

hi everyone,

I´m playing with the TUIO library for multitouch surfaces. I found there´s an implementation for C#, how is it possible to insert it in a script component in GH?

cheers

Views: 1178

Replies to This Discussion

From the readme file of the C# download:

Demo Applications:
------------------
This package contains two demo applications which are able
to receive TUIO messages from any TUIO enable tracker.

* TuioDump prints the TUIO events directly to the concole
* TuioDemo draws the object and cursor state on the screen

You can use these demo applications for debugging purposes,
or use them as a starting point for the development of your own
C# applications implementing the TUIO protocol. Please refer to
the source code of the both examples and the following section.


These are not libraries. They are visual studio projects you will need to compile. Once compiled they will run small apps to test connectivity with the devices. Connectivity with the devices happens through Open Sound Control (osc) which is using UDP anyways. It seems like the TUIO protocol is a very refined parser for those UDP packets (maybe creates a vector from a gesture and sends that), but I have not dug too deep into it.

What we would need to see is which files contain just the library...TUIO_LIB for example. Maybe that will compile into a useful library...
so, I would have to compile it into a library (with visual studio or whatever) and then?
how could I insert it into gh?
Hi Miguel - I know next to nothing about Grasshopper. I have never used Grasshopper. I'm just lurking here on the forums because it's interesting, so maybe later I'll use Grasshopper. But C# and VB.Net are my daily tools.

Perhaps Luis can verify this: I assume to use C# from Grasshopper the C# code must be packaged in a .DLL - Luis, is that so?

If Grasshopper can use C# .DLLs, read on, otherwise the rest of this is low-value text.

And even if Grasshopper can use C# .DLLs, be warned that I expect some re-coding will be needed to get this TUIO code to do anything with Grasshopper.

You will need Visual Studio 2008 or C# Express 2008 (Express versions are free. Visual Studio is not free).

Download and unzip the TUIO source code. In C# Express open the .sln file. The code must have been written in C# 2005, because C# 2008 will ask to convert. Just click the usual buttons to convert. On my machine the conversion was painless and error-free.

Visual Studio lets people organize sets of related code projects into solutions (.sln files represent solutions). After conversion of the TUIO solution you will notice the solution contains three related C# projects: TUIO_DEMO, TUIO_DUMP and TUIO_LIB.

And now we get to the indications that some re-coding will be needed. TUIO_DEMO builds to a windows application .EXE, so would ignore that piece. TUIO_LIB builds to a .DLL file, so you likely keep that. The problem is TUIO_DUMP. TUIO_DUMP builds to a console .EXE file.

If Grasshopper requires DLL files, then what you will want to build is one new DLL file. This one new DLL will contain all the source for TUIO_LIB, likely without requiring any changes. Good.

The bad news is that TUIO_LIB has defined it's own client interface, and the best way to deal with that is probably: to understand and edit the code in TUIO_DUMP. The goals of the TUIO_DUMP edits will be 1) to support the interface that TUIO_LIB defines (and requires), and 2) to get the TUIO data up into Grasshopper somehow. As indicated above, I don't know exactly how Grasshopper interfaces with C# code. I just assume based on Luis' response that there is some reasonable way.

So, to build that one new DLL you would combine all the unedited TUIO_LIB C# source files and the edited TUIO_DUMP C# sojurce files into a single new C# project. That new project would be a C# library project (also called DLL project).

Hopefully I'm wrong and this will take less work that I have outlined.

Good luck in any case :-)
Ouch, that sounds rather complicated.

It's possible to reference a DotNET dll from within a VB or C# scripting component. But you'll indeed have to build that dll first.

If you really have to change the TUIO source code to short circuit a hard-coded GUI... well, to paraphrase Mr. T: "I pity the fool who's about to spend 3 weeks trying to change someone else's code!"

Please be absolutely sure you can call into the TUIO assembly before you start to edit the source.


--
David Rutten
david@mcneel.com
Poprad, Slovakia
ok, thanks for your explanations, both of you.

unfortunately, I never used visual studio or similar. I never had the need to code a huge solution. I only tried eclipse.

the whole stuff seems rather tricky. I´ll get down to it and see what I can do. I´ll definetely focus on just trying to make a .dll and insert it into gh. I don´t feel capable of starting to recode the whole solution. anything, I´ll let you know.

anyway, if I finally get to have a fine .dll, how can I play with it in gh?
Reference the assembly by right-clicking the c# component ...
ok, great!

thanks, luis.

I hope I´ll end up doing somethig fine with this TOUI. let´s see ...

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service