Grasshopper

algorithmic modeling for Rhino

Hello Everyone.

Is there the chance to export a file with a list of all the components used/present in a definition and how often they have been used? I would need it for educational purposes.

eg.

point:4 components

move: 6 components

y vector: 2 components

scale: 1 component

...

and so on

Thanks

Lorenzo

Views: 1027

Replies to This Discussion

Well you can save a Grasshopper file as a .ghx file, which is just a plain text XML file. So then you just need a little script that goes through it and finds the names and so on. You can do this in Grasshopper as well. I'll give it a little try, as I would also like that.

What you are looking for is this line (just an example):

<item name="Name" type_name="gh_string" type_code="10">Divide Curve</item>

Thanks Armin, I will very much look for that. I'll also give it a try, but my look-for-strings-and-text-in-grasshopper skills are not that good.

thanks!

Here's a simple method using GHPython that might help:

Attachments:

Fantastic!

thanks Andres.

ps. on the "group" component shows 90 instances where there are only a few. any idea?

Could you please sort them according to how often they are used?

There you go, I also added a check so that the GHPython component which does the counting as NOT included in the data.

Attachments:

Thank you!

Wow, thanks, thats awesome. Can finally marble at my creation and back it up with solid numbers :D

I noticed it doesn't count anything in clusters. Is that possible, since large parts of my documents are organised in nested clusters.

Haha, yes, indeed :)

I believe a cluster is technically a Grasshopper document within a Grasshopper document (turtles all the way down style potentially!). Meaning that you would have to jump into a cluster to count its components (either via code or manually by placing the script component in each cluster and outputting its data to the main document).

Okay that makes sense. I seem to think of clusters differently and not as separate documents. But I guess thats because in the other visual programming tools I use all the time (vvvv) clusters are actually separate files, which is much nicer to work with on large projects, because versioning of large parts becomes much easier. Maybe one day I can place 1 GH file into another and be very happy. :)

Neat. Could you share the component please? :)

Pretty sure it's the same* component with a new icon slapped on top ;)

170330_CountComponentsOnGHCanvas_01.gh

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