Array Along Curve (within curve)

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

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

ArrayCrvSubCrv.3dm (80.4 KB)

-Pascal

1 Like

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.

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

Thanks for your help.

mm template scale.3dm (42.6 KB)

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

thanks,

-Pascal

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

Dovetail curve.3dm (44.5 KB)

Thanks, what is the desired result?

-Pascal

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 (51.4 KB)

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

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

@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.


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.

@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

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

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

-Pascal

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

ArrayBetween.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:

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:


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

2 Likes

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

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

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.

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

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

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

[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

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