hexagon logo

PC-DMIS not scripting into Excel Properly.

Good day!

So, when attempting to script out the results of a program into Excel, I am having an issue regarding the GDT results. For some reason, the results for these inspection points will only populate the first column of my excel sheet. I have other dimensions that are working fine. All other dimensions are coming in fine, and I have the scripting set to append the results from PC-DMIS so I can run an entire job and look at the results when it is done. For some reason though, the GDT results keep populating in the first column of the Excel sheet and write over the previous results, meaning if I run ten parts, I will have the results for all the inspection points in nice, neat columns and rows; however, the GDT results look like I only have one results and the rest of the columns are blank (I have a picture what my excel sheet looks like).

I added pictures of the Settings I have selected to attempt to get the script out. Here is the actual script from the program --> Script.txt

I hope someone understands what I am trying to do and can help. Thank you.





Attached Files
Parents
  • Hello,

    As you can see here, with "xlSheet.Cells(RCount, 4).Value" the CCount is not counted up, so it is always in the same column.

    In addition, only one line is needed at this point
    As you can see from the FCF example, 5 values are written into the same cell (and only the last value is visible)​


    Wrong:

    'Fill In measured data
    [...]
    ' -- Do FCF --------------------------------------------------------
    If Cmd.Type = 184 Then
    ReportDim = Cmd.GetText(OUTPUT_TYPE, 0)
    If ReportDim = "BOTH" Or ReportDim = "STATS" Then
    xlSheet.Cells(RCount, CCount).Value = Cmd.GetText(ID, 0) & "." & "FCF"
    xlSheet.Cells(RCount, CCount).Value = "0"
    xlSheet.Cells(RCount, CCount).Value = Cmd.GetText(LINE2_PLUSTOL, 1)
    xlSheet.Cells(RCount, CCount).Value = "0"
    xlSheet.Cells(RCount, CCount).Value = Cmd.GetText(LINE2_DEV, 1)
    RCount = RCount + 1
    End If
    End If

    ' -- Do GDT --------------------------------------------------------
    'new 06.10.2021
    If (Cmd.Type = ISO_TOLERANCE_COMMAND) Or (Cmd.Type = ASME_TOLERANCE_COMMAND) Then
    ReportDim = Cmd.GetText(OUTPUT_TYPE, 0)
    If ReportDim = "BOTH" Or ReportDim = "STATS" Then

    LoopIndex = 1
    sPuffer = Cmd.GetText(REF_ID, LoopIndex)
    While sPuffer <> ""
    xlSheet.Cells(RCount, 4).Value = Cmd.GetText(ID, 0) & "." & "GDT [Ref:" & sPuffer & "]" ' id
    xlSheet.Cells(RCount, 1).Value = "0" ' Nominals
    xlSheet.Cells(RCount, 2).Value = Cmd.GetText(FORM_TOLERANCE, 1) ' Tol plus
    xlSheet.Cells(RCount, 3).Value = "0" ' Tol minus
    xlSheet.Cells(RCount, 5).Value = Cmd.GetTextEx(DIM_DEVIATION, LoopIndex, "SEG=1") ' Meas

    RCount = RCount + 1
    LoopIndex = LoopIndex + 1
    sPuffer = Cmd.GetText(REF_ID, LoopIndex)
    Wend

    End If
    End If 'Do GDT​


    better:

    'Fill In measured data
    [...]
    ' -- Do FCF --------------------------------------------------------
    If Cmd.Type = 184 Then
    ReportDim = Cmd.GetText(OUTPUT_TYPE, 0)
    If ReportDim = "BOTH" Or ReportDim = "STATS" Then
    xlSheet.Cells(RCount, CCount).Value = Cmd.GetText(LINE2_DEV, 1)
    RCount = RCount + 1
    End If
    End If

    ' -- Do GDT --------------------------------------------------------
    'new 06.10.2021
    If (Cmd.Type = ISO_TOLERANCE_COMMAND) Or (Cmd.Type = ASME_TOLERANCE_COMMAND) Then
    ReportDim = Cmd.GetText(OUTPUT_TYPE, 0)
    If ReportDim = "BOTH" Or ReportDim = "STATS" Then

    LoopIndex = 1
    sPuffer = Cmd.GetText(REF_ID, LoopIndex)
    While sPuffer <> ""
    xlSheet.Cells(RCount, CCount).Value = Cmd.GetTextEx(DIM_DEVIATION, LoopIndex, "SEG=1") ' Meas

    RCount = RCount + 1
    LoopIndex = LoopIndex + 1
    sPuffer = Cmd.GetText(REF_ID, LoopIndex)
    Wend

    End If
    End If 'Do GDT​
  • I attempted to do what you suggested. Take a gander below (at my most recent comment) of a picture of what happens with the new script. Thanks again.
Reply Children
No Data