Would anybody know when or have a macro of script file for Ncplot to extract the tool numbers with offsets and the tool comments from a .Nc file?
I was also looking to extract how many bytes are in the file.
Thank You
Would anybody know when or have a macro of script file for Ncplot to extract the tool numbers with offsets and the tool comments from a .Nc file?
I was also looking to extract how many bytes are in the file.
Thank You
Hi Cam, a little example for you....
If you copy this code and save it as a file in the script folder, open a file in ncplot click the VBS button, click the script file name, It will message box each tool in the format e.g......T5M6 or T8M06.Code:Set re = New RegExp 'set up a regular expression re.Pattern = "T\d+\s?(M6|M06)" ' the reg exp pattern numlines=NCPlot.NCPGetNumLines ' sets a variable with the number of lines in the file for i = 0 to numlines 'set a loop to read a line at a time currentline=NCPlot.NCPGetLine(i) 'get the current line as a text string value If re.Test(currentline) Then 'test if the regex is in the current line Set matches = re.Execute(currentline) ' if it is then get the matches If matches.Count > 0 Then for each match in matches ' for each match... do something msgbox (match) next end if End If next
Regards,
Keith
Thank You. I am looking to extract a list like this that I can then put at the top of my nc program
---------------------------------------------------------------------
Tool List:
----------------------------------------------------------------------
File :
Program :
Full name :
Created : 2/10/2011 5:19:51 PM
----------------------------------------------------------------------
Tool number Tool information
----------------------------------------------------------------------
T1 3-CENTERDRILL
T2 STUB-DRILL-.250-DIA-1.00-F.L.
T4 ENDMILL-.250-DIA-.50-F.L.-1.00-O.L.
T5 BULL-ENDMILL-.250-DIA-.75-F.L.-1.375-O.L.
T7 BULL-ENDMILL-.250-DIA-.062-R-.50-F.L.-1.00-O.L.
T8 ENDMILL-.375-DIA-.50-F.L.-1.00-O.L.
T9 ENDMILL-.250-DIA-.50-F.L.-1.00-O.L
T14 1 CENTERDRILL X 1.0 O.L.
T15 DRILL 3/64 -.0469 X 1.0 O.L.
T16 ENDMILL .125 DIA -.50 F.L. - 1.0- O.L.
T19 BULL ENDMILL .250 DIA.- R.032-.75 F.L.-1.25 O.L.
----------------------------------------------------------------------
Hi Camtd,
To create the regular expression to find the data you need, i would need to know the exact fromat of your program file, and they would also have to strictly follow this format. Do you hava a sample of one/ or part of your program? For example are the lines as follows :
T1 M6 (3-CENTERDRILL)
T1M06(3-CENTERDRILL)
You see how above there is slight difference in format... this needs to be known.
Once the data is extracted it can be writtrn out to a text file automatic.
Thats what i do with our stuff.
Regards,
Keith.