4 Replies Latest reply on Mar 10, 2014 1:41 PM by Jerry Wolverton

    Managing Custom References.

    Seth Morgan-Ruhan

      Hi,

       

      I have managed to add & remove Custom references with the interface "IEdmEnumeratorCustomReference5". However I can not determine how I can control the Quanity or the function that adds the reference to the BOM side of things.

      Snap1.jpg

       

       

       

      Public Sub AddReference(ReferenceFile As EDMFile, ByVal UnlockFile As Boolean)
              Dim CheckFile_IN As Boolean
              If Not Me.IsValid Then Exit Sub
      
      
              If Not _File.IsLocked Then
                  If UnlockFile Then
                      _File.edmFile.LockFile(_File.edmFolder.ID, 0)
                      CheckFile_IN = True
                  Else
                      Throw New Exception(_File.edmFile.Name & " was not checked out.")
                  End If
              End If
              Dim mainFile As IEdmEnumeratorCustomReference5 = _File
              Dim File2 As IEdmFile7 = ReferenceFile.edmFile
              Dim Folder2 As IEdmFolder5 = ReferenceFile.edmFolder
              mainFile.AddReference(File2.ID, Folder2.ID)
              If CheckFile_IN Then
                  _File.edmFile.UnlockFile(_File.edmFolder.ID, "File reference added")
              End If
          End Sub
      
          Public Sub RemoveReference(ReferenceFile As EDMFile, ByVal UnlockFile As Boolean)
              Dim CheckFile_IN As Boolean
              If Not Me.IsValid Then Exit Sub
      
      
              If Not _File.IsLocked Then
                  If UnlockFile Then
                      _File.edmFile.LockFile(_File.edmFolder.ID, 0)
                      CheckFile_IN = True
                  Else
                      Throw New Exception(_File.edmFile.Name & " was not checked out.")
                  End If
              End If
              Dim mainFile As IEdmEnumeratorCustomReference5 = _File
              Dim File2 As IEdmFile7 = ReferenceFile.edmFile
              Dim Folder2 As IEdmFolder5 = ReferenceFile.edmFolder
              mainFile.RemoveReference(File2.ID, Folder2.ID)
              If CheckFile_IN Then
                  _File.edmFile.UnlockFile(_File.edmFolder.ID, "File reference removed")
              End If
          End Sub