hexagon logo

Tracefields and Scripts

Anyone out there know how to retrieve a Tracefield Value from a part program in a script? Can't quite find the right command...
Parents
  • Another long shot:

    Change:
    objFolder = objFSO.CreateFolder(strFldr)


    To:
    [COLOR="#FF0000"]Set[/COLOR] objFolder = objFSO.CreateFolder(strFldr)


    Yea it's still throwing the error... I've never had this much trouble. There should be nothing wrong with the code...

    Sub Main()
    
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'Declares PC-DMIS As the Active Program/Application
    Dim PCDApp As Object
    Dim Part As Object
    Dim Cmds  As Object
    Dim Cmd As Object
    Dim TCmd As Object
    Dim TCmds As Object
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set Part = PCDApp.ActivePartProgram
    Set Cmds = Part.Commands
    Dim VPART, VDESCRIPTION, VPROGRAMID, VPROGRAMREV As Object
    Dim VSERIALNUMBER As String
    Dim RESULTS As String
    
    Set VPART = Part.GetVariableValue ("VPART")
    Set VDESCRIPTION = Part.GetVariableValue ("VDESCRIPTION")
    Set VPROGRAMID = Part.GetVariableValue ("VPROGRAMID")
    Set VPROGRAMREV = Part.GetVariableValue ("VPROGRAMREV")
    
    
        For Each Cmd In Cmds
              If Cmd.IsTraceField Then
      
              If Cmd.GetText(TRACE_NAME, 0) = "Serial Number" Then
                    VSERIALNUMBER = Cmd.GetText(TRACE_VALUE, 0)
                    
              End If
    
              End If
    
         Next Cmd
    
    strPath = "D:\\CMM_PROGRAMS\\" & VPART.StringValue & "_" & VDESCRIPTION.StringValue & "_" & VPROGRAMID.StringValue & "_" & VPROGRAMREV.StringValue
    strFldrPath = strPath & "\" & "RESULTS\"
    strFldrName = VSERIALNUMBER
    
    strFldr = strFldrPath & StrFldrName
    
    Set objFldr = objFSO.CreateFolder(strFldr)
    
    End Sub
Reply
  • Another long shot:

    Change:
    objFolder = objFSO.CreateFolder(strFldr)


    To:
    [COLOR="#FF0000"]Set[/COLOR] objFolder = objFSO.CreateFolder(strFldr)


    Yea it's still throwing the error... I've never had this much trouble. There should be nothing wrong with the code...

    Sub Main()
    
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'Declares PC-DMIS As the Active Program/Application
    Dim PCDApp As Object
    Dim Part As Object
    Dim Cmds  As Object
    Dim Cmd As Object
    Dim TCmd As Object
    Dim TCmds As Object
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set Part = PCDApp.ActivePartProgram
    Set Cmds = Part.Commands
    Dim VPART, VDESCRIPTION, VPROGRAMID, VPROGRAMREV As Object
    Dim VSERIALNUMBER As String
    Dim RESULTS As String
    
    Set VPART = Part.GetVariableValue ("VPART")
    Set VDESCRIPTION = Part.GetVariableValue ("VDESCRIPTION")
    Set VPROGRAMID = Part.GetVariableValue ("VPROGRAMID")
    Set VPROGRAMREV = Part.GetVariableValue ("VPROGRAMREV")
    
    
        For Each Cmd In Cmds
              If Cmd.IsTraceField Then
      
              If Cmd.GetText(TRACE_NAME, 0) = "Serial Number" Then
                    VSERIALNUMBER = Cmd.GetText(TRACE_VALUE, 0)
                    
              End If
    
              End If
    
         Next Cmd
    
    strPath = "D:\\CMM_PROGRAMS\\" & VPART.StringValue & "_" & VDESCRIPTION.StringValue & "_" & VPROGRAMID.StringValue & "_" & VPROGRAMREV.StringValue
    strFldrPath = strPath & "\" & "RESULTS\"
    strFldrName = VSERIALNUMBER
    
    strFldr = strFldrPath & StrFldrName
    
    Set objFldr = objFSO.CreateFolder(strFldr)
    
    End Sub
Children
No Data