XML to GH?

unhandled

#1

Hello I am a newbie user and found a code in the internet that i want to use, but the thing is that it seems to be scripted and I have no clue how to open it in grasshopper.

http://home.fa.utl.pt/~al7486/mod_geom/ex09-7486-ruimota.ghx


(David Rutten) #2

Just download that file and make sure the extension is ghx instead of xml (the link claims ghx, but sometimes browsers will change the file extension for no good reason), then open that file in Grasshopper.


#3

how can i download it?i cant see any button to make the download


#4

Right click > Save As…


#5

The file is .txt, not .ghx, but I managed to convert it:
file.ghx (1.4 MB)


#6

thanks man, how you did it? so i don’t need to ask again :smiley:


#7
private void RunScript(string x)  {
  try{
    GH_IO.Serialization.GH_Archive ar = new GH_Archive();
    ar.Deserialize_Xml(x);
    Print(
        ar.WriteToFile(
        "C:\\Users\\Dani\\Desktop\\Nueva carpeta\\file.ghx",
        true, false).ToString()
    );
  }catch(Exception e){
      Print(e.ToString());
  }
}

You have to add reference to the GH_IO.dll.


(David Rutten) #8

Whoa whoa. Xml is text, just with a different extension.

All you have to do is right click on that link @Leonardo_G_Pate posted, Save As… to your desktop, make sure the extension is indeed ghx as the link claims, and then just start Grasshopper and open it.