Is there a way to automatically rotate and move a (flattened) surface against a previously drawn line?

I’ve been struggling for quite some time to align these curves/flattened objects along a line parallel to the X-Axis. I’m a coding noob so I had to find my way with the Rhino commands. I’m trying to automate this entire proces into a new button.

I think you can accomplish this with Orient2Pt (copy=no, scale=no), click 2 points on the object that represent the alignment direction you want along the X-Axis, then for the target points type 0 (for the origin) and with Ortho activated, pull the line out anywhere along the X-axis and click to set.

That helped me further a lot more than I expected!
Do you also happen to know if there’s a possibility to not manually input 2 points so it still has a perfect fit?
Absolutely no problem if there isn’t such an option, appreciate the help.

Kind regards.

Align command lets you align objects to a line parallel to the x-axis. Bottom option aligns the bottom of the objects, Top option aligns the top of the objects.Horizontal center aligns the horizontal center of the objects’ bounding boxes. For the point to align with either pick any point on the line, or input point coordinates with any value (such as 0) for x and the desired height above the x-axis for y.

Are the two “footprints” mirrored to eachother from the begining?
Meaning does they have the same amount of controlpoints?

I guess you’re looking for something like a minimum bounding box function that would enclose the object and (perhaps) result in the object being aligned touching one of the box sides at two points; then aligning the box with a principal axis.

No, there is no native function in rhino that does that, I have a planar minimum bounding rectangle script if that could help.

That is exactly was I am looking for to use! It would also be easier to automatically rotate it. Are you willing to share the script you made or guide me through the proces of making it myself?

Kind regards.
A Vann

Here you go… Just select your object(s) and run the script. It accepts anything planar (if multiple objects, all must be coplanar). (6.4 KB)

To run the script, save it somewhere (where it will reside permanently), then create a toolbar button or alias that has the following:

NoEcho ! _-RunPythonScript "full path to script file"

The output will be a rectangle. You will still need to align the rectangle plus the part to the desired axis, that is easily done with Orient2Pt or simply a rotate with Ortho followed by a Move.

1 Like

added tags.