Translate a box inside boundaries with the initial orientation in C#

Hello,
I am trying to use Transform. Translate to a box but I want it to move it inside the boundaries. Plus, every time I move it, I lost the initial orientation of my box.
Does anyone have a solution to it?
Thank you
move rnd trial .gh (7.3 KB)

Get an entry level - a bit naive - take on that matter (for the real (*) thing … well … I can’t post the solution [is internal]). But you can try to do it with K2 as well.

Curve_MoveInsideCurve_V1.gh (117.9 KB)

(*) in fact a variant - with no “fit” rotation - of this :

1 Like

Thank you, a lot for your reply I was stuck. Now, I understand what I have to do. :slightly_smiling_face:

Well … as a hint for a bit more “pro like” search/solution … you can try to move the Crv (if !success) in small steps around (prior finding/testing a new candidate rnd Pt in the BrepFace). The smart part is to adopt some “no waste time” Translation Vector policy (based on the Crv/Crv Ccx events).