Grasshopper

algorithmic modeling for Rhino

Forgive my apparent ignorance, but I've only picked up grasshopper recently and have endeavoured to get to grips with it, without the need to pester the office's resident grasshopper/CAD monkey (he's a busy chap these days) and searching on these boards revealed very little.

Whilst a lot of the functions and methodology all comes across as quite logical, I find movement of simple objects to confuse me each and every time. Currently I've set up a very simple function that measures the input rectangle (pre drawn in rhino), segments it into blocks using Recgrid and then find the 0,0,0 point of each grid square by using Hframes and a value of 1. Using these Hframes I create a rectangle the size of the aforementioned segments, but when they are created, the Hframes are at their centre, so they appear to be staggered down and to the left if viewed from top down perspective.

How on earth can I move these rectangles so that their 0,0,0 point sits on the Hframe 0,0,0 point (i.e. they lie in the exact same position as the grid?). Bear in mind I can't rely on a constant X/Y axis (hence using Hframes) as this function will be used to divide larger city areas into smaller city blocks.

Thanks.

(attached: red grid is Recgrid construction, green grid are the rectangles I created that need to be moved in line with the red grid)

Views: 7415

Attachments:

Replies to This Discussion

Hi Daniel,

you need to find two points, one on the green grid and a corresponding one on the red grid. Then construct a vector between these two points, and feed that vector into the Move component. If you only supply a single motion vector, then all the geometry that you move will use that one vector.

If you want to move a bunch of objects with different translation (move) vectors each, you'll have to generate N vectors for N objects.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hehe...
Thanks for the reply David, that helped, was easy to define a point on the red and green grid given the bottom left hand corners are both their respective 0 string when exploding a tree, so creating a vector was simple, regardless of the number of grid squares (the first square is always created from the same point). Solved (and thanks to the input from my resident CAD monkey as well)

Now, again a question of vectors and moving objects. I have a set of Hframes spread across a curve (spread at random) and at these Hframes I create a series of boxes. I then want to move these boxes at right angles to the tangent of the curve at the point of the Hframe. Given Hframes orientate themselves to the tangent of the curve, regardless of thecurve's XY orientation, how can I use them to define a vector 90 degrees to the tangent? Unfortunately, yet again, I can't rely on a straight line curve (otherwise it would be easy to use endpoints, 2ptvector and rotate), hence the need for tangents, I think?

I know dividedistance would give me a tangent and a point at which to create boxes, but this also creates 'rogue' multiple boxes at the end points of the curve?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service