hexagon logo

Passing Part Variables back and forth

I am having a helluva time trying to pull variables from the part program. The first time I pull a variable in this script, (Shown in blue) it works beautiful. The second time, pulling the same variable (shown in red), it pulls nothing! I have slowly changed the second call back to the exact text of the first, because nothing is working! Now it is identical except for the variable name the part variable is being assigned to and it still won't work! W T F! AngryAngryAngry

Dim Var
Dim Var2 As Object

If dblouttol > 0 Then 
   MsgBox "Part is BAD!" & Chr(10) & "Number of Dimensions Out of Tolerance:" & dblouttol & Chr(10) &"Features out of tolerance:" & Chr(10) & Msg ' Display the ID's that are out of tolerance
   [COLOR="Blue"]Set Var = objPART.GetVariableValue ("SUB_OUTTOLNUM")[/COLOR]        'Grabs the variable SUB_OUTTOLNUM from the subroutine program
   Var.stringvalue  = dblOutTol                                      'Sets variable As number of outtol dimensions. Change this To actual CMM Name/number
   Set Var2 = objPART.getvariablevalue ("SUB_ACCEPTREJECT")  'Grabs the variable Sub_ACCEPTREJECT from the subroutine program
   var2.stringvalue = "~~4 REJECTED"                                                                       'Sets variable As Accept, As part is good
                
End If  

objPART.SetVariableValue "SUB_OUTTOLNUM", Var                  'Passes the number of outtol dimensions back To the subroutine
objPART.SetVariableValue "SUB_ACCEPTREJECT", Var2           'Passes the Accept/Reject variable back To the subroutine


Dim Test1

[COLOR="Red"]Set Test1 = objpart.GetVariableValue ("SUB_OUTTOLNUM") [/COLOR]
msgbox Test1.stringvalue
Parents
  • This is not all the code. It is part of a quite lengthy script. Sometime today I am going to start with a fresh script and do some tests to see what works and what doesnt in a new file. Here is the initial declaration of stuff:


    Dim objApp As Object
    Set objApp = CreateObject("PCDLRN.Application")
    Dim objPart As Object
    Set objPart = objApp.ActivePartProgram
    Dim objCmds 'As Object
    Set objCmds = objPart.Commands
    Dim objCmd 'As Object
    Dim objDimCmd As Object
    Dim dblOutTol As Long
    dblOutTol = 0
    Dim dblTotalMeas As Long
    dblTotalMeas = 0
Reply
  • This is not all the code. It is part of a quite lengthy script. Sometime today I am going to start with a fresh script and do some tests to see what works and what doesnt in a new file. Here is the initial declaration of stuff:


    Dim objApp As Object
    Set objApp = CreateObject("PCDLRN.Application")
    Dim objPart As Object
    Set objPart = objApp.ActivePartProgram
    Dim objCmds 'As Object
    Set objCmds = objPart.Commands
    Dim objCmd 'As Object
    Dim objDimCmd As Object
    Dim dblOutTol As Long
    dblOutTol = 0
    Dim dblTotalMeas As Long
    dblTotalMeas = 0
Children
No Data