Curve Proximity Along an Axis

I may be overlooking something here, but I’m stuck on this issue.

In this script, I’m placing a repeated set of blocks within a boundary, then using curve proximity to move each block to touch one of the boundary lines.

BLOCK PLACED:

BLOCK MOVED:

Curve proximity works when the boundary line is perpendicular to the axis of movement, but it causes the blocks to push outside the boundary if that boundary is curved. I need to be able to run a similar process to curve proximity but have it only check along a specific axis.

BLOCK PLACED:

BLOCK MOVED:

I have tried grabbing the vertices of the objects and extending lines along the desired axis. I then used an intersection to find the shortest path. This works but is very process heavy. I’m going to be using a lot of blocks in the final version of this script, and I don’t want it to bog down if I can help it.

Let me know if you have any suggestions. Thank you.

Could you do something like this, project the points from the original shape (2 or more, in the example below it’s just the end points from a line), then find the shortest to the curve by sorting the distances. Use this vector to move the object. Apologies if I’ve misunderstood the question though.

Hey johnharding,

Thank you for this idea! I think this could work. Let me try to add this to the script and see if I can get the desired result.

Thank you again!

When I test this on a small scale it works, but it isn’t working once I plug it into my larger script. I’m certain it is a list order issue, but I can’t figure out how to order the data to get it to work.

I need each set of points to use the correct axis and projection curve. I can get the axis correct, but it won’t use the correct projection curve.

This is the points projected to a single curve. The axis is correct here.

Once I plug in the set of projection curves it changes the axis. This is with the projection curves plugged in.

Let me know if you have any ideas. Thank you so much for your help so far.

I found the issue. Some points were hitting the curves more than once. This was causing the list order to be higher on the output and was throwing a flag. Thank you again for all of your help!

1 Like