Imports EgtUILib

Module DirectCut
   ' Riferimenti a pagine
   Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)

   Friend Function CreateDirectCutPart() As Integer
      Dim nPartId = EgtCreateGroup(GDB_ID.ROOT)
      EgtSetName(nPartId, NAME_DIRECTCUT)
      Return nPartId
   End Function

   Friend Function EraseDirectCutPart() As Boolean
      ' Recupero identificativo del pezzo
      Dim nPartId As Integer = EgtGetFirstNameInGroup(m_MainWindow.m_CurrentProjectPageUC.m_nRawId, NAME_DIRECTCUT)
      If nPartId = GDB_ID.NULL Then Return True
      ' Cancello le lavorazioni
      EraseMachinings(nPartId)
      ' Tolgo il pezzo dal grezzo
      EgtRemovePartFromRawPart(nPartId)
      ' Cancello il pezzo
      EgtErase(nPartId)
      Return True
   End Function

   Friend Function GetDirectCutPart() As Integer
      Return EgtGetFirstNameInGroup(m_MainWindow.m_CurrentProjectPageUC.m_nRawId, NAME_DIRECTCUT)
   End Function

End Module
