3801 lines
150 KiB
VB.net
3801 lines
150 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.Drawing
|
|
Imports System.Reflection
|
|
Imports System.Security.Cryptography
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports EgtWPFLib5.EgtCustomWindow
|
|
|
|
Public Class SplitModeVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Stato
|
|
Private m_nCurrPhase As Integer = 0
|
|
Private m_MachiningList As New List(Of SplitMach)
|
|
Private m_bModified As Boolean = False
|
|
Private m_nNbrGrpId As Integer = GDB_ID.NULL
|
|
Private m_CurrFirstInd As Integer = -1
|
|
Private m_CurrLastInd As Integer = -1
|
|
Private m_SelectedItemsList As New ObservableCollection(Of NameIdLsBxItem)
|
|
|
|
' numero di lavorazioni di tipo lama
|
|
Private m_nCountSawing As Integer = 0
|
|
' numero di lavprazioni di tipo waterjet
|
|
Private m_nCountWaterjetting As Integer = 0
|
|
' altri tipi di lavorazioni (Foro/Fresa)
|
|
Private m_nCountOtherMachining As Integer = 0
|
|
' verifico che le lavorazioni selezionate siano omogenee (con lo stesso utensile)
|
|
Private m_bAreHomogeneous As Boolean = False
|
|
|
|
' Id tagli WJ per generazione ponticelli tra due percorsi
|
|
Private m_nIdSelectedPartWJ_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedSideWJ_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedWaterJet_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedPartWJ_End As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedSideWJ_End As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedWaterJet_End As Integer = GDB_ID.NULL
|
|
' Id gruppo Bridges (Nuovo da versione 30/08/2022)
|
|
Private m_nIdBridgesGroup As Integer = GDB_ID.NULL
|
|
'Private m_nIdBridgeLineGroup As Integer = GDB_ID.NULL
|
|
Private m_nIdBridge As Integer = GDB_ID.NULL
|
|
Private m_ptSrtBridge As New Point3d
|
|
Private m_ptEndBridge As New Point3d
|
|
|
|
' Punti per creazione tagli odi separazione
|
|
Private m_ptStartPoint As Point3d
|
|
Private m_bGetStartPoint As Boolean = False
|
|
Private m_ptEndPoint As Point3d
|
|
Private m_bGetEndPoint As Boolean = False
|
|
Private m_IdSplitLine As Integer = GDB_ID.NULL
|
|
Private m_IdSplitGroup As Integer = GDB_ID.NULL
|
|
Private m_IdSplitGroupLayer As Integer = GDB_ID.NULL
|
|
Private m_IdCurrRawSolid As Integer = GDB_ID.NULL
|
|
Private m_IdSplitLineRemove As Integer = GDB_ID.NULL
|
|
|
|
' Flag di pagina attiva
|
|
Private m_bActive As Boolean = False
|
|
' Drag
|
|
Private m_nDragInd As Integer = -1
|
|
Private m_nDragType As Integer = 0 '0=niente, 1=attacco, 2=uscita
|
|
Private m_ptDragPrev As Point3d
|
|
Private m_bDragging As Boolean = False
|
|
' Selected cut
|
|
Private m_nSelected As Integer = GDB_ID.NULL
|
|
' Abilita la mofica Inizio fine per i tagli interni sugli angoli
|
|
Private m_StartEndModifyOnIntCorner As Boolean = False
|
|
|
|
Private m_ItemList As New ObservableCollection(Of NameIdLsBxItem)
|
|
Public ReadOnly Property ItemList As ObservableCollection(Of NameIdLsBxItem)
|
|
Get
|
|
Return m_ItemList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_bEnabledCommandMove As Boolean = False
|
|
Public Property bEnabledCommandMove As Boolean
|
|
Get
|
|
Return m_bEnabledCommandMove
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bEnabledCommandMove = value
|
|
NotifyPropertyChanged("bEnabledCommandMove")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SplitModeIsEnabled As Boolean
|
|
Public Property SplitModeIsEnabled As Boolean
|
|
Get
|
|
Return m_SplitModeIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_SplitModeIsEnabled = value
|
|
NotifyPropertyChanged("SplitModeIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllExtRedVisibility As Visibility
|
|
Public Property AllExtRedVisibility As Visibility
|
|
Get
|
|
Return m_AllExtRedVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllExtRedVisibility = value
|
|
NotifyPropertyChanged("AllExtRedVisibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CutBtnVisibility As Visibility
|
|
Public Property CutBtnVisibility As Visibility
|
|
Get
|
|
Return m_CutBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CutBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(CutBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CutStartBtnVisibility As Visibility
|
|
Public Property CutStartBtnVisibility As Visibility
|
|
Get
|
|
Return m_CutStartBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CutStartBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(CutStartBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CutEndBtnVisibility As Visibility
|
|
Public Property CutEndBtnVisibility As Visibility
|
|
Get
|
|
Return m_CutEndBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_CutEndBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(CutEndBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OutCenStartBtnVisibility As Visibility
|
|
Public Property OutCenStartBtnVisibility As Visibility
|
|
Get
|
|
Return m_OutCenStartBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_OutCenStartBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(OutCenStartBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OutCenEndBtnVisibility As Visibility
|
|
Public Property OutCenEndBtnVisibility As Visibility
|
|
Get
|
|
Return m_OutCenEndBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_OutCenEndBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(OutCenEndBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_InvertBtnVisibility As Visibility
|
|
Public Property InvertBtnVisibility As Visibility
|
|
Get
|
|
Return m_InvertBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_InvertBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(InvertBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PauseBtnVisibility As Visibility
|
|
Public Property PauseBtnVisibility As Visibility
|
|
Get
|
|
Return m_PauseBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_PauseBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(PauseBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllOutStartBtnVisibility As Visibility
|
|
Public Property AllOutStartBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllOutStartBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllOutStartBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllOutStartBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllCenStartBtnVisibility As Visibility
|
|
Public Property AllCenStartBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllCenStartBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllCenStartBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllCenStartBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllOutEndBtnVisibility As Visibility
|
|
Public Property AllOutEndBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllOutEndBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllOutEndBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllOutEndBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllCenEndBtnVisibility As Visibility
|
|
Public Property AllCenEndBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllCenEndBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllCenEndBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllCenEndBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllExtendBtnVisibility As Visibility
|
|
Public Property AllExtendBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllExtendBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllExtendBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllExtendBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllReduceBtnVisibility As Visibility
|
|
Public Property AllReduceBtnVisibility As Visibility
|
|
Get
|
|
Return m_AllReduceBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllReduceBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(AllReduceBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BridgeBtnVisibility As Visibility = Visibility.Hidden
|
|
Public Property BridgeBtnVisibility As Visibility
|
|
Get
|
|
Return m_BridgeBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_BridgeBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(BridgeBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BridgeDeleteBtnVisibility As Visibility = Visibility.Hidden
|
|
Public Property BridgeDeleteBtnVisibility As Visibility
|
|
Get
|
|
Return m_BridgeDeleteBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_BridgeDeleteBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(BridgeDeleteBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_QualityBtnVisibility As Visibility = Visibility.Hidden
|
|
|
|
Public Property QualityBtnVisibility As Visibility
|
|
Get
|
|
Return m_QualityBtnVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_QualityBtnVisibility = value
|
|
NotifyPropertyChanged(NameOf(QualityBtnVisibility))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bOnOffCut_IsExpanded As Boolean = True
|
|
Public Property bOnOffCut_IsExpanded As Boolean
|
|
Get
|
|
Return m_bOnOffCut_IsExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bOnOffCut_IsExpanded = value
|
|
NotifyPropertyChanged(NameOf(bOnOffCut_IsExpanded))
|
|
WriteMainPrivateProfileString("Split", "OnOffCut", If(m_bOnOffCut_IsExpanded, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bSpLitCut_IsExpanded As Boolean = True
|
|
Public Property bSpLitCut_IsExpanded As Boolean
|
|
Get
|
|
Return m_bSpLitCut_IsExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bSpLitCut_IsExpanded = value
|
|
NotifyPropertyChanged(NameOf(bSpLitCut_IsExpanded))
|
|
WriteMainPrivateProfileString("Split", "SplitCut", If(m_bSpLitCut_IsExpanded, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bDirectSpLitCut_IsExpanded As Boolean = True
|
|
Public Property bDirectSpLitCut_IsExpanded As Boolean
|
|
Get
|
|
Return m_bDirectSpLitCut_IsExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bDirectSpLitCut_IsExpanded = value
|
|
NotifyPropertyChanged(NameOf(bDirectSpLitCut_IsExpanded))
|
|
WriteMainPrivateProfileString("Split", "DirectSplitCut", If(m_bDirectSpLitCut_IsExpanded, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bModifyCut_IsExpanded As Boolean = True
|
|
Public Property bModifyCut_IsExpanded As Boolean
|
|
Get
|
|
Return m_bModifyCut_IsExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bModifyCut_IsExpanded = value
|
|
NotifyPropertyChanged(NameOf(bModifyCut_IsExpanded))
|
|
WriteMainPrivateProfileString("Split", "ModifyCut", If(m_bModifyCut_IsExpanded, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BridgeBtn_IsChecked As Boolean = False
|
|
Public Property BridgeBtn_IsChecked As Boolean
|
|
Get
|
|
Return m_BridgeBtn_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_BridgeBtn_IsChecked = value
|
|
BridgeIsChecked()
|
|
NotifyPropertyChanged(NameOf(BridgeBtn_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BridgeDeleteBtn_IsChecked As Boolean = False
|
|
Public Property BridgeDeleteBtn_IsChecked As Boolean
|
|
Get
|
|
Return m_BridgeDeleteBtn_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_BridgeDeleteBtn_IsChecked = value
|
|
BridgeDeleteIsChecked()
|
|
NotifyPropertyChanged(NameOf(BridgeDeleteBtn_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LayNbArrTgBtn_IsChecked As Boolean = False
|
|
Public Property LayNbArrTgBtn_IsChecked As Boolean
|
|
Get
|
|
Return m_LayNbArrTgBtn_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
' imposto il valore della bottone, dell'icona e del messaggio
|
|
SetLayNbArrTgBtn_IsChecked(value)
|
|
WriteMainPrivateProfileString(S_GENERAL, K_SHOWNBARROW, If(m_LayNbArrTgBtn_IsChecked, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub SetLayNbArrTgBtn_IsChecked(value As Boolean)
|
|
m_LayNbArrTgBtn_IsChecked = value
|
|
If value Then
|
|
StatusOffNumbArrow(GDB_ST.ON_)
|
|
m_LayNbArrTgBtnMsg = EgtMsg(91218) ' Hide
|
|
m_LayNbArrTgBtnImg = "/Resources/NewIcons/LightArrowOn.png"
|
|
Else
|
|
StatusOffNumbArrow(GDB_ST.OFF)
|
|
m_LayNbArrTgBtnMsg = EgtMsg(91219) ' Show
|
|
m_LayNbArrTgBtnImg = "/Resources/NewIcons/LightArrowOff.png"
|
|
End If
|
|
NotifyPropertyChanged(NameOf(LayNbArrTgBtnMsg))
|
|
NotifyPropertyChanged(NameOf(LayNbArrTgBtnImg))
|
|
End Sub
|
|
|
|
#Region "SPLIT CUT"
|
|
|
|
Private m_CreateCut_IsChecked As Boolean
|
|
Public Property CreateCut_IsChecked As Boolean
|
|
Get
|
|
Return m_CreateCut_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_CreateCut_IsChecked = value
|
|
m_RemoveCut_IsChecked = False
|
|
m_CreateParallelCut_IsChecked = False
|
|
m_ModifyCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
CreateCutIsChecked()
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RemoveCut_IsChecked As Boolean
|
|
Public Property RemoveCut_IsChecked As Boolean
|
|
Get
|
|
Return m_RemoveCut_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_RemoveCut_IsChecked = value
|
|
m_CreateCut_IsChecked = False
|
|
m_CreateParallelCut_IsChecked = False
|
|
m_ModifyCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
RemoveCutIsChecked()
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CreateParallelCut_IsChecked As Boolean
|
|
Public Property CreateParallelCut_IsChecked As Boolean
|
|
Get
|
|
Return m_CreateParallelCut_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_CreateParallelCut_IsChecked = value
|
|
m_CreateCut_IsChecked = False
|
|
m_RemoveCut_IsChecked = False
|
|
m_ModifyCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
CreateParellelCutIsChecked()
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ModifyCut_IsChecked As Boolean
|
|
Public Property ModifyCut_IsChecked As Boolean
|
|
Get
|
|
Return m_ModifyCut_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_ModifyCut_IsChecked = value
|
|
m_CreateCut_IsChecked = False
|
|
m_RemoveCut_IsChecked = False
|
|
m_CreateParallelCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
ModifyCutIsChecked()
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Split Cut
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property OnOffMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOffMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 4)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 5)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 6)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OutCenStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 7)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOutStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 8)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllCenStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 9)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OutCenEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 12)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOutEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 13)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllCenEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 14)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllExtendMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 15)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllReduceMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 16)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ModifStartMsg As String
|
|
Get
|
|
Return EgtMsg(90373) ' Inizio Modif.
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ModifEndMsg As String
|
|
Get
|
|
Return EgtMsg(90374) ' Fine Modif.
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PauseMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 31)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property InvertMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 36)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BridgeMsg As String
|
|
Get
|
|
Return EgtMsg(91671)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BridgeDeleteMsg As String
|
|
Get
|
|
Return EgtMsg(91672)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property QualityMsg As String
|
|
Get
|
|
Return EgtMsg(91673)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EnableCutMsg As String
|
|
Get
|
|
Return EgtMsg(91663)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property SplitCutMsg As String
|
|
Get
|
|
Return EgtMsg(91664)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DirectSplitCutMsg As String
|
|
Get
|
|
Return EgtMsg(91665)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ManageStartEndCutMsg As String
|
|
Get
|
|
Return EgtMsg(91666)
|
|
End Get
|
|
End Property
|
|
|
|
Private Property m_LayNbArrTgBtnMsg As String = "Show"
|
|
Public ReadOnly Property LayNbArrTgBtnMsg As String
|
|
Get
|
|
Return m_LayNbArrTgBtnMsg
|
|
End Get
|
|
End Property
|
|
|
|
Private Property m_LayNbArrTgBtnImg As String = "/Resources/NewIcons/LightArrowOn.png"
|
|
Public ReadOnly Property LayNbArrTgBtnImg As String
|
|
Get
|
|
Return m_LayNbArrTgBtnImg
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comandi
|
|
Private m_cmdMoveUp As ICommand
|
|
Private m_cmdMoveDown As ICommand
|
|
Private m_cmdOnOff As ICommand
|
|
Private m_cmdAllOn As ICommand
|
|
Private m_cmdAllOff As ICommand
|
|
Private m_cmdCut As ICommand
|
|
Private m_cmdCutStart As ICommand
|
|
Private m_cmdCutEnd As ICommand
|
|
Private m_cmdOutCenStart As ICommand
|
|
Private m_cmdAllOutStart As ICommand
|
|
Private m_cmdAllCenStart As ICommand
|
|
Private m_cmdOutCenEnd As ICommand
|
|
Private m_cmdAllOutEnd As ICommand
|
|
Private m_cmdAllCenEnd As ICommand
|
|
Private m_cmdAllExtend As ICommand
|
|
Private m_cmdAllReduce As ICommand
|
|
Private m_cmdModifStart As ICommand
|
|
Private m_cmdModifEnd As ICommand
|
|
Private m_cmdPause As ICommand
|
|
Private m_cmdInvert As ICommand
|
|
Private m_cmdQuality As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in OmagOFFICEMap
|
|
OmagOFFICEMap.SetRefSplitModeVM(Me)
|
|
' leggo la configurazione
|
|
SetLayNbArrTgBtn_IsChecked((GetMainPrivateProfileInt(S_GENERAL, K_SHOWNBARROW, 1) <> 0))
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Function InitSplitRaw() As Boolean
|
|
m_bActive = True
|
|
m_bOnOffCut_IsExpanded = GetMainPrivateProfileInt("Split", "OnOffCut", 0) <> 0
|
|
NotifyPropertyChanged(NameOf(bOnOffCut_IsExpanded))
|
|
m_bSpLitCut_IsExpanded = GetMainPrivateProfileInt("Split", "SplitCut", 0) <> 0
|
|
NotifyPropertyChanged(NameOf(bSpLitCut_IsExpanded))
|
|
m_bDirectSpLitCut_IsExpanded = GetMainPrivateProfileInt("Split", "DirectSplitCut", 0) <> 0
|
|
NotifyPropertyChanged(NameOf(bDirectSpLitCut_IsExpanded))
|
|
m_bModifyCut_IsExpanded = GetMainPrivateProfileInt("Split", "ModifyCut", 0) <> 0
|
|
NotifyPropertyChanged(NameOf(bModifyCut_IsExpanded))
|
|
' aggiorno la visualizzazione dei comandi per generare i bridge
|
|
m_BridgeBtn_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(BridgeBtn_IsChecked))
|
|
m_BridgeDeleteBtn_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(BridgeDeleteBtn_IsChecked))
|
|
'm_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
' verifico se è abilitata la possibiltà di allungare i lati interni
|
|
m_StartEndModifyOnIntCorner = (GetPrivateProfileInt(S_NEST, K_STARTENDMODIFYONINTCORNER, 0, sMachIniFile) <> 0)
|
|
' Nascondo eventuali pezzi in parcheggio
|
|
EstCalc.HideParkedParts()
|
|
' Nascondo eventuale contorno da foto
|
|
EstPhoto.ShowContour(False)
|
|
' Deseleziono pezzi
|
|
EgtDeselectAll()
|
|
VeinMatching.OnDeselectAll()
|
|
EgtZoom(ZM.ALL)
|
|
' Elimino eventuali pretagli su uscite
|
|
CamAuto.RemoveAllExitPreCuts()
|
|
' Se non sono in sola visualizzazione, faccio ordine automatico delle lavorazioni
|
|
If Not OmagOFFICEMap.refMachiningTabVM.IsShow Then
|
|
If CurrentMachine.WaterJettingActive Then ResetAllMachinings()
|
|
If SortAllMachinings() Then EstCalc.SetOrderMachiningFlag()
|
|
If CurrentMachine.WaterJettingActive Then
|
|
Dim bModif As Boolean = TestAllMachiningsForStrict()
|
|
If bModif Then OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90321), 3, MSG_TYPE.WARNING) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
End If
|
|
End If
|
|
' Disabilito impostazione modificato
|
|
EgtDisableModified()
|
|
' Creo gruppo per numeri identificativi di lavorazione (colore default grigio)
|
|
m_nNbrGrpId = EgtCreateGroup(GDB_ID.ROOT)
|
|
EgtSetColor(m_nNbrGrpId, COL_MCH_DIS_NUMBER)
|
|
EgtSetStatus(m_nNbrGrpId, GDB_ST.SEL)
|
|
EgtSetLevel(m_nNbrGrpId, GDB_LV.TEMP)
|
|
' Recupero l'indice della fase corrente
|
|
m_nCurrPhase = EgtGetCurrPhase()
|
|
' Visualizzo solo anteprime di lavorazioni della fase
|
|
ShowOnePhaseMachiningPreview(m_nCurrPhase)
|
|
' Preparo la lista delle lavorazioni
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
' azzero i contatori delle lavorazioni
|
|
m_nCountSawing = 0
|
|
m_nCountWaterjetting = 0
|
|
m_nCountOtherMachining = 0
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberDirectionMachining(nI)
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Abilito impostazione modificato
|
|
EgtEnableModified()
|
|
' Nessun item corrente
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -1
|
|
' Reset flag di modifica
|
|
m_bModified = False
|
|
' Abilitazione bottoni
|
|
EnableButtons()
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function ExitSplitRaw(Optional bTrueExit As Boolean = True) As Boolean
|
|
m_bActive = False
|
|
' eventualmente interrompo la creazione dei ponticelli
|
|
DeselectWJBridgesPart()
|
|
|
|
' Interrompo la creazione di tagli di separazione
|
|
ResetSplitCut()
|
|
m_CreateCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
m_RemoveCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
m_CreateParallelCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
m_ModifyCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
|
|
' Rimuovo evidenziazione e numeri
|
|
RemoveMarkAndNumbers()
|
|
' Ripristino colori lavorazioni
|
|
EgtDisableModified()
|
|
For i As Integer = 0 To m_MachiningList.Count() - 1
|
|
ColorMachining(m_MachiningList(i), True)
|
|
Next
|
|
EgtEnableModified()
|
|
' Pulisco la lista che tiene conto delle lavorazioni selezionate
|
|
m_SelectedItemsList.Clear()
|
|
' se modificato salvo ordine e stato delle lavorazioni
|
|
If m_bModified Then
|
|
' Al primo posto deve rimanere la disposizione della fase
|
|
Dim nFirstOperId As Integer = EgtGetPhaseDisposition(m_nCurrPhase)
|
|
For i = m_ItemList.Count() - 1 To 0 Step -1
|
|
Dim nI As Integer = m_ItemList(i).Ind
|
|
Dim nMchId As Integer = m_MachiningList(nI).m_nId
|
|
EgtRelocate(nMchId, nFirstOperId, GDB_POS.AFTER)
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
EgtSetOperationMode(m_MachiningList(nI).m_nId, True)
|
|
EgtRemoveInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_OFF)
|
|
Else
|
|
EgtSetOperationMode(m_MachiningList(nI).m_nId, False)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_OFF, True)
|
|
End If
|
|
Next
|
|
' dichiaro ordine salvato
|
|
EstCalc.SetOrderMachiningFlag()
|
|
End If
|
|
' Affondamento ridotto
|
|
Dim dReducedDepth As Double = GetMainPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1)
|
|
' Restringo o rialzo lavorazioni abilitate ma con interferenza
|
|
Dim bModified As Boolean = False
|
|
For Each Mach As SplitMach In m_MachiningList
|
|
If Mach.m_bEnabled And Mach.m_nInterf <> FMI_TYPE.NONE Then
|
|
If AdjustMachining(Mach.m_nId, Mach.m_nInterf, dReducedDepth) Then
|
|
bModified = True
|
|
End If
|
|
End If
|
|
Next
|
|
If bTrueExit Then
|
|
' ritorno a fase 1
|
|
EgtSetCurrPhase(1)
|
|
' Ripristino visualizzazione preview lavorazioni
|
|
ShowAllPhasesMachiningPreview()
|
|
End If
|
|
If bModified Then
|
|
' Ridotte alcune lavorazioni per evitare interferenze
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90321), 3, MSG_TYPE.WARNING)
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub AddPauseText(ByRef sName As String)
|
|
sName &= " " & EgtMsg(MSG_SPLITPAGEUC + 32) ' Pausa
|
|
End Sub
|
|
|
|
Private Sub AddTopText(ByRef sName As String)
|
|
sName &= EgtMsg(91217) ' Top
|
|
End Sub
|
|
|
|
Private Sub RemovePauseText(ByRef sName As String)
|
|
sName = sName.Replace(EgtMsg(MSG_SPLITPAGEUC + 32), "")
|
|
sName = sName.TrimEnd()
|
|
End Sub
|
|
|
|
Friend Function GetDisabledCutsCount() As Integer
|
|
' Determino il numero di tagli disabilitati
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If Not m_MachiningList(nI).m_bEnabled Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
Return nCount
|
|
End Function
|
|
|
|
Friend Function GetSplitCutsCount() As Integer
|
|
' Determino il numero di tagli passanti almeno da un lato
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled And
|
|
(m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
Return nCount
|
|
End Function
|
|
|
|
Friend Sub GetSplitCuts(ByRef Cuts() As Integer)
|
|
' Determino l'elenco dei tagli passanti almeno da un lato
|
|
Dim MyCuts As New List(Of Integer)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled And
|
|
(m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) Then
|
|
MyCuts.Add(m_MachiningList(nI).m_nId)
|
|
End If
|
|
Next
|
|
Cuts = MyCuts.ToArray()
|
|
End Sub
|
|
|
|
Friend Sub GetEnabledCuts(ByRef Cuts() As Integer)
|
|
' Determino l'elenco dei tagli abilitati
|
|
Dim MyCuts As New List(Of Integer)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
MyCuts.Add(m_MachiningList(nI).m_nId)
|
|
End If
|
|
Next
|
|
Cuts = MyCuts.ToArray()
|
|
End Sub
|
|
|
|
Friend Sub ExecAuto()
|
|
' Con movimento manuale, non disponibile movimento automatico
|
|
If OmagOFFICEMap.refMachiningTabVM.ByHand Then Return
|
|
' Elimino evidenziazione e numerazione
|
|
RemoveMarkAndNumbers()
|
|
' Calcolo automatico
|
|
Dim bFinished As Boolean = False
|
|
Dim bOk As Boolean = SplitAuto.CalculateOnePhaseSplitAuto(bFinished)
|
|
If Not bOk Then
|
|
' Calcolo automatico non riuscito
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90350), 3, MSG_TYPE.WARNING)
|
|
End If
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Friend Sub ChangeToModify()
|
|
' Elimino le fasi successive alla corrente
|
|
While EgtGetPhaseCount() > m_nCurrPhase
|
|
RemoveLastPhase()
|
|
End While
|
|
' Aggiorno le lavorazioni (eliminato sort per lasciare ordine immutato)
|
|
If CurrentMachine.WaterJettingActive Then ResetAllMachinings()
|
|
EstCalc.SetOrderMachiningFlag()
|
|
If CurrentMachine.WaterJettingActive Then
|
|
Dim bModif As Boolean = TestAllMachiningsForStrict()
|
|
If bModif Then OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90321), 3, MSG_TYPE.WARNING) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
End If
|
|
' Visualizzo solo anteprime di lavorazioni della fase
|
|
ShowOnePhaseMachiningPreview(m_nCurrPhase)
|
|
' Nascondo gli eventuali percorsi di lavorazione
|
|
HideAllMachinings()
|
|
' Preparo la lista delle lavorazioni e le disabilito
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
' azzero i contatori delle lavorazioni
|
|
m_nCountSawing = 0
|
|
m_nCountWaterjetting = 0
|
|
m_nCountOtherMachining = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
EgtEmptyGroup(m_nNbrGrpId)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberDirectionMachining(nI)
|
|
Next
|
|
' -------------------- Recupero le lavorazioni indicate come attive --------------------
|
|
Dim ActiveMachLst As New List(Of Integer)
|
|
For Each ItemSplitMach As NameIdLsBxItem In m_ItemList
|
|
ActiveMachLst.Add(ItemSplitMach.Ind)
|
|
Next
|
|
' -------------------- Recupero le lavorazioni indicate come attive --------------------
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
' -------------------- Riattivo le lavorazioni precedenti --------------------
|
|
For Each Item As SplitMach In m_MachiningList
|
|
EgtSetInfo(Item.m_nId, INFO_MCH_USER_OFF, True)
|
|
Next
|
|
|
|
For nIndex As Integer = 0 To ActiveMachLst.Count - 1
|
|
For Each ItemSplitMach As NameIdLsBxItem In m_ItemList
|
|
If ItemSplitMach.Ind = ActiveMachLst(nIndex) Then
|
|
EgtRemoveInfo(m_MachiningList(ItemSplitMach.Ind).m_nId, INFO_MCH_USER_OFF)
|
|
m_MachiningList(ItemSplitMach.Ind).m_bEnabled = True
|
|
ItemSplitMach.bIsActive = True
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(ItemSplitMach.Ind))
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
' -------------------- Riattivo le lavorazioni precedenti --------------------
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
' Aggiorno le lavorazioni
|
|
Private Sub PreviewMachinigList()
|
|
' Visualizzo solo anteprime di lavorazioni della fase
|
|
ShowOnePhaseMachiningPreview(m_nCurrPhase)
|
|
' Preparo la lista delle lavorazioni
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
' azzero i contatori delle lavorazioni
|
|
m_nCountSawing = 0
|
|
m_nCountWaterjetting = 0
|
|
m_nCountOtherMachining = 0
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
EgtEmptyGroup(m_nNbrGrpId)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberDirectionMachining(nI)
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
End Sub
|
|
|
|
Private Sub ShowMachiningList()
|
|
m_ItemList.Clear()
|
|
For i As Integer = 1 To m_MachiningList.Count()
|
|
Dim Mach As SplitMach = m_MachiningList(i - 1)
|
|
If Mach.m_nType = MCH_OY.SAWING Then ' Taglio
|
|
Dim sText As String = String.Empty
|
|
If Math.Abs(Mach.m_dSideAng) < EPS_ANG_SMALL Then
|
|
sText = EgtMsg(90791) & " " & i.ToString()
|
|
If Mach.m_sLay = NAME_ONPATH Then AddTopText(sText)
|
|
Else
|
|
sText = EgtMsg(90791) & " " & i.ToString() & " " & DoubleToString(Mach.m_dSideAng, 2) & "°"
|
|
End If
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, MCH_OY.SAWING, "/Resources/NewIcons/Movimento-manuale.png"))
|
|
ElseIf Mach.m_nType = MCH_OY.DRILLING Then ' Foratura
|
|
Dim sText As String = EgtMsg(90792) & " " & i.ToString()
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, MCH_OY.DRILLING, "/Resources/NewIcons/Foro-singolo.png"))
|
|
ElseIf Mach.m_nType = MCH_OY.MILLING Then ' Fresatura
|
|
Dim sText As String = EgtMsg(90793) & " " & i.ToString()
|
|
If Mach.m_sLay = NAME_ONPATH Then AddTopText(sText)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, MCH_OY.MILLING, "/Resources/NewIcons/Spianatura.png"))
|
|
ElseIf Mach.m_nType = MCH_OY.POCKETING Then ' Svuotatura
|
|
Dim sText As String = EgtMsg(90796) & " " & i.ToString()
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, MCH_OY.POCKETING))
|
|
ElseIf Mach.m_nType = MCH_OY.WATERJETTING Then ' Waterjet
|
|
Dim sText As String = EgtMsg(90797) & " " & i.ToString()
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, MCH_OY.WATERJETTING))
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub EnableButtons()
|
|
' Per bottone PREV
|
|
OmagOFFICEMap.refMachiningTabVM.PrevIsEnabled = (m_nCurrPhase > 1)
|
|
' Per bottone NEXT
|
|
' Se abilitato manipolatore
|
|
If OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.MAN_MANIP) Or
|
|
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.AUTO_MANIP) Then
|
|
' Se in modifica
|
|
If Not OmagOFFICEMap.refMachiningTabVM.IsShow Then
|
|
' Se allontanamento perpendicolare
|
|
If OmagOFFICEMap.refMachiningTabVM.ByHand Then
|
|
' Ci deve essere almeno 1 taglio disabilitato e 1 e 1 solo passante
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = (GetDisabledCutsCount() > 0 And GetSplitCutsCount() = 1)
|
|
' Altrimenti
|
|
Else
|
|
' Ci deve essere almeno 1 taglio disabilitato e almeno 1 passante oppure fase successiva alla prima
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = (GetDisabledCutsCount() > 0 And
|
|
(GetSplitCutsCount() > 0 Or m_nCurrPhase > 1)) Or
|
|
CurrentMachine.bRawFinalMove
|
|
End If
|
|
' altrimenti sto solo visualizzando
|
|
Else
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = (m_nCurrPhase < EgtGetPhaseCount())
|
|
End If
|
|
Else
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = False
|
|
End If
|
|
' Per bottone MODIFY
|
|
OmagOFFICEMap.refMachiningTabVM.ModifyIsEnabled = OmagOFFICEMap.refMachiningTabVM.IsShow
|
|
' Per bottone AUTO
|
|
OmagOFFICEMap.refMachiningTabVM.AutoIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow And
|
|
((GetDisabledCutsCount() > 0 Or m_nCurrPhase = 1) And
|
|
Not OmagOFFICEMap.refMachiningTabVM.ByHand)
|
|
' Altri bottoni
|
|
SplitModeIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow
|
|
|
|
' nascondo i comandi che non devono essere visualizzati in funzione delle lavorazioni attive
|
|
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining > 0) Then
|
|
VisibilityButtonFromMachining(MCH_OY.WATERJETTING)
|
|
Else
|
|
VisibilityButtonFromMachining(MCH_OY.SAWING)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub VerifyHomogenousMachining(ItemList As List(Of NameIdLsBxItem))
|
|
If IsNothing(ItemList) OrElse ItemList.Count = 0 Then
|
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
|
Return
|
|
End If
|
|
Dim nSawing As Integer = 0
|
|
Dim nWaterjetting As Integer = 0
|
|
Dim nOtherMachining As Integer = 0
|
|
' conto il numero di tipi di lavprazioni
|
|
For Each Item As NameIdLsBxItem In ItemList
|
|
If Item.Type = MCH_OY.SAWING Then
|
|
nSawing += 1
|
|
ElseIf Item.Type = MCH_OY.WATERJETTING Then
|
|
nWaterjetting += 1
|
|
Else
|
|
nOtherMachining += 1
|
|
End If
|
|
Next
|
|
' verifico se le lavorazioni sono omeogenee
|
|
If nSawing > 0 And (nWaterjetting > 0 Or nOtherMachining > 0) Then
|
|
m_bAreHomogeneous = False
|
|
VisibilityButtonFromMachining(MCH_OY.SAWING)
|
|
ElseIf nSawing = 0 And nOtherMachining > 0 And nWaterjetting > 0 Then
|
|
m_bAreHomogeneous = False
|
|
VisibilityButtonFromMachining(MCH_OY.WATERJETTING)
|
|
Else
|
|
VisibilityButtonFromMachining(ItemList(0).Type)
|
|
m_bAreHomogeneous = True
|
|
End If
|
|
' eventualmente stampo messaggio
|
|
If Not m_bAreHomogeneous Then
|
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Lavorazioni non omogenee", MSG_TYPE.WARNING)
|
|
Else
|
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub VisibilityButtonFromMachining(ByVal Type As Integer)
|
|
If Type <> MCH_OY.SAWING Then
|
|
CutBtnVisibility = Visibility.Hidden
|
|
CutStartBtnVisibility = Visibility.Hidden
|
|
CutEndBtnVisibility = Visibility.Hidden
|
|
|
|
OutCenStartBtnVisibility = Visibility.Hidden
|
|
OutCenEndBtnVisibility = Visibility.Hidden
|
|
InvertBtnVisibility = Visibility.Hidden
|
|
PauseBtnVisibility = Visibility.Hidden
|
|
AllOutStartBtnVisibility = Visibility.Hidden
|
|
AllCenStartBtnVisibility = Visibility.Hidden
|
|
AllOutEndBtnVisibility = Visibility.Hidden
|
|
AllCenEndBtnVisibility = Visibility.Hidden
|
|
AllExtendBtnVisibility = Visibility.Hidden
|
|
AllReduceBtnVisibility = Visibility.Hidden
|
|
Else
|
|
CutBtnVisibility = Visibility.Visible
|
|
CutStartBtnVisibility = Visibility.Visible
|
|
CutEndBtnVisibility = Visibility.Visible
|
|
|
|
OutCenStartBtnVisibility = Visibility.Visible
|
|
OutCenEndBtnVisibility = Visibility.Visible
|
|
InvertBtnVisibility = Visibility.Visible
|
|
PauseBtnVisibility = Visibility.Visible
|
|
AllOutStartBtnVisibility = Visibility.Visible
|
|
AllCenStartBtnVisibility = Visibility.Visible
|
|
AllOutEndBtnVisibility = Visibility.Visible
|
|
AllCenEndBtnVisibility = Visibility.Visible
|
|
AllExtendBtnVisibility = Visibility.Visible
|
|
AllReduceBtnVisibility = Visibility.Visible
|
|
End If
|
|
|
|
' gestione bottone per generazione ponticelli
|
|
If Type = MCH_OY.WATERJETTING Then
|
|
' siccome la stessa posizione è occupata da due comandi sovrapposti
|
|
If CutBtnVisibility = Visibility.Hidden Then
|
|
BridgeBtnVisibility = Visibility.Visible
|
|
BridgeDeleteBtnVisibility = Visibility.Visible
|
|
QualityBtnVisibility = Visibility.Visible
|
|
Else
|
|
BridgeBtnVisibility = Visibility.Hidden
|
|
BridgeDeleteBtnVisibility = Visibility.Hidden
|
|
QualityBtnVisibility = Visibility.Hidden
|
|
End If
|
|
Else
|
|
BridgeBtnVisibility = Visibility.Hidden
|
|
BridgeDeleteBtnVisibility = Visibility.Hidden
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function ModifyOtherLeadIn(nI As Integer, nLiOthType As Integer) As Boolean
|
|
' Modifico l'attacco delle lavorazioni inglobate
|
|
For Each nMchId As Integer In m_MachiningList(nI).m_vOthId
|
|
EgtSetCurrMachining(nMchId)
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, nLiOthType)
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ModifyOtherLeadOut(nI As Integer, nLoOthType As Integer) As Boolean
|
|
' Modifico l'uscita delle lavorazioni inglobate
|
|
For Each nMchId As Integer In m_MachiningList(nI).m_vOthId
|
|
EgtSetCurrMachining(nMchId)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, nLoOthType)
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub NumberDirectionMachining(nI As Integer, Optional bNumber As Boolean = True)
|
|
EgtDisableModified()
|
|
' Determino se seconda lavorazione
|
|
Dim sName As String = String.Empty
|
|
EgtGetName(m_MachiningList(nI).m_nId, sName)
|
|
Dim b2ndLav As Boolean = sName.Contains("_") Or sName.Contains("Drip")
|
|
' Ingombro complessivo della lavorazione
|
|
Dim ptMin, ptMax As Point3d
|
|
If Not BoxFromMachining(nI, ptMin, ptMax) Then Return
|
|
' Metto il numero nel centro
|
|
Dim dRadXY = Point3d.DistXY(ptMin, ptMax)
|
|
Dim dHtxt As Double = 50
|
|
Dim dRat As Double = 0.75
|
|
If dRadXY < 200 Then
|
|
dHtxt = 40
|
|
dRat = 0.6
|
|
ElseIf dRadXY < 25 Then
|
|
dHtxt = 25
|
|
dRat = 0.5
|
|
End If
|
|
Dim vtXY As Vector3d = ptMax - ptMin
|
|
vtXY.Normalize()
|
|
Dim ptCen As Point3d = Point3d.Media(ptMin, ptMax) + vtXY * If(Not b2ndLav, -0.8, 0.8) * dHtxt
|
|
ptCen.z = ptMax.z + 1
|
|
|
|
' ricavo la posizione del punto (se waterjet separata)
|
|
If m_MachiningList(nI).m_nType = MCH_OY.WATERJETTING Or m_MachiningList(nI).m_nType = MCH_OY.MILLING Then
|
|
Dim ptMid As Point3d
|
|
Dim vVers As Vector3d
|
|
MidPointOfCurve(m_MachiningList(nI).m_nId, ptMid, vVers)
|
|
ptCen = ptMid ' + vVers * If(Not b2ndLav, -0.8, 0.8) * dHtxt
|
|
End If
|
|
|
|
If bNumber Then
|
|
Dim nNbrId As Integer = EgtCreateTextAdv(m_nNbrGrpId, ptCen, 0, (nI + 1).ToString(), "",
|
|
300, False, dHtxt, dRat, 0, INS_POS.MC)
|
|
m_MachiningList(nI).m_nNbrId = nNbrId
|
|
' Aggiungo a numero info con identificativo della lavorazione e viceversa
|
|
EgtSetInfo(nNbrId, "MId", m_MachiningList(nI).m_nId)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, "NbrId", nNbrId)
|
|
If Not m_LayNbArrTgBtn_IsChecked Then
|
|
EgtSetStatus(nNbrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nNbrId, GDB_ST.ON_)
|
|
End If
|
|
End If
|
|
' Se taglio con lama, metto la direzione accanto al numero
|
|
If m_MachiningList(nI).m_nType = MCH_OY.SAWING Then
|
|
Dim ptStart As New Point3d(ptCen + m_MachiningList(nI).m_vtDir * dHtxt)
|
|
Dim vtDir As New Vector3d(m_MachiningList(nI).m_vtDir)
|
|
Dim bTwin As Boolean = (Not m_MachiningList(nI).m_bEnableInvert OrElse Math.Abs(m_MachiningList(nI).m_dSideAng) > 0.1)
|
|
Dim nArrId As Integer = AddMachiningDirection(ptStart, vtDir, dHtxt, bTwin)
|
|
m_MachiningList(nI).m_nArrId = nArrId
|
|
' Aggiungo a freccia info con identificativo della lavorazione e viceversa
|
|
EgtSetInfo(nArrId, "MId", m_MachiningList(nI).m_nId)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, "ArrId", nArrId)
|
|
If Not m_LayNbArrTgBtn_IsChecked Then
|
|
EgtSetStatus(nArrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nArrId, GDB_ST.ON_)
|
|
End If
|
|
Else
|
|
m_MachiningList(nI).m_nArrId = GDB_ID.NULL
|
|
End If
|
|
' Assegno colore a numero e freccia
|
|
ColorNumberArrow(nI)
|
|
EgtEnableModified()
|
|
End Sub
|
|
|
|
Private Function BoxFromMachining(nI As Integer, ByRef ptMin As Point3d, ByRef ptMax As Point3d) As Boolean
|
|
If nI < 0 Then Return False
|
|
' Lavorazione principale
|
|
If Not BoxFromSingleMachining(m_MachiningList(nI).m_nId, ptMin, ptMax) Then
|
|
Return False
|
|
End If
|
|
' Eventuali lavorazioni inglobate
|
|
For Each nId As Integer In m_MachiningList(nI).m_vOthId
|
|
Dim ptMchMin, ptMchMax As Point3d
|
|
If BoxFromSingleMachining(nId, ptMchMin, ptMchMax) Then
|
|
ptMin.x = Math.Min(ptMin.x, ptMchMin.x)
|
|
ptMin.y = Math.Min(ptMin.y, ptMchMin.y)
|
|
ptMin.z = Math.Min(ptMin.z, ptMchMin.z)
|
|
ptMax.x = Math.Max(ptMax.x, ptMchMax.x)
|
|
ptMax.y = Math.Max(ptMax.y, ptMchMax.y)
|
|
ptMax.z = Math.Max(ptMax.z, ptMchMax.z)
|
|
End If
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Function BoxFromSingleMachining(nOperId As Integer, ByRef ptMin As Point3d, ByRef ptMax As Point3d) As Boolean
|
|
' Recupero il preview della lavorazione
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Return EgtGetBBoxGlob(nPvId, GDB_BB.STANDARD, ptMin, ptMax)
|
|
End Function
|
|
|
|
Private Function MidPointOfCurve(nOperId As Integer, ByRef ptMid As Point3d, ByRef vVers As Vector3d) As Boolean
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
' creo un layer ausiliario per creare la curva composita
|
|
Dim AuxLayer As Integer = EgtCreateGroup(nPvId)
|
|
' imposto la lavorazione corrente
|
|
EgtSetCurrMachining(nOperId)
|
|
' recupero tutte le entità della lavorazione corrente
|
|
Dim nInd As Integer = 0
|
|
Dim nIdCurr As Integer
|
|
Dim nSub As Integer
|
|
Dim CurveCompoList As New List(Of Integer)
|
|
While EgtGetMachiningGeometry(nInd, nIdCurr, nSub)
|
|
CurveCompoList.Add(nIdCurr)
|
|
nInd += 1
|
|
End While
|
|
Dim PtNearStart As Point3d
|
|
Dim nIdCutPath As Integer = EgtCreateCurveCompoByChain(AuxLayer, CurveCompoList.ToArray, PtNearStart, False)
|
|
Dim dLength As Double = 0
|
|
EgtCurveLength(nIdCutPath, dLength)
|
|
Dim dParam As Double = 0
|
|
EgtCurveParamAtLength(nIdCutPath, dLength / 2, dParam)
|
|
EgtAtParamPoint(nIdCutPath, dParam, GDB_RT.GLOB, ptMid)
|
|
EgtAtParamVector(nIdCutPath, dParam, -1, vVers)
|
|
vVers.Normalize()
|
|
vVers.Rotate(Vector3d.Z_AX, 90)
|
|
EgtErase(AuxLayer)
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AddMachiningDirection(ptStart As Point3d, vtDir As Vector3d, dLen As Double, bTwin As Boolean) As Integer
|
|
Dim dArrX As Double = dLen * Math.Cos(30 * Math.PI / 180)
|
|
Dim dArrY As Double = dLen * Math.Sin(30 * Math.PI / 180)
|
|
Dim nTmpId As Integer = EgtCreateLine(m_nNbrGrpId, Point3d.ORIG() + dArrY * Vector3d.Y_AX(), Point3d.ORIG() + dArrX * Vector3d.X_AX())
|
|
Dim nCrvId As Integer = EgtCreateCurveCompo(m_nNbrGrpId, nTmpId, True)
|
|
EgtAddCurveCompoLine(nCrvId, Point3d.ORIG() - dArrY * Vector3d.Y_AX())
|
|
If bTwin Then
|
|
EgtAddCurveCompoLine(nCrvId, Point3d.ORIG() + 2 * dArrX * Vector3d.X_AX())
|
|
EgtCloseCurveCompo(nCrvId)
|
|
End If
|
|
Dim frLoc As New Frame3d(ptStart, vtDir, Vector3d.Z_AX() ^ vtDir, Vector3d.Z_AX())
|
|
EgtTransform(nCrvId, frLoc)
|
|
Return nCrvId
|
|
End Function
|
|
|
|
Private Sub MarkMachining(nI As Integer, bMark As Boolean)
|
|
If nI < 0 Then Return
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
' Evidenzio la lavorazione principale
|
|
MarkSingleMachining(nOperId, bMark)
|
|
' Evidenzio l'eventuale numero della lavorazione
|
|
MarkNumberArrow(nI, bMark)
|
|
' Marco anche le lavorazioni inglobate
|
|
For Each nId As Integer In m_MachiningList(nI).m_vOthId
|
|
MarkSingleMachining(nId, bMark)
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub MarkSingleMachining(nOperId As Integer, bMark As Boolean)
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId) Then
|
|
If bMark Then
|
|
EgtSetMark(nPvId)
|
|
Else
|
|
EgtResetMark(nPvId)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MarkNumberArrow(nI As Integer, bMark As Boolean)
|
|
If nI < 0 Then Return
|
|
Dim nNbrId As Integer = m_MachiningList(nI).m_nNbrId
|
|
Dim nArrId As Integer = m_MachiningList(nI).m_nArrId
|
|
If bMark Then
|
|
EgtSetMark(nNbrId)
|
|
EgtSetMark(nArrId)
|
|
Else
|
|
EgtResetMark(nNbrId)
|
|
EgtResetMark(nArrId)
|
|
End If
|
|
If Not m_LayNbArrTgBtn_IsChecked And Not bMark Then
|
|
EgtSetStatus(nNbrId, GDB_ST.OFF)
|
|
EgtSetStatus(nArrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nNbrId, GDB_ST.ON_)
|
|
EgtSetStatus(nArrId, GDB_ST.ON_)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ColorNumberArrow(nI As Integer)
|
|
If nI < 0 Then Return
|
|
Dim nNbrId As Integer = m_MachiningList(nI).m_nNbrId
|
|
Dim nArrId As Integer = m_MachiningList(nI).m_nArrId
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
If m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtSetColor(nNbrId, COL_MCH_FREE)
|
|
EgtSetColor(nArrId, COL_MCH_FREE)
|
|
Else
|
|
EgtSetColor(nNbrId, COL_MCH_INTERF)
|
|
EgtSetColor(nArrId, COL_MCH_INTERF)
|
|
End If
|
|
Else
|
|
If m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtResetColor(nNbrId)
|
|
EgtResetColor(nArrId)
|
|
ElseIf Not m_MachiningList(nI).m_bEnabled Then
|
|
EgtSetColor(nNbrId, COL_MCH_DIS_INTERF)
|
|
EgtSetColor(nArrId, COL_MCH_DIS_INTERF)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RemoveMarkAndNumbers()
|
|
EgtDisableModified()
|
|
' cancello evidenziazione
|
|
If m_CurrFirstInd >= 0 Then
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
MarkMachining(m_ItemList(Index).Ind, False)
|
|
Next
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -1
|
|
End If
|
|
' cancello gruppo di numerazione e ripristino colori lavorazioni
|
|
EgtErase(m_nNbrGrpId)
|
|
For i As Integer = 0 To m_MachiningList.Count() - 1
|
|
ColorMachining(m_MachiningList(i), True)
|
|
Next
|
|
EgtEnableModified()
|
|
End Sub
|
|
|
|
Private Sub SwapStartEndData(nI As Integer)
|
|
' Swap angoli precedente e successivo
|
|
Dim dAng As Double = m_MachiningList(nI).m_dPrevAng
|
|
m_MachiningList(nI).m_dPrevAng = m_MachiningList(nI).m_dNextAng
|
|
m_MachiningList(nI).m_dNextAng = dAng
|
|
' Swap lunghezze libere
|
|
Dim dFreeLen As Double = m_MachiningList(nI).m_dStartFreeLen
|
|
m_MachiningList(nI).m_dStartFreeLen = m_MachiningList(nI).m_dEndFreeLen
|
|
m_MachiningList(nI).m_dEndFreeLen = dFreeLen
|
|
' Swap stato di allungamento
|
|
Dim bAll As Boolean = m_MachiningList(nI).m_bStartAll
|
|
m_MachiningList(nI).m_bStartAll = m_MachiningList(nI).m_bEndAll
|
|
m_MachiningList(nI).m_bEndAll = bAll
|
|
' Swap possibilità di allungamento
|
|
Dim bCanAll As Boolean = m_MachiningList(nI).m_bCanStartAll
|
|
m_MachiningList(nI).m_bCanStartAll = m_MachiningList(nI).m_bCanEndAll
|
|
m_MachiningList(nI).m_bCanEndAll = bCanAll
|
|
' Swap stato interferenza
|
|
If (m_MachiningList(nI).m_nInterf And FMI_TYPE.LI) <> 0 And (m_MachiningList(nI).m_nInterf And FMI_TYPE.LO) = 0 Then
|
|
m_MachiningList(nI).m_nInterf -= FMI_TYPE.LI
|
|
m_MachiningList(nI).m_nInterf += FMI_TYPE.LO
|
|
ElseIf (m_MachiningList(nI).m_nInterf And FMI_TYPE.LI) = 0 And (m_MachiningList(nI).m_nInterf And FMI_TYPE.LO) <> 0 Then
|
|
m_MachiningList(nI).m_nInterf += FMI_TYPE.LI
|
|
m_MachiningList(nI).m_nInterf -= FMI_TYPE.LO
|
|
End If
|
|
' Swap Allungamento Utente
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_SAL, dOrigUeal)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_EAL, dOrigUsal)
|
|
End Sub
|
|
|
|
Private Sub BridgeIsChecked()
|
|
' eventualmente spengo il comando per eliminare i ponticelli
|
|
If m_BridgeDeleteBtn_IsChecked Then
|
|
m_BridgeDeleteBtn_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(BridgeDeleteBtn_IsChecked))
|
|
End If
|
|
' se deseleziono resetto tutte le variabili
|
|
If Not m_BridgeBtn_IsChecked Then
|
|
' se sono in fase di creazione di un ponticello interrompo
|
|
DeselectWJBridgesPart()
|
|
Return
|
|
End If
|
|
' recuoero il gruppo di lavorazione corrente
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
' creo il gruppo per i ponticelli
|
|
Dim sNameGroup As String = NAME_BRIDGES
|
|
Dim nId As Integer = EgtGetFirstNameInGroup(nIdCurrMachGroup, sNameGroup)
|
|
If nId <> GDB_ID.NULL Then
|
|
m_nIdBridgesGroup = nId
|
|
End If
|
|
' se non lo trovo allora lo creo
|
|
If nId = GDB_ID.NULL Then
|
|
m_nIdBridgesGroup = EgtCreateGroup(nIdCurrMachGroup)
|
|
EgtSetName(m_nIdBridgesGroup, NAME_BRIDGES)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BridgeDeleteIsChecked()
|
|
' eventualmente spengo il comando per inserire i ponticelli
|
|
If m_BridgeBtn_IsChecked Then
|
|
m_BridgeBtn_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(BridgeBtn_IsChecked))
|
|
End If
|
|
|
|
If Not m_BridgeDeleteBtn_IsChecked Then
|
|
DeselectWJBridgesPart()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CreateCutIsChecked()
|
|
' attivo la scena per renderla attiva
|
|
If m_CreateCut_IsChecked Then
|
|
' OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusSelPoint()
|
|
OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull()
|
|
ResetSplitCut()
|
|
Else
|
|
' ????????
|
|
ResetSplitCut()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RemoveCutIsChecked()
|
|
If m_RemoveCut_IsChecked Then
|
|
OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull()
|
|
ResetSplitCut()
|
|
Else
|
|
' ????????
|
|
ResetSplitCut()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CreateParellelCutIsChecked()
|
|
If m_CreateParallelCut_IsChecked Then
|
|
OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull()
|
|
ResetSplitCut()
|
|
Else
|
|
' ????????
|
|
ResetSplitCut()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ModifyCutIsChecked()
|
|
If m_CreateParallelCut_IsChecked Then
|
|
OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull()
|
|
ResetSplitCut()
|
|
Else
|
|
' ????????
|
|
ResetSplitCut()
|
|
End If
|
|
End Sub
|
|
|
|
' Forzo la fine della creazione di un elemento SplitCut
|
|
Private Sub ResetSplitCut()
|
|
EgtResetMark(m_IdCurrRawSolid)
|
|
ResetAllMark()
|
|
If m_IdSplitGroup <> GDB_ID.NULL Then
|
|
EgtErase(m_IdSplitGroup)
|
|
End If
|
|
m_bGetStartPoint = False
|
|
m_bGetEndPoint = False
|
|
m_IdSplitLine = GDB_ID.NULL
|
|
m_IdSplitGroup = GDB_ID.NULL
|
|
m_IdSplitGroupLayer = GDB_ID.NULL
|
|
m_IdCurrRawSolid = GDB_ID.NULL
|
|
m_IdSplitLineRemove = GDB_ID.NULL
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
' spegno il comando Split correntemente attivo
|
|
Public Sub DeactiveSplitCut()
|
|
ResetSplitCut()
|
|
m_RemoveCut_IsChecked = False
|
|
m_CreateCut_IsChecked = False
|
|
m_CreateParallelCut_IsChecked = False
|
|
m_ModifyCut_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(CreateCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(CreateParallelCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(RemoveCut_IsChecked))
|
|
NotifyPropertyChanged(NameOf(ModifyCut_IsChecked))
|
|
End Sub
|
|
|
|
Public Sub ResetAllMark()
|
|
For Each Item As NameIdLsBxItem In m_ItemList
|
|
Item.IsSelected = False
|
|
MarkMachining(Item.Ind, False)
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "MoveCommands"
|
|
|
|
Public ReadOnly Property MoveUpCommand As ICommand
|
|
Get
|
|
If m_cmdMoveUp Is Nothing Then
|
|
m_cmdMoveUp = New Command(AddressOf MoveUp)
|
|
End If
|
|
Return m_cmdMoveUp
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub MoveUp(ByVal param As Object)
|
|
MoveItem(-1)
|
|
End Sub
|
|
|
|
Public ReadOnly Property MoveDownCommand As ICommand
|
|
Get
|
|
If m_cmdMoveDown Is Nothing Then
|
|
m_cmdMoveDown = New Command(AddressOf MoveDown)
|
|
End If
|
|
Return m_cmdMoveDown
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub MoveDown(ByVal param As Object)
|
|
MoveItem(+1)
|
|
End Sub
|
|
|
|
Public Sub MoveItem(direction As Integer)
|
|
' Checking selected item
|
|
If m_CurrFirstInd = -1 Then
|
|
Return
|
|
End If
|
|
|
|
' Se la direzione è giù
|
|
If direction = 1 And m_CurrLastInd < m_ItemList.Count - 1 Then
|
|
' sposto il successivo prima di tutti i selezionati
|
|
m_ItemList.Move(m_CurrLastInd + 1, m_CurrFirstInd)
|
|
MoveMachining(m_CurrLastInd + 1, m_CurrFirstInd)
|
|
' aggiorno gli indici degli elementi coinvolti nello spostamento (selezionati e non)
|
|
For index = m_CurrLastInd + 1 To m_CurrFirstInd Step -1
|
|
m_ItemList(index).Ind = index
|
|
Next
|
|
m_CurrFirstInd += 1
|
|
m_CurrLastInd += 1
|
|
ElseIf direction = -1 And m_CurrFirstInd > 0 Then
|
|
' sposto il precedente dopo tutti i selezionati
|
|
m_ItemList.Move(m_CurrFirstInd - 1, m_CurrLastInd)
|
|
MoveMachining(m_CurrFirstInd - 1, m_CurrLastInd)
|
|
' aggiorno gli indici degli elementi coinvolti nello spostamento (selezionati e non)
|
|
For index = m_CurrFirstInd - 1 To m_CurrLastInd
|
|
m_ItemList(index).Ind = index
|
|
Next
|
|
m_CurrFirstInd -= 1
|
|
m_CurrLastInd -= 1
|
|
End If
|
|
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub MoveMachining(oldIndex As Integer, newIndex As Integer)
|
|
Dim item As SplitMach = m_MachiningList(oldIndex)
|
|
m_MachiningList.RemoveAt(oldIndex)
|
|
m_MachiningList.Insert(newIndex, item)
|
|
End Sub
|
|
|
|
#End Region ' MoveCommands
|
|
|
|
#Region "OnOffCommand"
|
|
|
|
Public ReadOnly Property OnOffCommand As ICommand
|
|
Get
|
|
If m_cmdOnOff Is Nothing Then
|
|
m_cmdOnOff = New Command(AddressOf OnOff)
|
|
End If
|
|
Return m_cmdOnOff
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OnOff(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If m_ItemList(Index).IsSelected Then
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
m_ItemList(Index).bIsActive = False
|
|
Else
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
m_ItemList(Index).bIsActive = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
' EnableButtons()
|
|
' recupero l'elenco degli elementi selezionati
|
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
|
For Each Item As NameIdLsBxItem In m_SelectedItemsList ' MachiningLsBx.SelectedItems
|
|
ItemList.Add(Item)
|
|
Next
|
|
'For Each Item As NameIdLsBxItem In m_ItemList
|
|
' If Item.bIsActive Then ItemList.Add(Item)
|
|
'Next
|
|
VerifyHomogenousMachining(ItemList)
|
|
End Sub
|
|
|
|
#End Region ' OnOffCommand
|
|
|
|
#Region "AllOnCommand"
|
|
|
|
Public ReadOnly Property AllOnCommand As ICommand
|
|
Get
|
|
If m_cmdAllOn Is Nothing Then
|
|
m_cmdAllOn = New Command(AddressOf AllOn)
|
|
End If
|
|
Return m_cmdAllOn
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOn(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If Not m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
m_ItemList(nI).bIsActive = True
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllOnCommand
|
|
|
|
#Region "AllOffCommand"
|
|
|
|
Public ReadOnly Property AllOffCommand As ICommand
|
|
Get
|
|
If m_cmdAllOff Is Nothing Then
|
|
m_cmdAllOff = New Command(AddressOf AllOff)
|
|
End If
|
|
Return m_cmdAllOff
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOff(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
m_ItemList(nI).bIsActive = False
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllOffCommand
|
|
|
|
#Region "CutCommands"
|
|
|
|
Public ReadOnly Property CutCommand As ICommand
|
|
Get
|
|
If m_cmdCut Is Nothing Then
|
|
m_cmdCut = New Command(AddressOf Cut)
|
|
End If
|
|
Return m_cmdCut
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Cut(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Provo ad entrambi gli estremi
|
|
Dim bModif As Boolean = AdjustBothCuts(nI)
|
|
' Provo all'inizio
|
|
If Not bModif Then bModif = AdjustStartCut(nI)
|
|
' Provo alla fine
|
|
If Not bModif Then bModif = AdjustEndCut(nI)
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Public ReadOnly Property CutStartCommand As ICommand
|
|
Get
|
|
If m_cmdCutStart Is Nothing Then
|
|
m_cmdCutStart = New Command(AddressOf CutStart)
|
|
End If
|
|
Return m_cmdCutStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CutStart(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Eseguo
|
|
If AdjustStartCut(nI) Then
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Public ReadOnly Property CutEndCommand As ICommand
|
|
Get
|
|
If m_cmdCutEnd Is Nothing Then
|
|
m_cmdCutEnd = New Command(AddressOf CutEnd)
|
|
End If
|
|
Return m_cmdCutEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CutEnd(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Eseguo
|
|
If AdjustEndCut(nI) Then
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Function AdjustBothCuts(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che entrambi gli estremi siano allungabili
|
|
If Not (m_MachiningList(nI).m_bCanStartAll And m_MachiningList(nI).m_bCanEndAll) Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If (m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) And Not bAllForced Then
|
|
' accorcio
|
|
If nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
End If
|
|
If nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = False
|
|
m_MachiningList(nI).m_bEndAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
End If
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = True
|
|
m_MachiningList(nI).m_bEndAll = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AdjustStartCut(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che l'estremo iniziale sia allungabile
|
|
If Not m_MachiningList(nI).m_bCanStartAll Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If m_MachiningList(nI).m_bStartAll And Not bAllForced Then
|
|
' accorcio
|
|
If nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AdjustEndCut(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che l'estremo finale sia allungabile
|
|
If Not m_MachiningList(nI).m_bCanEndAll Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If m_MachiningList(nI).m_bEndAll And Not bAllForced Then
|
|
' accorcio
|
|
If nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
End If
|
|
m_MachiningList(nI).m_bEndAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
End If
|
|
m_MachiningList(nI).m_bEndAll = True
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' CutCommands
|
|
|
|
#Region "OutCenStartCommand"
|
|
|
|
Public ReadOnly Property OutCenStartCommand As ICommand
|
|
Get
|
|
If m_cmdOutCenStart Is Nothing Then
|
|
m_cmdOutCenStart = New Command(AddressOf OutCenStart)
|
|
End If
|
|
Return m_cmdOutCenStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OutCenStart(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
ElseIf nLiPrev = MCH_SAW_LI.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' OutCenStartCommand
|
|
|
|
#Region "AllOutStartCommand"
|
|
|
|
Public ReadOnly Property AllOutStartCommand As ICommand
|
|
Get
|
|
If m_cmdAllOutStart Is Nothing Then
|
|
m_cmdAllOutStart = New Command(AddressOf AllOutStart)
|
|
End If
|
|
Return m_cmdAllOutStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOutStart(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllOutStartCommand
|
|
|
|
#Region "AllCenStartCommand"
|
|
|
|
Public ReadOnly Property AllCenStartCommand As ICommand
|
|
Get
|
|
If m_cmdAllCenStart Is Nothing Then
|
|
m_cmdAllCenStart = New Command(AddressOf AllCenStart)
|
|
End If
|
|
Return m_cmdAllCenStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllCenStart(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllCenStartCommand
|
|
|
|
#Region "OutCenEndCommand"
|
|
|
|
Public ReadOnly Property OutCenEndCommand As ICommand
|
|
Get
|
|
If m_cmdOutCenEnd Is Nothing Then
|
|
m_cmdOutCenEnd = New Command(AddressOf OutCenEnd)
|
|
End If
|
|
Return m_cmdOutCenEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OutCenEnd(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
ElseIf nLoPrev = MCH_SAW_LO.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' OutCenEndCommand
|
|
|
|
#Region "AllOutEndCommand"
|
|
|
|
Public ReadOnly Property AllOutEndCommand As ICommand
|
|
Get
|
|
If m_cmdAllOutEnd Is Nothing Then
|
|
m_cmdAllOutEnd = New Command(AddressOf AllOutEnd)
|
|
End If
|
|
Return m_cmdAllOutEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOutEnd(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllOutEndCommand
|
|
|
|
#Region "AllCenEndCommand"
|
|
|
|
Public ReadOnly Property AllCenEndCommand As ICommand
|
|
Get
|
|
If m_cmdAllCenEnd Is Nothing Then
|
|
m_cmdAllCenEnd = New Command(AddressOf AllCenEnd)
|
|
End If
|
|
Return m_cmdAllCenEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllCenEnd(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllCenEndCommand
|
|
|
|
#Region "AllExtendCommand"
|
|
|
|
Public ReadOnly Property AllExtendCommand As ICommand
|
|
Get
|
|
If m_cmdAllExtend Is Nothing Then
|
|
m_cmdAllExtend = New Command(AddressOf AllExtend)
|
|
End If
|
|
Return m_cmdAllExtend
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllExtend(ByVal param As Object)
|
|
Dim bModif As Boolean = False
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' Provo ad entrambi gli estremi
|
|
Dim bOneModif As Boolean = AdjustBothCuts(nI, True, False)
|
|
' Provo all'inizio
|
|
If Not bOneModif Then bOneModif = AdjustStartCut(nI, True, False)
|
|
' Provo alla fine
|
|
If Not bOneModif Then bOneModif = AdjustEndCut(nI, True, False)
|
|
' Aggiorno flag globale
|
|
If bOneModif Then bModif = True
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllExtendCommand
|
|
|
|
#Region "AllReduceCommand"
|
|
|
|
Public ReadOnly Property AllReduceCommand As ICommand
|
|
Get
|
|
If m_cmdAllReduce Is Nothing Then
|
|
m_cmdAllReduce = New Command(AddressOf AllReduce)
|
|
End If
|
|
Return m_cmdAllReduce
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllReduce(ByVal param As Object)
|
|
Dim bModif As Boolean = False
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' Provo ad entrambi gli estremi
|
|
Dim bOneModif As Boolean = AdjustBothCuts(nI, False, True)
|
|
' Provo all'inizio
|
|
If Not bOneModif Then bOneModif = AdjustStartCut(nI, False, True)
|
|
' Provo alla fine
|
|
If Not bOneModif Then bOneModif = AdjustEndCut(nI, False, True)
|
|
' Aggiorno flag globale
|
|
If bOneModif Then bModif = True
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllReduceCommand
|
|
|
|
#Region "ModifStartCommand"
|
|
|
|
Public ReadOnly Property ModifStartCommand As ICommand
|
|
Get
|
|
If m_cmdModifStart Is Nothing Then
|
|
m_cmdModifStart = New Command(AddressOf ModifStart)
|
|
End If
|
|
Return m_cmdModifStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ModifStart(ByVal param As Object)
|
|
Dim bFirstInd As Boolean = True
|
|
Dim bFirstMill As Boolean = True
|
|
Dim bFirstWJ As Boolean = True
|
|
' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING
|
|
Dim dUsal As Double = 0
|
|
' elenco delle variabili : MCH_MY.WATERJETTING
|
|
Dim dWJAddLen As Double = 0
|
|
Dim bWJLiHole As Boolean = True
|
|
Dim nWJTangDist As Double = 0
|
|
Dim nWJPerpDist As Double = 0
|
|
Dim nWJLeadInType As Integer = 0
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
' Se taglio con lama
|
|
If nMachiningType = MCH_MY.SAWING Then
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
' Dialogo richiesta valore
|
|
If bFirstInd Then
|
|
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
|
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
|
ModifStartWindowVM.Title = EgtMsg(90791) ' Sawing
|
|
ModifStartWindow.DataContext = ModifStartWindowVM
|
|
ModifStartWindow.Owner = Application.Current.MainWindow
|
|
ModifStartWindowVM.SetVal(dOrigUsal)
|
|
' Il posizionamento è forzato nel codice xaml: WindowStartupLocation="CenterOwner"
|
|
ModifStartWindow.Left = 190
|
|
ModifStartWindow.Top = 600
|
|
If Not ModifStartWindow.ShowDialog() Then Return
|
|
' Modifica della lavorazione
|
|
dUsal = ModifStartWindowVM.GetVal()
|
|
bFirstInd = False
|
|
End If
|
|
|
|
Dim bRepeat As Boolean = False
|
|
Do
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(nI).m_dStartFreeLen < FREELEN_INF Then
|
|
' se abilitati i controlli sugli allungamenti dei lati interni
|
|
If Not m_StartEndModifyOnIntCorner Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUsal = Math.Min(dUsal, m_MachiningList(nI).m_dStartFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
End If
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
' verifico che non sia sull'angolo interno (altrimenti vieto la modifica)
|
|
If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUsal < -10 * EPS_SMALL) Then
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
If bRepeat Then
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
dUsal = dOrigUsal
|
|
End If
|
|
Loop Until Not bRepeat
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
ElseIf nMachiningType = MCH_MY.MILLING Then ' And m_MachiningList(nI).m_sLay = NAME_ONPATH
|
|
|
|
' leggo il valore salvato nella geometria
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
' Dialogo richiesta valore
|
|
If bFirstMill Then
|
|
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
|
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
|
ModifStartWindowVM.Title = EgtMsg(90793) ' Milling
|
|
ModifStartWindow.DataContext = ModifStartWindowVM
|
|
ModifStartWindow.Owner = Application.Current.MainWindow
|
|
ModifStartWindowVM.SetVal(dOrigUsal)
|
|
If Not ModifStartWindow.ShowDialog() Then Return
|
|
' Modifica della lavorazione
|
|
dUsal = ModifStartWindowVM.GetVal()
|
|
bFirstMill = False
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bGenModif = True
|
|
|
|
' se altrimenti getto d'acqua
|
|
ElseIf nMachiningType = MCH_MY.WATERJETTING Then
|
|
' Recupero i valori attuali della lavorazione
|
|
If bFirstWJ Then
|
|
Dim bOriginalIsLeadIn As Boolean = True
|
|
Dim dOriginalAddLen As Double = 0
|
|
Dim bOriginalLiHole As Boolean = True
|
|
Dim nOriginalTangDist As Double = 0
|
|
Dim nOriginalPerpDist As Double = 0
|
|
Dim nOriginalLeadInType As Integer = 0
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dOriginalAddLen)
|
|
EgtGetMachiningParam(MCH_MP.LIHOLE, bOriginalLiHole)
|
|
EgtGetMachiningParam(MCH_MP.LITANG, nOriginalTangDist)
|
|
EgtGetMachiningParam(MCH_MP.LIPERP, nOriginalPerpDist)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nOriginalLeadInType)
|
|
' Dialogo richiesta valori
|
|
Dim ModifStartWnd As New ModifStartEndWjWindowV
|
|
Dim ModifStartWndVM As New ModifStartEndWjWindowVM
|
|
ModifStartWndVM.Title = EgtMsg(90798) ' Water jetting
|
|
ModifStartWnd.DataContext = ModifStartWndVM
|
|
ModifStartWnd.Owner = Application.Current.MainWindow
|
|
ModifStartWndVM.HoleVisibility = Visibility.Visible
|
|
ModifStartWndVM.LeadInVisibility = Visibility.Visible
|
|
ModifStartWndVM.LeadOutVisibility = Visibility.Collapsed
|
|
ModifStartWndVM.SetVal(dOriginalAddLen)
|
|
ModifStartWndVM.SetHole(bOriginalLiHole)
|
|
ModifStartWndVM.SetLeadInType(nOriginalLeadInType)
|
|
ModifStartWndVM.SetLiTangDist(nOriginalTangDist)
|
|
ModifStartWndVM.SetLiPerpDist(nOriginalPerpDist)
|
|
If Not ModifStartWnd.ShowDialog() Then Return
|
|
|
|
dWJAddLen = ModifStartWndVM.GetVal()
|
|
bWJLiHole = ModifStartWndVM.GetHole()
|
|
nWJTangDist = ModifStartWndVM.GetLiTangDist()
|
|
nWJPerpDist = ModifStartWndVM.GetLiPerpDist()
|
|
nWJLeadInType = ModifStartWndVM.GetLeadInType().Id
|
|
bFirstWJ = False
|
|
End If
|
|
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetMachiningParam(MCH_MP.LIHOLE, bWJLiHole)
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dWJAddLen)
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, nWJLeadInType)
|
|
EgtSetMachiningParam(MCH_MP.LITANG, nWJTangDist)
|
|
EgtSetMachiningParam(MCH_MP.LIPERP, nWJPerpDist)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' ModifStartCommand
|
|
|
|
#Region "ModifEndCommand"
|
|
|
|
Public ReadOnly Property ModifEndCommand As ICommand
|
|
Get
|
|
If m_cmdModifEnd Is Nothing Then
|
|
m_cmdModifEnd = New Command(AddressOf ModifEnd)
|
|
End If
|
|
Return m_cmdModifEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ModifEnd(ByVal param As Object)
|
|
Dim bFirstInd As Boolean = True
|
|
Dim bFirstMill As Boolean = True
|
|
Dim bFirstWJ As Boolean = True
|
|
' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING
|
|
Dim dUeal As Double = 0
|
|
' elenco delle variabili : MCH_MY.WATERJETTING
|
|
Dim dWJAddLen As Double = 0
|
|
Dim nWJTangDist As Double = 0
|
|
Dim nWJPerpDist As Double = 0
|
|
Dim nWJLeadInType As Integer = 0
|
|
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
' Se taglio con lama
|
|
If nMachiningType = MCH_MY.SAWING Then
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
' Dialogo richiesta valore
|
|
If bFirstInd Then
|
|
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
|
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
|
ModifStartWindowVM.Title = EgtMsg(90791) ' Sawing
|
|
ModifStartWindow.DataContext = ModifStartWindowVM
|
|
ModifStartWindow.Owner = Application.Current.MainWindow
|
|
ModifStartWindowVM.SetVal(dOrigUeal)
|
|
If Not ModifStartWindow.ShowDialog() Then Return
|
|
' Modifica della lavorazione
|
|
dUeal = ModifStartWindowVM.GetVal()
|
|
bFirstInd = False
|
|
End If
|
|
Dim bRepeat As Boolean = False
|
|
Do
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(nI).m_dEndFreeLen < FREELEN_INF Then
|
|
' se abilitati i controlli sugli allungamenti dei lati interni
|
|
If Not m_StartEndModifyOnIntCorner Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUeal = Math.Min(dUeal, m_MachiningList(nI).m_dEndFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
End If
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUeal < -10 * EPS_SMALL) Then
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
If bRepeat Then
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
dUeal = dOrigUeal
|
|
End If
|
|
Loop Until Not bRepeat
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
ElseIf nMachiningType = MCH_MY.MILLING Then ' And m_MachiningList(nI).m_sLay = NAME_ONPATH
|
|
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstMill Then
|
|
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
|
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
|
ModifStartWindowVM.Title = EgtMsg(90793) ' Milling
|
|
ModifStartWindow.DataContext = ModifStartWindowVM
|
|
ModifStartWindow.Owner = Application.Current.MainWindow
|
|
ModifStartWindowVM.SetVal(dOrigUeal)
|
|
If Not ModifStartWindow.ShowDialog() Then Return
|
|
' Modifica della lavorazione
|
|
dUeal = ModifStartWindowVM.GetVal()
|
|
bFirstMill = False
|
|
End If
|
|
' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bGenModif = True
|
|
|
|
' se altrimenti getto d'acqua
|
|
ElseIf nMachiningType = MCH_MY.WATERJETTING Then
|
|
' Recupero i valori attuali della lavorazione
|
|
If bFirstWJ Then
|
|
Dim dAddLen As Double = 0
|
|
Dim nTangDist As Double = 0
|
|
Dim nPerpDist As Double = 0
|
|
Dim LeadOutTypeId As Integer = 0
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtGetMachiningParam(MCH_MP.LOTANG, nTangDist)
|
|
EgtGetMachiningParam(MCH_MP.LOPERP, nPerpDist)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, LeadOutTypeId)
|
|
' Dialogo richiesta valori
|
|
Dim ModifStartWnd As New ModifStartEndWjWindowV()
|
|
Dim ModifStartWndVM As New ModifStartEndWjWindowVM
|
|
ModifStartWndVM.Title = EgtMsg(90798) ' Water jetting
|
|
ModifStartWnd.DataContext = ModifStartWndVM
|
|
ModifStartWnd.Owner = Application.Current.MainWindow
|
|
ModifStartWndVM.HoleVisibility = Visibility.Collapsed
|
|
ModifStartWndVM.LeadInVisibility = Visibility.Collapsed
|
|
ModifStartWndVM.LeadOutVisibility = Visibility.Visible
|
|
ModifStartWndVM.SetVal(dAddLen)
|
|
ModifStartWndVM.SetLeadOutType(LeadOutTypeId)
|
|
ModifStartWndVM.SetLoTangDist(nTangDist)
|
|
ModifStartWndVM.SetLoPerpDist(nPerpDist)
|
|
If Not ModifStartWnd.ShowDialog() Then Return
|
|
|
|
dWJAddLen = ModifStartWndVM.GetVal()
|
|
nWJTangDist = ModifStartWndVM.GetLoTangDist()
|
|
nWJPerpDist = ModifStartWndVM.GetLoPerpDist()
|
|
nWJLeadInType = ModifStartWndVM.GetLeadOutType().Id
|
|
|
|
bFirstWJ = False
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dWJAddLen)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, nWJLeadInType)
|
|
EgtSetMachiningParam(MCH_MP.LOTANG, nWJTangDist)
|
|
EgtSetMachiningParam(MCH_MP.LOPERP, nWJPerpDist)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' ModifEndCommand
|
|
|
|
#Region "PauseCommand"
|
|
|
|
Public ReadOnly Property PauseCommand As ICommand
|
|
Get
|
|
If m_cmdPause Is Nothing Then
|
|
m_cmdPause = New Command(AddressOf Pause)
|
|
End If
|
|
Return m_cmdPause
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Pause(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
If GetPause(nOperId) Then
|
|
ResetPause(nOperId)
|
|
m_MachiningList(nI).m_bPause = False
|
|
RemovePauseText(m_ItemList(Index).Name)
|
|
Else
|
|
SetPause(nOperId)
|
|
m_MachiningList(nI).m_bPause = True
|
|
AddPauseText(m_ItemList(Index).Name)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' PauseCommand
|
|
|
|
#Region "InvertCommand"
|
|
|
|
Public ReadOnly Property InvertCommand As ICommand
|
|
Get
|
|
If m_cmdInvert Is Nothing Then
|
|
m_cmdInvert = New Command(AddressOf Invert)
|
|
End If
|
|
Return m_cmdInvert
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Invert(ByVal param As Object)
|
|
If m_CurrFirstInd = -1 Then Return
|
|
For Index = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Si possono invertire solo i tagli di lama
|
|
If m_MachiningList(nI).m_nType <> MCH_OY.SAWING Then Continue For
|
|
' Non si possono invertire i tagli di lama inclinati
|
|
If Math.Abs(m_MachiningList(nI).m_dSideAng) > 0.1 Then Continue For
|
|
' Se abilitata inversione automatica e quindi non invertito
|
|
If m_MachiningList(nI).m_bEnableInvert Then
|
|
' Inverto e disabilito inversione automatica
|
|
If CamAuto.InvertVerticalCut(m_MachiningList(nI).m_nId) Then
|
|
m_MachiningList(nI).m_bInvert = True
|
|
m_MachiningList(nI).m_vtDir = -m_MachiningList(nI).m_vtDir
|
|
m_MachiningList(nI).m_bEnableInvert = False
|
|
SwapStartEndData(nI)
|
|
ResetEnableInvert(m_MachiningList(nI).m_nEntId)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtDraw()
|
|
End If
|
|
' se altrimenti disabilitata inversione automatica e invertito
|
|
ElseIf m_MachiningList(nI).m_bInvert Then
|
|
' Tolgo inversione e lascio disabilitazione inv. autom.
|
|
If CamAuto.InvertVerticalCut(m_MachiningList(nI).m_nId) Then
|
|
m_MachiningList(nI).m_bInvert = False
|
|
m_MachiningList(nI).m_vtDir = -m_MachiningList(nI).m_vtDir
|
|
SwapStartEndData(nI)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtDraw()
|
|
End If
|
|
' altrimenti disabilitata inversione automatica e non invertito
|
|
Else
|
|
' Abilito inversione automatica e lascio non invertito
|
|
m_MachiningList(nI).m_bEnableInvert = True
|
|
SetEnableInvert(m_MachiningList(nI).m_nEntId)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtDraw()
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' InvertComman
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
#Region "EVENTS"
|
|
|
|
#Region "BRIDGE"
|
|
|
|
Private Sub OnMyMouseDownSceneBridges(sender As Object, e As System.Windows.Forms.MouseEventArgs,
|
|
ByVal IsFirst As Boolean,
|
|
ByRef m_nIdSelectedSideWJ As Integer,
|
|
ByRef m_nIdSelectedWaterJet As Integer,
|
|
ByRef nIdParentPart As Integer)
|
|
|
|
' Acquisisco punto da disegno
|
|
Dim CurrPoint As New Point3d
|
|
EgtUnProjectPoint(e.Location, CurrPoint)
|
|
|
|
' Verifico se selezionato indicativo di pezzo
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSelMy As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
|
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdMy <> GDB_ID.NULL
|
|
Dim sLayer As String = String.Empty
|
|
' layer di origine
|
|
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
|
' recupero il nome del Layer
|
|
EgtGetName(nIdParent, sLayer)
|
|
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
|
|
If sLayer = NAME_OUTLOOP Then
|
|
If (EgtGetType(nIdMy) = GDB_TY.CRV_ARC OrElse EgtGetType(nIdMy) = GDB_TY.CRV_COMPO OrElse EgtGetType(nIdMy) = GDB_TY.CRV_LINE) AndAlso VerifySideIsAcceptable(nIdMy) Then
|
|
If m_nIdSelectedSideWJ <> GDB_ID.NULL Or m_nIdSelectedSideWJ = nIdMy Then
|
|
EgtDeselectObj(m_nIdSelectedSideWJ)
|
|
End If
|
|
' recupero il gruppo della lavorazione associata
|
|
nIdParentPart = EgtGetParent(nIdParent)
|
|
' se non esiste almeno 1 Preview di tipo WaterJet
|
|
If IsWaterJetting(nIdMy) Then
|
|
m_nIdSelectedSideWJ = nIdMy
|
|
' recupero il punto più vicino alla curva passata
|
|
If IsFirst Then
|
|
EgtNearPoint(nIdMy, CurrPoint, GDB_RT.GLOB, m_ptSrtBridge)
|
|
Else
|
|
' prima di confermare verifico che non ci siano interferenze
|
|
EgtNearPoint(nIdMy, CurrPoint, GDB_RT.GLOB, m_ptEndBridge)
|
|
EgtModifyCurveEndPoint(m_nIdBridge, m_ptEndBridge, GDB_RT.GLOB)
|
|
If VerifyInterference(m_nIdBridge) Then
|
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
|
EgtSetInfo(m_nIdBridge, "PartStart", m_nIdSelectedPartWJ_Srt)
|
|
EgtSetInfo(m_nIdBridge, "EntStart", m_nIdSelectedSideWJ_Srt)
|
|
EgtSetInfo(m_nIdBridge, "PartEnd", m_nIdSelectedPartWJ_End)
|
|
EgtSetInfo(m_nIdBridge, "EntEnd", m_nIdSelectedSideWJ_End)
|
|
EgtSetInfo(m_nIdBridge, "Ph", EgtGetCurrPhase())
|
|
' Ricalcolo tutte le lavorazioni
|
|
Dim nWarn As Integer = 0
|
|
ResetAllMachinings(nWarn)
|
|
Else
|
|
' attendo la selezione di un punto valido
|
|
m_nIdSelectedSideWJ = GDB_ID.NULL
|
|
m_nIdSelectedWaterJet = GDB_ID.NULL
|
|
nIdParentPart = GDB_ID.NULL
|
|
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage("Bridge intersects part", 3, MSG_TYPE.ERROR_)
|
|
Return
|
|
End If
|
|
End If
|
|
' salvo il valore del PreView evidenziato
|
|
EgtSetMark(nIdParentPart)
|
|
' EgtSetMark(nIdWJ)
|
|
EgtSelectObj(nIdMy)
|
|
EgtDraw()
|
|
Exit While
|
|
End If
|
|
End If
|
|
End If
|
|
nIdMy = EgtGetNextObjInSelWin()
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseDownSceneBridgesDelete(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
' Acquisisco punto da disegno
|
|
Dim CurrPoint As New Point3d
|
|
EgtUnProjectPoint(e.Location, CurrPoint)
|
|
|
|
' Verifico se selezionato indicativo di pezzo
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSelMy As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
|
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdMy <> GDB_ID.NULL
|
|
Dim sGroupName As String = String.Empty
|
|
Dim sSelName As String = String.Empty
|
|
' gruppo di appartenenza
|
|
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
|
' recupero il nome del gruppo di appartenenza
|
|
EgtGetName(nIdParent, sGroupName)
|
|
' recupero il nome dell'oggetto selezionato
|
|
EgtGetName(nIdMy, sSelName)
|
|
If sGroupName.Contains(NAME_BRIDGES) AndAlso sSelName.Contains(NAME_BRIDGESLINE) Then
|
|
EgtErase(nIdMy)
|
|
EgtDraw()
|
|
' Ricalcolo tutte le lavorazioni
|
|
Dim nWarn As Integer = 0
|
|
ResetAllMachinings(nWarn)
|
|
Return
|
|
End If
|
|
nIdMy = EgtGetNextObjInSelWin()
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseMoveSceneBridges(ptCurr As Point3d)
|
|
ptCurr.z = m_ptSrtBridge.z
|
|
' rappresento il egmento
|
|
If m_nIdBridge = GDB_ID.NULL Then
|
|
m_nIdBridge = EgtCreateLine(m_nIdBridgesGroup, m_ptSrtBridge, ptCurr, GDB_RT.GLOB)
|
|
' assegno un nome alla linea
|
|
EgtSetName(m_nIdBridge, NAME_BRIDGESLINE)
|
|
End If
|
|
EgtModifyCurveEndPoint(m_nIdBridge, ptCurr, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Function VerifyInterference(nIdBridge As Integer) As Boolean
|
|
' prima di procedere alla verifica accorco il segmento (solo per sicurezza) 10 * EPS_SMALL
|
|
Dim dLen As Double
|
|
EgtCurveLength(nIdBridge, dLen)
|
|
If dLen > 21 AndAlso Not EgtCurveIsClosed(nIdBridge) Then
|
|
EgtTrimCurveEndAtLen(nIdBridge, dLen - 10 * EPS_SMALL)
|
|
EgtTrimCurveStartAtLen(nIdBridge, 10 * EPS_SMALL)
|
|
End If
|
|
' EgtSaveFile("c:\EgtData\OmagOFFICE\Temp\Bridge.nge", NGE.BIN)
|
|
Dim nIdPart As Integer = GDB_ID.NULL
|
|
nIdPart = EgtGetFirstPartInRawPart(GetCurrentRaw())
|
|
While nIdPart <> GDB_ID.NULL
|
|
Dim nIdRegion As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_REGION)
|
|
Dim nIdSurf As Integer = EgtGetFirstInGroup(nIdRegion)
|
|
While nIdSurf <> GDB_ID.NULL
|
|
If EgtGetType(nIdSurf) = GDB_TY.SRF_FRGN Then
|
|
' se la linea bridge interseca la superficie allora restitusco false
|
|
If EgtCurveWithRegionClassify(nIdBridge, nIdSurf) <> CREGC.OUT Then
|
|
EgtExtendCurveStartByLen(nIdBridge, 10 * EPS_SMALL)
|
|
Return False
|
|
End If
|
|
Exit While
|
|
End If
|
|
End While
|
|
nIdPart = EgtGetNextPartInRawPart(nIdPart)
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Function VerifySideIsAcceptable(nMyId As Integer) As Boolean
|
|
Dim dVal As Double = 0
|
|
' verifico che l'entità selezionata non contenga questi parametri
|
|
If EgtGetInfo(nMyId, INFO_SIDE_ANGLE2, dVal) Then
|
|
If dVal <> 0 Then
|
|
Return False
|
|
End If
|
|
End If
|
|
If EgtGetInfo(nMyId, INFO_SIDE_ANGLE, dVal) Then
|
|
If dVal <> 0 Then
|
|
Return False
|
|
End If
|
|
End If
|
|
If EgtGetInfo(nMyId, INFO_ORIG_SIDE_ANGLE, dVal) Then
|
|
If dVal <> 0 Then
|
|
Return False
|
|
End If
|
|
End If
|
|
' altrimenti l'entità è accettabile
|
|
Return True
|
|
End Function
|
|
|
|
' verifico che il lato selezionato appartenga ad una lavorazione di tipo Waterjet
|
|
Private Function IsWaterJetting(nMyId As Integer) As Boolean
|
|
' verifico che sul lato indicato sia impostato un taglio di tipo WaterJet
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
nMchId = m_MachiningList(nInd).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(m_MachiningList(nInd).m_nId)
|
|
If nMachiningType = MCH_MY.WATERJETTING Then
|
|
EgtSetCurrMachining(nMchId)
|
|
Dim nIndex As Integer = 0
|
|
Dim nIdSide As Integer = GDB_ID.NULL
|
|
Dim nSub As Integer = GDB_ID.NULL
|
|
While EgtGetMachiningGeometry(nIndex, nIdSide, nSub)
|
|
If nIdSide = nMyId Then
|
|
Return True
|
|
End If
|
|
nIndex += 1
|
|
End While
|
|
End If
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub RefreshMachList()
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' cancello tutti gli indici di lavorazione presenti nel disegno
|
|
Dim nNbrId As Integer = GDB_ID.NULL
|
|
EgtErase(m_MachiningList(nI).m_nNbrId)
|
|
EgtRemoveInfo(m_MachiningList(nI).m_nId, "NbrId")
|
|
Next
|
|
' Preparo la lista delle lavorazioni
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno nuova numerazione
|
|
NumberDirectionMachining(nI)
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' aggiorno grafica
|
|
ShowMachiningList()
|
|
' aggiorno la visualizzazione
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Public Sub DeselectWJBridgesPart()
|
|
' se in fase di definzione di un ponticello lo elimino
|
|
If m_nIdSelectedSideWJ_Srt <> GDB_ID.NULL And m_nIdSelectedSideWJ_End = GDB_ID.NULL And m_nIdBridge <> GDB_ID.NULL Then
|
|
EgtErase(EgtGetParent(m_nIdBridge))
|
|
End If
|
|
m_nIdBridge = GDB_ID.NULL
|
|
EgtResetMark(m_nIdSelectedPartWJ_Srt)
|
|
m_nIdSelectedPartWJ_Srt = GDB_ID.NULL
|
|
EgtDeselectObj(m_nIdSelectedSideWJ_Srt)
|
|
m_nIdSelectedSideWJ_Srt = GDB_ID.NULL
|
|
m_nIdSelectedWaterJet_Srt = GDB_ID.NULL
|
|
EgtResetMark(m_nIdSelectedPartWJ_End)
|
|
m_nIdSelectedPartWJ_End = GDB_ID.NULL
|
|
EgtDeselectObj(m_nIdSelectedSideWJ_End)
|
|
m_nIdSelectedSideWJ_End = GDB_ID.NULL
|
|
m_nIdSelectedWaterJet_End = GDB_ID.NULL
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
#End Region ' Bridge
|
|
|
|
#Region "Quality"
|
|
|
|
Public ReadOnly Property QualityCommand As ICommand
|
|
Get
|
|
If m_cmdQuality Is Nothing Then
|
|
m_cmdQuality = New Command(AddressOf ModifyQuality)
|
|
End If
|
|
Return m_cmdQuality
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ModifyQuality()
|
|
Dim bFirstWJ As Boolean = True
|
|
Dim sQuality As String = String.Empty
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
' se altrimenti getto d'acqua
|
|
If nMachiningType = MCH_MY.WATERJETTING Then
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstWJ Then
|
|
EgtSetCurrMachining(nOperId)
|
|
' Dialogo richiesta valore
|
|
'(m_MainWindow, m_MainWindow.m_CurrentMachine.Qualities, "Quality")
|
|
Dim ModifyQualityWnd As New ModifyQualityV
|
|
Dim ModifyQuality As New ModifyQualityVM
|
|
ModifyQuality.Title = EgtMsg(91673) ' Quality
|
|
ModifyQuality.QualityList = CurrentMachine.Qualities
|
|
ModifyQualityWnd.DataContext = ModifyQuality
|
|
ModifyQualityWnd.Owner = Application.Current.MainWindow
|
|
If EgtGetInfo(nOperId, "Quality", sQuality) Then
|
|
ModifyQuality.SelectedQuality = sQuality
|
|
Else
|
|
ModifyQuality.SelectedQuality = CurrentMachine.sCurrWaterJettingQuality
|
|
End If
|
|
If Not ModifyQualityWnd.ShowDialog() Then Return
|
|
sQuality = ModifyQuality.SelectedQuality
|
|
' comunico che ho letto il primo dato
|
|
bFirstWJ = False
|
|
|
|
End If
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetInfo(nOperId, "Quality", sQuality)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
' verifico interferenza
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Quality
|
|
|
|
' Genera la lavorazione associata al percoso indicato
|
|
Private Function CreateSingleCut() As Boolean
|
|
Dim bOk As Boolean = False
|
|
' Verifico sia definito il punto iniziale e il grezzo
|
|
If Not (m_bGetStartPoint And m_bGetEndPoint) AndAlso m_IdCurrRawSolid <> GDB_ID.NULL Then
|
|
Return False
|
|
End If
|
|
' Spessore grezzo
|
|
Dim ptRawMin, ptRawMax As Point3d
|
|
If Not EgtGetRawPartBBox(m_IdCurrRawSolid, ptRawMin, ptRawMax) Then Return False
|
|
Dim dRawHeight As Double = ptRawMax.z - ptRawMin.z
|
|
' Recupero spessore lama corrente
|
|
Dim sSaw As String = CurrentMachine.sCurrSaw
|
|
Dim sSawing As String = CurrentMachine.sCurrSawing
|
|
EgtTdbSetCurrTool(sSaw)
|
|
Dim dThick As Double = 0
|
|
' Se è impostata una lavorazione di lama
|
|
If Not String.IsNullOrEmpty(sSawing) Then
|
|
EgtTdbGetCurrToolParam(MCH_TP.THICK, dThick)
|
|
End If
|
|
' Recupero pezzo per il taglio diretto
|
|
Dim nPartId = m_IdSplitGroup
|
|
' Calcolo punto di inserimento nel grezzo
|
|
Dim ptMin, ptMax As Point3d
|
|
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, ptMin, ptMax)
|
|
Dim ptTabOri As Point3d
|
|
EgtGetTableRef(1, ptTabOri)
|
|
'Dim ptIns As Point3d = ptMin + (ptTabOri - ptRawMin)
|
|
Dim ptOri As New Point3d
|
|
Dim ptIns As Point3d = ptOri + (ptMin - ptRawMin)
|
|
ptIns.z = dRawHeight
|
|
' Imposto la fase corrente
|
|
EgtSetCurrPhase(m_nCurrPhase)
|
|
' Inserisco il taglio nel grezzo : CamAuto.GetCurrentRaw()
|
|
EgtAddPartToRawPart(nPartId, ptIns, m_IdCurrRawSolid)
|
|
' Inserisco la lavorazione
|
|
bOk = AddMachinings(nPartId) AndAlso UpdateAllMachiningsToolpaths()
|
|
'' Spengo la linea
|
|
'If bOk Then
|
|
' EgtSetStatus(m_IdSplitLine, GDB_ST.OFF)
|
|
'End If
|
|
Return bOk
|
|
End Function
|
|
|
|
Private Function RemoveCut(nId As Integer) As Boolean
|
|
Dim bOk As Boolean = False
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
Dim ParentId As Integer = EgtGetParent(nId)
|
|
While ParentId <> GDB_ID.NULL
|
|
Dim sCutName As String = String.Empty
|
|
EgtGetName(ParentId, sCutName)
|
|
If sCutName.Contains(SPLIT_CUT & "_" & nIdCurrMachGroup.ToString) Then
|
|
bOk = RemoveCurrentSplitCut(ParentId)
|
|
Return bOk
|
|
End If
|
|
ParentId = EgtGetParent(ParentId)
|
|
End While
|
|
Return bOk
|
|
End Function
|
|
|
|
Friend Sub OnMouseDownScene_DoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
OnMouseDownScene(sender, e)
|
|
If m_nSelected = GDB_ID.NULL Then Return
|
|
OnOff(Nothing)
|
|
End Sub
|
|
|
|
Friend Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
' Se tasto premuoto allora attivo la selezione multipla da Scena
|
|
Dim bKeyCtrlPressed = (Keyboard.Modifiers And ModifierKeys.Control) > 0
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse OmagOFFICEMap.refMachiningTabVM.IsShow Then Return
|
|
' Si può selezionare solo con il tasto sinistro e se stato NULL
|
|
If e.Button <> Windows.Forms.MouseButtons.Left Or
|
|
Not OmagOFFICEMap.refSceneHostVM.MainScene.IsStatusNull() Then
|
|
Return
|
|
End If
|
|
|
|
' definizione dei ponticelli
|
|
If m_BridgeBtn_IsChecked Then
|
|
If m_nIdSelectedPartWJ_Srt = GDB_ID.NULL Then
|
|
OnMyMouseDownSceneBridges(sender, e, True, m_nIdSelectedSideWJ_Srt, m_nIdSelectedWaterJet_Srt, m_nIdSelectedPartWJ_Srt)
|
|
Else
|
|
OnMyMouseDownSceneBridges(sender, e, False, m_nIdSelectedSideWJ_End, m_nIdSelectedWaterJet_End, m_nIdSelectedPartWJ_End)
|
|
' aggiorno la visualizzazione delle lavorazioni e la lista
|
|
RefreshMachList()
|
|
End If
|
|
' se entrambi i pezzi sono stati definiti allora procedo alla deselezione
|
|
If m_nIdSelectedPartWJ_Srt <> GDB_ID.NULL And m_nIdSelectedPartWJ_End <> GDB_ID.NULL Then
|
|
DeselectWJBridgesPart()
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
' eliminazione dei ponticelli
|
|
If m_BridgeDeleteBtn_IsChecked Then
|
|
OnMyMouseDownSceneBridgesDelete(sender, e)
|
|
' aggiorno la visualizzazione delle lavorazioni e la lista
|
|
RefreshMachList()
|
|
Return
|
|
End If
|
|
|
|
' Recupero le coordinate del punto corrente (solo se esiste la selezione di un grezzo corrente -> vedi sotto)
|
|
If m_CreateCut_IsChecked AndAlso m_IdCurrRawSolid <> GDB_ID.NULL Then
|
|
Dim ptCurr As Point3d
|
|
EgtUnProjectPoint(e.Location, ptCurr)
|
|
If m_bGetStartPoint And Not m_bGetEndPoint Then
|
|
m_ptEndPoint = ptCurr
|
|
m_bGetEndPoint = True
|
|
End If
|
|
If Not m_bGetStartPoint Then
|
|
m_ptStartPoint = ptCurr
|
|
m_bGetStartPoint = True
|
|
m_IdSplitGroup = EgtCreateGroup(GDB_ID.ROOT)
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
EgtSetName(m_IdSplitGroup, SPLIT_CUT & "_" & nIdCurrMachGroup.ToString & "." & EgtGetCurrPhase())
|
|
m_IdSplitGroupLayer = EgtCreateGroup(m_IdSplitGroup)
|
|
EgtSetName(m_IdSplitGroupLayer, NAME_OUTLOOP)
|
|
End If
|
|
If m_bGetStartPoint And m_bGetEndPoint Then
|
|
' procedo a disegnare la linea tra i due punti indicati
|
|
Dim ptRawMin, ptRawMax As Point3d
|
|
If EgtGetRawPartBBox(m_IdCurrRawSolid, ptRawMin, ptRawMax) Then
|
|
m_ptStartPoint.z = ptRawMax.z
|
|
m_ptEndPoint.z = ptRawMax.z
|
|
EgtModifyCurveEndPoint(m_IdSplitLine, m_ptEndPoint)
|
|
CreateSingleCut()
|
|
' Resetto tutte le variabili utilizzate
|
|
EgtResetMark(m_IdCurrRawSolid)
|
|
m_bGetStartPoint = False
|
|
m_bGetEndPoint = False
|
|
m_IdSplitLine = GDB_ID.NULL
|
|
m_IdSplitGroup = GDB_ID.NULL
|
|
m_IdSplitGroupLayer = GDB_ID.NULL
|
|
m_IdCurrRawSolid = GDB_ID.NULL
|
|
m_IdSplitLineRemove = GDB_ID.NULL
|
|
' Aggiorno la visualizzazione
|
|
PreviewMachinigList()
|
|
EgtDraw()
|
|
End If
|
|
End If
|
|
Return
|
|
ElseIf m_CreateCut_IsChecked AndAlso m_IdCurrRawSolid = GDB_ID.NULL Then
|
|
' Verifico se selezionato grezzo
|
|
EgtSetObjFilterForSelWin(False, False, True, False, False)
|
|
Dim nSelRaw As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelRaw)
|
|
Dim nIdRaw As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdRaw <> GDB_ID.NULL
|
|
Dim sRawName As String = String.Empty
|
|
If EgtGetName(nIdRaw, sRawName) AndAlso sRawName = NAME_RAW_SOLID Then
|
|
m_IdCurrRawSolid = EgtGetParent(nIdRaw)
|
|
EgtSetMark(m_IdCurrRawSolid)
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
nIdRaw = EgtGetNextObjInSelWin()
|
|
End While
|
|
Return
|
|
End If
|
|
|
|
If m_CreateParallelCut_IsChecked AndAlso m_IdCurrRawSolid = GDB_ID.NULL Then
|
|
' Verifico se selezionato grezzo
|
|
EgtSetObjFilterForSelWin(False, False, True, False, False)
|
|
Dim nSelRaw As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelRaw)
|
|
Dim nIdRaw As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdRaw <> GDB_ID.NULL
|
|
Dim sRawName As String = String.Empty
|
|
If EgtGetName(nIdRaw, sRawName) AndAlso sRawName = NAME_RAW_SOLID Then
|
|
m_IdCurrRawSolid = EgtGetParent(nIdRaw)
|
|
EgtSetMark(m_IdCurrRawSolid)
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
nIdRaw = EgtGetNextObjInSelWin()
|
|
End While
|
|
Return
|
|
ElseIf m_CreateParallelCut_IsChecked AndAlso m_IdCurrRawSolid <> GDB_ID.NULL AndAlso m_bGetStartPoint AndAlso Not m_bGetEndPoint Then
|
|
m_bGetEndPoint = True
|
|
CreateSingleCut()
|
|
' Resetto tutte le variabili utilizzate
|
|
EgtResetMark(m_IdCurrRawSolid)
|
|
m_bGetStartPoint = False
|
|
m_bGetEndPoint = False
|
|
m_IdSplitLine = GDB_ID.NULL
|
|
m_IdSplitGroup = GDB_ID.NULL
|
|
m_IdSplitGroupLayer = GDB_ID.NULL
|
|
m_IdCurrRawSolid = GDB_ID.NULL
|
|
m_IdSplitLineRemove = GDB_ID.NULL
|
|
' Aggiorno la visualizzazione
|
|
PreviewMachinigList()
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
|
|
If m_ModifyCut_IsChecked AndAlso m_IdCurrRawSolid = GDB_ID.NULL Then
|
|
' Verifico se selezionato grezzo
|
|
EgtSetObjFilterForSelWin(False, False, True, False, False)
|
|
Dim nSelRaw As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelRaw)
|
|
Dim nIdRaw As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdRaw <> GDB_ID.NULL
|
|
Dim sRawName As String = String.Empty
|
|
If EgtGetName(nIdRaw, sRawName) AndAlso sRawName = NAME_RAW_SOLID Then
|
|
m_IdCurrRawSolid = EgtGetParent(nIdRaw)
|
|
EgtSetMark(m_IdCurrRawSolid)
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
nIdRaw = EgtGetNextObjInSelWin()
|
|
End While
|
|
Return
|
|
ElseIf m_ModifyCut_IsChecked AndAlso m_IdCurrRawSolid <> GDB_ID.NULL AndAlso m_bGetStartPoint AndAlso Not m_bGetEndPoint Then
|
|
m_bGetEndPoint = True
|
|
CreateSingleCut()
|
|
RemoveCut(m_IdSplitLineRemove)
|
|
' Resetto tutte le variabili utilizzate
|
|
EgtResetMark(m_IdCurrRawSolid)
|
|
m_bGetStartPoint = False
|
|
m_bGetEndPoint = False
|
|
m_IdSplitLine = GDB_ID.NULL
|
|
m_IdSplitGroup = GDB_ID.NULL
|
|
m_IdSplitGroupLayer = GDB_ID.NULL
|
|
m_IdCurrRawSolid = GDB_ID.NULL
|
|
m_IdSplitLineRemove = GDB_ID.NULL
|
|
' Aggiorno la visualizzazione
|
|
PreviewMachinigList()
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
|
|
' Reset drag
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
' Reset selection interface
|
|
m_nSelected = GDB_ID.NULL
|
|
' Verifico se selezionato estremo di taglio con lama
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSel As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
|
|
Dim nId As Integer = EgtGetFirstObjInSelWin()
|
|
While nId <> GDB_ID.NULL
|
|
' --------------------------------- SPLIT CUT ---------------------------------
|
|
' Se attiva l'eliminazione di un taglio di separazione
|
|
If m_RemoveCut_IsChecked Then
|
|
RemoveCut(nId)
|
|
' Aggiorno la visualizzazione
|
|
PreviewMachinigList()
|
|
EgtDraw()
|
|
Return
|
|
End If
|
|
|
|
' Recupero le info del pezzo selezionato per procedere a generare
|
|
If m_CreateParallelCut_IsChecked AndAlso m_IdCurrRawSolid <> GDB_ID.NULL Then
|
|
Dim sMyName As String = ""
|
|
EgtGetName(nId, sMyName)
|
|
If String.Compare(sMyName, NAME_PV_CUT) = 0 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim sPvid As String = String.Empty
|
|
EgtGetName(nPvId, sPvid)
|
|
If sPvid.StartsWith("Saw") Then
|
|
sPvid = sPvid.Remove(0, 3)
|
|
If IsNumeric(sPvid) Then
|
|
Dim nIdLine As Integer = CInt(sPvid)
|
|
m_IdSplitGroup = EgtCreateGroup(GDB_ID.ROOT)
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
EgtSetName(m_IdSplitGroup, SPLIT_CUT & "_" & nIdCurrMachGroup.ToString & "." & EgtGetCurrPhase())
|
|
m_IdSplitGroupLayer = EgtCreateGroup(m_IdSplitGroup)
|
|
EgtSetName(m_IdSplitGroupLayer, NAME_OUTLOOP)
|
|
m_IdSplitLine = EgtCopyGlob(nIdLine, m_IdSplitGroupLayer)
|
|
' Recupero la dimennsione del taglio (non basta copiare la geometria)
|
|
Dim dUsal As Double = 0
|
|
Dim dUeal As Double = 0
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
EgtGetInfo(nMchId, INFO_MCH_USER_SAL, dUsal)
|
|
EgtGetInfo(nMchId, INFO_MCH_USER_EAL, dUeal)
|
|
End If
|
|
' Aggiorno la dimensione della geometria
|
|
EgtExtendCurveStartByLen(m_IdSplitLine, dUsal)
|
|
EgtExtendCurveEndByLen(m_IdSplitLine, dUeal)
|
|
EgtDeselectObj(nId)
|
|
m_bGetStartPoint = True
|
|
End If
|
|
End If
|
|
Return
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
If m_ModifyCut_IsChecked AndAlso m_IdCurrRawSolid <> GDB_ID.NULL Then
|
|
Dim sMyName As String = ""
|
|
EgtGetName(nId, sMyName)
|
|
If String.Compare(sMyName, NAME_PV_CUT) = 0 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim sPvId As String = String.Empty
|
|
EgtGetName(nPvId, sPvId)
|
|
If sPvId.StartsWith("Saw") Then
|
|
sPvId = sPvId.Remove(0, 3)
|
|
If IsNumeric(sPvId) Then
|
|
Dim nIdLine As Integer = CInt(sPvId)
|
|
m_IdSplitGroup = EgtCreateGroup(GDB_ID.ROOT)
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
EgtSetName(m_IdSplitGroup, SPLIT_CUT & "_" & nIdCurrMachGroup.ToString & "." & EgtGetCurrPhase())
|
|
m_IdSplitGroupLayer = EgtCreateGroup(m_IdSplitGroup)
|
|
EgtSetName(m_IdSplitGroupLayer, NAME_OUTLOOP)
|
|
m_IdSplitLine = EgtCopyGlob(nIdLine, m_IdSplitGroupLayer)
|
|
' Recupero la dimennsione del taglio (non basta copiare la geometria)
|
|
Dim dUsal As Double = 0
|
|
Dim dUeal As Double = 0
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
EgtGetInfo(nMchId, INFO_MCH_USER_SAL, dUsal)
|
|
EgtGetInfo(nMchId, INFO_MCH_USER_EAL, dUeal)
|
|
End If
|
|
' Aggiorno la dimensione della geometria
|
|
EgtExtendCurveStartByLen(m_IdSplitLine, dUsal)
|
|
EgtExtendCurveEndByLen(m_IdSplitLine, dUeal)
|
|
EgtDeselectObj(nId)
|
|
' Salvo l'Id del tagli da eliminare
|
|
m_IdSplitLineRemove = nId
|
|
m_bGetStartPoint = True
|
|
EgtDraw()
|
|
End If
|
|
End If
|
|
Return
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
' --------------------------------- SPLIT CUT ---------------------------------
|
|
' Verifico sia un attacco o uscita di taglio con lama
|
|
Dim nType As Integer = 0
|
|
Dim sName As String = ""
|
|
EgtGetName(nId, sName)
|
|
If String.Compare(sName, NAME_PV_PRECUT) = 0 Then
|
|
nType = 1
|
|
ElseIf String.Compare(sName, NAME_PV_POSTCUT) = 0 Then
|
|
nType = 2
|
|
ElseIf String.Compare(sName, NAME_PV_CUT) = 0 Then
|
|
nType = 3
|
|
End If
|
|
If nType = 1 Or nType = 2 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nInd).m_nId = nMchId Then
|
|
m_nDragInd = nInd
|
|
m_nDragType = nType
|
|
End If
|
|
For nJ As Integer = 0 To m_MachiningList(nInd).m_vOthId.Count() - 1
|
|
If m_MachiningList(nInd).m_vOthId(nJ) = nMchId Then
|
|
m_nDragInd = nInd
|
|
m_nDragType = nType
|
|
Exit For
|
|
End If
|
|
Next
|
|
If m_nDragInd >= 0 Then
|
|
' Assegno l'id dell'elemento selezionato
|
|
m_nSelected = m_nDragInd
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
If m_nDragInd >= 0 Then
|
|
' Assegno l'id dell'elemento selezionato
|
|
m_nSelected = m_nDragInd
|
|
Exit While
|
|
End If
|
|
ElseIf nType = 3 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nInd).m_nId = nMchId Then
|
|
m_nSelected = nInd
|
|
End If
|
|
For nJ As Integer = 0 To m_MachiningList(nInd).m_vOthId.Count() - 1
|
|
If m_MachiningList(nInd).m_vOthId(nJ) = nMchId Then
|
|
m_nSelected = nInd
|
|
Exit For
|
|
End If
|
|
Next
|
|
If m_nSelected >= 0 Then Exit For
|
|
Next
|
|
End If
|
|
If m_nSelected >= 0 Then Exit While
|
|
End If
|
|
nId = EgtGetNextObjInSelWin()
|
|
End While
|
|
' Sistemazioni per drag
|
|
If m_nSelected >= 0 AndAlso EgtUnProjectPoint(e.Location, m_ptDragPrev) Then
|
|
Dim nItemIndex = 0
|
|
For Each Item In ItemList
|
|
If Not bKeyCtrlPressed Then
|
|
Item.IsSelected = (nItemIndex = m_nSelected)
|
|
Else
|
|
' procedo ad rendere attivo solo l'elemnento selezionato
|
|
If nItemIndex = m_nSelected Then
|
|
Item.IsSelected = True
|
|
End If
|
|
End If
|
|
nItemIndex += 1
|
|
Next
|
|
Else
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
m_nSelected = GDB_ID.NULL
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse OmagOFFICEMap.refMachiningTabVM.IsShow Then Return
|
|
' Ricavo il punto corrente in coordinate mondo
|
|
Dim ptCurr As Point3d
|
|
EgtUnProjectPoint(e.Location, ptCurr)
|
|
|
|
' definizione dei ponticelli
|
|
If m_BridgeBtn_IsChecked Then
|
|
If m_nIdSelectedPartWJ_Srt <> GDB_ID.NULL Then
|
|
OnMyMouseMoveSceneBridges(ptCurr)
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
' Recupero le coordinate del punto corrente
|
|
If m_CreateCut_IsChecked Then
|
|
If m_bGetStartPoint And Not m_bGetEndPoint Then
|
|
m_ptEndPoint = ptCurr
|
|
End If
|
|
If m_bGetStartPoint And Not m_bGetEndPoint Then
|
|
' procedo a disegnare la linea tra i due punti indicati
|
|
Dim ptRawMin, ptRawMax As Point3d
|
|
If EgtGetRawPartBBox(m_IdCurrRawSolid, ptRawMin, ptRawMax) Then
|
|
m_ptStartPoint.z = ptRawMax.z
|
|
m_ptEndPoint.z = ptRawMax.z
|
|
If m_IdSplitLine = GDB_ID.NULL Then
|
|
m_IdSplitLine = EgtCreateLine(m_IdSplitGroupLayer, m_ptStartPoint, m_ptEndPoint)
|
|
Else
|
|
EgtModifyCurveEndPoint(m_IdSplitLine, m_ptEndPoint)
|
|
End If
|
|
EgtDraw()
|
|
End If
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
If m_CreateParallelCut_IsChecked AndAlso m_IdSplitLine <> GDB_ID.NULL Then
|
|
Dim mPoint3d As Point3d
|
|
EgtMidPoint(m_IdSplitLine, mPoint3d)
|
|
mPoint3d.z = 0
|
|
ptCurr.z = 0
|
|
EgtMove(m_IdSplitLine, ptCurr - mPoint3d)
|
|
EgtDraw()
|
|
End If
|
|
|
|
If m_ModifyCut_IsChecked AndAlso m_IdSplitLine <> GDB_ID.NULL Then
|
|
Dim mPoint3d As Point3d
|
|
EgtMidPoint(m_IdSplitLine, mPoint3d)
|
|
mPoint3d.z = 0
|
|
ptCurr.z = 0
|
|
EgtMove(m_IdSplitLine, ptCurr - mPoint3d)
|
|
EgtDraw()
|
|
End If
|
|
|
|
' Se drag non abilitato o in corso
|
|
If m_nDragInd = -1L Or m_bDragging Then Return
|
|
m_bDragging = True
|
|
Dim nOperId As Integer = m_MachiningList(m_nDragInd).m_nId
|
|
' Ricavo il vettore di movimento e la variazione di lunghezza
|
|
Dim vtMove As Vector3d = ptCurr - m_ptDragPrev
|
|
Dim dDelta = vtMove * m_MachiningList(m_nDragInd).m_vtDir
|
|
If m_nDragType = 1 Then
|
|
Dim dOrigUsal As Double = 0
|
|
Dim dUsal As Double
|
|
' ----------------------- REPEAT -----------------------
|
|
Do
|
|
dDelta = -dDelta
|
|
' Leggo il valore salvato nella geometria
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
dUsal = dOrigUsal + dDelta
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(m_nDragInd).m_dStartFreeLen < FREELEN_INF Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUsal = Math.Min(dUsal, m_MachiningList(m_nDragInd).m_dStartFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then
|
|
m_bDragging = False
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
Loop Until UpdateMachiningPreview(m_MachiningList(m_nDragInd).m_nId, True)
|
|
' ----------------------- REPEAT (solo se il segmento scompare) -----------------------
|
|
Else
|
|
Dim dOrigUeal As Double = 0
|
|
Dim dUeal As Double
|
|
dDelta = -dDelta
|
|
Do
|
|
dDelta = -dDelta
|
|
' Leggo il valore salvato nella geometria
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
dUeal = dOrigUeal + dDelta
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(m_nDragInd).m_dEndFreeLen < FREELEN_INF Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, CurrentMachine.sMachIniFile), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUeal = Math.Min(dUeal, m_MachiningList(m_nDragInd).m_dEndFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then
|
|
m_bDragging = False
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
Loop Until UpdateMachiningPreview(m_MachiningList(m_nDragInd).m_nId, True)
|
|
End If
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(m_nDragInd).m_nId, m_MachiningList(m_nDragInd).m_nInterf)
|
|
ColorMachining(m_MachiningList(m_nDragInd))
|
|
ColorNumberArrow(m_nDragInd)
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
m_bModified = True
|
|
' Aggiorno punto e stato di drag
|
|
m_ptDragPrev = ptCurr
|
|
m_bDragging = False
|
|
End Sub
|
|
|
|
Friend Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse OmagOFFICEMap.refMachiningTabVM.IsShow Then Return
|
|
' Se drag in corso
|
|
If m_nDragInd >= 0 Then
|
|
m_nDragInd = -1
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs)
|
|
' Con CANC cancello i pezzi selezionati
|
|
If (e.KeyData = System.Windows.Forms.Keys.Delete Or e.KeyData = System.Windows.Forms.Keys.Escape) And (m_BridgeBtn_IsChecked Or m_BridgeDeleteBtn_IsChecked) Then
|
|
DeselectWJBridgesPart()
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub StatusOffNumbArrow(Status As GDB_ST)
|
|
For Each Item In m_MachiningList
|
|
Dim nOperId As Integer = Item.m_nId
|
|
Dim nNbrId As Integer = Item.m_nNbrId
|
|
Dim nArrId As Integer = Item.m_nArrId
|
|
Dim nInd As Integer = m_MachiningList.IndexOf(Item)
|
|
If nInd >= 0 AndAlso nInd < m_ItemList.Count AndAlso Not m_ItemList(nInd).IsSelected Then
|
|
EgtSetStatus(nNbrId, Status)
|
|
EgtSetStatus(nArrId, Status)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
End Sub
|
|
#End Region ' EVENTS
|
|
|
|
'-----------------------------------------------------------------------------------------------
|
|
Public Class NameIdLsBxItem
|
|
Inherits VMBase
|
|
|
|
Private m_nInd As Integer
|
|
Private m_sName As String
|
|
Private m_sSourceImg As String
|
|
Private m_bIsActive As Boolean
|
|
Private m_nType As Integer
|
|
|
|
Public Property Ind As Integer
|
|
Get
|
|
Return m_nInd
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nInd = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Name As String
|
|
Get
|
|
Return m_sName
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sName Then
|
|
m_sName = value
|
|
NotifyPropertyChanged("Name")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SourceImg As String
|
|
Get
|
|
Return m_sSourceImg
|
|
End Get
|
|
Set(value As String)
|
|
m_sSourceImg = value
|
|
NotifyPropertyChanged("SourceImg")
|
|
End Set
|
|
End Property
|
|
|
|
Public Property bIsActive As Boolean
|
|
Get
|
|
Return m_bIsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_bIsActive Then
|
|
m_bIsActive = value
|
|
NotifyPropertyChanged("bIsActive")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsSelected As Boolean
|
|
Public Property IsSelected As Boolean
|
|
Get
|
|
Return m_IsSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If Not IsNothing(value) Then
|
|
m_IsSelected = value
|
|
If value AndAlso Not OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Contains(Me) Then
|
|
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Add(Me)
|
|
Else
|
|
OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Remove(Me)
|
|
End If
|
|
' se non è stato aggiunto nessun nuovo elemento alla lista dei selezionati allora esco
|
|
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 0 Then
|
|
EgtDraw()
|
|
NotifyPropertyChanged("IsSelected")
|
|
Return
|
|
End If
|
|
' se ho un solo elemento allora so che è coerrente con se stesso come lavorazione
|
|
If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then
|
|
OmagOFFICEMap.refSplitModeVM.m_bAreHomogeneous = True
|
|
End If
|
|
' creo lista ordinata dei selezionati
|
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
|
For Each Item In OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList
|
|
ItemList.Add(Item)
|
|
Next
|
|
|
|
' ------------------------ verifico che le lavorazioni siano dello stesso tipo ------------------------
|
|
OmagOFFICEMap.refSplitModeVM.VerifyHomogenousMachining(ItemList)
|
|
' -----------------------------------------------------------------------------------------------------
|
|
' riordino l'elenco delle lavorazioni
|
|
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(x), OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(y)))
|
|
' ------------------------ verifico che le lavorazioni siano contigue ---------------------------------
|
|
OmagOFFICEMap.refSplitModeVM.bEnabledCommandMove = VerifyContinuity(ItemList)
|
|
' -----------------------------------------------------------------------------------------------------
|
|
|
|
'If Not My.Computer.Keyboard.ShiftKeyDown And (My.Computer.Keyboard.CtrlKeyDown And value) Then
|
|
' ' verifico che siano contigui
|
|
' Dim bContigus As Boolean = False
|
|
' Dim LastSel As NameIdLsBxItem = OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList(OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count - 1)
|
|
' If OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count = 1 Then
|
|
' bContigus = True
|
|
' Else
|
|
' For Each Item In ItemList
|
|
' If Item.Ind = LastSel.Ind + 1 Or Item.Ind = LastSel.Ind - 1 Then
|
|
' bContigus = True
|
|
' End If
|
|
' Next
|
|
' End If
|
|
' ' se non contiguo, elimino dai selezionati il primo(che è l'ultimo ad essere stato selezionato)
|
|
' If Not bContigus Then
|
|
' ItemList.Remove(LastSel)
|
|
' OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.RemoveAt(OmagOFFICEMap.refSplitModeVM.m_SelectedItemsList.Count - 1)
|
|
' OmagOFFICEMap.refSplitModeVM.ItemList(LastSel.Ind).IsSelected = Not value 'm_IsSelected = Not value
|
|
' ' disabilito il pulsanti per spostare le lavorazioni
|
|
' End If
|
|
'End If
|
|
|
|
' resetto marcatura lavorazioni
|
|
If OmagOFFICEMap.refSplitModeVM.m_CurrFirstInd > -1 Then
|
|
For Index = OmagOFFICEMap.refSplitModeVM.m_CurrFirstInd To OmagOFFICEMap.refSplitModeVM.m_CurrLastInd
|
|
OmagOFFICEMap.refSplitModeVM.MarkMachining(OmagOFFICEMap.refSplitModeVM.m_ItemList(Index).Ind, False)
|
|
Next
|
|
End If
|
|
' resetto indici
|
|
OmagOFFICEMap.refSplitModeVM.m_CurrFirstInd = -1
|
|
OmagOFFICEMap.refSplitModeVM.m_CurrLastInd = -1
|
|
' marco lavorazioni selezionate
|
|
For Each Item In ItemList
|
|
OmagOFFICEMap.refSplitModeVM.MarkMachining(Item.Ind, True)
|
|
Next
|
|
If (ItemList.Count > 0) Then
|
|
OmagOFFICEMap.refSplitModeVM.m_CurrFirstInd = OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(ItemList(0))
|
|
OmagOFFICEMap.refSplitModeVM.m_CurrLastInd = OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(ItemList(ItemList.Count - 1))
|
|
End If
|
|
EgtDraw()
|
|
NotifyPropertyChanged("IsSelected")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Function VerifyContinuity(ItemList As List(Of NameIdLsBxItem)) As Boolean
|
|
If ItemList.Count < 2 Then Return True
|
|
Dim bContigus As Boolean = False
|
|
For Index As Integer = 0 To ItemList.Count - 2
|
|
If ItemList(Index).Ind = ItemList(Index + 1).Ind + 1 Or ItemList(Index).Ind = ItemList(Index + 1).Ind - 1 Then
|
|
bContigus = True
|
|
Else
|
|
bContigus = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
Return bContigus
|
|
End Function
|
|
|
|
Public Property Type As Integer
|
|
Get
|
|
Return m_nType
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nType = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Name As String, Ind As Integer, bIsActive As Boolean, nType As Integer)
|
|
Me.m_sName = Name
|
|
Me.m_nInd = Ind
|
|
Me.m_bIsActive = bIsActive
|
|
Me.m_nType = nType
|
|
End Sub
|
|
|
|
Sub New(Name As String, Ind As Integer, bIsActive As Boolean, nType As Integer, sImg As String)
|
|
Me.m_sName = Name
|
|
Me.m_nInd = Ind
|
|
Me.m_bIsActive = bIsActive
|
|
Me.m_nType = nType
|
|
Me.m_sSourceImg = sImg
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
End Class
|