I've created a text file that has 5 lines. This goes into a local folder on the CMM computer. The first line is the file path to a network drive, the second is the CMM machine number (1 or 2), the 3rd, 4th, and 5th numbers are the X, Y, and Z offsets.
I also have a CSV file on the network (hence the file path in the text file) that has the part number and machine the reference frame was created on each line for all the parts we have programs for.
I would like to run the script right after recalling the Fixture Reference Frame, create a point with the variables, and set origin to that point. I'm stumbling through this but feel I'm close. It doesn't seem to like the Split variable code. Is this something the native VB version doesn't recognize or am I doing it wrong?
Sorry for the rambling explanation but it's been a long day and I'm exhausted.
Code: Select all
'FIXTURE REFERENCE FRAME OFFSETS Dim CMMInfo(10) Dim FilePath As String Dim PN As String Dim FileName As String Dim filerow As Interger Dim PartLine(10) As String Dim CMM As Interger Dim XOffset As Double Dim YOffset As Double Dim ZOffset As Double Dim XREF As Double Dim YREF As Double Dim ZREF As Double 'Enter Part Number below where there are Xs PN = xxxxxx 'Get local CMM info Open "c:\CMMData\CMM.txt" For Input As #1 filerow = 0 Do Until EOF(1) filerow = filerow + 1 Line Input #1, fileline CMMInfo(i) = fileline Loop Close #1 FilePath = CMMInfo(1) CMM = CMMInfo(2) XOffset = CMMInfo(3) YOffset = CMMInfo(4) ZOffset = CMMInfo(5) 'Determine which CMM FRF was created FileName = FilePath & "FRF.crv" Open Filename For Input As #2 filerow = 0 Do Until partline(0) = PN filerow = filerow + 1 Line Input #2, fileline PartLine = Split (fileline, ",") Loop Close #2 'Determine if offset is needed If PartLine(1) = CMM Then XREF = 0 YREF = 0 ZREF = 0 Else XREF = XOffset YREF = YOffset ZREF = ZOffset End If