Assume I take a dowel pin from toolbox into my assembly, the macro will choose the diameter and the length of the dowel pin according the size of my holes and the thickness of the part. Is that possible?
Absolutely Marco. The trick is to use topology traversal techniques. For example. starting from a circular edge of a hole, you can get the underlying curve and its diameter using CircleParams. Also, from the edge, you can get the two adjacent faces using GetTwoAdjacentFaces2. Figure out which one is the cylinder, use GetSurface and check its IsCylinder property. From the cylindrical face, get the other circular edge and check the distance between the two circular edges, again using CircleParams. Then it is a matter of selecting the corresponding configuration in your dowel pin.
I would like to add few points to Michael Spens response.
1. You will also need to get the thickness of other part as you fasten two or more parts using the fastener.
2. You will also need to consider thicknesses of washers and nut if you are using them.
Retrieving data ...