I would like to determine the cylindrical face of a threaded hole.
I can get the faces of the hole but I don't see direct way to know which is the thread.
Anyone have an idea?
The following code does not find a face style BTW.
mPartDoc = mSolidApp.ActiveDocument
mModels = mPartDoc.Models
mModel = mModels.Item(1)
mHoles = mModel.Holes
mHole = mHoles.Item(1)
mHoleFaces = mHole.Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryCylinder)
For r As Integer = 0 To mHoleFaces.Count - 1
mHoleFace = mHoleFaces(r)
If mHoleFace.Style IsNot Nothing AndAlso mHoleFace.Style.StyleName = "Thread" Then
Dim cyl As Object = mHoleFace.Geometry
Catch ex As Exception
you can't get to the cylinder using the Style property, as long as it is not set by the user. SE is directly rendering threads in a specific style based on internal information they have.
Dependend on what you are going to do with the cylinder geometry, you might get to it by comparing the thread diameter from the HoleData (ThreadMinorDiameter and ThreadDepth for simple threaded finite holes where the thread does not go until the end of the hole) with the diameter of the cylinder.
To distinguish between the threaded and unthreaded cylinder, you might check the range of the cylinder to get its height (or implicitly from its area, if you know that the holes are perpendicular to the surface and end with a circular edge on each side).
Sounds a little bit complicated, but it depends on whether you really need access to the cylinder or some other information from the HoleData.