I'm trying to determine what size milling cutters(ball nose) would be required to finish a body in order to estimate machining times. I'm currently using ISurface.FindMinimumRadius, but this does not necessarily return the minimum concave radius. I was wondering if anyone might have any ideas on the matter?
...
vFaces = swBody.GetFaces
For Each vFace In vFaces
Set swFace = vFace
vFaceUV = swFace.GetUVBounds
uBoundArray(0) = vFaceUV(0)
uBoundArray(1) = vFaceUV(1)
vBoundArray(0) = vFaceUV(2)
vBoundArray(1) = vFaceUV(3)
uBoundSuf = uBoundArray
vBoundSuf = vBoundArray
Set swSurf = swFace.GetSurface
numOfRadii = 0 'FindMinimumRadius isn't setting numOfRadii to 0!
If Not IsPartOfHole(swFace) Then
If swSurf.FindMinimumRadius(uBoundSuf, vBoundSuf, numOfRadii, radius, location, uvparameter) Then
If numOfRadii Then
For i = 0 To (numOfRadii - 1)
If swFace.FaceInSurfaceSense Then d = -radius(i) Else d = radius(i) '+ number indicates concave curvature,- number indicates convex curvature
'Debug.Print "Smallest rad for this surface "; Round(d, 5)
If d > 0 Then
If i = 0 Then
Select Case d
Case 0 To 0.0009: FaceArea1mm = FaceArea1mm + swFace.GetArea
Case 0.0009 To 0.0014: FaceArea2mm = FaceArea2mm + swFace.GetArea
Case 0.0014 To 0.0019: FaceArea3mm = FaceArea3mm + swFace.GetArea
Case 0.0019 To 0.0024: FaceArea4mm = FaceArea4mm + swFace.GetArea
Case 0.0024 To 0.0029: FaceArea5mm = FaceArea5mm + swFace.GetArea
Case 0.0029 To 0.0039: FaceArea6mm = FaceArea6mm + swFace.GetArea
Case 0.0039 To 0.0049: FaceArea8mm = FaceArea8mm + swFace.GetArea
Case 0.0049 To 0.0059: FaceArea10mm = FaceArea10mm + swFace.GetArea
Case Else: FaceArea12mm = FaceArea12mm + swFace.GetArea
End Select
End If
If d < SmallestRad Then SmallestRad = d
Else
If i = 0 Then
FaceArea12mm = FaceArea12mm + swFace.GetArea
End If
End If
Next i
End If
End If
End If
Next
...
So a concave surface can be a cylinder surface based on the targeting face.
What you will need is to capture faces relative to a surface, so if it's a piece of raw stock one of the 6 block faces.
The reason for this is you will need to determine the axis of cylindrical faces. If they are NOT the same as the targeting face normal, then they are concave. If the axis is in the same direction or opposite direction, then they are cylindrical and can be drilled.
This link has the code determining which faces to analze., But you will need to know the raw stock faces for yours to work, or possibly use the 6 standard view normals (0,0,1),(0,1,0),(1,0,0),(0,0,-1),(0,-1,0),(-1,0,0)
These are xyz vector directions.
If you aren't familiar with them, Think of them as the direction ratio that a flat face is pointing to. So (0,0,1) is flat, and is moving away from the origin in the positive the z axis of the part while (0,0,-1) is moving away from the origin in the negative dimensions in the z axis
Maximum milling drill tool
Clear as mud?