Your Products have been synced, click here to refresh
Its looping, so it's grabbing everything. Looks like you want to stop after 2nd time through the loop. One way to do this would be, after I=I+1 add: If I > 2 then Exit While
Sub Main' Original CSV Ouput Script by Jay Hall of Hexagon Metrology ' Modified by Josh Carpenter, Mike Grones, Andy Mears, And Jay Hall of Hexagon Metrology August 2011 ' Modified by John Szanto 05-10-2013 ' Modifications: Captures all Xactmeasure Non-Position data And exports measured, max, And min values To a csv file. ' Also names CSV file With part Name, lot number, And serial number ' Notes: ' Variable "V_SERIALNUMBER" For Serial Number must be present In PC-DMIS part program ' Variable "V_LOT" For Lot Number must be present In PC-DMIS part program ' Exports CSV data To C:\YOUR_FOLDER_HERE\CSV Data Output\, change below On Line 34 ' PC-DMIS v2011 Release: when using Xactmeasure To dimension Position of multiple holes, make sure the required axis are of the Feature Set are checked. 'pcdlrn declarations And Open ppg Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Dim str As String Dim Int As Integer Dim strType As String Dim Serial As Object Dim LotNo As Object Set Serial = Part.GetVariableValue ("V_SERIALNUMBER") Set LotNo = Part.GetVariableValue ("V_LOT") 'Open file **** Change File Path If needed ***************************************************************************************************************************************************************** FileName = "J:\CMM\Data Export\" & Part.PartName & "_Lot " & LotNo.StringValue & "_SN " & Serial.StringValue & "_Min-Max_Output" & ".csv" Open FileName For Output As #1 Print #1, "Part,Lot #,Serial #,Date,Time" Print #1, Part.PartName & "," & LotNo.StringValue & "," & Serial.StringValue & "," & Month(Date) & Day(Date) & Year(Date) & "," & Hour(Time) & Minute(Time) Print #1, "Section,Measured,Max,Min" 'Sort Program********************************************************************************************************************************************************************* For Each Cmd In Cmds '_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Process Xactmeasure GD&T _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ If Cmd.Type = 184 Then ' looks For Xactmeasure dimensions If Left(Cmd.ID, 5) = "SECT_" Then ' Look only dimensions With certain naming convention strType = Cmd.GetText (GDT_SYMBOL, 0) If strType <> "POSITION" Then 'All Non-Position GD&T Get Meas, Max, And Min Int = 1 str = Cmd.GetText (ID, 0) & "," & Format(cdbl(Cmd.GetText (LINE2_MEAS, Int)),"0.0000") & "," & Format(cdbl(Cmd.GetText (LINE2_MAX, Int)),"0.0000") & "," & Format(cdbl(Cmd.GetText (LINE2_MIN, Int)),"0.0000") Print #1, str End If ' is Not Position End If ' specific dimension names End If ' is Cmd.Type 184 Xactmeasure GD&T Next Cmd 'Save And Cleanup******************************************************************************************************************************************************************* Close #1 End Sub
Its looping, so it's grabbing everything. Looks like you want to stop after 2nd time through the loop. One way to do this would be, after I=I+1 add: If I > 2 then Exit While
Sub Main' Original CSV Ouput Script by Jay Hall of Hexagon Metrology ' Modified by Josh Carpenter, Mike Grones, Andy Mears, And Jay Hall of Hexagon Metrology August 2011 ' Modified by John Szanto 05-10-2013 ' Modifications: Captures all Xactmeasure Non-Position data And exports measured, max, And min values To a csv file. ' Also names CSV file With part Name, lot number, And serial number ' Notes: ' Variable "V_SERIALNUMBER" For Serial Number must be present In PC-DMIS part program ' Variable "V_LOT" For Lot Number must be present In PC-DMIS part program ' Exports CSV data To C:\YOUR_FOLDER_HERE\CSV Data Output\, change below On Line 34 ' PC-DMIS v2011 Release: when using Xactmeasure To dimension Position of multiple holes, make sure the required axis are of the Feature Set are checked. 'pcdlrn declarations And Open ppg Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Dim str As String Dim Int As Integer Dim strType As String Dim Serial As Object Dim LotNo As Object Set Serial = Part.GetVariableValue ("V_SERIALNUMBER") Set LotNo = Part.GetVariableValue ("V_LOT") 'Open file **** Change File Path If needed ***************************************************************************************************************************************************************** FileName = "J:\CMM\Data Export\" & Part.PartName & "_Lot " & LotNo.StringValue & "_SN " & Serial.StringValue & "_Min-Max_Output" & ".csv" Open FileName For Output As #1 Print #1, "Part,Lot #,Serial #,Date,Time" Print #1, Part.PartName & "," & LotNo.StringValue & "," & Serial.StringValue & "," & Month(Date) & Day(Date) & Year(Date) & "," & Hour(Time) & Minute(Time) Print #1, "Section,Measured,Max,Min" 'Sort Program********************************************************************************************************************************************************************* For Each Cmd In Cmds '_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Process Xactmeasure GD&T _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ If Cmd.Type = 184 Then ' looks For Xactmeasure dimensions If Left(Cmd.ID, 5) = "SECT_" Then ' Look only dimensions With certain naming convention strType = Cmd.GetText (GDT_SYMBOL, 0) If strType <> "POSITION" Then 'All Non-Position GD&T Get Meas, Max, And Min Int = 1 str = Cmd.GetText (ID, 0) & "," & Format(cdbl(Cmd.GetText (LINE2_MEAS, Int)),"0.0000") & "," & Format(cdbl(Cmd.GetText (LINE2_MAX, Int)),"0.0000") & "," & Format(cdbl(Cmd.GetText (LINE2_MIN, Int)),"0.0000") Print #1, str End If ' is Not Position End If ' specific dimension names End If ' is Cmd.Type 184 Xactmeasure GD&T Next Cmd 'Save And Cleanup******************************************************************************************************************************************************************* Close #1 End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |