PDA

View Full Version : Marco or Script for toollist



camtd
02-06-2011, 01:02 PM
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

TURNER
02-06-2011, 02:28 PM
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 camtd, i have a script that i may be able to modify for getting your toolnumbers. What sort of format is the program.? Do you have a snippet?
Keith.

TURNER
02-06-2011, 03:05 PM
Hi Cam, a little example for you....


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

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.
Regards,
Keith

camtd
02-10-2011, 05:23 PM
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.
----------------------------------------------------------------------

TURNER
02-12-2011, 03:05 PM
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.