How to splice ldraw models

https://threejs.org/examples/webgl_loader_ldraw.html

Hello everyone, this is a model from the official example. I want to make an assembly function on it, so that I can move the parts and assemble them into a finished product one by one. I want to know how to judge whether two parts can be assembled together? Please give me some ideas, thank you