Compare commits

...

8 Commits

Author SHA1 Message Date
NicolaP d57075b065 Gestione inserimento di più CSV 2022-02-23 19:01:08 +01:00
NicolaP c3c24cd8e6 Inserimento da nge e dxf 2022-02-21 19:59:24 +01:00
NicolaP 63e708d601 Inserimento da CSV 2022-02-21 19:38:22 +01:00
NicolaP 0849514253 Selezione multipla per inserimento in tavola 2022-02-21 15:28:48 +01:00
NicolaP 703b7c0bad Inizio nuova gestione parcheggio 2022-02-18 16:25:25 +01:00
DarioS a9235820c5 OmagCUT :
- modifiche per nuovo parametro in import/export utensili e lavorazioni
- in WorkInProgress spostato ritardo programmabile nel ciclo.
2022-02-16 09:42:49 +01:00
NicolaP ba59163234 Gestione ritardo lettura assi (WPStepTime) 2022-02-15 19:46:32 +01:00
NicolaP e1897e68b0 Aggiunta configurazione TableUp/Down per AreaCut 2022-02-15 18:11:26 +01:00
17 changed files with 977 additions and 148 deletions
+42 -3
View File
@@ -1,5 +1,5 @@
Imports EgtUILib
Imports System.IO
Friend Module CSVFile
@@ -7,6 +7,7 @@ Friend Module CSVFile
'-----------------------------------------------------------------------------------------------
Friend Class CsvPart
Public m_sPath As String = String.Empty
Public m_sName As String = String.Empty
Public m_sOrd As String = String.Empty
Public m_sDist As String = String.Empty
@@ -29,6 +30,10 @@ Friend Module CSVFile
Public m_dHeel4 As Double = 0
Public m_nOriInd As Integer = 0
Public m_nId As Integer = GDB_ID.NULL
' definsco il riferimento al gruppo
Public m_sRefGuid As String = System.Guid.NewGuid.ToString
' definisco il colore del gruppo che sto inserendo
Public m_cColor As Color3d = CompoColor(m_MainWindow.GetIniFile())
End Class
'-----------------------------------------------------------------------------------------------
@@ -59,6 +64,7 @@ Friend Module CSVFile
For i As Integer = 1 To nNbr
Dim OnePart As New CsvPart
Dim sN As String = i.ToString()
OnePart.m_sPath = sFile
EgtLuaGetGlobStringVar("CSV.NAME" & sN, OnePart.m_sName)
OnePart.m_bActive = True
EgtLuaGetGlobStringVar("CSV.ORD" & sN, OnePart.m_sOrd)
@@ -79,6 +85,9 @@ Friend Module CSVFile
EgtLuaGetGlobNumVar("CSV.A4_" & sN, OnePart.m_dAng4)
EgtLuaGetGlobNumVar("CSV.H4_" & sN, OnePart.m_dHeel4)
OnePart.m_nOriInd = i
If OnePart.m_nCount > 1 Then
OnePart.m_sRefGuid = System.Guid.NewGuid.ToString
End If
' inserisco in lista
CsvPartList.Add(OnePart)
Next
@@ -139,7 +148,9 @@ Friend Module CSVFile
Else
Dim sItems() As String = sLine.Split("=".ToCharArray)
If sItems.Count() >= 2 Then
If sItems(0) = "Nam" Then
If sItems(0) = "Path" Then
OnePart.m_sPath = sItems(1)
ElseIf sItems(0) = "Nam" Then
OnePart.m_sName = sItems(1)
ElseIf sItems(0) = "Ord" Then
OnePart.m_sOrd = sItems(1)
@@ -181,6 +192,8 @@ Friend Module CSVFile
StringToDouble(sItems(1), OnePart.m_dHeel4)
ElseIf sItems(0) = "OIn" Then
StringToInt(sItems(1), OnePart.m_nOriInd)
ElseIf sItems(0) = "Guid" Then
OnePart.m_sRefGuid = sItems(1).Trim
End If
End If
End If
@@ -208,6 +221,7 @@ Friend Module CSVFile
For i As Integer = 1 To CsvPartList.Count()
Dim CurrPart As CsvPart = CsvPartList(i - 1)
Writer.WriteLine("[P" & i.ToString() & "]")
Writer.WriteLine("Path=" & CurrPart.m_sPath)
Writer.WriteLine("Nam=" & CurrPart.m_sName)
Writer.WriteLine("Ord=" & CurrPart.m_sOrd)
Writer.WriteLine("Dist=" & CurrPart.m_sDist)
@@ -229,19 +243,44 @@ Friend Module CSVFile
Writer.WriteLine("A4=" & DoubleToString(CurrPart.m_dAng4, 4))
Writer.WriteLine("H4=" & DoubleToString(CurrPart.m_dHeel4, 4))
Writer.WriteLine("OIn=" & CurrPart.m_nOriInd.ToString())
Writer.WriteLine("Guid=" & CurrPart.m_sRefGuid)
Next
' Terminatore
Writer.WriteLine("[END]")
' Chiudo file
Writer.Close()
Return True
' Errore
' Errore
Catch ex As Exception
EgtOutLog("CSV List error writing " & sFile)
Return False
End Try
End Function
' dato l'elenco completo dei file salvo ogni singolo epl
Friend Function WriteCsvMergePartList(CsvPartList As List(Of CsvPart)) As Boolean
Dim bOk As Boolean = True
Dim LocalPartList As New List(Of CsvPart)
Dim Index As Integer = 0
' devo dividere la lista in tante parti quanti sono i file che lo costituiscono
While Index < CsvPartList.Count
Dim CurrFile As String = CsvPartList(Index).m_sPath
Dim sFile As String = Path.ChangeExtension(CurrFile, ".epl")
LocalPartList.Clear()
While CurrFile = CsvPartList(Index).m_sPath
LocalPartList.Add(CsvPartList(Index))
Index += 1
' se terminata la lista
If Index = CsvPartList.Count Then
Exit While
End If
End While
' salvo l'elenco corrente
bOk = WriteCsvPartList(sFile, CurrFile, LocalPartList) And bOk
End While
Return bOk
End Function
Friend Function RemoveNotToNestParts(ByRef CsvPartList As List(Of CsvPart)) As Boolean
For i As Integer = CsvPartList.Count() - 1 To 0 Step -1
If CsvPartList(i).m_nToNest = 0 Then
+207 -27
View File
@@ -11,7 +11,7 @@ Public Class CSVPage
Private WithEvents m_CurrProjPage As CurrentProjectPageUC
' Flag di pagina attiva
Private m_bActive As Boolean = False
' Flag tipologia
' Flag tipologia (False -> Cvs semplificato)
Private m_bFull As Boolean = False
' Flag inserimento diretto
Private m_bDirect As Boolean = True
@@ -28,6 +28,10 @@ Public Class CSVPage
Private m_ptRawMin As Point3d
Private m_ptRawMax As Point3d
Dim m_bIsCounterLy As Boolean = False
Dim m_nCurrNubrOfParts As Integer = 0
Dim m_nIdToSel As Integer = GDB_ID.NULL
Private Sub CSVPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Assegno la lista dei pezzi Csv come sorgente del treeview
PartsTreeView.ItemsSource = m_ItemsList
@@ -101,13 +105,36 @@ Public Class CSVPage
If EgtIsPart(nPartId) Or bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se già selezionato, lo deselezione
If nStat = GDB_ST.SEL Then
EgtDeselectObj(nPartId)
' Altrimenti lo seleziono
Else
EgtSelectObj(nPartId)
' verifico se l'lemento selezionato è il numero di pezzi
If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
Dim NameLayer As String = String.Empty
EgtGetName(EgtGetParent(nId), NameLayer)
If NameLayer = INFO_COUNTERLY Then
Dim sText As String = String.Empty
If EgtTextGetContent(nId, sText) Then
Dim sItems() As String = sText.Split("#")
If sItems.Count > 1 Then
m_nCurrNubrOfParts = 0
If StringToInt(sItems(1), m_nCurrNubrOfParts) And m_nCurrNubrOfParts > 0 Then
m_bIsCounterLy = True
m_nIdToSel = nPartId
End If
End If
End If
End If
End If
If Not m_bIsCounterLy Then
' Se già selezionato, lo deselezione
If nStat = GDB_ST.SEL Then
EgtDeselectObj(nPartId)
' Altrimenti lo seleziono
Else
EgtSelectObj(nPartId)
End If
End If
Exit While
End If
nId = EgtGetNextObjInSelWin()
@@ -115,6 +142,28 @@ Public Class CSVPage
EgtDraw()
End Sub
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseUpScene
If m_bIsCounterLy Then
' apro una finestra di dialogo per chiedere se inserire tutti i pezzi della famiglia
Dim SelectWD As New SelectPartFromFamilyWD(m_MainWindow, m_nCurrNubrOfParts)
Dim sRefGroup As String = String.Empty
EgtGetInfo(m_nIdToSel, INFO_REFGROUP, sRefGroup)
' deseleziono il pezzo corrente
m_MainWindow.m_CadCutPageUC.m_NestPage.DeselectPartInFaimily(sRefGroup)
Select Case SelectWD.NumberOfSelection
Case 0 ' Annulla
' continuo senza eseguire niente
Case Else
' seleziono il numero di pezzi indicati
m_MainWindow.m_CadCutPageUC.m_NestPage.SelectPartInFaimily(sRefGroup, SelectWD.NumberOfSelection)
End Select
m_bIsCounterLy = False
' disassegno il riferimento all'oggetto appena creato
SelectWD = Nothing
EgtDraw()
End If
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
m_MainWindow.m_CadCutPageUC.CadCutPageGrid.Children.Remove(Me)
m_MainWindow.m_CadCutPageUC.CadCutPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC.m_NestPage)
@@ -133,15 +182,47 @@ Public Class CSVPage
WritePrivateProfileString(S_CSV, K_CSVLASTFILE, "", m_MainWindow.GetIniFile())
End Sub
Private Function CreateListOfDeniedFiles() As List(Of String)
Dim LocalList As New List(Of String)
LocalList.Add("MERGE")
Dim Index1 As Integer = 0
Dim Index2 As Integer = 0
For Index1 = 0 To m_CsvPartList.Count - 1
Dim sFileName As String = m_CsvPartList(Index1).m_sPath
Dim bNewFile As Boolean = True
For Index2 = 0 To LocalList.Count - 1
If sFileName = LocalList(Index2) Then
bNewFile = False
Exit For
End If
Next
If bNewFile Then
LocalList.Add(Path.GetFileNameWithoutExtension(sFileName).ToUpper.Trim)
End If
Next
Return LocalList
End Function
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
' Salvo lista dei pezzi attuale
SaveCsvPartList()
'' Salvo lista dei pezzi attuale
'SaveCsvPartList()
' Leggo direttorio corrente dei file CSV
Dim sCurrDir As String = ""
GetPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir, m_MainWindow.GetIniFile())
' Apro dialogo scelta file
Dim OpenFileWnd As New OpenFileWD(m_MainWindow, sCurrDir, ".CSV", ".EPL")
Dim OpenFileWnd As OpenFileWD
Dim sDeniedFiles As List(Of String) = CreateListOfDeniedFiles()
' imposto il filtro
If m_bFull Then
OpenFileWnd = New OpenFileWD(m_MainWindow, sCurrDir, ".CSV", ".EPL", sDeniedFiles)
Else
OpenFileWnd = New OpenFileWD(m_MainWindow, sCurrDir, ".CSV")
End If
If Not OpenFileWnd.ShowDialog() Then Return
' verifico che il file inserito non appartenga al Merge attuale
' Salvo lista dei pezzi attuale
SaveCsvPartList()
' Salvo direttorio corrente
WritePrivateProfileString(S_CSV, K_CSVCURRDIR, OpenFileWnd.GetFileDir(), m_MainWindow.GetIniFile())
' Apertura file
@@ -173,17 +254,28 @@ Public Class CSVPage
' Pulisco path e lista dei pezzi Csv
m_sFilePath = String.Empty
m_sCsvPath = String.Empty
m_CsvPartList.Clear()
' mantengo la lista attuale dei pezzi
'm_CsvPartList.Clear()
' aggiungo i pezzi su una lista temporanea
Dim LocalPartList As New List(Of CsvPart)
' Eseguo la lettura del file Csv
If Not ReadCsvFile(sCsvPath, m_bFull, m_sCsvPath, m_CsvPartList) Then
If Not ReadCsvFile(sCsvPath, m_bFull, m_sCsvPath, LocalPartList) Then
m_CurrProjPage.SetErrorMessage(EgtMsg(91206)) 'Errore nella lettura del file CSV
Return False
End If
' Creo un nuovo file che ospitarà il merge de
Dim sNewMergeFile As String = Path.GetDirectoryName(m_sCsvPath) & "\Merge.csv"
m_sCsvPath = sNewMergeFile
m_sFilePath = m_sCsvPath
' Elimino pezzi nulli
RemoveWrongParts(m_CsvPartList)
RemoveWrongParts(LocalPartList)
' Aggiorno
If m_bFull Then
MySaveCsvPartList(LocalPartList)
' Salvo come epl
SaveCsvPartList()
' Rinomino file originale
@@ -196,9 +288,41 @@ Public Class CSVPage
' eseguo rinomina
My.Computer.FileSystem.RenameFile(sCsvPath, sBakName)
End If
' attacco i nuovi pezzi alla lista corrente
For Each Item As CsvPart In LocalPartList
m_CsvPartList.Add(Item)
Next
Return True
End Function
Private Sub LoadCsvPartList(sFile As String)
' Se Csv semplificato non va letta
If Not m_bFull Then Return
' Pulisco path e lista dei pezzi Csv
m_sCsvPath = String.Empty
' mantengo la lista attuale dei pezzi
'm_CsvPartList.Clear()
' aggiungo i pezzi su una lista temporanea
Dim LocalPartList As New List(Of CsvPart)
' Lettura del file
If ReadCsvPartList(sFile, m_sCsvPath, m_CsvPartList) Then
' Creo un nuovo file che ospitarà il merge de
Dim sNewMergeFile As String = Path.GetDirectoryName(m_sCsvPath) & "\Merge.csv"
m_sCsvPath = sNewMergeFile
m_sFilePath = m_sCsvPath
End If
' Elimino pezzi nulli
RemoveWrongParts(LocalPartList)
' attacco i nuovi pezzi alla lista corrente
For Each Item As CsvPart In LocalPartList
m_CsvPartList.Add(Item)
Next
End Sub
Private Sub ShowTreeView()
' Path del file Csv
Dim TempPath As New Text.StringBuilder(260)
@@ -208,6 +332,7 @@ Public Class CSVPage
m_ItemsList.Clear()
Dim sCurrMat As String = String.Empty
Dim dCurrTh As Double = 0
Dim sCurrPath As String = String.Empty
Dim nCatToNest As Integer = 0
Dim nCatCount As Integer = 0
Dim PartCathegory As New PartCathegoryItem("", 0)
@@ -218,19 +343,27 @@ Public Class CSVPage
If i = 1 Then
sCurrMat = CurrPart.m_sMaterial
dCurrTh = CurrPart.m_dTh
sCurrPath = CurrPart.m_sPath
ElseIf String.Compare(sCurrMat, CurrPart.m_sMaterial, True) <> 0 Or
Math.Abs(dCurrTh - CurrPart.m_dTh) > 10 * EPS_SMALL Then
If m_bFull Then
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
" - " & LenToString(dCurrTh, 2) &
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
Else
PartCathegory.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
End If
PartCathegory.IsExpanded = True
m_ItemsList.Add(PartCathegory)
sCurrMat = CurrPart.m_sMaterial
dCurrTh = CurrPart.m_dTh
sCurrPath = CurrPart.m_sPath
PartCathegory = New PartCathegoryItem("", 0)
nCatToNest = 0
nCatCount = 0
@@ -248,8 +381,14 @@ Public Class CSVPage
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
" - " & LenToString(dCurrTh, 2) &
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
Else
PartCathegory.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
PartCathegory.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
End If
PartCathegory.IsExpanded = True
m_ItemsList.Add(PartCathegory)
@@ -259,6 +398,7 @@ Public Class CSVPage
For Each CatItem As PartCathegoryItem In m_ItemsList
Dim sCurrMat As String = String.Empty
Dim dCurrTh As Double = 0
Dim sCurrPath As String = String.Empty
Dim nCatToNest As Integer = 0
Dim nCatCount As Integer = 0
For Each PrtItem As PartCustomItem In CatItem.Items
@@ -268,6 +408,7 @@ Public Class CSVPage
PrtItem.sText1 = sCount
sCurrMat = PartData.m_sMaterial
dCurrTh = PartData.m_dTh
sCurrPath = PartData.m_sPath
nCatToNest += PartData.m_nToNest
nCatCount += PartData.m_nCount
Next
@@ -275,8 +416,14 @@ Public Class CSVPage
CatItem.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
" - " & LenToString(dCurrTh, 2) &
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
CatItem.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
Else
CatItem.Name = nCatToNest.ToString() & "/" & nCatCount.ToString()
If Not String.IsNullOrWhiteSpace(sCurrPath) Then
CatItem.Name &= vbCrLf & Path.GetFileNameWithoutExtension(sCurrPath)
End If
End If
Next
End Sub
@@ -490,14 +637,31 @@ Public Class CSVPage
Utility.SetTextColor( nRegId)
' Lo sposto nel gruppo speciale
EgtRelocate(nId, nIpGrp)
' assegno l'identificatico del pezzo, se esiste
If Not String.IsNullOrEmpty(CurrPart.m_sRefGuid) Then
EgtSetInfo(CurrPart.m_nId, INFO_REFGROUP, CurrPart.m_sRefGuid)
End If
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(CurrPart.m_nId, NAME_REGION)
' Imposto il colore del pezzo inserito nel progetto
EgtSetColor(nRegLayId, CurrPart.m_cColor)
Dim EntId As Integer = EgtGetFirstInGroup(nRegLayId)
While EntId <> GDB_ID.NULL
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, CurrPart.m_cColor)
EntId = EgtGetNext(EntId)
End While
Next
EgtLuaResetGlobVar("CMP")
EgtLuaResetGlobVar("CMP_Draw")
' Provo ad inserire i pezzi
Dim dNewArea As Double = 0
For i As Integer = 1 To InsPartList.Count()
Dim CurrPart As CsvPart = InsPartList(i - 1)
While CurrPart.m_nToNest > 0
If m_bDirect Then
If NestOnePart(CurrPart.m_nId) Then
dNewArea += GeomCalc.GetPartArea(CurrPart.m_nId)
@@ -519,6 +683,7 @@ Public Class CSVPage
m_CurrProjPage.UpdateTotalArea( dNewArea)
m_CurrProjPage.UpdateToProduceArea()
m_MainWindow.m_CurrentProjectPageUC.ShowAreas()
Return True
End Function
@@ -609,13 +774,19 @@ Public Class CSVPage
End If
' Cancello il pezzo
EgtErase(nId)
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
m_MainWindow.m_CadCutPageUC.m_NestPage.CountPartInFamily(CurrPart.m_sRefGuid)
' Aggiorno il contatore
CurrPart.m_nToNest += 1
' ricreo la lista delle famiglie di pezzi presenti in parcheggio
m_MainWindow.m_CadCutPageUC.m_NestPage.GetFamilyGroupInPark()
' Esco
Return True
End If
Next
End If
' creo la lista delle famiglie di pezzi presenti in parcheggio
m_MainWindow.m_CadCutPageUC.m_NestPage.GetFamilyGroupInPark()
' Pezzo non appartenente al Csv corrente
Return False
End Function
@@ -630,24 +801,33 @@ Public Class CSVPage
End If
' Path del file
Dim sFile As String = Path.ChangeExtension(m_sFilePath, ".epl")
' Scrittura del file
If WriteCsvPartList(sFile, m_sCsvPath, m_CsvPartList) Then
' Registro in ini path
WritePrivateProfileString(S_CSV, K_CSVLASTFILE, sFile, m_MainWindow.GetIniFile())
' Scrittura dei file
If WriteCsvMergePartList(m_CsvPartList) Then
' Scrittura dei file Merge
If WriteCsvPartList(sFile, m_sCsvPath, m_CsvPartList) Then
WritePrivateProfileString(S_CSV, K_CSVLASTFILE, sFile, m_MainWindow.GetIniFile())
End If
End If
End Sub
Private Sub LoadCsvPartList(sFile As String)
' Se Csv semplificato non va letta
' salvo il sottoelenco dei pezzi
Friend Sub MySaveCsvPartList(ByVal CurrPartList As List(Of CsvPart))
' Se Csv semplificato non va salvata
If Not m_bFull Then Return
' Pulisco path e lista dei pezzi Csv
m_sCsvPath = String.Empty
m_CsvPartList.Clear()
' Lettura del file
ReadCsvPartList(sFile, m_sCsvPath, m_CsvPartList)
m_sFilePath = sFile
' Elimino pezzi nulli
RemoveWrongParts(m_CsvPartList)
Dim sCurrPath As String = String.Empty
' recupero dalla lista il nome del file corrente
For Each Item As CsvPart In CurrPartList
sCurrPath = Item.m_sPath
Next
' se non trov il nome del file assocciato all'elenco di pezzi esco
If String.IsNullOrEmpty(sCurrPath) Then
EgtOutLog("CSV Curr list missing")
Return
End If
' Path del file
Dim sFile As String = Path.ChangeExtension(sCurrPath, ".epl")
' Scrittura del file
WriteCsvPartList(sFile, sCurrPath, CurrPartList)
End Sub
Friend Sub UpdateCsvPartList()
+417 -108
View File
@@ -56,6 +56,12 @@ Public Class NestPageUC
Private m_bMagnetic As Boolean = False
Private m_dSnapDist As Double = 0
' lista delle famiglie di pezzi in parcheggio
Private m_ListOfGroupInPark As New List(Of FamilyPart)
' se seleniozato il layer CounterPz
Dim m_bIsCounterLy As Boolean = False
Dim m_nCurrNubrOfParts As Integer = 0
Private Sub NestPage_Initialized(sender As Object, e As EventArgs)
' Imposto i messaggi letti dal file dei messaggi
InsertPartBtn.ToolTip = EgtMsg(MSG_NESTPAGEUC + 1) 'Insert part - Inserisci pezzo
@@ -195,6 +201,7 @@ Public Class NestPageUC
Return
End If
m_bIsCounterLy = False
' Per default no drag
m_bDrag = False
' Verifico se selezionato indicativo di pezzo
@@ -211,33 +218,56 @@ Public Class NestPageUC
If EgtIsPart(nPartId) Or bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se già selezionato o posizione oggetto incompatibile con flag posizione selezionati
If nStat = GDB_ST.SEL Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nPartId
' verifico se l'lemento selezionato è il numero di pezzi
If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
Dim NameLayer As String = String.Empty
EgtGetName(EgtGetParent(nId), NameLayer)
If NameLayer = INFO_COUNTERLY Then
Dim sText As String = String.Empty
If EgtTextGetContent(nId, sText) Then
Dim sItems() As String = sText.Split("#")
If sItems.Count > 1 Then
m_nCurrNubrOfParts = 0
If StringToInt(sItems(1), m_nCurrNubrOfParts) Then
m_bIsCounterLy = True
m_nIdToSel = nPartId
End If
End If
End If
End If
End If
If Not m_bIsCounterLy Then
' Se già selezionato o posizione oggetto incompatibile con flag posizione selezionati
If nStat = GDB_ST.SEL Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nPartId
End If
End If
' Drag possibile
m_bDrag = True
Exit While
Else
' verifico se l'elemento selezionato è il nome della tavola
If EgtGetType(nId) = GDB_TY.EXT_TEXT AndAlso (sNamePartId = MAIN_TAB Or sNamePartId = SECOND_TAB) Then
Exit While
Else
' verifico se l'elemento selezionato è il nome della tavola
If EgtGetType(nId) = GDB_TY.EXT_TEXT AndAlso (sNamePartId = MAIN_TAB Or sNamePartId = SECOND_TAB) Then
Dim nRes As Integer = m_MainWindow.m_CadCutPageUC.m_ProjectMgr.ChangeTable()
' se non è stata eseguita nessuna scelta esco dal ciclo
If nRes = 0 Then Exit While
' imposto l'altra tavola
Dim sOtherTab = If( sNamePartId = MAIN_TAB, SECOND_TAB, MAIN_TAB)
EgtChangeTable( sOtherTab, True)
m_CurrProjPage.AdjustAdditionalTable( True)
Dim sOtherTab = If(sNamePartId = MAIN_TAB, SECOND_TAB, MAIN_TAB)
EgtChangeTable(sOtherTab, True)
m_CurrProjPage.AdjustAdditionalTable(True)
EgtSetMachineLook(MCH_LOOK.TAB)
' aggiorno le lavorazioni
UpdateAllMachiningsToolpaths()
' aggiorno i movimenti pezzi tra disposizioni
For nI As Integer = 1 To EgtGetPhaseCount()
EgtSetCurrPhase( nI)
For nI As Integer = 1 To EgtGetPhaseCount()
EgtSetCurrPhase(nI)
Dim nDispId As Integer = EgtGetPhaseDisposition(nI)
SpecialApplyDisposition(nDispId, True)
Next
@@ -250,31 +280,31 @@ Public Class NestPageUC
Dim nPPId As Integer = EgtGetFirstPart()
While nPPId <> GDB_ID.NULL
PackPartInStore(nPPId)
nPPId = EgtGetNextPart( nPPId)
nPPId = EgtGetNextPart(nPPId)
End While
' se prevista rotazione
If GetPrivateProfileInt(S_TABLE, K_CHANGETABWD, 0, m_MainWindow.GetMachIniFile()) = 2 Then
' Dati tavola
Dim b3Tab As New BBox3d
EgtGetTableArea( 1, b3Tab)
EgtGetTableArea(1, b3Tab)
' Box lastra
Dim b3OrigRaw As New BBox3d
GetRawBox( b3OrigRaw)
GetRawBox(b3OrigRaw)
' Allargo i limiti della tavola in tutte le fasi
Const TAB_OFFS As Double = 3000
For nI As Integer = 1 To EgtGetPhaseCount()
EgtSetCurrPhase(nI)
EgtSetTableAreaOffset( TAB_OFFS, TAB_OFFS, TAB_OFFS, TAB_OFFS)
EgtSetTableAreaOffset(TAB_OFFS, TAB_OFFS, TAB_OFFS, TAB_OFFS)
Next
EgtSetCurrPhase(1)
' Rotazione
Dim dAngRot As Double = If(sOtherTab = SECOND_TAB, 180, -180)
if Not RotateAllRawParts(dAngRot, False) Then
If Not RotateAllRawParts(dAngRot, False) Then
m_CurrProjPage.SetWarningMessage(EgtMsg(90339)) 'Rotazione impossibile
End If
' Traslazione per riportare la lastra nella stessa posizione rispetto all'angolo BL che diveta TR e viceversa
Dim b3Raw As New BBox3d
GetRawBox( b3Raw)
GetRawBox(b3Raw)
Dim vtMove As Vector3d
If sOtherTab = SECOND_TAB Then
Dim vtDiffIni As Vector3d = b3OrigRaw.Min() - b3Tab.Min()
@@ -283,14 +313,14 @@ Public Class NestPageUC
Else
Dim vtDiffIni As Vector3d = b3Tab.Max() - b3OrigRaw.Max()
Dim vtDiffFin As Vector3d = b3Raw.Min() - b3Tab.Min()
vtMove = -( vtDiffFin - vtDiffIni)
vtMove = -(vtDiffFin - vtDiffIni)
End If
vtMove.z = 0
MoveAllRawParts(vtMove)
' Ripristino i limiti della tavola in tutte le fasi
For nI As Integer = 1 To EgtGetPhaseCount()
EgtSetCurrPhase(nI)
EgtSetTableAreaOffset( 0, 0, 0, 0)
EgtSetTableAreaOffset(0, 0, 0, 0)
Next
EgtSetCurrPhase(1)
HideAllMachinings()
@@ -336,15 +366,28 @@ Public Class NestPageUC
m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_NESTPAGEUC + 7))
End If
' Applico le lavorazioni al pezzo
Dim b3Curr As new BBox3d
EgtGetBBoxGlob( EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Curr)
if Not PreInsertOnePart( nTestId) Then Return
Dim b3Ins As new BBox3d
EgtGetBBoxGlob( EgtGetFirstNameInGroup( nTestId, NAME_REGION), BBFLAG, b3Ins)
Dim vtDiff As new Vector3d( b3Curr.Min().x - b3Ins.Min().x, b3Curr.Min().y - b3Ins.Min().y, 0)
EgtMove( nMoveId, vtDiff)
Dim b3Curr As New BBox3d
EgtGetBBoxGlob(EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Curr)
If Not PreInsertOnePart(nTestId) Then Return
Dim b3Ins As New BBox3d
EgtGetBBoxGlob(EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Ins)
Dim vtDiff As New Vector3d(b3Curr.Min().x - b3Ins.Min().x, b3Curr.Min().y - b3Ins.Min().y, 0)
EgtMove(nMoveId, vtDiff)
'---------------------- COUNTER PART ----------------------
' aggiorno contatore pezzi
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' spengo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.OFF)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
' Gestione VeinMatching
VeinMatching.OnInsertPartInRaw( nMoveId)
VeinMatching.OnInsertPartInRaw(nMoveId)
' Imposto stato
m_bVerify = True
m_bFromParking = True
@@ -362,7 +405,7 @@ Public Class NestPageUC
If m_bVerify Then
EgtMove(nMoveId, vtMove)
m_vtTotMove += vtMove
' altrimenti caso con verifica durante il movimento
' altrimenti caso con verifica durante il movimento
Else
' Aggiorno regioni per nesting
UpdateNestRegions()
@@ -382,7 +425,7 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( nMoveId) Then
If Not GetLockOnRotation(nMoveId) Then
EgtAlignPartOnCollision(nMoveId, m_bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
@@ -425,16 +468,16 @@ Public Class NestPageUC
UpdateNestRegions()
EnableReferenceRegion(False)
' Eseguo verifica
If VerifyTrfData( nMoveId) And EgtVerifyPart( nMoveId, m_bReducedCut) Then
If VerifyTrfData(nMoveId) And EgtVerifyPart(nMoveId, m_bReducedCut) Then
m_CurrProjPage.ResetOrderMachiningFlag()
' Non superata riporto alla posizione iniziale
' Non superata riporto alla posizione iniziale
Else
If m_bFromParking Then
m_CurrProjPage.ClearMessage()
PreRemoveOnePart( nMoveId)
VeinMatching.OnRemovePartFromRaw( nMoveId)
PreRemoveOnePart(nMoveId)
VeinMatching.OnRemovePartFromRaw(nMoveId)
Else
EgtMove( nMoveId, -m_vtTotMove)
EgtMove(nMoveId, -m_vtTotMove)
' Eventuale notifica al VeinMatching
If nMoveId = GDB_ID.SEL Then
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -446,13 +489,46 @@ Public Class NestPageUC
VeinMatching.OnMovePartInRaw(nMoveId)
End If
End If
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' accendo il layer che contiene il contatore (spento in fase di Drag)
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
End If
m_bFromParking = False
' altrimenti caso con verifica durante il movimento
' altrimenti caso con verifica durante il movimento
Else
' Basta reset alla fine
End If
' Se selezione da eseguire
' se è stato selezionato il layer del contatore mostro la finsetra
ElseIf m_bIsCounterLy Then
'---------------------- COUNTER PART ----------------------
' apro una finestra di dialogo per chiedere se inserire tutti i pezzi della famiglia
Dim SelectWD As New SelectPartFromFamilyWD(m_MainWindow, m_nCurrNubrOfParts)
Dim sRefGroup As String = String.Empty
EgtGetInfo(m_nIdToSel, INFO_REFGROUP, sRefGroup)
' deseleziono il pezzo corrente
DeselectPartInFaimily(sRefGroup)
Select Case SelectWD.NumberOfSelection
Case 0 ' Annulla
' continuo senza eseguire niente
Case Else
' seleziono il numero di pezzi indicati
SelectPartInFaimily(sRefGroup, SelectWD.NumberOfSelection)
End Select
m_bIsCounterLy = False
' disassegno il riferimento all'oggetto appena creato
SelectWD = Nothing
'---------------------- COUNTER PART ----------------------
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' Determino se pezzo in tavola o in parcheggio
Dim bPartInTable As Boolean = (EgtGetParent(m_nIdToSel) = m_nRawId)
@@ -469,12 +545,15 @@ Public Class NestPageUC
VeinMatching.OnSelectPart(m_nIdToSel)
' Set flag posizione selezionati
m_nPartPos = If(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
' Se deselezione da eseguire
' Se deselezione da eseguire
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
EgtDeselectObj(m_nIdToDesel)
' Eventuale aggiornamento VeinMatching
VeinMatching.OnDeselectPart(m_nIdToDesel)
End If
' Reset
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
@@ -521,9 +600,9 @@ Public Class NestPageUC
Private Sub MaximizeMoveBtn_Click(sender As Object, e As RoutedEventArgs) Handles MaximizeMoveBtn.Click
If MaximizeMoveBtn.IsChecked() Then
m_bMaximizeMove = True
m_bMaximizeMove = True
Else
m_bMaximizeMove = False
m_bMaximizeMove = False
End If
End Sub
@@ -541,8 +620,8 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then
EgtAlignPartOnCollision( GDB_ID.SEL, m_bReducedCut, bAlignMoved)
If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
@@ -577,7 +656,7 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then
If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
@@ -613,7 +692,7 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then
If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
@@ -649,7 +728,7 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then
If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
@@ -758,7 +837,7 @@ Public Class NestPageUC
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Se pezzo con rotazione libera
If Not EgtExistsInfo( nId, INFO_PARTROT) Then
If Not EgtExistsInfo(nId, INFO_PARTROT) Then
' Calcolo il centro di rotazione come centro del pezzo
Dim ptCen As Point3d
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
@@ -771,10 +850,10 @@ Public Class NestPageUC
nId = EgtGetNextSelectedObj()
End While
Return True
' Altrimenti li ruoto tenendo conto delle collisioni
' Altrimenti li ruoto tenendo conto delle collisioni
Else
' Verifico se ci sono dei pezzi bloccati in rotazione
Dim bLockedRot As Boolean = GetLockOnRotation( GDB_ID.SEL)
Dim bLockedRot As Boolean = GetLockOnRotation(GDB_ID.SEL)
' Se tutti i pezzi possono ruotare
If Not bLockedRot Then
' Calcolo il centro di rotazione come centro del cluster
@@ -804,7 +883,7 @@ Public Class NestPageUC
m_CurrProjPage.SetWarningMessage(EgtMsg(90338)) 'Angolo di registrazione oltre i limiti
Return
End If
Dim bMoveOk As Boolean = RotateAllRawParts( dAngDeg)
Dim bMoveOk As Boolean = RotateAllRawParts(dAngDeg)
If Not bMoveOk Then m_CurrProjPage.SetWarningMessage(EgtMsg(90339)) 'Rotazione impossibile
End Sub
@@ -864,7 +943,7 @@ Public Class NestPageUC
End While
nRevPhase += 1
End While
' Altrimenti eseguo sistemazioni
' Altrimenti eseguo sistemazioni
Else
' Origine della tavola
Dim ptOri As Point3d
@@ -949,13 +1028,14 @@ Public Class NestPageUC
Private Sub InsertPartBtn_Click(sender As Object, e As RoutedEventArgs) Handles InsertPartBtn.Click
' Se inserimento automatico
If GetPrivateProfileInt( S_NEST, K_AUTOMATICOPTIMIZE, 0, m_MainWindow.GetIniFile()) <> 0 And
If GetPrivateProfileInt(S_NEST, K_AUTOMATICOPTIMIZE, 0, m_MainWindow.GetIniFile()) <> 0 And
m_MainWindow.GetAutoNestingOption() Then
AutomaticInsert()
' altrimenti inserimento standard
' altrimenti inserimento standard
Else
StandardInsert()
End If
End Sub
Private Sub StandardInsert()
@@ -1000,7 +1080,7 @@ Public Class NestPageUC
Private Sub AutomaticInsert()
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
m_CurrProjPage.SetInfoMessage( EgtMsg( 90340)) ' Nesting Automatico in corso
m_CurrProjPage.SetInfoMessage(EgtMsg(90340)) ' Nesting Automatico in corso
Dim bWrongTrf As Boolean = False
Dim vParts As New List(Of Integer)
' Ciclo di pre-inserimento in tavola dei pezzi selezionati
@@ -1018,7 +1098,7 @@ Public Class NestPageUC
End If
' Lo preparo in tavola, se possibile
If PreInsertOnePart(nId) Then
vParts.Add( nId)
vParts.Add(nId)
Else
EgtSetStatus(nId, GDB_ST.ON_)
VeinMatching.OnDeselectPart(nId)
@@ -1033,12 +1113,12 @@ Public Class NestPageUC
Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0)
EnableReferenceRegion(bAligned)
' Eseguo nesting automatico
Dim bOpimizeOnX As Boolean = ( GetPrivateProfileInt( S_NEST, K_AUTOMATICOPTIMIZE, 2, m_MainWindow.GetIniFile()) = 1)
Dim bOpimizeOnX As Boolean = (GetPrivateProfileInt(S_NEST, K_AUTOMATICOPTIMIZE, 2, m_MainWindow.GetIniFile()) = 1)
Dim bGuillotineMode As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_GHIGLIOTTINA, 0, m_MainWindow.GetMachIniFile()) <> 0)
Dim nAutomaticMaxTime As Integer = GetPrivateProfileInt( S_NEST, K_AUTOMATICMAXTIME, 20, m_MainWindow.GetIniFile())
Dim dPartTime As Double = If( bGuillotineMode, 1.0, 0.5)
Dim nMaxTime As Integer = Math.Min( 2.0 + dPartTime * vParts.Count(), nAutomaticMaxTime)
EgtAutomaticPackParts( vParts, bOpimizeOnX, m_bReducedCut, bGuillotineMode, nMaxTime)
Dim nAutomaticMaxTime As Integer = GetPrivateProfileInt(S_NEST, K_AUTOMATICMAXTIME, 20, m_MainWindow.GetIniFile())
Dim dPartTime As Double = If(bGuillotineMode, 1.0, 0.5)
Dim nMaxTime As Integer = Math.Min(2.0 + dPartTime * vParts.Count(), nAutomaticMaxTime)
EgtAutomaticPackParts(vParts, bOpimizeOnX, m_bReducedCut, bGuillotineMode, nMaxTime)
' Sistemo i pezzi
For Each nPartId As Integer In vParts
' se pezzo inserito
@@ -1046,11 +1126,11 @@ Public Class NestPageUC
VeinMatching.OnInsertPartInRaw(nPartId)
' Eventuale aggiunta solido per taglio da sotto
UpdateSolidForDrip(nPartId)
' altrimenti rifiutato
else
' altrimenti rifiutato
Else
' Ripristino lo stato originale
PreRemoveOnePart( Math.Abs( nPartId))
VeinMatching.OnDeselectPart( Math.Abs( nPartId))
PreRemoveOnePart(Math.Abs(nPartId))
VeinMatching.OnDeselectPart(Math.Abs(nPartId))
End If
Next
' Aggiorno flag selezionati
@@ -1093,7 +1173,7 @@ Public Class NestPageUC
Friend Function PreInsertOnePart(nId As Integer) As Boolean
' Se non esiste grezzo o pezzo non in parcheggio, esco
If m_nRawId = GDB_ID.NULL OrElse not EgtIsPart(nId) Then Return false
If m_nRawId = GDB_ID.NULL OrElse Not EgtIsPart(nId) Then Return False
' Sistemazioni per eventuali lati inclinati con tallone
AdjustPartSideAngleHeel(nId, m_b3Raw.DimZ())
' Sistemazioni per eventuali lati esterni inclinati e/o offsettati
@@ -1109,17 +1189,17 @@ Public Class NestPageUC
Dim dRawCenY = ptRawCenter.y - m_b3Raw.Min().y
' Inserisco il pezzo nel grezzo, in centro in XY e in alto in Z
Dim ptP As New Point3d(dRawCenX - 0.5 * b3Part.DimX(), dRawCenY - 0.5 * b3Part.DimY(), m_b3Raw.DimZ() - b3Part.DimZ() + DELTAZ_REG)
If not EgtAddPartToRawPart(nId, ptP, m_nRawId) Then Return false
If Not EgtAddPartToRawPart(nId, ptP, m_nRawId) Then Return False
' Aggiungo le lavorazioni standard
Dim nWarn As Integer = 0
AddMachinings(nId, nWarn)
If nWarn = 1 Then m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_SPLITPAGEUC + 11)) ' Lama troppo grande per utilizzo ventosa
Return true
Return True
End Function
Friend Function PreRemoveOnePart(nId As Integer) As Boolean
' Se non esiste il pezzo, esco
If nId = GDB_ID.NULL Then Return false
If nId = GDB_ID.NULL Then Return False
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Elimino eventuali modifiche per lati esterni inclinati e/o offsettati
@@ -1130,7 +1210,7 @@ Public Class NestPageUC
' Parcheggio
EgtRemovePartFromRawPart(nId)
EgtSetStatus(nId, GDB_ST.ON_)
Return true
Return True
End Function
Friend Function InsertOnePart(nId As Integer) As Boolean
@@ -1138,7 +1218,7 @@ Public Class NestPageUC
If Not EgtIsPart(nId) Then Return False
' Metto pezzo in centro grezzo con lavorazioni e sistemazioni varie
Dim bFit As Boolean = False
If PreInsertOnePart( nId) Then
If PreInsertOnePart(nId) Then
' Eseguo nesting
If UpdateNestRegions() Then
Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0)
@@ -1150,15 +1230,26 @@ Public Class NestPageUC
bFit = EgtPackPart(nId, m_bReducedCut, True)
End If
End If
End if
End If
' Gestione risultato nesting
If bFit Then
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
' spengo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.OFF)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
' Eventuale aggiunta solido per taglio da sotto
UpdateSolidForDrip(nId)
Return True
Else
' Ripristino lo stato originale
PreRemoveOnePart( nId)
PreRemoveOnePart(nId)
Return False
End If
End Function
@@ -1182,10 +1273,10 @@ Public Class NestPageUC
End While
' Aggiorno le entità con tallone e quelle con angolo esterno
Const AGG_DEPTH As Double = 0.75
Dim bSizeOnTop As Boolean = ( GetPrivateProfileInt( S_SIDES, K_SIZEALWAYSONTOP, 0, m_MainWindow.GetIniFile()) <> 0)
Dim bSizeOnTop As Boolean = (GetPrivateProfileInt(S_SIDES, K_SIZEALWAYSONTOP, 0, m_MainWindow.GetIniFile()) <> 0)
For Each nEnt As Integer In vEnt
' Se aggiornamento vietato, vado oltre
If EgtExistsInfo( nEnt, INFO_SIDE_FIXED) Then continue for
If EgtExistsInfo(nEnt, INFO_SIDE_FIXED) Then Continue For
' Recupero eventuali tallone ed angolo originale
Dim dHeel As Double = 0
Dim dSideAng As Double = 0
@@ -1208,7 +1299,7 @@ Public Class NestPageUC
End If
EgtSetInfo(nEnt, INFO_DEPTH2, (dTh - dHeel) + AGG_DEPTH)
EgtSetInfo(nEnt, INFO_AGG2, AGG_DEPTH)
' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato
' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato
Else
EgtSetInfo(nEnt, INFO_SIDE_ANGLE, 0.0)
EgtSetInfo(nEnt, INFO_SIDE_ANGLE2, 0.0)
@@ -1216,7 +1307,7 @@ Public Class NestPageUC
EgtRemoveInfo(nEnt, INFO_DEPTH2)
EgtRemoveInfo(nEnt, INFO_AGG2)
End If
' Inclinazione interna
' Inclinazione interna
Else
' Se tallone inferiore a spessore
If dHeel < dTh - 10 * EPS_SMALL Then
@@ -1224,7 +1315,7 @@ Public Class NestPageUC
EgtSetInfo(nEnt, INFO_SIDE_ANGLE2, 0.0)
EgtSetInfo(nEnt, INFO_DEPTH2, dHeel + AGG_DEPTH)
EgtSetInfo(nEnt, INFO_AGG2, AGG_DEPTH)
' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato
' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato
Else
EgtSetInfo(nEnt, INFO_SIDE_ANGLE, 0.0)
EgtRemoveInfo(nEnt, INFO_OFFSET)
@@ -1233,7 +1324,7 @@ Public Class NestPageUC
EgtRemoveInfo(nEnt, INFO_AGG2)
End If
End If
' Se altrimenti inclinazione esterna
' Se altrimenti inclinazione esterna
ElseIf dSideAng > EPS_ANG_SMALL Then
If Not bSizeOnTop Then
EgtSetInfo(nEnt, INFO_OFFSET, -dTh * Math.Tan(dSideAng * Math.PI / 180))
@@ -1245,7 +1336,151 @@ Public Class NestPageUC
Return True
End Function
#Region "Manager Counter Part"
' creo la lista delle famiglie che popolano il parcheggio
Public Sub GetFamilyGroupInPark()
m_ListOfGroupInPark.Clear()
Dim nIdInPark As Integer = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup) Then
Dim bExists As Boolean = False
For Each sItem As FamilyPart In m_ListOfGroupInPark
If sRefGroup = sItem.sRefGuid Then
bExists = True
Exit For
End If
Next
If Not bExists Then
m_ListOfGroupInPark.Add(New FamilyPart(sRefGroup, nIdInPark))
End If
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub CountPartInFamily(sRefGuid As String)
If String.IsNullOrEmpty(sRefGuid) Then Return
Dim nCount As Integer = 0
Dim nIdInPark As Integer = EgtGetFirstPart()
' conto il nuero di pezzi del gruppo inidcato
While nIdInPark <> GDB_ID.NULL
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
nCount += 1
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
' aggiorno il contatore dei pezzi del gruppo
nIdInPark = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
Dim nId As Integer = EgtGetFirstNameInGroup(nIdInPark, INFO_COUNTERLY)
If nId <> GDB_ID.NULL Then
Dim m_IdCounterTextas As Integer = EgtGetFirstInGroup(nId)
EgtModifyText(m_IdCounterTextas, "# " & nCount.ToString)
End If
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub SelectPartInFaimily(sRefGuid As String, nNbrOfSelection As Integer)
' aggiorno il contatore dei pezzi del gruppo
Dim nIdInPark As Integer = EgtGetFirstPart()
Dim nCounter As Integer = 0
While nIdInPark <> GDB_ID.NULL And nCounter < nNbrOfSelection
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
EgtSelectObj(nIdInPark)
nCounter += 1
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Sub DeselectPartInFaimily(sRefGuid As String)
' aggiorno il contatore dei pezzi del gruppo
Dim nIdInPark As Integer = EgtGetFirstPart()
While nIdInPark <> GDB_ID.NULL
Dim sRefGroup As String = String.Empty
EgtGetInfo(nIdInPark, INFO_REFGROUP, sRefGroup)
If sRefGroup = sRefGuid Then
EgtDeselectObj(nIdInPark)
End If
nIdInPark = EgtGetNextPart(nIdInPark)
End While
End Sub
Public Function ParkInGroupFamily(nId As Integer) As Boolean
' se pezzo appartenente ad un gruppo
Dim sRefGroup As String = String.Empty
Dim Element As FamilyPart
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
' verifico se esiste un pezzo dello stesso gruppo in parcheggio
Dim nNewLayer As Integer
Dim ptMin As Point3d
Dim ptMax As Point3d
For Each sItem As FamilyPart In m_ListOfGroupInPark
If sRefGroup = sItem.sRefGuid Then
' creo un nuovo layer per contenere l'informazione del numero di pezzi da inserire
If EgtGetFirstNameInGroup(nId, INFO_COUNTERLY) = GDB_ID.NULL Then
nNewLayer = EgtCreateGroup(nId)
EgtSetName(nNewLayer, INFO_COUNTERLY)
EgtSetColor(nNewLayer, New Color3d(0, 0, 0))
EgtGetBBox(nId, GDB_BB.STANDARD, ptMin, ptMax)
EgtCreateText(nNewLayer, New Point3d((ptMin.x + ptMax.x) / 2, ptMin.y - sItem.nHText - 20, ptMin.z), "# ???", sItem.nHText, GDB_RT.LOC)
Else
' Accendo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
End If
' calcolo lo spostamento del pezzo
Dim PtMinInRaw As Point3d
Dim PtMaxInRaw As Point3d
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, PtMinInRaw, PtMaxInRaw)
Dim vtMoveToStorage As New Vector3d
vtMoveToStorage = sItem.PtStorage() - PtMinInRaw
EgtMove(nId, vtMoveToStorage, GDB_RT.GLOB)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
Return True
End If
Next
' inserisco il primo pezzo del gruppo nel parcheggio
Element = New FamilyPart(sRefGroup, nId)
m_ListOfGroupInPark.Add(Element)
' creo un nuovo layer per contenere l'informazione del numero di pezzi da inserire
If EgtGetFirstNameInGroup(nId, INFO_COUNTERLY) = GDB_ID.NULL Then
nNewLayer = EgtCreateGroup(nId)
EgtSetName(nNewLayer, INFO_COUNTERLY)
EgtSetColor(nNewLayer, New Color3d(0, 0, 0))
EgtGetBBox(nId, GDB_BB.STANDARD, ptMin, ptMax)
' posso migliorarei lposizioanamento in funzione della dimensione della scritta...
EgtCreateText(nNewLayer, New Point3d((ptMin.x + ptMax.x) / 2, ptMin.y - Element.nHText - 20, ptMin.z), "# 1", Element.nHText, GDB_RT.LOC)
Else
' Accendo il layer che contiene il contatore
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
End If
Return False
End Function
#End Region ' Manager Counter Part
Private Sub StorePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles StorePartBtn.Click
' creo la lista delle famiglie di pezzi presenti in parcheggio
GetFamilyGroupInPark()
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
' Ciclo di parcheggio dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -1270,7 +1505,13 @@ Public Class NestPageUC
If bForced OrElse
(m_nRawId <> GDB_ID.NULL AndAlso EgtGetParent(nId) = m_nRawId) Then
' Ripristino lo stato originale
PreRemoveOnePart( nId)
PreRemoveOnePart(nId)
'---------------------- COUNTER PART ----------------------
' se esiste almento un pezzo del gruppo in parcheggio esco
If ParkInGroupFamily(nId) Then Return True
'---------------------- COUNTER PART ----------------------
' Parcheggio
PackPartInStore(nId)
' Aggiusto la posizione in Z
@@ -1341,14 +1582,21 @@ Public Class NestPageUC
' Se abilitata cancellazione in ogni caso o pezzo non da Csv
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
' Aggiorno l'area dei pezzi cancellati
dEraseArea += GeomCalc.GetPartArea( nId)
dEraseArea += GeomCalc.GetPartArea(nId)
' Se pezzo in parcheggio cancello direttamente
If EgtIsPart(nId) Then
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
' recupero l'GUID del gruppo
EgtGetInfo(nId, INFO_REFGROUP, sRefGroup)
'---------------------- COUNTER PART ----------------------
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
EgtErase(nId)
' Altrimenti pezzo nel grezzo
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
CountPartInFamily(sRefGroup)
' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = m_nRawId Then
If EgtRemovePartFromRawPart(nId) Then
' Eventuale notifica al VeinMatching
@@ -1363,10 +1611,11 @@ Public Class NestPageUC
' Passo al successivo selezionato
nId = nNextId
End While
' Imposto flag posizione pezzi
m_nPartPos = PART_POS.NONE_TABLE
' Aggiorno Aree totale e da lavorare dei pezzi
m_CurrProjPage.UpdateTotalArea( - dEraseArea)
m_CurrProjPage.UpdateTotalArea(-dEraseArea)
m_CurrProjPage.UpdateToProduceArea()
m_CurrProjPage.ShowAreas()
' Aggiorno vista
@@ -1389,7 +1638,7 @@ Public Class NestPageUC
End While
' Aggiorno flag
m_nPartPos = If(EgtGetSelectedObjCount() > 0, PART_POS.IN_TABLE, PART_POS.NONE_TABLE)
' Altrimenti
' Altrimenti
Else
' Seleziono tutti i pezzi in parcheggio
Dim nPartId As Integer = EgtGetFirstPart()
@@ -1418,28 +1667,28 @@ Public Class NestPageUC
EgtDraw()
End Sub
Private Sub PartRotOnBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOnBtn.Click
Private Sub PartRotOnBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOnBtn.Click
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
' Se non ci sono pezzi selezionati o non sono in parcheggio, esco
If EgtGetSelectedObjCount() = 0 OrElse m_nPartPos <> PART_POS.OUT_TABLE Then Return
' Tolgo blocco rotazione sui pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
While nId <> GDB_ID.NULL
' Se rotazione bloccata, tolgo blocco e aggiorno info
If EgtExistsInfo( nId, INFO_PARTROT) Then
If EgtExistsInfo(nId, INFO_PARTROT) Then
' Rimuovo flag di rotazione bloccata
EgtRemoveInfo( nId, INFO_PARTROT)
EgtRemoveInfo(nId, INFO_PARTROT)
' Tolgo da info sul pezzo Codice
Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION))
Dim nTextId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(nId, NAME_REGION))
While nTextId <> GDB_ID.NULL
If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then
If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = ""
EgtTextGetContent( nTextId, sText)
sText = sText.Replace( "<br/>(X)", "")
EgtModifyText( nTextId, sText)
EgtTextGetContent(nTextId, sText)
sText = sText.Replace("<br/>(X)", "")
EgtModifyText(nTextId, sText)
Exit While
End If
nTextId = EgtGetNext( nTextId)
nTextId = EgtGetNext(nTextId)
End While
End If
' Passo al successivo selezionato
@@ -1449,7 +1698,7 @@ Public Class NestPageUC
EgtDraw()
End Sub
Private Sub PartRotOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOffBtn.Click
Private Sub PartRotOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOffBtn.Click
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
' Se non ci sono pezzi selezionati o non sono in parcheggio, esco
If EgtGetSelectedObjCount() = 0 OrElse m_nPartPos <> PART_POS.OUT_TABLE Then Return
@@ -1457,20 +1706,20 @@ Public Class NestPageUC
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Se rotazione libera, applico blocco e aggiorno info
If Not EgtExistsInfo( nId, INFO_PARTROT) Then
If Not EgtExistsInfo(nId, INFO_PARTROT) Then
' Imposto flag di rotazione bloccata
EgtSetInfo( nId, INFO_PARTROT, 0)
EgtSetInfo(nId, INFO_PARTROT, 0)
' Inserisco in info sul pezzo Codice
Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION))
Dim nTextId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(nId, NAME_REGION))
While nTextId <> GDB_ID.NULL
If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then
If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = ""
EgtTextGetContent( nTextId, sText)
EgtTextGetContent(nTextId, sText)
sText &= "<br/>(X)"
EgtModifyText( nTextId, sText)
EgtModifyText(nTextId, sText)
Exit While
End If
nTextId = EgtGetNext( nTextId)
nTextId = EgtGetNext(nTextId)
End While
End If
' Passo al successivo selezionato
@@ -1480,16 +1729,16 @@ Public Class NestPageUC
EgtDraw()
End Sub
Private Function GetLockOnRotation( nPartId As Integer) As Boolean
Private Function GetLockOnRotation(nPartId As Integer) As Boolean
' Se singolo pezzo
If nPartId <> GDB_ID.SEL Then
Return EgtExistsInfo( nPartId, INFO_PARTROT)
' Altrimenti tutti i selezionati
Return EgtExistsInfo(nPartId, INFO_PARTROT)
' Altrimenti tutti i selezionati
Else
Dim bLockedRot As Boolean = False
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
If EgtExistsInfo( nId, INFO_PARTROT) Then
If EgtExistsInfo(nId, INFO_PARTROT) Then
bLockedRot = True
Exit While
End If
@@ -1612,3 +1861,63 @@ Public Class NestPageUC
End Function
End Class
Class FamilyPart
Private PtMinStoraged As Point3d
Private PtMaxStoraged As Point3d
Private m_nHText As Integer = 40
Public ReadOnly Property nHText As String
Get
Return m_nHText
End Get
End Property
Private m_sRefGuid As String = String.Empty
Public ReadOnly Property sRefGuid As String
Get
Return m_sRefGuid
End Get
End Property
Private m_nIdPart As Integer = -1
Public ReadOnly Property nIdPart As Integer
Get
Return m_nIdPart
End Get
End Property
Private m_IdCounterText As Integer
Public ReadOnly Property IdCounterText As Integer
Get
Return m_IdCounterText
End Get
End Property
Public Function PtStorage() As Point3d
EgtGetBBoxGlob(m_nIdPart, GDB_BB.STANDARD, PtMinStoraged, PtMaxStoraged)
Return PtMinStoraged
End Function
'Public Sub RefreshCounterLayer(nNbr As Integer)
' GetIdtextCounteLayer()
' EgtModifyText(m_IdCounterText, "# " & nNbr.ToString)
'End Sub
'Private Sub GetIdtextCounteLayer()
' Dim nId As Integer = EgtGetFirstNameInGroup(m_nIdPart, INFO_COUNTERLY)
' If nId <> GDB_ID.NULL Then
' m_IdCounterText = EgtGetFirstInGroup(nId)
' Else
' CreateCounterLayer()
' End If
'End Sub
Sub New(Guid As String, IdPart As Integer)
m_sRefGuid = Guid
m_nIdPart = IdPart
End Sub
End Class
+21 -4
View File
@@ -9,6 +9,7 @@ Public Class OpenFileWD
Private m_sCurrFile As String = String.Empty
Private m_sExt As String = String.Empty
Private m_sExt2 As String = String.Empty
Private n_sDeniedFiles As New List(Of String)
Private m_OpenItemList As New ObservableCollection(Of IconListBoxItem)
@@ -27,6 +28,15 @@ Public Class OpenFileWD
InitializeComponent()
End Sub
Sub New(Owner As Window, sDir As String, sExt As String, sExt2 As String, DeniedFiles As List(Of String))
Me.Owner = Owner
m_sCurrDir = sDir
m_sExt = sExt
m_sExt2 = sExt2
n_sDeniedFiles = DeniedFiles
InitializeComponent()
End Sub
Private Sub OpenFile_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Posizione finestra
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
@@ -71,13 +81,20 @@ Public Class OpenFileWD
Dim FileI As FileInfo
For Each FileI In vFileI
Dim sExt As String = Path.GetExtension(FileI.Name).ToUpper()
If String.Compare(sExt, m_sExt, True) = 0 Or
String.Compare(sExt, m_sExt2, True) = 0 Then
Dim sFileName As String = Path.GetFileNameWithoutExtension(FileI.Name).ToUpper.Trim
Dim bDenied As Boolean = False
For Each ItemFile As String In n_sDeniedFiles
If ItemFile.ToUpper.Trim = sFileName Then
bDenied = True
Exit For
End If
Next
If (String.Compare(sExt, m_sExt, True) = 0 Or String.Compare(sExt, m_sExt2, True) = 0) And Not bDenied Then
m_OpenItemList.Add(New IconListBoxItem(FileI.Name, 3))
End If
Next
' riporto visualizzazione in cima alla lista (esiste sempre almeno un elemento)
FileListBox.ScrollIntoView(m_OpenItemList(0))
' riporto visualizzazione in cima alla lista (esiste sempre almeno un elemento)
FileListBox.ScrollIntoView(m_OpenItemList(0))
Return True
End Function
+72
View File
@@ -0,0 +1,72 @@
<Window x:Class="SelectPartFromFamilyWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
FontFamily="{DynamicResource OmagCut_Font}"
ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
Title="SaveNameWD" Height="200" Width="400" ShowInTaskbar="False">
<!--Definizione della pagina di scelta del nome con cui salvare il progetto-->
<Border Style="{DynamicResource OmagCut_Border}">
<Grid x:Name="SaveNameGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<!--Messaggio: Seleziona il numero di pezzi-->
<TextBlock Name="TitleWDTxbl" Grid.Column="1" Grid.Row="1"
Style="{DynamicResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
<UniformGrid Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" Columns="2">
<TextBlock Name="NbrOfPartsMsg"
Style="{DynamicResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
<EgtWPFLib:EgtTextBox Name="NbrOfParts"
Style="{DynamicResource OmagCut_CalculatorTextBox}" />
</UniformGrid>
<Grid Name="ButtonsGrid" Grid.Column="1" Grid.Row="5" Grid.RowSpan="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<!--ultimo progetto-->
<Button Name="ConfirmSelection" Grid.Column="1" Style="{DynamicResource OmagCut_RightGrayGradientYellowButton}"
ToolTip="Confirm">
<Image Source="{DynamicResource VImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<!--nuovo progetto-->
<Button Name="SelectAllPart" Grid.Column="2" Style="{DynamicResource OmagCut_RightGrayGradientYellowButton}"
ToolTip="Select all" Visibility="Collapsed">
<Image Source="{DynamicResource NuovoImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<!--apri folder progetti-->
<Button Name="CancelSelection" Grid.Column="5" Style="{DynamicResource OmagCut_RightGrayGradientYellowButton}"
ToolTip="Cancel">
<Image Source="{DynamicResource XImg}" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
</Grid>
</Grid>
</Border>
</Window>
+66
View File
@@ -0,0 +1,66 @@
Public Class SelectPartFromFamilyWD
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_NumberOfParts As Integer = 1
Public Property NumberOfParts As Integer
Get
Return m_NumberOfParts
End Get
Set(value As Integer)
m_NumberOfParts = value
End Set
End Property
Private m_NumberOfSelection As Integer = 1
Public Property NumberOfSelection As Integer
Get
Return m_NumberOfSelection
End Get
Set(value As Integer)
m_NumberOfSelection = value
End Set
End Property
Public Sub New(Owner As Window, NbrParts As Integer)
Me.Owner = Owner
m_NumberOfParts = NbrParts
InitializeComponent()
Me.ShowDialog()
End Sub
' inizializzo la finestra
Private Sub SelectPartFromFamilyWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' posiziono la fistra in centro alla pagina
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
TitleWDTxbl.Text = "Selection parts"
NbrOfPartsMsg.Text = "Number of parts"
NbrOfParts.Text = m_NumberOfParts.ToString
End Sub
' seleziono il numero di elementi indicati
Private Sub ConfirmSelection_Click(sender As Object, e As RoutedEventArgs) Handles ConfirmSelection.Click
Dim nVal As Integer = 0
StringToInt(NbrOfParts.Text, nVal)
If nVal >= 0 Then
m_NumberOfSelection = nVal
Else
' indice non valido per la selezione
m_NumberOfSelection = 0
End If
Me.Close()
End Sub
'' seleziona tutti
'Private Sub SelectAllPart_Click(sender As Object, e As RoutedEventArgs) Handles SelectAllPart.Click
' m_NumberOfSelection = m_NumberOfParts
' Me.Close()
'End Sub
' Deseleziomo tutto
Private Sub CancelSelection_Click(sender As Object, e As RoutedEventArgs) Handles CancelSelection.Click
m_NumberOfSelection = 0
Me.Close()
End Sub
End Class
+3
View File
@@ -147,6 +147,9 @@ Module ConstGen
Public Const INFO_RAW_BLOCK = "Block"
' Info per numero lastra nel blocco
Public Const INFO_RAW_SLABNBR = "SlabNbr"
' Info per identificazione gruppo pezzi
Public Const INFO_REFGROUP As String = "RefGroup"
Public Const INFO_COUNTERLY As String = "CounterPz"
' Contrassegno di progetto OmagCut
Public Const NAME_PROJMARK As String = "OmagCut"
+1
View File
@@ -251,6 +251,7 @@
Public Const S_MACH_INPROGRESS As String = "InProgress"
Public Const K_PHASEVAR As String = "PhaseVar"
Public Const K_WP_STEPTIME As String = "WPStepTime"
Public Const S_MACH_PROBING As String = "Probing"
Public Const K_PROBINGSTATEVAR As String = "ProbingStateVar"
@@ -342,6 +342,37 @@ Public Class ControlsMachineButtonUC
End If
End Sub
Friend Sub ZoneStateChanged(ZoneState As Integer)
'Dim sFlag As String = String.Empty
'If ZoneState = 1 Then
' sFlag = BTN_ENABLE_ZONE_1
'ElseIf ZoneState = 2 Then
' sFlag = BTN_ENABLE_ZONE_2
'End If
'Dim EnableZoneButton As TwoStateButton = Nothing
'For Each MachineButton As MachineButton In m_ButtonList
' If MachineButton.StateFlag = K_ENABLEZONE Then
' EnableZoneButton = MachineButton
' End If
'Next
'If Not IsNothing(EnableZoneButton) Then
' EnableZoneButton.SetIsChecked(EnableZone)
'End If
End Sub
Friend Sub PcStateChanged(EnablePC As Boolean)
'Dim EnablePCButton As TwoStateButton = Nothing
'For Each MachineButton As MachineButton In m_ButtonList
' If MachineButton.StateFlag = K_ENABLEPC Then
' EnablePCButton = MachineButton
' End If
'Next
'If Not IsNothing(EnablePCButton) Then
' EnablePCButton.SetIsChecked(EnablePC)
'End If
End Sub
Public Function GetPrivateProfileMachineButtons(
ByVal lpAppName As String,
ByVal lpKeyName As String,
@@ -414,6 +445,8 @@ Public MustInherit Class MachineButton
Friend Const BTN_STATE_THREEAXIS As String = "ThreeAxis"
Friend Const BTN_STATE_FIVEAXIS As String = "FiveAxis"
Friend Const BTN_STATE_NOTHING As String = "Nothing"
Friend Const BTN_ENABLE_ZONE_1 As String = "EnableZone1"
Friend Const BTN_ENABLE_ZONE_2 As String = "EnableZone2"
' Dichiarazione delle Page UserControl
Friend Shared m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
+68
View File
@@ -735,6 +735,74 @@ Public Class MachineButtonsUC
End If
End Sub
Friend Sub TableUpChanged(TableUpState As Boolean)
Dim nIndex As Integer = Array.IndexOf(StateFlagArray, K_TABLEUP)
If nIndex = -1 Then Return
If TableUpState Then
GetToggleButton(nIndex + 1).IsChecked = True
Try
Dim s As String
If (m_MainWindow.m_OptionsPageUC.ThemesCmBx.SelectedIndex = 0) Then
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & ImageArrayY(nIndex)
Else
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\NewIcons\" & ImageArrayY(nIndex)
End If
Dim sButtonImageSource As ImageSource = ImageConverter.ConvertFromString(s)
GetImage(nIndex + 1).Source = sButtonImageSource
Catch ex As Exception
EgtOutLog("Error loading image " & ImageArrayY(nIndex + 1))
End Try
Else
GetToggleButton(nIndex + 1).IsChecked = False
Try
Dim s As String
If (m_MainWindow.m_OptionsPageUC.ThemesCmBx.SelectedIndex = 0) Then
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & ImageArrayN(nIndex)
Else
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\NewIcons\" & ImageArrayN(nIndex)
End If
Dim sButtonImageSource As ImageSource = ImageConverter.ConvertFromString(s)
GetImage(nIndex + 1).Source = sButtonImageSource
Catch ex As Exception
EgtOutLog("Error loading image " & ImageArrayN(nIndex + 1))
End Try
End If
End Sub
Friend Sub TableDownChanged(TableDownState As Boolean)
Dim nIndex As Integer = Array.IndexOf(StateFlagArray, K_TABLEDOWN)
If nIndex = -1 Then Return
If TableDownState Then
GetToggleButton(nIndex + 1).IsChecked = True
Try
Dim s As String
If (m_MainWindow.m_OptionsPageUC.ThemesCmBx.SelectedIndex = 0) Then
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & ImageArrayY(nIndex)
Else
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\NewIcons\" & ImageArrayY(nIndex)
End If
Dim sButtonImageSource As ImageSource = ImageConverter.ConvertFromString(s)
GetImage(nIndex + 1).Source = sButtonImageSource
Catch ex As Exception
EgtOutLog("Error loading image " & ImageArrayY(nIndex + 1))
End Try
Else
GetToggleButton(nIndex + 1).IsChecked = False
Try
Dim s As String
If (m_MainWindow.m_OptionsPageUC.ThemesCmBx.SelectedIndex = 0) Then
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\" & ImageArrayN(nIndex)
Else
s = m_MainWindow.GetResourcesDir() & "\MachineButtonsImage\NewIcons\" & ImageArrayN(nIndex)
End If
Dim sButtonImageSource As ImageSource = ImageConverter.ConvertFromString(s)
GetImage(nIndex + 1).Source = sButtonImageSource
Catch ex As Exception
EgtOutLog("Error loading image " & ImageArrayN(nIndex + 1))
End Try
End If
End Sub
'----------------- Queste funzioni determina lo stato del bottone direttamente dalla lettura delle variabili CN
Friend Sub XYJogChanged(ByVal bXYAxes As Boolean)
' recupero le asscociazioni con i bottoni
+15 -1
View File
@@ -893,6 +893,9 @@ Public Class DrawPageUC
' Cancello layer regioni per selezione buchi
Pz = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
' identificativo univoico del gruppo di pezzi, se più di un pezzo
Dim sGUICode As String = String.Empty
While Pz <> -1
' imposto il contesto corrente
EgtSetCurrentContext(DrawScene.GetCtx())
@@ -1040,6 +1043,12 @@ Public Class DrawPageUC
EgtEraseEmptyParts()
' Area dei nuovi pezzi
Dim dNewArea As Double = 0
If nNbr > 1 Then
sGUICode = System.Guid.NewGuid.ToString
End If
' dimensione caratteri per numero di pezzi
Dim nHText As Integer = 40
' Se esiste il file del pezzo
If My.Computer.FileSystem.FileExists(sTmpFile) Then
' eseguo inserimento
@@ -1054,7 +1063,12 @@ Public Class DrawPageUC
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", m_TrfOrderCode & "-" & nId2.ToString())
' Aggiorno l'area dei nuovi pezzi
dNewArea += GeomCalc.GetPartArea(nId2)
' Inserisco in parcheggio
' assegno l'identificatico del pezzo, se esiste
If Not String.IsNullOrEmpty(sGUICode) Then
EgtSetInfo(nId2, INFO_REFGROUP, sGUICode)
End If
' muovo il pezzo nella prima posizione di parcheggio libera
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True)
' ------------------------ AGGIUNGO PEZZO NEL VEINMATCH ----------------------------------
+12
View File
@@ -808,6 +808,10 @@ Public Class ImportPageUC
EgtErase(EgtGetFirstNameInGroup(PartId, SELECT_REGION_LAYER))
PartId = EgtGetNextPart(PartId)
End While
' identificativo univoico del gruppo di pezzi, se più di un pezzo
Dim sGUICode As String = String.Empty
' Scrivo testi per nesting
SideAngle.WriteSideAngleForNest(ImportScene.GetCtx())
' Imposto riferimento sul centro geometrico di ogni pezzo
@@ -827,6 +831,10 @@ Public Class ImportPageUC
Dim nRepeat = 1
StringToInt(PartNumTxBx.Text, nRepeat)
nRepeat = Math.Min(Math.Max(1, nRepeat), 50)
' creo il riferimento
If nRepeat > 1 Then
sGUICode = System.Guid.NewGuid.ToString
End If
' Inserisco i pezzi nell'ambiente principale e recupero Id primo pezzo inserito
Dim nFirstId As Integer = EgtGetLastPart()
For nInd As Integer = 1 To nRepeat
@@ -890,6 +898,10 @@ Public Class ImportPageUC
Utility.SetTextColor( nRegId)
' Imposto path di provenienza
EgtSetInfo(nId, INFO_SOU_PATH, IO.Path.Combine(m_sCurrDir, m_sCurrFile))
' assegno l'identificatico del pezzo, se esiste
If Not String.IsNullOrEmpty(sGUICode) Then
EgtSetInfo(nId, INFO_REFGROUP, sGUICode)
End If
' Inserisco in parcheggio
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId, True)
' Recupero Id di pezzo successivo
+2 -2
View File
@@ -339,7 +339,7 @@ Public Class MachiningDbPageUC
Next
MachiningToExportList.Add(ImpExpMachiningFamily)
Next
Dim ExportWndVM As New ImportExportMachiningWindowVM(MachiningToExportList)
Dim ExportWndVM As New ImportExportMachiningWindowVM(MachiningToExportList, true)
Dim ExportWnd As New ImportExportMachiningWindowWD(Application.Current.MainWindow, ExportWndVM)
ExportWnd.ShowDialog()
@@ -396,7 +396,7 @@ Public Class MachiningDbPageUC
MachinigToImportList.Add(NewFamily)
End If
Next
Dim ImportWndVM As New ImportExportMachiningWindowVM(MachinigToImportList, ImportFilePath, ImportFileMachiningNameList)
Dim ImportWndVM As New ImportExportMachiningWindowVM(MachinigToImportList, False, ImportFilePath, ImportFileMachiningNameList)
Dim ImportWnd As New ImportExportMachiningWindowWD(Application.Current.MainWindow, ImportWndVM)
ImportWnd.ShowDialog()
+2 -2
View File
@@ -506,7 +506,7 @@ Public Class ToolsDbPageUC
ToolToExportList.Add(ImpExpToolFamily)
Next
Dim ExportWndVM As New ImportExportToolWindowVM(ToolToExportList)
Dim ExportWndVM As New ImportExportToolWindowVM(ToolToExportList, True)
Dim ExportWnd As New ImportExportToolWD(Application.Current.MainWindow, ExportWndVM)
ExportWnd.ShowDialog()
@@ -558,7 +558,7 @@ Public Class ToolsDbPageUC
ToolToImportList.Add(NewFamily)
End If
Next
Dim ImportWndVM As New ImportExportToolWindowVM(ToolToImportList, ImportFilePath, ImportFileToolNameList)
Dim ImportWndVM As New ImportExportToolWindowVM(ToolToImportList, False, ImportFilePath, ImportFileToolNameList)
Dim ImportWnd As New ImportExportToolWD(Application.Current.MainWindow, ImportWndVM)
ImportWnd.ShowDialog()
+5
View File
@@ -549,6 +549,7 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.FiveAxisStateChanged(m_CN.Is_G24_active())
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.ParkingStateChanged(m_CN.bParkingState)
'm_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.ZoneStateChanged(m_CN.nEnableZone)
'm_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.PcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumUpChanged(m_CN.bVacuumUp)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumDownChanged(m_CN.bVacuumDown)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum2UpChanged(m_CN.bVacuum2Up)
@@ -597,6 +598,8 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ParkingStateChanged(m_CN.bParkingState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.EnableZoneStateChanged(m_CN.nEnableZone)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.EnablePcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.TableUpChanged(m_CN.bTableUpState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.TableDownChanged(m_CN.bTableDownState)
' Nuovi bottoni (uso joystick) per Area4
If m_IsNewConsole Then
@@ -635,6 +638,8 @@ Public Class CNCommunication
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.ParkingStateChanged(m_CN.bParkingState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.EnableZoneStateChanged(m_CN.nEnableZone)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.EnablePcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.TableUpChanged(m_CN.bTableUpState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.TableDownChanged(m_CN.bTableDownState)
End If
End Sub
+7
View File
@@ -166,6 +166,9 @@
<Compile Include="AboutBox\AboutBoxWD.xaml.vb">
<DependentUpon>AboutBoxWD.xaml</DependentUpon>
</Compile>
<Compile Include="CadCuts\SelectPartFromFamilyWD.xaml.vb">
<DependentUpon>SelectPartFromFamilyWD.xaml</DependentUpon>
</Compile>
<Compile Include="CAM\CamPolishing.vb" />
<Compile Include="DirectCuts\Polishing.xaml.vb">
<DependentUpon>Polishing.xaml</DependentUpon>
@@ -405,6 +408,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="CadCuts\SelectPartFromFamilyWD.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DirectCuts\Polishing.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+4 -1
View File
@@ -201,6 +201,9 @@ Public Class WorkInProgressPageUC
End If
EgtSetCurrPhase(nCurrPhase, True)
EgtDraw()
' Tempo di ritardo nel ciclo
Dim nTimeStep As Integer = 50
nTimeStep = GetPrivateProfileInt(S_MACH_INPROGRESS, K_WP_STEPTIME, nTimeStep, m_MainWindow.GetMachIniFile())
' Ciclo
While m_bContinue
' Rileggo la variabile di fase
@@ -233,7 +236,7 @@ Public Class WorkInProgressPageUC
EgtDraw()
End If
' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU
System.Threading.Thread.Sleep(10)
System.Threading.Thread.Sleep(nTimeStep)
' Leggo la fase
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 3 Then
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0