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
  • Thanks for the replies so far guys. I really appreciate it. Just can't quite get what I'm looking for though. I need to be able to take the value from the "Serial Number" tracefield and create a folder with the Trace field value as it's name. I just can't find quite the right commands to do that.

    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 VSERIALNUMBER As Object
    
    For Each Cmd In Cmds
       
       Set TCmd = Cmd.TraceFieldCommand
    
    Set VSERIALNUMBER = TCmd("Serial Number").GetText
        
    
    
    Next Cmd


    This is what I have so far...

    Gotta be able to pull the tracefield value from the part program and assign to the VSERIALNUMBER variable in the script.
    The line: "VSERIALNUMBER = TCmd("Serial Number").GetText" is throwing an Object Variable error "Not Set"
Reply
  • Thanks for the replies so far guys. I really appreciate it. Just can't quite get what I'm looking for though. I need to be able to take the value from the "Serial Number" tracefield and create a folder with the Trace field value as it's name. I just can't find quite the right commands to do that.

    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 VSERIALNUMBER As Object
    
    For Each Cmd In Cmds
       
       Set TCmd = Cmd.TraceFieldCommand
    
    Set VSERIALNUMBER = TCmd("Serial Number").GetText
        
    
    
    Next Cmd


    This is what I have so far...

    Gotta be able to pull the tracefield value from the part program and assign to the VSERIALNUMBER variable in the script.
    The line: "VSERIALNUMBER = TCmd("Serial Number").GetText" is throwing an Object Variable error "Not Set"
Children
No Data