algorithmic modeling for Rhino
Hi Kameron,
You can do a REST (Representational State Transfer) for that. The question is, in which format you transfer the data to GH. Usually in REST API's jason or XML are common formats. I'd recommend to use XML, cause there are already some plugins for GH to read the xml...search for gHowl for example.
I've added an example with a simple C# script, to output the XML to GH, so you don't need a plugin for now.
Here is the php code of this simple REST API:
<?php
$data1 = array(
"one",
"two",
"three",
"hello",
"world"
);
$data2 = array(
"area" => "1234.93489",
"diameter" => "38994784",
"lengths" => array(
"238748.43",
"238972897.92198"),
"something" => "238775.2874"
);
function getData($array){
$out = '';
foreach($array as $key => $value){
if(is_array($value))
$value = getData($value);
if(is_numeric($key))
$out.='<item>'.$value.'</item>';
else
$out.='<'.$key.'>'.$value.'</'.$key.'>';
}
return $out;
}
header ("Content-Type:text/xml"); ?>
<myXMLDocument>
<?php if($_REQUEST['select']=='data2') echo getData($data2); else echo getData($data1); ?>
</myXMLDocument>
I think this is pretty clear if you understand basic php. Tell me if you need help with the code.
Hope this helps.
Cheers
FF
Holy Moley Batman!
Florian you may have single handedly saved my projection mapping final! Thanks! I have a php facebook site that is pulling user data which grasshopper is doing some data management and pairity, and then sending a UDP message to Max to be interpreted and projected onto a face.
Once again thank you for the help!
Glad that it helped you with your project.
Hope you can post some pics on the forum, once it's finished ;-)
Have a nice day,
FF
Expect them Friday!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by