Break solid into constituent parts

198 views Asked by At

The following 3d model-in stl format-is composed of cuboids and cylinders

enter image description here

How can I extract the dimensions and coordinates of these constituent solids from the composite, i.e. the dimensions and locations of cuboids/cylinders?

I have tried an approach based on constructive solid geometry, this is a bit too slow and unwieldy for me. Due to the lack of a dataset, machine learning or deep learning models are not an option.

1

There are 1 answers

0
Alice Oualouest On

If you refer to the STL format described in wikipedia, in this format, each STL solid is composed solely of triangles. The construction information you are looking for in not in the file anymore.

If, however, all the solids you are looking for are not merged into one STL solid, and each solid is a cube or a cylinder, you can easily

  • determine the bounding box of each solid,
  • determine if the solid is a cube or a cylinder by checking each point against the bounding box planes (if a point is not on the bounding box plane, the solid is a cylinder),
  • and the same to determine orientation of the cylinder.

With the bounding box and the type/orientation, you have the base attribute of the solids you're looking for.