algorithmic modeling for Rhino
It is possible, but I think you'll have to write a lot of code in VB/C# components to do it.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Please, if it possible, can you make a text serch component - to find a symbol or a text in the search text and figure out the index of first symbol of the search in the source text?
This will be so cool and handle...
I am just wondering if anyone has added any HTML parsing components since this thread was written. If not, I will consider writing some in python and publishing them, but my programming background is not terribly impressive. Before I undertake this, however, I would like to make sure that nothing else is available at this point in time... does anyone know of any plugins that offer this type of functionality? How about any plugins that extend GH's basic string manipulation?
I don't think so.
I recommend you to use lxml.html module in python, which parses html. With the python component in grasshopper, you can use lxml.html in grasshoppr
Thanks, Philipp. I'll give it a look!
Hi Philipp,
i've done this for a project long time ago. It's pretty simple with C#, when you use a library called "HTML Agility Pack". I've attached a GH Definition with this library and a really short code example.
string source = (new System.Net.WebClient()).DownloadString(url);
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(source);
HtmlNode table = doc.GetElementbyId("installers");
DataTree result = new DataTree();
foreach(HtmlNode row in table.Descendants("tr"))
{
GH_Path path = new GH_Path(table.Descendants("tr").ToList().IndexOf(row));
foreach(HtmlNode column in row.Descendants("td"))
result.Add(column.InnerText.Trim(), path);
}
A = result;
Thats it. I hope this helps...
Cheers,
FF
The GH definition ...would not upload with the first reply hm :-/
Hi Florian,
I tried using your component and for some reason whatever I do the C# component fails to import the HtmlAgilityPack.dll library. Any idea why this could be happening?
Best,
Chris
Hi Christopher,
i just reopened the script and it's working as it was in 2015. Please check following things:
1.) HtmlAgilityPack.dll requires at least .Net Framework 4.0
2.) Update to the latest Grasshopper and Rhinoceros version.
3.) Unblock the HtmlAgilityPack.dll if necessary, by opening properties (right-click in file browser and click "unblock" on properties dialog)
4.) Save the GH and DLL file in a different directory...e.g Documents and try to run the script again.
Hope this works,
FF
Thanks Florian - #3 was the problem, I had to "unblock" the library. This works great! Thanks for your help.
Also @William Carroll - Eagles Fly High.
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