Align two meshes through grasshopper

Hi all,

This is my first post so please forgive any mistakes.

I have two meshes - mesh1 and mesh2. Mesh2 is a smaller section of mesh1 that is translated and rotated by unknown values. I need to position mesh2 back on to mesh1. Right now i can do that by looking at the mesh wires in rhino and use Orient Objects: 3 points to manually align the two meshes. Is there a way to do the same in grasshopper as i need to do this for 1000+ objects eventually.

Thank you in advance
Mesh Alignment.gh (326.2 KB)

Box around the source mesh. Translate that box with the section of mesh, use the translated box to align the mesh back to the box around the source mesh.


MESHMOVE.gh (129.7 KB)

1 Like

Thank you for the response, Ftzuk.

But this does not exactly do what i wanted. I need to translate and rotate mesh2 onto mesh1 so that mesh2 overlaps mesh1. I’m fairly new to grasshopper, please correct me if i’ve misunderstood something.

Are you doing the rotations yourself or are you getting cad from someone else with these transformations already applied and you need to re-orient mesh 2 to mesh 1?

If you’re doing them yourself then that solution should work, if someone else is doing it and you can’t put a box around mesh 2 before moving it then the solution won’t work.

The translation and rotations are done in another software and exported as two different meshes. Its not done in rhino, so essentially its done by someone else.

I was wondering if there was a way to identify 3 similar vertices between the two meshes and use that to align mesh2 onto mesh1?

not sure if it works for any of the 1000+, have a look


RE_Mesh Alignment.gh (173.4 KB)

1 Like

Thank you. This only works for these two meshes, it fails with all other meshes i tried with.

I’ve now tried it with 30 sets, it worked for 7 sets, failed for 23. Can you guide me if there is any parameters that i can tweak to make it more reliable?


meshmove2.gh (172.9 KB)

Slightly simplified but the other one might work better. In both cases the idea is to get the largest mesh face from mesh2, find that mesh face in mesh1, then use their edges to orient. Triangle mapping might break depending on the mesh topology.


meshmove-3.gh (173.9 KB)

3 Likes

@ftzuk This works on lighter mesh models but the construct mesh component causes my computer to run out of memory with meshes with 300k+ triangles ( I have 32GB of RAM). Is there a more efficient work around to this as reducing the polycount is not an option?

@ferry59 this failed with all the other mesh sets i’ve tried

1 Like

@Nachi, sorry, I was wrong. Try this, should work better:
RE3_Mesh Alignment.gh (172.3 KB)
It searches for the largest mesh area in the sub-mesh and tries to find the most similar area in the original mesh.
Since there are meshes in which faces of the same size occur (or even all faces are the same size), it will not work in this case and I do not know a solution for it

@ferry59 this works for 99% of the ones i’ve tried. Thank you!