# Array Along Curve (within curve)

**URL:** <https://discourse.mcneel.com/t/array-along-curve-within-curve/18486>\
**Category:** Rhino for Mac\
**Created:** [April 1, 2015, 9:02pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486 "2015-04-01T21:02:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 1, 2015, 9:02pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/1 "2015-04-01T21:02:17Z")

</div>

I’ve recently switched to Rhino from Sketchup and I need to create evenly spaced dovetail pins and tails. I’ve marked out the closed curves for the tails and thought that by running ArrayCrv along a curve I’d get 10 evenly spaced closed curves. I do, but 10th curve (shape of my dovetail tail) is placed at the end of the curve and runs off the end. Is there any way to have the arrayed objects constrained within the curve? Or is there another way to achieve this?

Thanks,

Jeremy

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 2, 2015, 2:07am UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/2 "2015-04-02T02:07:26Z")

</div>

Hi Jeremy - you can make a sub curve (SubCrv, Copy=Yes) and array on the shorter curve.

[ArrayCrvSubCrv.3dm](https://sea3.discourse-cdn.com/mcneel/uploads/default/18257/b098094dde12c1e1.3dm) (80.4 KB)

-Pascal

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 2, 2015, 7:43pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/3 "2015-04-02T19:43:04Z")

</div>

Can you post a bit more info on how to achieve this? I understand how to make a sub curve, but not how it applies to an array that requires precise spacing between objects and within the curve.

I’ve also run into an issue with my templates. When I use the small objects mm template I end up with objects that look massive. I thought that it might just be the grid, but when I import it into Keyshot for render I end up with a tiled rendering. I don’t have the same problem with small objects inches template. I have the same problem with large objects mm — I just get a larger grid.

![](https://sea3.discourse-cdn.com/mcneel/uploads/default/18287/747b2a31a606f93e.png) ![](https://sea3.discourse-cdn.com/mcneel/uploads/default/18288/e7a625c4a1465ad5.png)

I’ve attached a basic example of a box measuring 200x200x12.

Thanks for your help.

[mm template scale.3dm](https://sea3.discourse-cdn.com/mcneel/uploads/default/18289/04eedbbebc5acacb.3dm) (42.6 KB)

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 2, 2015, 7:49pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/4 "2015-04-02T19:49:50Z")

</div>

> [@jeremyp](#):
>
> Can you post a bit more info on how to achieve this? I understand how to make a sub curve, but not how it applies to an array that requires precise spacing between objects and within the curve.

Jeremy - can you post the curve etc that you have?

thanks,

-Pascal

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 2, 2015, 7:55pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/5 "2015-04-02T19:55:11Z")

</div>

This is the curve with the dovetail outlines arrayed along it.

[Dovetail curve.3dm](https://sea3.discourse-cdn.com/mcneel/uploads/default/18290/05f101be0306f557.3dm) (44.5 KB)

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 2, 2015, 8:14pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/6 "2015-04-02T20:14:23Z")

</div>

Thanks, what is the _desired_ result?

-Pascal

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 2, 2015, 8:25pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/7 "2015-04-02T20:25:13Z")

</div>

The desired result is on a green layer, the actual array on curve result in the blue layer.

I ended up with the desired result by manually calculating the width of the tails and the gaps between them and used the ‘distance between items’ option. I then deleted the extra tail that I didn’t need.

[Dovetail curve.3dm](https://sea3.discourse-cdn.com/mcneel/uploads/default/18291/2d6ad1a854b335fb.3dm) (51.4 KB)

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 2, 2015, 8:33pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/8 "2015-04-02T20:33:38Z")

</div>

Yeah that is the way to go - in fact if you start with the first one in place, you do not get an extra.

-Pascal

---

<div class="post-metadata">

**Author:** ![Toby](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/toby/32/681480_2.png) [@Toby](https://discourse.mcneel.com/u/Toby)\
**Post date:** [April 2, 2015, 11:26pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/9 "2015-04-02T23:26:11Z")

</div>

To array them on the curve without calculating, you could trim the guideline first with the bottomline of the object to be arrayed:

![](https://sea3.discourse-cdn.com/mcneel/uploads/default/18296/5cca166a969adc22.png)

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [April 3, 2015, 4:01am UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/10 "2015-04-03T04:01:25Z")

</div>

@pascal

maybe you could make a request to add the following functionality to `ArrayLinear` ? and other applicable array commands? i suppose it would work with ArrayCrv also… it mostly already works with ArrayPolar.

```python

import rhinoscriptsyntax as rs

obj = rs.GetObject('Select object to array')

amount = rs.GetInteger('How many objects in array')
point1 = rs.GetPoint('Pick start point')
point2 = rs.GetPoint('Pick end point')

vector = rs.VectorCreate(point2, point1)
copyvec = rs.VectorDivide(vector, amount - 1)

for i in range(1, amount):
    copy = rs.CopyObject(obj, copyvec * i)

```

…except fancier with the preview geometry and whatnot.

or… i assume that’s what jeremy is expecting since he’s coming from a sketchup background which allows you to make an array based off the space between obj1 and obj2 like ArrayLinear does… or you can pick the overall distance and have the desired amount of objects fill in the space… it’s pretty useful.

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 3, 2015, 4:18pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/11 "2015-04-03T16:18:04Z")

</div>

@pascal @jeff_hammond

If a feature like this could be added to Rhino that would be great. This is a good summary of how it works in Sketchup which is super useful for laying out woodworking joints: [https://www.youtube.com/watch?v=Sk\_g2JqNrBk](https://www.youtube.com/watch?v=Sk_g2JqNrBk)

On my other question —any idea why my mm templates make the objects appear so large and affect my renders?

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 3, 2015, 4:26pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/12 "2015-04-03T16:26:12Z")

</div>

Hi Jeremy- are the objects the right size, in mm?

-Pascal

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [April 3, 2015, 4:38pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/13 "2015-04-03T16:38:00Z")

</div>

you can use python scripts in rhino for mac… here’s a script that will roughly mimic sketchup’s array

[ArrayBetween.py](https://sea3.discourse-cdn.com/mcneel/uploads/default/18338/6be3928eb2bbde21.py) (605 Bytes)

to use the script, do the following:

• Navigate to **~/ Libray/ Application Support/ McNeel/ Rhinoceros/ Scripts** (\*note. this is your User library… not the MacHD library)  
• Place the file _ArrayBetween.py_ in the Scripts folder.  
• in rhino, use the command `RunPythonScript`  
• that command will open your scripts folder then choose the ArrayBetween script… press the open button.

in the case of the dovetails, the initial setup would look something like:

![](https://sea3.discourse-cdn.com/mcneel/uploads/default/18340/1cebf47bf8c0e525.png)

start the script, select the object, enter the number of items, click on the first point (point to copy from)… click the second point (point to copy to)… the result will be:

![](https://sea3.discourse-cdn.com/mcneel/uploads/default/18341/b52304b4ff723f04.png)

* * *

\*note… if you can’t find your user library… post back here and i’ll tell you how to find it.

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 3, 2015, 4:41pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/14 "2015-04-03T16:41:07Z")

</div>

They are 200mm x 200mm x 12mm. I attached this yesterday as an example: [http://discourse.mcneel.com/uploads/default/18289/04eedbbebc5acacb.3dm](http://discourse.mcneel.com/uploads/default/18289/04eedbbebc5acacb.3dm)

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 3, 2015, 5:23pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/15 "2015-04-03T17:23:06Z")

</div>

Thanks @jeff_hammond — that works exactly how I’d hoped. Brilliant!

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [April 3, 2015, 7:59pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/16 "2015-04-03T19:59:53Z")

</div>

glad it worked out for you.

it’s a little different than sketchup in that the number you enter is the total number of objects in the array – including the original one. (ie- the example image above, i entered 6 for the amount)

i never really liked how sketchup makes you enter the number of copies… (the above in sketchup would require you to enter 5)… it’s confusing imo… but if you want to make the script act like sketchup in this regard, that’s possible.

---

<div class="post-metadata">

**Author:** ![Toby](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/toby/32/681480_2.png) [@Toby](https://discourse.mcneel.com/u/Toby)\
**Post date:** [April 3, 2015, 8:14pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/17 "2015-04-03T20:14:31Z")

</div>

Thanks Jeff, this can save me a lot of time in future as well.

---

<div class="post-metadata">

**Author:** ![jeremyp](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeremyp/32/168183_2.png) [@jeremyp](https://discourse.mcneel.com/u/jeremyp)\
**Post date:** [April 3, 2015, 9:22pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/18 "2015-04-03T21:22:59Z")

</div>

I think your implementation is better that Sketchup’s — the less math I have to do the better! Thanks again.

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 3, 2015, 9:28pm UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/19 "2015-04-03T21:28:44Z")

</div>

Just for the sake of completeness, the Copy command has several options, after the first copy is made, that if invoked (all of them) allows a kind of regular array to be made. (FromLastPoint, UseLastDistance, UseLastDirection)

And, TestScalePosition may come in handy.

-Pascal

---

<div class="post-metadata">

**Author:** ![jeff\_hammond](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jeff_hammond/32/768846_2.png) [@jeff\_hammond](https://discourse.mcneel.com/u/jeff_hammond)\
**Post date:** [April 5, 2015, 2:42am UTC](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486/20 "2015-04-05T02:42:10Z")

</div>

[quote=“pascal, post:19, topic:18486, full:true”]  
Just for the sake of completeness, the Copy command has several options, after the first copy is made, that if invoked (all of them) allows a kind of regular array to be made. (FromLastPoint, UseLastDistance, UseLastDirection)[/quote]  
a lot of times, yes, Copy is the way to go… `Divide` and Copy

> [@](#):
>
> And, TestScalePositions may come in handy.

no ‘s’ but that thing is sweet… never used it before but often do similar manually. thnks

[Next page](https://discourse.mcneel.com/t/array-along-curve-within-curve/18486.md?page=2)
