Checking for a created feature ID?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Checking for a created feature ID?

    Code:
    For X = 1 To 55 Step 1
        Set Cmd = Nothing
        
        'Read Text File values
        Input #1, MyFeatID, MyFeatX, MyFeatY, MyFeatZ, MyFeatI, MyFeatJ, MyFeatK
        
        'Set the Cmd = to the Feature ID read out of the text file
        Set Cmd = Cmds.Item(MyFeatID)
    
            'Check to see if I have the correct command ID first.
            If Cmd.ID = MyFeatID Then
                ReturnVar1 = Cmd.PutText(MyFeatX, TARG_X, 0)
                ReturnVar2 = Cmd.PutText(MyFeatY, TARG_Y, 0)
                ReturnVar3 = Cmd.PutText(MyFeatZ, TARG_Z, 0)
                ReturnVar4 = Cmd.PutText(MyFeatI, TARG_I, 0)
                ReturnVar5 = Cmd.PutText(MyFeatJ, TARG_J, 0)
                ReturnVar6 = Cmd.PutText(MyFeatK, TARG_K, 0)
                Cmd.ReDraw
            Else
                MsgBox "Feature ID: " & MyFeatID & " not matching, somethings wrong!!!"
            End If
    
    Next X
    In the above code Im setting the targ values in my current PCDMIS part program to target values saved from a prior run. Of course It works ok when everything is ok. However I want to test to see if my Cmd.ID matchs MyFeatID before blindly blasting data into my part program.

    So I setup a test and put a bogus feature id in my text file and of course pcdmis or VB couldnt find the feature id when I tried to set the command in the code above. This makes "Cmd" = nothing, which is all cool and stuff but how do you get the VB compiler to evaluate an object that is = nothing?

    This one has me stumped for now, any thoughts?

    Above code will die at the beginning of the If statement if the object is not found.

    I was hoping someone might know if there is a "If Exsists" function for feature IDs instead? This way I could test for the feature before trying to run the Set command code against it.

    Thanks
    Mr. Comment
    SCIROCCO-NT 13-20-10
    B3C-LC Controller (Leitz Protocol), SP600M, TP200
    PCDMIS CAD++ v4.3 MR1(Build: 12/11/08)
    sigpic

  • #2
    If Not Cmd Is Nothing Then
    msgbox "Command is Not NULL and we are happy"
    Else
    msgbox "Cmd is Nothing"
    End If

    Comment


    • #3
      Ah, thanks...

      I forgot all about the IS clauses.
      Mr. Comment
      SCIROCCO-NT 13-20-10
      B3C-LC Controller (Leitz Protocol), SP600M, TP200
      PCDMIS CAD++ v4.3 MR1(Build: 12/11/08)
      sigpic

      Comment

      Related Topics

      Collapse

      Working...
      X