CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
2.93k stars 276 forks source link

Best way to check if two objects touch? #1539

Closed mxmws closed 2 months ago

mxmws commented 3 months ago

Hi,

I have an object with a number of children. For every child I want to generate a list of neighboring children. Two children are neighbors if the minimum distance between them is 0 (they touch). There are no intersections. What's the best way to approach this in cq?

Best

mxmws commented 3 months ago

Formulating the question made me realize how to do this. I used the distance(other: Shape)→ float function https://cadquery.readthedocs.io/en/latest/classreference.html?highlight=distance#cadquery.Shape.distance