Grasshopper

algorithmic modeling for Rhino

My goal: Grab a bunch of random geometry in separate layers created in rhino, reference it in grasshopper, and create a list of layers (strings) that represent that selected geometry. Ultimately I'd like to have geometry referenced by layer from the rhino through just a sample of the pre-existing geometry, which I will run area and volume calculations on.

Attempt: I used horster to reference the layers, and went create a cull pattern that would isolate the individual layers, but obviously the equality component doesn't work on strings. I'm basically looking for anything to drop duplicate strings.

Any ideas on how I could accomplish this? Alternate logic welcome :D

Views: 2495

Replies to This Discussion

Ok, nevermind. I have yet to play with "sets" because I didn't know what they were used for... but i have realized that "delete consecutive" is exactly what I was looking for. 

I'm going to leave this discussion up incase some one else has a similar problem.

Any good discussions on how people use sets?

Sets only work on simple data types (booleans, integers, (complex) numbers, strings, points, vectors, colours and domains). They are not actually proper mathematical sets because most Set components will allow you to input a collection of data with the same value occurring more than once.

Basically the Set component allow you to perform operations on collections of data, rather than individual elements. So, whereas the subtraction component takes one number and subtracts another number from it, giving you a third number, resulting in something like:

10 - 6 = 4

The Set subtraction (officially called Set Difference) operates on collections. It leaves the values untouched, but returns a new collection containing zero or more of the elements that were present in the input collections:

{A;B;C;D;E;F} - {B;E;F} = {A;C;D}

where A, B, C etc. could be any value of the types mentioned above. For example:

{4;6;8;"hello";"world";True} - {6;"world";True} = {4;8;"hello"}

Set components are quite useful, but be careful when using data types with floating point numbers, as they have to be exactly the same or Sets will treat them as two different members. I.e. 1.0 is not the same as 1.00000000000000000002

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Today I was trying something similar - thought I would share my results.

Essentially, I'm trying to select a bunch of different surfaces in Rhino, on a handful of different layers (named by program type). I wanted to get Grasshopper to sort these by layer, and return the total area for each program group, and extrude the base surfaces and bake the extrusions onto separate layers, with material colors set based on the input surfaces. Anyway, here's what I got... plugin req: Horster & Lunchbox.

Attachments:

Digging up an old one here.

Will's original question was about testing equality for a string or string fragment; this was to cull out all duplicates. Turned out that Delete Consecutive was what he wanted all along.

Going the other way though, is it possible to test string equality?

I have a set of curves defining gridlines from Revit, that are attributed to their grid name. For instance, I'd like to isolate all the gridlines from the east:

E1

E2

...

E(n)

Is there a way to test for this?

Thanks Tom,

I'm very novice when it comes to scripting via python/C#/VB... and while I understand that this works, is the operation I'm thinking of possible to native GH? Or is that just not the case?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service