Compare commits

...

1 Commits

Author SHA1 Message Date
NicolaP faba640eee Gestione comando per separazione lavorazione WaterJet 2022-05-25 15:19:22 +02:00
4 changed files with 273 additions and 17 deletions
+28
View File
@@ -95,6 +95,34 @@ Friend Module CamAuto
Return True
End Function
Friend Function ResetAllSplitCurv() As Boolean
Dim bOk As Boolean = True
Dim nIdPart As Integer = EgtGetFirstPart()
While nIdPart <> GDB_ID.NULL
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
Dim nIdMy As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
While nIdMy <> GDB_ID.NULL
EgtRemoveInfo(nIdMy, "JoinEntity")
nIdMy = EgtGetNext(nIdMy)
End While
nIdPart = EgtGetNextPart(nIdPart)
End While
Dim nRawId As Integer = CamAuto.GetCurrentRaw()
nIdPart = EgtGetFirstPartInRawPart(nRawId)
While nIdPart <> GDB_ID.NULL
' accedo al Layer OutLoop
Dim nIdLayerOutLoop As Integer = EgtGetFirstNameInGroup(nIdPart, NAME_OUTLOOP)
Dim nIdMy As Integer = EgtGetFirstInGroup(nIdLayerOutLoop)
While nIdMy <> GDB_ID.NULL
EgtRemoveInfo(nIdMy, "JoinEntity")
nIdMy = EgtGetNext(nIdMy)
End While
nIdPart = EgtGetNextPartInRawPart(nIdPart)
End While
Return bOk
End Function
Friend Function RemoveFinalEmptyPhases() As Boolean
Dim nOpeId As Integer = EgtGetLastOperation()
While nOpeId <> GDB_ID.NULL
+3
View File
@@ -248,6 +248,9 @@ Public Class MyMachGroupPanelVM
' aggiungo alla lista delle lastre correnti/orig
Dim sSlabNameDB As String = GetSlabName()
LoadSlabsList(sSlabNameDB)
' imposto la visibilità dei comandi per il waterjet
OmagOFFICEMap.refNestingTabVM.Set_SplitCurvWJ_Visibility()
Return True
End Function
+7 -7
View File
@@ -148,13 +148,8 @@
Margin="2.5,0,0,0"/>
</UniformGrid>
<Grid Margin="0,0,-2.5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<UniformGrid Grid.Column="0" Columns="{Binding CountColumn}" Margin="0,0,0,5">
<Button Content="{Binding RemovePartMsg}"
Grid.ColumnSpan="{Binding DragRectangle_Cl_Span}"
Style="{StaticResource OptionPanel_TextButton}"
Command="{Binding RemovePartCommand}"
Margin="0,0,2.5,0"/>
@@ -163,7 +158,12 @@
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bDragRectangle}"
Margin="2.5,0,2.5,0"/>
</Grid>
<ToggleButton Content="{Binding SplitCurvWJMsg}" Grid.Column="2"
Visibility="{Binding SplitCurvWJ_Visibility}"
Style="{StaticResource OptionPanel_ToggleButton}"
IsChecked="{Binding bSplitCurvWJ}"
Margin="2.5,0,2.5,0"/>
</UniformGrid>
<UniformGrid Columns="2" Margin="0,0,0,5">
+235 -10
View File
@@ -46,6 +46,9 @@ Public Class NestingTabVM
Private m_SideListRectangle(4) As Integer
Private m_sTextContent As String = String.Empty
' Id dei lato WJ da separare tramite comando ON_OFF
Private m_nIdSelectedSideWJ As Integer = GDB_ID.NULL
Private m_nIdSelectedWaterJet As Integer = GDB_ID.NULL
Private m_CsvImportWindow As CsvWindowV
Friend ReadOnly Property CsvImportWindow As CsvWindowV
@@ -152,6 +155,13 @@ Public Class NestingTabVM
End Set
End Property
Private m_CountColumn As Integer = 1
Public ReadOnly Property CountColumn As Integer
Get
Return m_CountColumn
End Get
End Property
#Region "Messages"
Public ReadOnly Property InsertPartMsg As String
@@ -178,6 +188,12 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property SplitCurvWJMsg As String
Get
Return "Split"
End Get
End Property
Public ReadOnly Property SelectAllMsg As String
Get
Return EgtMsg(MSG_NESTPAGEUC + 4)
@@ -198,7 +214,7 @@ Public Class NestingTabVM
Public ReadOnly Property CsvDataMsg As String
Get
Return EgtMsg( 90398) 'Dati Csv
Return EgtMsg(90398) 'Dati Csv
End Get
End Property
@@ -230,11 +246,12 @@ Public Class NestingTabVM
Sub New()
If GetMainPrivateProfileInt(S_NEST, K_DRAGRECTANGLE, 1) <> 0 Then
m_DragRectangle_Visibility = Visibility.Visible
m_CountColumn += 1
Else
m_DragRectangle_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("DragRectangle_Visibility")
NotifyPropertyChanged("DragRectangle_Cl_Span")
NotifyPropertyChanged("CountColumn")
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefNestingTabVM(Me)
End Sub
@@ -846,6 +863,8 @@ Public Class NestingTabVM
End Get
Set(value As Boolean)
m_bDragRectangle = value
m_bSplitCurvWJ = False
NotifyPropertyChanged("bSplitCurvWJ")
End Set
End Property
@@ -856,15 +875,207 @@ Public Class NestingTabVM
End Get
End Property
Public ReadOnly Property DragRectangle_Cl_Span As Integer
Get
If m_DragRectangle_Visibility = Visibility.Visible Then
Return 1
#Region "WATERJET"
' funzione per la selezione dei lati su cui operare la separazione del tagli waterjet
Private Sub OnMyMouseDownSceneSplitCurv(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Si può selezionare solo con il tasto sinistro e se il bottone TEST Attivo
If e.Button <> Windows.Forms.MouseButtons.Left Or
Not m_bSplitCurvWJ Then
Return
End If
' Se esiste un elemento selezionato
EgtResetMark(m_nIdSelectedWaterJet)
' 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 Then
If m_nIdSelectedSideWJ <> GDB_ID.NULL Or m_nIdSelectedSideWJ = nIdMy Then
EgtDeselectObj(m_nIdSelectedSideWJ)
End If
' recupero il gruppo della lavorazione associata
Dim nIdParentPart As Integer = EgtGetParent(nIdParent)
Dim nIdPV As Integer = EgtGetFirstNameInGroup(nIdParentPart, "PV")
' VERIFICA: recupero l'elenco delle Preview di Tipo WaterJet associate a questo Part
Dim ListGroup As List(Of Integer) = ResearchGropuWJ(nIdParent, nIdPV)
' se non esiste almeno 1 Preview di tipo WaterJet
If ListGroup.Count > 0 Then
m_nIdSelectedSideWJ = nIdMy
Dim nValInfo As Integer = 1
If EgtGetInfo(nIdMy, "JoinEntity", nValInfo) Then
If nValInfo = 1 Then
' separo il taglio
EgtSetInfo(nIdMy, "JoinEntity", 0)
Else
' unisco il taglio
EgtSetInfo(nIdMy, "JoinEntity", 1)
End If
Else
' se manca l'info allora il taglio sValInfo = "1" quindi separo il taglio
EgtSetInfo(nIdMy, "JoinEntity", 0)
End If
' Ricalcolo tutte le lavorazioni
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
' recupero l'indice del PreView che deve essere acceso per indicare la selezione
ListGroup = ResearchGropuWJ(nIdParent, nIdPV)
Dim nIdWJ As Integer = GetPVIdFromIdSide(ListGroup, nIdMy)
GetCurrentPVFromIdSide(ListGroup, nIdMy, nIdWJ, nIdParent)
' salvo il valore del PreView evidenziato
m_nIdSelectedWaterJet = nIdWJ
EgtSetMark(nIdWJ)
EgtSelectObj(nIdMy)
EgtDraw()
Exit While
End If
End If
End If
Return 2
nIdMy = EgtGetNextObjInSelWin()
End While
Return
End Sub
' restituisce l'elenco dei Gruppi Waterjet associati al contorno indicato
Public Function ResearchGropuWJ(nIdOutLoop As Integer, nIdPV As Integer) As List(Of Integer)
Dim ListOfGroupPV As New List(Of Integer)
Dim nIdGroup As Integer = GDB_ID.NULL
Dim nIdMy As Integer = GDB_ID.NULL
' recupero il primo lato dall'elenco dei lati della figura
nIdMy = EgtGetFirstInGroup(nIdOutLoop)
' altrimenti cerco all'interno del layer OutLoop per ogni lato la lavorazione associata
While nIdMy <> GDB_ID.NULL
' verifico se esiste una Preview associata al lato
nIdGroup = EgtGetFirstNameInGroup(nIdPV, "Waterjet" & nIdMy.ToString & "S")
If nIdGroup <> GDB_ID.NULL Then
ListOfGroupPV.Add(nIdGroup)
End If
nIdMy = EgtGetNext(nIdMy)
End While
Return ListOfGroupPV
End Function
Public Function GetPVIdFromIdSide(ListGroup As List(Of Integer), nIdMy As Integer) As Integer
Dim IdWaterjetPV As Integer = GDB_ID.NULL
For Each nIdItem As Integer In ListGroup
Dim sName As String = String.Empty
If EgtGetName(nIdItem, sName) Then
If sName.Contains(nIdMy.ToString) Then
IdWaterjetPV = nIdItem
Exit For
End If
End If
Next
Return IdWaterjetPV
End Function
Public Sub GetCurrentPVFromIdSide(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, nIdParent As Integer)
Dim nObjInGroup As Integer = EgtGetGroupObjs(nIdParent)
Dim nCount As Integer = 0
GetNextSideJoint(ListGroup, nIdMy, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
GetPrevSideJoint(ListGroup, nIdMy, nIdWj, nCount, nObjInGroup)
End Sub
' funzione ricorsiva per la ricerca del lato al quale è associata la PreView
Private Sub GetNextSideJoint(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, ByRef nCount As Integer, nObjInGroup As Integer)
Dim nValInfo As Integer = 1
' espressione di controllo per evitare di generare Loop infinito
If nCount > nObjInGroup Then Return
If nIdWj = GDB_ID.NULL Then
Dim nIdWJNext As Integer = EgtGetNext(nIdMy)
If nIdWJNext = GDB_ID.NULL Then nIdWJNext = EgtGetFirstInGroup(EgtGetParent(nIdMy))
nCount += 1
EgtGetInfo(nIdWJNext, "JoinEntity", nValInfo)
If nValInfo = 1 Then
nIdWj = GetPVIdFromIdSide(ListGroup, nIdWJNext)
If nIdWj <> GDB_ID.NULL Then Return
Else
Return
End If
'nIdWJNext = EgtGetNext(nIdWJNext)
GetNextSideJoint(ListGroup, nIdWJNext, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
End If
End Sub
' funzione ricorsiva per la ricerca del lato al quale è associata la PreView
Private Sub GetPrevSideJoint(ListGroup As List(Of Integer), nIdMy As Integer, ByRef nIdWj As Integer, ByRef nCount As Integer, nObjInGroup As Integer)
Dim nValInfo As Integer = 1
' espressione di controllo per evitare di generare Loop infinito
If nCount > nObjInGroup Then Return
If nIdWj = GDB_ID.NULL Then
Dim nIdWJPrev As Integer = EgtGetPrev(nIdMy)
' se arrivato al primo valore allora continuo la ricerca dall'ultimo
If nIdWJPrev = GDB_ID.NULL Then nIdWJPrev = EgtGetLastInGroup(EgtGetParent(nIdMy))
nCount += 1
EgtGetInfo(nIdWJPrev, "JoinEntity", nValInfo)
If nValInfo = 1 Then
nIdWj = GetPVIdFromIdSide(ListGroup, nIdWJPrev)
If nIdWj <> GDB_ID.NULL Then Return
Else
Return
End If
'nIdWJPrev = EgtGetPrev(nIdWJPrev)
GetPrevSideJoint(ListGroup, nIdWJPrev, nIdWj, nCount, nObjInGroup)
If nIdWj <> GDB_ID.NULL Then Return
End If
End Sub
Public Sub ResetSplitCurvWJParam()
EgtDeselectObj(m_nIdSelectedSideWJ)
EgtResetMark(m_nIdSelectedWaterJet)
m_nIdSelectedSideWJ = GDB_ID.NULL
m_nIdSelectedWaterJet = GDB_ID.NULL
End Sub
#End Region ' WaterJet Section and StartPoint
Private m_bSplitCurvWJ As Boolean
Public Property bSplitCurvWJ As Boolean
Get
Return m_bSplitCurvWJ
End Get
Set(value As Boolean)
m_bSplitCurvWJ = value
m_bDragRectangle = False
NotifyPropertyChanged("bDragRectangle")
End Set
End Property
Private m_SplitCurvWJ_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property SplitCurvWJ_Visibility As Visibility
Get
Return m_SplitCurvWJ_Visibility
End Get
End Property
' in funzione della macchinata attiva predispone la visualizzazione del bottone SplitCurv (abilitato solo per WaterJet Machine)
Public Sub Set_SplitCurvWJ_Visibility()
' gestisco la visualizzazione del comando ON_OFF (per i tagli waterjet)
If CurrentMachine.WaterJettingActive Then
m_SplitCurvWJ_Visibility = Visibility.Visible
m_CountColumn += 1
Else
' verifico se in precedenza fosse stato attivo il comando
If m_SplitCurvWJ_Visibility = Visibility.Visible Then m_CountColumn -= 1
m_SplitCurvWJ_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SplitCurvWJ_Visibility")
NotifyPropertyChanged("CountColumn")
End Sub
#Region "COMMANDS"
@@ -1450,6 +1661,8 @@ Public Class NestingTabVM
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' Cancello eventuali messaggi
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
' cancello tutti i tagli di separazione
ResetAllSplitCurv()
' Cancello tutte le lavorazioni
CamAuto.EraseMachinings(GDB_ID.NULL)
' Reinserisco tutte le lavorazioni piane
@@ -1512,8 +1725,8 @@ Public Class NestingTabVM
EgtTextGetContent( nTextId, sText)
Dim nPos As Integer = sText.IndexOf( sCsvName)
Dim sNewText As String
If nPos < 0 Then
sNewText = sNewName & "<br/>" & sText
If nPos <0 Then
sNewText= sNewName & "<br/>" & sText
Else
sNewText = sText.Remove( nPos, sCsvName.Length()).Insert( nPos, sNewName)
End If
@@ -1547,6 +1760,12 @@ Public Class NestingTabVM
m_vtTotMove = Vector3d.NULL()
Return
End If
' se in modalità separazione curve WaterJet
If m_bSplitCurvWJ Then
OnMyMouseDownSceneSplitCurv(sender, e)
Return
End If
' Per default no drag
m_bDrag = False
' Verifico se selezionato indicativo di pezzo
@@ -1610,7 +1829,7 @@ Public Class NestingTabVM
If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
If Math.Abs(e.Location.X - m_locPrev.X) <m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return
End If
@@ -1729,6 +1948,12 @@ Public Class NestingTabVM
ResetDragRectangleParam()
Return
End If
' verifico che sia attivo il comando di modifica tagli waterjet
If m_bSplitCurvWJ Then
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
ResetSplitCurvWJParam()
Return
End If
' Se eseguito drag
If Not m_bDragToStart Then
' Se movimento con sola verifica finale