Hi guys. I have been using a modified toollist section of setupsheet.bas supplied with featurecam to make tool lists for my operators. I was tired of seeing a blank space in the chamfermill section under Length. So I added some code ( more for my own API education than anything else, I have zero OOP experience ). I thought I'd share my changes in case someone else might benefit. Below is posted my modified private function for gimmeLength.
Code:
' each tool type has a different way of referring to the length.
' this function handles that situation.
Private Function gimmeLength( tool As FMTool ) As String
On Error Resume Next
Dim strLen As String
Dim diameter As Double
Dim toolangle As Double
Dim angleasradians As Double
Dim result As Double
Dim pi As Double
pi = 3.14159265358979323846264338327950288419716939937510
diameter = tool.OuterDiameter
toolangle = tool.angle
If tool.ToolGroup = eTG_EndMill Or _
tool.ToolGroup = eTG_PlungeRough Or _
tool.ToolGroup = eTG_ThreadMill Then
strLen = Format( tool.CutterLength, "0.000" )
ElseIf tool.ToolGroup = eTG_TwistDrill Or _
tool.ToolGroup = eTG_Tap Or _
tool.ToolGroup = eTG_SpotDrill Or _
tool.ToolGroup = eTG_CounterBore Then
strLen = Format( tool.Length, "0.000" )
ElseIf tool.ToolGroup = eTG_FaceMill Then
strLen = Format( tool.Height, "0.000" )
ElseIf tool.ToolGroup = eTG_ChamferMill Then
angleasradians = (90-toolangle)/180*pi ' Convert the tool angle in degrees to radians
result = Tan(angleasradians)*diameter ' Multiply resulting ratio by the tool diameter
strLen = Format( result, "0.000" )
Else
' we're not done yet... more code left to write here...BackBore...BoringBar...CounterSink...LatheTool...Ream...RoundingMill...SideMill...ThreadTool
strLen = "—"
End If
gimmeLength = strLen
End Function
My changes were adding at the top:
Code:
On Error Resume Next
...
Dim diameter As Double
Dim toolangle As Double
Dim angleasradians As Double
Dim result As Double
Dim pi As Double
pi = 3.14159265358979323846264338327950288419716939937510
diameter = tool.OuterDiameter
toolangle = tool.angle
And adding the eTG_ChamferMill section:
Code:
ElseIf tool.ToolGroup = eTG_ChamferMill Then
angleasradians = (90-toolangle)/180*pi ' Convert the tool angle in degrees to radians
result = Tan(angleasradians)*diameter ' Multiply resulting ratio by the tool diameter
strLen = Format( result, "0.000" )