Your Products have been synced, click here to refresh
Set DmisCommand = DmisCommands.Add(TRACEFIELD, TRUE) DmisCommand.Marked = TRUE ' Set Name = Lot # retval = DmisCommand.PutText ("Lot #", TRACE_NAME, 0) ' Set Value = retval = DmisCommand.PutText ("", TRACE_VALUE, 0) ' Set Value Limit = 15 retval = DmisCommand.PutText ("15", TRACE_VALUE_LIMIT, 0) Result = DmisCommand.SetExpression("LOT", TRACE_VALUE, 0)
This is what a PCD tracefield command looks like in basic:
Set DmisCommand = DmisCommands.Add(TRACEFIELD, TRUE) DmisCommand.Marked = TRUE ' Set Name = Lot # retval = DmisCommand.PutText ("Lot #", TRACE_NAME, 0) ' Set Value = retval = DmisCommand.PutText ("", TRACE_VALUE, 0) ' Set Value Limit = 15 retval = DmisCommand.PutText ("15", TRACE_VALUE_LIMIT, 0) Result = DmisCommand.SetExpression("LOT", TRACE_VALUE, 0)
Just have to figure out how to look for a specific TRACE_NAME then get the TRACE_VALUE.
Sub Main 'Declares the File System Object And Instantiates it Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") Dim Count As Integer 'Declares PC-DMIS As the Active Program/Application Dim PCDApp, Part, Cmds, Cmd, TCmd As Object Set PCDApp = CreateObject("PCDLRN.Application") Set Part = PCDApp.ActivePartProgram Set Cmds = Part.Commands For Each Cmd In Cmds If Cmd.IsTraceFieldCommand Then Set TCmd = Cmd.TraceFieldCommand Count=Count+1 End If Next Cmd
Take a look at this thread: http://www.pcdmisforum.com/showthread.php?26953-Script-to-make-a-change-in-all-programs
I posted some examples of both getting and setting values for some other commands, the syntax will be nearly the same for what you're doing.
Sub Main 'Declares the File System Object And Instantiates it Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") Dim Count As Integer 'Declares PC-DMIS As the Active Program/Application Dim PCDApp, Part, Cmds, Cmd, TCmd As Object Set PCDApp = CreateObject("PCDLRN.Application") Set Part = PCDApp.ActivePartProgram Set Cmds = Part.Commands For Each Cmd In Cmds [COLOR=#ff0000]If Cmd.Type = 191 Then 'Think this is the tracefield type number TCmd = Cmd.gettext(TRACE_VALUE, 1)[/COLOR] Count=Count+1 End If Next Cmd
Am I on the right track with this? I keep getting a type mismatch error with the If line ("If Cmd.IsTraceFieldCommand Then")
Dim PCDApp, Part, Cmds, Cmd, TCmd, TCmds As Object PCDApp = CreateObject("PCDLRN.Application") Part = PCDApp.ActivePartProgram Cmds = Part.Commands Cmd = Part.Command TCmds = Part.TraceFieldCommands TCmd = Part.TraceFieldCommand Dim VSERIALNUMBER As Object For Each TCmd In TCmds If TCmd.Name = "SERIALNUMBER" Then VSERIALNUMBER = TCmd.Value End If Next
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |