Grasshopper

algorithmic modeling for Rhino

Hi all,

I wish to write all the binary combinations that exist in X number of figures,

so it's structure would be (for a 2 figure binary toggle)

{0}

(0) 0

(1) 0

{1}

(0) 0

(1) 1

{2}

(0) 1

(1) 0

{3}

(0) 1

(1) 1

any ideas how I can generate such a list?

Seasons Greetings,

K

Views: 1391

Replies to This Discussion

not particularly flexible, but if you don't want N to be variable, this will do the trick.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Oh I'm sorry, this is the scripting forum, missed that.

Convert.ToString(int, int)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

Firstly, congrats for your work, respect.

So, I am trying to list all the possibilities of trusses from ground structure method for 6 node 15 member truss. All the possibilities that exist 2^15 are being listed. Later I will use this info to cull;

all instances where important nodes are not present,

geometric unstable trusses using Grubler's criterion,

the remainder will go to FEM for further analysis,

I can use this method but i require to separate each binary boolean

so they are stored separately like so;

{0}
(0) 0
(1) 0
(2) 0
(3) 0
(4) 0
. .
. .
. .
. .
(15) 0

{1}
(0) 1
(1) 0
(2) 0
(3) 0
(4) 0
. .
. .
. .
. .
(15) 0

{2}
(0) 0
(1) 1
(2) 0
(3) 0
(4) 0
. .
. .
. .
. .
(15) 0

(I know there must be an easier scripted way how to do it) or else is there a way to decompose them directly from the method you sent me using standard Grasshopper components?. Any method would work.

Best,

Kane

Once you have a string with zeroes and ones, it's easy to convert it into an array of booleans or integers. I attached a script that does this I think.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks, Perfect !

Best wishes,

K

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