EgtCAM5 :

- modifiche per movimento grezzi contro riferimenti
- corretto seconda selezione su albero
- migliorata gestione parametri lavorazioni.
This commit is contained in:
Dario Sassi
2016-11-09 14:04:43 +00:00
parent 3ca4f7d5bd
commit aae55781ae
9 changed files with 201 additions and 154 deletions
@@ -110,70 +110,65 @@ Namespace EgtCAM5
End If
ParametersExpanderName = m_SelectedOperation.Name
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
Select Case SelectedOperation.m_Type
Case MCH_OY.DISP
' Abilito la selezione di tutti i tipi di geometria
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' Verifico se c'è un grezzo nella disposizione corrente
Dim bFirstRaw As Boolean = True
Dim nCurrPhase As Integer = EgtGetCurrPhase()
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawPartId, nCurrPhase) Then
bFirstRaw = False
Exit While
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
' Lancio funzione che inizializza la disposizione
m_OpenDispositionFunction(bFirstRaw)
' Nascondo tutte le lavorazioni
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
Dim nOpType As Integer = EgtGetOperationType(nOpId)
If nOpType = MCH_OY.DRILLING OrElse nOpType = MCH_OY.SAWING OrElse nOpType = MCH_OY.MILLING OrElse nOpType = MCH_OY.POCKETING OrElse nOpType = MCH_OY.MORTISING _
OrElse nOpType = MCH_OY.SAWROUGHING OrElse nOpType = MCH_OY.SAWFINISHING Then
EgtSetStatus(nOpId, GDB_ST.OFF)
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
Case MCH_OY.DRILLING, MCH_OY.SAWING, MCH_OY.MILLING, MCH_OY.MORTISING, MCH_OY.POCKETING, MCH_OY.SAWROUGHING, MCH_OY.SAWFINISHING
' Leggo il tipo di operazione per impostare il tipo di selezione
Dim OperationType As Integer = -1
EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
' Abilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione dei giusti tipi di geometria
Select Case OperationType
Case MCH_OY.SAWING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawing)
Case MCH_OY.DRILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomDrilling)
Case MCH_OY.MILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomMilling)
Case MCH_OY.POCKETING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomPocketing)
Case MCH_OY.MORTISING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomMortising)
Case MCH_OY.SAWROUGHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawRoughing)
Case MCH_OY.SAWFINISHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawFinishing)
End Select
End Select
If IsValidDispositionType(SelectedOperation.m_Type) Then
' Abilito la selezione di tutti i tipi di geometria
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' Verifico se c'è un grezzo nella disposizione corrente
Dim bFirstRaw As Boolean = True
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
bFirstRaw = False
Exit While
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
' Lancio funzione che inizializza la disposizione
m_OpenDispositionFunction(bFirstRaw)
' Nascondo tutte le lavorazioni
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, False)
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
ElseIf IsValidMachiningType(SelectedOperation.m_Type) Then
' Leggo il tipo di operazione per impostare il tipo di selezione
Dim OperationType As Integer = -1
EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
' Abilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione dei giusti tipi di geometria
Select Case OperationType
Case MCH_OY.SAWING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawing)
Case MCH_OY.DRILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomDrilling)
Case MCH_OY.MILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomMilling)
Case MCH_OY.POCKETING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomPocketing)
Case MCH_OY.MORTISING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomMortising)
Case MCH_OY.SAWROUGHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawRoughing)
Case MCH_OY.SAWFINISHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, m_SelGeomSawFinishing)
End Select
End If
Else
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
ListIsExpanded = True
End If
If SelectedOperation.m_Type = MCH_OY.DISP Then
' Riattivo tutte le lavorazioni
' Visualizzo tutte le lavorazioni della fase corrente
Dim nCurrPhase = EgtGetCurrPhase()
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
Dim nOpType As Integer = EgtGetOperationType(nOpId)
If nOpType = MCH_OY.DRILLING OrElse nOpType = MCH_OY.SAWING OrElse nOpType = MCH_OY.MILLING OrElse nOpType = MCH_OY.POCKETING OrElse nOpType = MCH_OY.MORTISING _
OrElse nOpType = MCH_OY.SAWROUGHING OrElse nOpType = MCH_OY.SAWFINISHING Then
EgtSetStatus(nOpId, GDB_ST.ON_)
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, (EgtGetOperationPhase(nOpId) = nCurrPhase))
End If
nOpId = EgtGetNextOperation(nOpId)
End While
@@ -372,7 +367,6 @@ Namespace EgtCAM5
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdUpdate As ICommand
Private m_cmdReloadMachining As ICommand
Sub New()
Dim Temp As Integer = 0
@@ -713,69 +707,6 @@ Namespace EgtCAM5
#End Region ' UpdateCommand
#Region "ReloadMachiningCommand"
''' <summary>
''' Restituisce funzione per ricalcolo lavorazione.
''' </summary>
Public ReadOnly Property ReloadMachiningCommand As ICommand
Get
If m_cmdReloadMachining Is Nothing Then
m_cmdReloadMachining = New RelayCommand(AddressOf ReloadMachining, AddressOf CanReloadMachining)
End If
Return m_cmdReloadMachining
End Get
End Property
''' <summary>
''' Ricalcola una lavorazione.
''' </summary>
Public Sub ReloadMachining(ByVal param As Object)
' Aggiorno valore depth
SelectedOperation.NotifyPropertyChanged("Depth")
' Carico tutta la geometria selezionata in una lista
Dim SelectedGeometry As New List(Of Integer)
Dim EntityIndex As Integer = EgtGetFirstSelectedObj()
While EntityIndex <> GDB_ID.NULL
SelectedGeometry.Add(EntityIndex)
EntityIndex = EgtGetNextSelectedObj()
End While
' Verifico se la geometria è cambiata, confrontando selezione attuale con geometria di lavorazione
Dim ModifiedGeometry As Boolean = False
Dim CountIndex As Integer = 0
EntityIndex = 0
Dim SubEntityIndex As Integer = 0 ' Sottocomponente, per ora non usato ma necessario
While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex)
If SubEntityIndex = GDB_ID.NULL And CountIndex < SelectedGeometry.Count() Then
If SelectedGeometry(CountIndex) <> EntityIndex Then
ModifiedGeometry = True
Exit While
End If
Else
ModifiedGeometry = True
Exit While
End If
CountIndex += 1
End While
If SelectedGeometry.Count <> CountIndex Then
ModifiedGeometry = True
End If
' Imposto geometria selezionata come geometria di lavorazione
If ModifiedGeometry Then EgtSetMachiningGeometry(SelectedGeometry.ToArray)
' Se necessario ricalcolo la lavorazione
EgtApplyMachining(ModifiedGeometry)
EgtDraw()
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanReloadMachining(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' ReloadMachiningCommand
#End Region ' Commands
#Region "METHODS"