Copy object to points

Hi All

I’m certain that I remember seeing a script or similar, that will distribute an object to a number of points. Can anyone point me in the right direction, as search comes up empty (or at least not the right thread).

TIA, Jakob

Ah, I just remembered that @Jarek’s wonderful ArrayCrv+ script does just that - so problem solved!

There are a few of these floating around, here is my .py version…

–Mitch

CopyObjectToPoints.py (515 Bytes)

3 Likes

This script is amazeballs!!!

1 Like

Any way to copy a group or multi objects?

I monkeyed with Helvetosaur’s script - I know he’ll forgive me. If it works.

CopyObjectsToPoints.py (626 Bytes)

-Pascal

2 Likes

Perfect!

Hey Pascal and Helvetosaur…

Thanks so much for your scripts, they are super useful.

To take it one step further, is the following possible?
Is it possible to make a script which takes an object, a reference curve, and target curves, to allow the moving of geometry/blocks from that original curve to other curves?

It would be super useful be able to move that original object to hundreds of other curves, with the option to scale 1D, (2D?) or 3D; similar to orient. The option for target layer would be great too.

Does the image below make sense?

It’s essentially batch orient; which could be amazing to deliver blocks to many target curves with orientation and scale adjusted.

-Jeremy

I suppose most of this is possible.

I could imagine the following logic:

  • Select the original object and the reference curve.
  • Get the length and direction of the reference curve plus (and here is the hard part) establish some sort of geometric correspondence/relationship between the object and the reference curve, resulting in a point on the reference curve. Reference CurveStart to CurveEnd would be the ‘direction’.
  • Get the proportional distance from the reference curve start to the reference point so created
  • Get the reference CurveFrame (a plane) at the reference point

Then

  • On each target curve get the curve length, establish the proportional distance point from the curve start
  • Get the target CurveFrame at the target curve proportional length point.
  • Transform the object plane to plane from the reference curve frame to the target curve frame
  • Scale the object 1D or 3D according to the proportion of target curve length/reference curve length

The first complicated part is figuring out how to create the reference point on the reference curve… Bounding box center of the object pulled to the curve? something else? This is not obvious.

The second limitation will be that there might indeed be some twist between the reference curve frame and the target curve frame if the curves are in 3D. So the results might be somewhat unpredictable.

Here is a quickie Grasshopper prototype, you can see that issue #2 is the hard one to solve.

ProportionalOrient1.gh (17.8 KB)
OrientProportional.3dm (2.5 MB)

Edit: Here is perhaps a better attempt that tries to keep the plane orientation as straight up as possible. It also has a Scale 3D / Scale 1D toggle.
ProportionalOrient3.gh (23.3 KB)

1 Like

Amazing work Mitch… Can’t wait to test. I don’t really know exactly how the Orient command manages to circumvent the issues you mentioned, but I’m no expert haha

You can imagine the use of this right… for example. I wanted to make a truss bridge, using struts which are blocks. It doesn’t matter too much if the strut blocks are stretched in 1D, so long as they follow the curves of the bridge.

So I would take two curves into GH to find the simple truss between them, and then extract the wireframe as curves. With those curves, I want to move the blocks and stretch them along the curves. This means that the file remains relatively small, but can be controlled with the original block.

There are heaps of examples of this, where I can extract a wireframe from a surface UV, and then want to put blocks on those wires. This batch orientation is useful for file size and control.
This is also in combination with random scale, scale non-uniform, and random rotate to emulate the randomness in nature.

-Jeremy.

It doesn’t actually - Orient(2pt) that is. The only way AFAIK to have absolute control over the orientation with Orient is to use Orient3Pt - which allows you to define a single reference plane with three points and unique target planes with three points. With only two points, the third point for determining the reference and target planes will be cooked up by Rhino - probably by using the active CPlanes. There is nothing in the Help about how this is actually done. In the GH script, I grabbed the Z vector of the reference curve frame and then tried to align the target planes using the curve tangent and the same Z vector as the reference curve. I don’t know if it will work in all situations, I didn’t test much.

The script is just a kind of prototype, much easier to test in GH than trying to code it directly in Python. I didn’t mess with using all the new V8 Rhino document components, those could be added later (as soon as I have time to understand what they do). It can be translated into Python code at some later time as well.

1 Like

Yeaa… I was imagining that the orient was cooking up something, and that orient3pt would require a surface or something to give a reference plane. That could be another kettle of fish.

-Jeremy

Just wondering, does your GH script work with blocks? Or how might one pursue making it work with blocks?

-Jeremy

In V8 it accepts blocks as input geometry. Haven’t tested on anything sophisticated though.

1 Like

Hey Helvetosaur,

I’ve been experimenting with your script in Rhino 8, and its quite close.
The issue seems to be with angled curves; perhaps not so easy to overcome.

In the image above, it’s the extracted wireframe from a solid polysurface (Red), but also angled curves to give shear rigidity (Blue)

When I take the pipe block on the bottom right of the image, and use it in the script, you can see that there is some unpredictable behaviour of which curves it follows.

For example, it follows the angled curves parallel to the reference curve, but no the ones perpendicular (Green)

It seems to build the geometry, but not orient them correctly.
There seems to be an error in the angle component


ProportionalOrient3.gh (18.3 KB)

-Jeremy