hexagon logo

Set A Variable in PC-DMIS with a textbox in VB.Net

Hi guys,

I have taken on the task of automating our CMM operations, and so far I have been able to push through some of my issues but I am stumped on this one. All I want to do is have the VB program output whatever is written in a textbox into a variable on PC-Dmis.

Thanks for the help.
Matt
Parents
  • It doesn't know what SRC_EXPR and DEST_EXPR are.

    They're part of an ENUMERATION (basically a list if numbers given names).

    The below works...

    As for retval, it's not declared,

    dim retval as boolean = cmd.puttext... blah bla blah, but if you're not testing if it works or not it's not needed.


    I also notice you've not told it what the PCDApp, PCDPartPrograms, PCDPartProgram are - how's it meant to know if they're variable or object variable?



    This works...

    Dim pcd As PCDLRN.Application
    pcd = CreateObject("pcdlrn.application")
    Dim pcpart As PCDLRN.PartProgram
    pcpart = pcd.ActivePartProgram

    Dim cmds As PCDLRN.Commands
    cmds = pcpart.Commands

    Dim cmd As PCDLRN.Command
    For i As Integer = 1 To cmds.Count
    cmd = cmds.Item(i)
    If cmd.IsFlowControl Then
    If cmd.TypeDescription = "Assignment" And cmd.GetText(PCDLRN.ENUM_FIELD_TYPES.DEST_EXPR, 0) = "JOBNO" Then


    cmd.PutText("1234", PCDLRN.ENUM_FIELD_TYPES.SRC_EXPR, 0)


    End If
    End If


    Next
Reply
  • It doesn't know what SRC_EXPR and DEST_EXPR are.

    They're part of an ENUMERATION (basically a list if numbers given names).

    The below works...

    As for retval, it's not declared,

    dim retval as boolean = cmd.puttext... blah bla blah, but if you're not testing if it works or not it's not needed.


    I also notice you've not told it what the PCDApp, PCDPartPrograms, PCDPartProgram are - how's it meant to know if they're variable or object variable?



    This works...

    Dim pcd As PCDLRN.Application
    pcd = CreateObject("pcdlrn.application")
    Dim pcpart As PCDLRN.PartProgram
    pcpart = pcd.ActivePartProgram

    Dim cmds As PCDLRN.Commands
    cmds = pcpart.Commands

    Dim cmd As PCDLRN.Command
    For i As Integer = 1 To cmds.Count
    cmd = cmds.Item(i)
    If cmd.IsFlowControl Then
    If cmd.TypeDescription = "Assignment" And cmd.GetText(PCDLRN.ENUM_FIELD_TYPES.DEST_EXPR, 0) = "JOBNO" Then


    cmd.PutText("1234", PCDLRN.ENUM_FIELD_TYPES.SRC_EXPR, 0)


    End If
    End If


    Next
Children
No Data