Grasshopper

algorithmic modeling for Rhino

Hi,

I'm very new to Kangaroo and have some very small success in getting it to work, however this time the intention for me is pretty complex and I'm unsure about why this script refuses to run.



Basically what I am trying to do (or what I'm working up to) is randomly generating these boxes, then moving them towards each other, basically a packing algorithm. I know the next step will be the make the boxes rigid so they do not intersect but for the moment all i want to do is have them move towards each other. I've tried atm to make the corners of the boxes the attracting elements for now, then use the median points of each as the lines they will follow. I'm getting the following runtime error

1. Solution exception:Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

No idea what that means. Any help would be appreciated and if anyone see anything glaringly wrong with the script asides from what I've mentioned I would appreciate it being pointed out too

Cheers

Views: 617

Attachments:

Replies to This Discussion

Hey Charles,

I did something similar to this, in my case I was trying to stack randomly generated rectangles. What I learnt from this experience is that stacking algorithms are very tricky and hard to implement and that free solutions do not exist at the moment (by the means of a plugin I mean, I would mention PackRat, try it if you want, but it didn't work for me that well).

I also realised that there should be some kind of additional algorithm that would check the gaps between generated rectangles and eliminate cases with tiny gaps (if you have a size threshold and I did) by resizing already generated shapes to close it up (in cases with a large gap it could be filled with a smaller rec within the threshold). In your case I think there is no need for that, because you have strings pulling the shapes to each other, why not try centroids?

Anyway, random shapes create too many problems and I'd suggest try to go with incremental sizes, for example my random rectangles had sides generated by random integers multiplied by the increment (10cm), in this case it was easier to manage the whole colection despite the fact that I didn't achieve a successful packing algorithm.

Oh, I forgot to mention that I used Anemone to loop the whole process, Kangaroo wan't involved. I would like to try Kangaroo to tackle the problem later on. 

I hope my experience can give you an insight, hope to see a post about your results. I might as well learn something from your case, good luck.

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