How to check if two ComponentInstances are in contact?
-
Hi,
Is it possible to know if a given ComponentInstance is in contact (touching) with another Component Instance? If yes, which Face is in contact?
(Given that my ComponentInstance is an rectangle box as shown in the attached image)Consider the attached image. B is in contact with A. The bottom Face of B is the Face that is in contact. If these two ComponentInstances (A & B) are ‘selected’ can I programmatically get the bottom Face object of B? And top Face object of A?
I tried the glued_to method on the ComponentInstance but that seems to mean(do) something different from what I want to achieve.Your help is appreciated.
-
In a simple example like two boxes stacked up you could look at their 'bounds'.
There are several 'points' that can be retrieved and compared in a bounding-box...Also, as there are 6 faces in one container get the normal and plane of each in turn and compare them with normal/plane of the other 6 faces inside the other container.
You need to get the containers' transformations and apply those to each normal/plane i.e. a [point,vector] in case they do not share a common transformation [which is very likely!]...Then if the plane is the same, or the same with a reversed normal vector you know one face in each of the containers is 'coplanar' with the other...
-
Thank you sir.
Advertisement