Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
NC tape conversion
I do NC programming and we have a new machine that rotated Z axis -90
degrees. I need to convert a few hundred NC tapes to the new machine. The old code looks like this G17 G9 X58.4296 Y100.7598 I60.0696 J99.0699 Z-21.43 C270 and converts to G17 G9 X100.7598 Y-58.4296 I99.0699 J-60.0696 Z-21.43 C180 X = Y Y = X- I = J J = I- Z = Z C = C-90 Any help would be very much appreciated, at the current rate I can do about 4 tapes a day. -- clcnewtoaccess |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
NC tape conversion
One way to do it: import all the text strings into Excel, and use the
Text to Columns feature to separate each value into a separate column. Then delete all the alpha characters: search for G, for instance, and replace with "" which will leave only numeric characters- then you can do the required math on them. For clarity, insert a row to contain headers, such as G, X, Y, Z, etc. When that's done, use columns off to the right to calculate the converted values. Then use a CONCATENATE function to tie it all back together: =CONCATENATE("G", a5, " ", "G", b5, " ","X",c5, " ", "Y", d5, " ", .....etc) Save the Excel file as a text file and the concatenated fields will be the text string you need. Dave O Eschew obfuscation |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
NC tape conversion
Another way is to use a User Defined Function - see below
If you are new to VBA see David McRitchie's site on "getting started" with VBA http://www.mvps.org/dmcritchie/excel/getstarted.htm best wishes Function Twister(oldcode) x = InStr(1, oldcode, "X") y = InStr(1, oldcode, "Y") i = InStr(1, oldcode, "I") j = InStr(1, oldcode, "J") z = InStr(1, oldcode, "Z") c = InStr(1, oldcode, "C") xval = Mid(oldcode, x + 1, y - x - 2) yval = Mid(oldcode, y + 1, i - y - 2) ival = Mid(oldcode, i + 1, i - y - 2) jval = Mid(oldcode, j + 1, j - i - 2) zval = Mid(oldcode, z + 1, z - j - 2) cval = Mid(oldcode, c + 1, 20) cval = cval - 90 newcode = Mid(oldcode, 1, x) newcode = newcode & yval & " Y-" & xval newcode = newcode & " I" & jval & " J-" & ival newcode = newcode & "Z" & zval newcode = newcode & "C" & cval Twister = newcode End Function -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "Dave O" wrote in message ... One way to do it: import all the text strings into Excel, and use the Text to Columns feature to separate each value into a separate column. Then delete all the alpha characters: search for G, for instance, and replace with "" which will leave only numeric characters- then you can do the required math on them. For clarity, insert a row to contain headers, such as G, X, Y, Z, etc. When that's done, use columns off to the right to calculate the converted values. Then use a CONCATENATE function to tie it all back together: =CONCATENATE("G", a5, " ", "G", b5, " ","X",c5, " ", "Y", d5, " ", .....etc) Save the Excel file as a text file and the concatenated fields will be the text string you need. Dave O Eschew obfuscation |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tape recording time code? | Excel Discussion (Misc queries) | |||
Created date in "General" tape and "Statistics" tape | Excel Discussion (Misc queries) | |||
Between conversion | Excel Worksheet Functions | |||
Conversion | Excel Worksheet Functions | |||
Formating fractions so they read like a measuring tape | Excel Discussion (Misc queries) |