Site Logo
Site Logo
 
It is currently Mon Mar 27, 2017 11:18 am

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: SetupSheet.bas Chamfermill LOC addition
PostPosted: Mon Dec 12, 2011 11:56 pm 
Offline

Joined: Fri Sep 16, 2011 5:48 pm
Posts: 98
Location: S.F. Bay Area
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" )


Top
 Profile  
 
 Post subject: Re: SetupSheet.bas Chamfermill LOC addition
PostPosted: Thu Jan 10, 2013 9:22 am 
Offline

Joined: Fri Dec 21, 2012 9:25 am
Posts: 1
That's great stuff. i had been fiddling with the similar code for quite some but was getting one or two thing wrong. Now it will help in my code execution.

___________________________
wire straightening and cutting


Top
 Profile  
 
 Post subject: Re: SetupSheet.bas Chamfermill LOC addition
PostPosted: Tue Jan 15, 2013 6:39 pm 
Offline

Joined: Fri Sep 16, 2011 5:48 pm
Posts: 98
Location: S.F. Bay Area
Great, I'm glad it was of use to you :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB