Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| faba640eee | |||
| 80f4dc6b83 | |||
| 8f5ef91890 | |||
| 2cef4e6fd8 | |||
| f2fce7a653 | |||
| 7581ae0bdb | |||
| 661ae9f09c | |||
| 44d411819f | |||
| 46134c10b6 | |||
| 36b7ae4843 | |||
| 63b4977c39 | |||
| ae927719c6 | |||
| 8944a8d191 | |||
| 5cdfc79aca | |||
| 2f24604fa8 | |||
| 2889e30386 | |||
| a9458620c1 | |||
| 7fe03cbbb4 | |||
| d0646eb922 | |||
| 83f37dc628 | |||
| 568d7c109d | |||
| 1c36907b47 | |||
| d2e45a937e | |||
| 13f9fc9bd2 | |||
| 614756e1bb |
@@ -364,6 +364,9 @@ Public Class CompoWindowVM
|
||||
' 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(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
|
||||
@@ -513,6 +516,9 @@ Public Class CompoWindowVM
|
||||
EgtEraseEmptyParts()
|
||||
' Area dei nuovi pezzi
|
||||
Dim dNewArea As Double = 0
|
||||
If nNbr > 1 Then
|
||||
sGUICode = System.Guid.NewGuid.ToString
|
||||
End If
|
||||
' Se esiste il file del pezzo
|
||||
If My.Computer.FileSystem.FileExists(sTmpFile) Then
|
||||
' eseguo inserimento
|
||||
@@ -527,8 +533,15 @@ Public Class CompoWindowVM
|
||||
If m_bTrfData Then EgtSetInfo(nId2, "CsvPart", CompoWindowMap.refCompoManagerVM.sTrfOrderCode & "-" & 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
|
||||
Dim sPreGuid As String = EstCalc.CreatePreGuidCode(nId2)
|
||||
EgtSetInfo(nId2, INFO_REFGROUP, sPreGuid & sGUICode)
|
||||
End If
|
||||
' muovo il pezzo nella prima posizione di parcheggio libera
|
||||
EstCalc.StoreOnePart(nId2, True)
|
||||
|
||||
' Aggiungo riferimento e lo inserisco in VeinMatching
|
||||
VeinMatching.SetRefOnPart(nId2)
|
||||
VeinMatching.AddPart(nId2, True)
|
||||
|
||||
@@ -121,7 +121,7 @@ Module ConstIni
|
||||
Public Const K_TEXTCOLOR As String = "TextColor"
|
||||
Public Const K_AUTOMATICOPTIMIZE As String = "AutomaticOptimize"
|
||||
Public Const K_AUTOMATICMAXTIME As String = "AutomaticMaxTime"
|
||||
Public Const K_DRAGRETTANGLE As String = "DragRettangle"
|
||||
Public Const K_DRAGRECTANGLE As String = "DragRectangle"
|
||||
|
||||
Public Const S_SPLIT As String = "Split"
|
||||
Public Const K_MOVE_LEV As String = "MoveLevel"
|
||||
@@ -133,6 +133,7 @@ Module ConstIni
|
||||
Public Const K_CSVCURRDIR As String = "CurrDir"
|
||||
Public Const K_CSVLASTFILE As String = "LastFile"
|
||||
Public Const K_THICKTOLERANCE As String = "ThickTolerance"
|
||||
Public Const K_FULL As String = "Full"
|
||||
|
||||
Public Const S_COLORTOSIDEANG As String = "ColorToSideAng"
|
||||
Public Const K_CTSA_ENABLE As String = "Enable"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
MinWidth="270" MinHeight="250"
|
||||
MaxWidth="500"
|
||||
ResizeMode="NoResize">
|
||||
|
||||
<DockPanel Margin="5,5,5,0">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
@@ -110,6 +111,8 @@ Public Class CsvWindowVM
|
||||
#Region "METHODS"
|
||||
|
||||
Private Sub ShowTreeView()
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
' Path del file Csv
|
||||
Dim TempPath As New Text.StringBuilder(260)
|
||||
PathCompactPathEx(TempPath, CsvM.CsvPath, 56, 0)
|
||||
@@ -118,6 +121,7 @@ Public Class CsvWindowVM
|
||||
m_CsvTypeList.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 CsvPartType("", 0)
|
||||
@@ -128,15 +132,29 @@ Public Class CsvWindowVM
|
||||
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
|
||||
String.Compare(sCurrPath, CurrPart.m_sPath, True) <> 0 Or
|
||||
Math.Abs(dCurrTh - CurrPart.m_dTh) > 10 * EPS_SMALL Then
|
||||
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||
" - " & LenToString(dCurrTh, 2) &
|
||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||
|
||||
If 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
|
||||
CsvTypeList.Add(PartCathegory)
|
||||
sCurrMat = CurrPart.m_sMaterial
|
||||
dCurrTh = CurrPart.m_dTh
|
||||
sCurrPath = CurrPart.m_sPath
|
||||
PartCathegory = New CsvPartType("", 0)
|
||||
nCatToNest = 0
|
||||
nCatCount = 0
|
||||
@@ -150,18 +168,31 @@ Public Class CsvWindowVM
|
||||
PartCathegory.CsvPartList.Add(New CsvPartItem(CurrPart.m_sName, i, sCount, sDim, CurrPart.m_bActive))
|
||||
Next
|
||||
' Inserisco ultima categoria
|
||||
PartCathegory.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||
" - " & LenToString(dCurrTh, 2) &
|
||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||
If 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
|
||||
CsvTypeList.Add(PartCathegory)
|
||||
NotifyPropertyChanged("CsvTypeList")
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateTreeView()
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
For Each CatItem As CsvPartType In m_CsvTypeList
|
||||
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 CsvPartItem In CatItem.CsvPartList
|
||||
@@ -171,12 +202,23 @@ Public Class CsvWindowVM
|
||||
PrtItem.sText1 = sCount
|
||||
sCurrMat = PartData.m_sMaterial
|
||||
dCurrTh = PartData.m_dTh
|
||||
sCurrPath = PartData.m_sPath
|
||||
nCatToNest += PartData.m_nToNest
|
||||
nCatCount += PartData.m_nCount + PartData.m_nAdd
|
||||
Next
|
||||
CatItem.Name = If(String.IsNullOrWhiteSpace(sCurrMat), "***", sCurrMat) &
|
||||
" - " & LenToString(dCurrTh, 2) &
|
||||
" - " & nCatToNest.ToString() & "/" & nCatCount.ToString()
|
||||
If bFull Then
|
||||
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
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<!--Quality-->
|
||||
<ComboBox ItemsSource="{Binding CurrWaterjettingQualityList}"
|
||||
SelectedItem="{Binding SelCurrWaterjettingQuality}"
|
||||
Visibility="{Binding CurrWaterjettingQuality_Visibility}"
|
||||
Visibility="{Binding CurrWaterjetting_Visibility}"
|
||||
Margin="5,0,0,5"
|
||||
Grid.Column="1">
|
||||
</ComboBox>
|
||||
|
||||
@@ -290,7 +290,7 @@ Public Class CurrMachWindowVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CurrWaterjetting_Visibility As Visibility
|
||||
Private m_CurrWaterjetting_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property CurrWaterjetting_Visibility As Visibility
|
||||
Get
|
||||
Return m_CurrWaterjetting_Visibility
|
||||
|
||||
@@ -710,6 +710,8 @@ Public Class DxfImportWindowVM
|
||||
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 New List(Of String)
|
||||
' Scrivo testi per nesting
|
||||
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
||||
' Imposto riferimento sul centro geometrico di ogni pezzo
|
||||
@@ -732,10 +734,33 @@ Public Class DxfImportWindowVM
|
||||
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
|
||||
' Elimino eventuali precedenti pezzi vuoti
|
||||
EgtEraseEmptyParts()
|
||||
' creo il riferimento
|
||||
If m_PartNum > 1 Then
|
||||
' per ogni pezze del file DXF creo un gruppo
|
||||
Dim nIdTemp As Integer = EgtGetFirstPart()
|
||||
While nIdTemp <> GDB_ID.NULL
|
||||
Dim sPreGuid As String = CreatePreGuidCode(nIdTemp)
|
||||
sGUICode.Add(sPreGuid & System.Guid.NewGuid.ToString)
|
||||
nIdTemp = EgtGetNextPart(nIdTemp)
|
||||
End While
|
||||
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 m_PartNum
|
||||
Dim nFirst2Id As Integer = EgtGetLastPart()
|
||||
EgtInsertFile(sTmpFile)
|
||||
Dim FirstOfImport As Integer = EgtGetNextPart(nFirst2Id)
|
||||
Dim Index As Integer = 1
|
||||
While FirstOfImport <> GDB_ID.NULL And Index <= sGUICode.Count
|
||||
If Not String.IsNullOrEmpty(sGUICode(Index - 1)) Then
|
||||
EgtSetInfo(FirstOfImport, INFO_REFGROUP, sGUICode(Index - 1))
|
||||
Index += 1
|
||||
Else
|
||||
Exit While
|
||||
End If
|
||||
FirstOfImport = EgtGetNextPart(FirstOfImport)
|
||||
End While
|
||||
nFirst2Id = If(nFirst2Id <> GDB_ID.NULL, EgtGetNextPart(nFirst2Id), EgtGetFirstPart())
|
||||
Next
|
||||
nFirstId = If(nFirstId <> GDB_ID.NULL, EgtGetNextPart(nFirstId), EgtGetFirstPart())
|
||||
' Cancello il 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
|
||||
|
||||
@@ -33,6 +33,10 @@ Module ConstMach
|
||||
Public Const KEY_VACLAY_SEL As String = "Sel"
|
||||
' Info in gruppo layout per angolo di rotazione preferito
|
||||
Public Const KEY_VACLAY_PREFROT As String = "PreferredRot"
|
||||
Public Const KEY_VACLAY_PREFVROTXMINUS As String = "PrefVertRotXMinus"
|
||||
Public Const KEY_VACLAY_PREFVROTXPLUS As String = "PrefVertRotXPlus"
|
||||
Public Const KEY_VACLAY_PREFVROTYMINUS As String = "PrefVertRotYMinus"
|
||||
Public Const KEY_VACLAY_PREFVROTYPLUS As String = "PrefVertRotYPlus"
|
||||
' Info in gruppo layout per direzione di riferimento ventose per tagli da sotto
|
||||
Public Const KEY_VACLAY_DRIPREFDIR As String = "DripRefDir"
|
||||
' Info in asse rotante ventosa per step discreti
|
||||
@@ -91,6 +95,9 @@ Module ConstMach
|
||||
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"
|
||||
|
||||
@@ -198,6 +198,10 @@
|
||||
Public Const S_MACH_RAWMOVE As String = "RawMove"
|
||||
Public Const K_MACH_RM_ROTATE As String = "Rotate"
|
||||
Public Const K_MACH_RM_FINALMOVE As String = "FinalMove"
|
||||
Public Const K_MACH_WEIGHT_SINGLEPLUGGER As String = "MaxWeightSinglePlugger"
|
||||
Public Const K_MACH_WEIGHT_DOUBLEPLUGGER As String = "MaxWeightDoublePlugger"
|
||||
Public Const K_MACH_ROTATEVACUUMFOREXTRASTROKEY As String = "RotateVacuumForExtraStrokeY"
|
||||
Public Const K_MACH_ROTATEVACUUMFOREXTRASTROKEX As String = "RotateVacuumForExtraStrokeX"
|
||||
|
||||
Public Const S_MACH_REG As String = "Reg"
|
||||
Public Const K_MACH_MAX_ROT_ANG As String = "MaxRotAng"
|
||||
@@ -260,6 +264,7 @@
|
||||
Public Const K_CURROFFICEMATERIAL As String = "CurrOfficeMaterial"
|
||||
Public Const K_MATERIAL As String = "Material"
|
||||
Public Const K_FROMDBWATERJET As String = "FromDBWaterJet"
|
||||
Public Const K_AVERAGEDENSITY As String = "AverageDensity"
|
||||
|
||||
Public Const S_SETUP As String = "SetUp"
|
||||
Public Const K_DEFAULT As String = "Default"
|
||||
|
||||
+321
-74
@@ -12,12 +12,19 @@ Module CsvM
|
||||
Return m_sCsvPath
|
||||
End Get
|
||||
End Property
|
||||
Private m_sFilePath As String = String.Empty
|
||||
Public ReadOnly Property FilePath As String
|
||||
Get
|
||||
Return m_sFilePath
|
||||
End Get
|
||||
End Property
|
||||
Private m_CsvPartList As New List(Of CsvPart)
|
||||
Public ReadOnly Property CsvPartList As List(Of CsvPart)
|
||||
Get
|
||||
Return m_CsvPartList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_bCsvPartListModified As Boolean = False
|
||||
Private m_sCompoDir As String = String.Empty
|
||||
|
||||
@@ -36,12 +43,7 @@ Module CsvM
|
||||
|
||||
Public Sub NewCmd()
|
||||
' Salvo lista dei pezzi attuale (se modificata)
|
||||
If Not SaveCsvPartList() Then
|
||||
' Errore nel salvataggio del file CSV, vuoi continuare lo stesso ? - Errore
|
||||
If MessageBox.Show(EgtMsg(MSG_CSVPAGEUC + 5), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.YesNo, MessageBoxImage.Error) <> MessageBoxResult.Yes Then
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
SaveCsvPartList()
|
||||
' Pulisco path e lista dei pezzi Csv
|
||||
m_sCsvPath = String.Empty
|
||||
m_CsvPartList.Clear()
|
||||
@@ -51,25 +53,33 @@ Module CsvM
|
||||
End Sub
|
||||
|
||||
Public Sub Open()
|
||||
' Salvo lista dei pezzi attuale (se modificata)
|
||||
If Not SaveCsvPartList() Then
|
||||
' Errore nel salvataggio del file CSV, vuoi continuare lo stesso ? - Errore
|
||||
If MessageBox.Show(EgtMsg(MSG_CSVPAGEUC + 5), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.YesNo, MessageBoxImage.Error) <> MessageBoxResult.Yes Then
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' Leggo direttorio corrente dei file CSV
|
||||
Dim sCurrDir As String = ""
|
||||
GetMainPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir)
|
||||
' Apro dialogo scelta file
|
||||
Dim CsvFileDlg As New Microsoft.Win32.OpenFileDialog()
|
||||
If Directory.Exists(sCurrDir) Then CsvFileDlg.InitialDirectory = sCurrDir
|
||||
CsvFileDlg.Filter = "Csv file (*.csv;*.epl)|*.csv;*.epl"
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
Dim sFilterDialog As String = String.Empty
|
||||
Dim sDeniedFiles As List(Of String) = CreateListOfDeniedFiles()
|
||||
If bFull Then
|
||||
sFilterDialog = "Csv file (*.csv;*.epl)|*.csv;*.epl;Merge.epl"
|
||||
Else
|
||||
sFilterDialog = "Csv file (*.csv)|*.csv"
|
||||
End If
|
||||
CsvFileDlg.Filter = sFilterDialog
|
||||
|
||||
If Not CsvFileDlg.ShowDialog() Then Return
|
||||
|
||||
' Salvo lista dei pezzi attuale
|
||||
SaveCsvPartList()
|
||||
|
||||
' Salvo direttorio corrente
|
||||
WriteMainPrivateProfileString(S_CSV, K_CSVCURRDIR, Path.GetDirectoryName(CsvFileDlg.FileName))
|
||||
' Apertura file
|
||||
Dim sPath = CsvFileDlg.FileName
|
||||
' se necessario cambio estensione del file
|
||||
If String.Compare(Path.GetExtension(sPath), ".CSV", True) = 0 Then
|
||||
LoadCsvFile(sPath)
|
||||
Else
|
||||
@@ -77,6 +87,93 @@ Module CsvM
|
||||
End If
|
||||
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
|
||||
sFileName = Path.GetFileNameWithoutExtension(sFileName).ToUpper.Trim()
|
||||
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 Function LoadCsvFile(sCsvPath As String) As Boolean
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
' aggiungo i pezzi su una lista temporanea
|
||||
Dim LocalPartList As New List(Of CsvPart)
|
||||
' Eseguo la lettura del file Csv
|
||||
If Not ReadCsvFile(sCsvPath, LocalPartList) Then
|
||||
'Errore nella lettura del file CSV
|
||||
MessageBox.Show(EgtMsg(91206), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
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(LocalPartList)
|
||||
' Aggiorno
|
||||
If bFull Then
|
||||
MySaveCsvPartList(LocalPartList)
|
||||
' Salvo come epl
|
||||
SaveCsvPartList()
|
||||
' Rinomino file originale
|
||||
Dim sBakPath As String = sCsvPath & ".bak"
|
||||
Dim sBakName As String = Path.GetFileName(sBakPath)
|
||||
' cancello eventuale vecchio backup
|
||||
If My.Computer.FileSystem.FileExists(sBakPath) Then
|
||||
My.Computer.FileSystem.DeleteFile(sBakPath)
|
||||
End If
|
||||
' 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)
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
' Se Csv semplificato non va letta
|
||||
If Not bFull Then Return
|
||||
|
||||
' aggiungo i pezzi su una lista temporanea
|
||||
Dim LocalPartList As New List(Of CsvPart)
|
||||
|
||||
' Lettura del file
|
||||
If ReadCsvPartList(sFile, LocalPartList) 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
|
||||
|
||||
Public Sub Insert()
|
||||
' Recupero lo spessore della lastra corrente
|
||||
Dim dRawHeight As Double = EstCalc.GetRawHeight()
|
||||
@@ -88,7 +185,7 @@ Module CsvM
|
||||
End If
|
||||
' Recupero la tolleranza sullo spessore
|
||||
Dim dToler As Double = GetMainPrivateProfileDouble(S_CSV, K_THICKTOLERANCE, 100 * EPS_SMALL)
|
||||
dToler = Math.Max( dToler, 100 * EPS_SMALL)
|
||||
dToler = Math.Max(dToler, 100 * EPS_SMALL)
|
||||
' Creo la lista dei pezzi inseribili nella lastra corrente
|
||||
Dim InsPartList As New List(Of CsvPart)
|
||||
For i As Integer = 1 To m_CsvPartList.Count()
|
||||
@@ -174,25 +271,46 @@ Module CsvM
|
||||
If Not bMaxDimOnX Then
|
||||
Dim dH As Double = Math.Min(0.1 * dDimY, 30)
|
||||
Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - 0.6 * dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC)
|
||||
EgtSetColor(nText, New Color3d( 0, 0, 0))
|
||||
EgtSetColor(nText, New Color3d(0, 0, 0))
|
||||
End If
|
||||
' Aggiusto per lavorazioni
|
||||
AdjustFlatPart(nId)
|
||||
' Aggiungo info su CSV di origine
|
||||
EgtSetInfo(nId, INFO_CSV_PATH, m_sCsvPath)
|
||||
EgtSetInfo(nId, INFO_CSV_PATH, CurrPart.m_sPath)
|
||||
EgtSetInfo(nId, INFO_CSV_PART, CurrPart.m_sName)
|
||||
EgtSetInfo(nId, INFO_CSV_ORD, CurrPart.m_sOrd)
|
||||
EgtSetInfo(nId, INFO_CSV_DIST, CurrPart.m_sDist)
|
||||
EgtSetInfo(nId, INFO_CSV_MAT, CurrPart.m_sMaterial)
|
||||
' Imposto colore testi
|
||||
EstCalc.SetTextColor( nRegId)
|
||||
EstCalc.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
|
||||
' GuidCode dovrebbe contenere 36 caratteri, il precode 5: tot = 41
|
||||
If CurrPart.m_sRefGuid.Count <= 36 Then
|
||||
Dim sPreGuid As String = CreatePreGuidCode(CurrPart.m_nId)
|
||||
CurrPart.m_sRefGuid = sPreGuid & CurrPart.m_sRefGuid
|
||||
End If
|
||||
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 bDirect As Boolean = (GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0)
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
Dim bDirect As Boolean = bFull And (GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0)
|
||||
For i As Integer = 1 To InsPartList.Count()
|
||||
Dim CurrPart As CsvPart = InsPartList(i - 1)
|
||||
While CurrPart.m_nToNest > 0
|
||||
@@ -229,7 +347,7 @@ Module CsvM
|
||||
EgtErase(nId2)
|
||||
Return False
|
||||
End If
|
||||
' altrimenti lo metto in parcheggio
|
||||
' altrimenti lo metto in parcheggio
|
||||
Else
|
||||
' Aggiungo riferimento e lo inserisco in VeinMatching
|
||||
VeinMatching.SetRefOnPart(nId2)
|
||||
@@ -270,11 +388,11 @@ Module CsvM
|
||||
Dim sName As String = String.Empty
|
||||
EgtGetInfo(nId, INFO_CSV_PART, sName)
|
||||
' Verifico che il pezzo appartenga a questo Csv
|
||||
If String.Compare(sCsvPath, m_sCsvPath, True) = 0 Then
|
||||
If SearchCurrCSV(sCsvPath) Then
|
||||
' Cerco il pezzo nella lista dei pezzi
|
||||
For i = 1 To m_CsvPartList.Count()
|
||||
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
||||
If String.Compare(sName, CurrPart.m_sName, True) = 0 Then
|
||||
If String.Compare(sName, CurrPart.m_sName, True) = 0 And String.Compare(sCsvPath, CurrPart.m_sPath, True) = 0 Then
|
||||
' Se era nel grezzo
|
||||
If EgtGetParent(nId) = EstCalc.GetRawId() Then
|
||||
' Rimuovo le lavorazioni
|
||||
@@ -282,12 +400,19 @@ Module CsvM
|
||||
' Rimuovo dal grezzo
|
||||
EgtRemovePartFromRawPart(nId)
|
||||
End If
|
||||
' recupero il Guid del pezzo corrente (potrebbe essere stato modificato a causa di rotazioni quando il pezzo è passato in parcheggio)
|
||||
Dim sCurrRefGuid As String = String.Empty
|
||||
EgtGetInfo(nId, INFO_REFGROUP, sCurrRefGuid)
|
||||
' Eventuale cancellazione per VM
|
||||
VeinMatching.OnRemovePart(nId)
|
||||
' Cancello il pezzo
|
||||
EgtErase(nId)
|
||||
' aggiorno il layer che indica il numero di pezzi in parcheggio (se sRefGroup<>"")
|
||||
EstCalc.CountPartInFamily(sCurrRefGuid)
|
||||
' Aggiorno il contatore
|
||||
CurrPart.m_nToNest += 1
|
||||
' ricreo la lista delle famiglie di pezzi presenti in parcheggio
|
||||
GetFamilyGroupInPark()
|
||||
' Esco
|
||||
Return True
|
||||
End If
|
||||
@@ -297,10 +422,19 @@ Module CsvM
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function LoadCsvFile(sCsvPath As String) As Boolean
|
||||
Private Function SearchCurrCSV(ByVal sCSVFile As String) As Boolean
|
||||
For i As Integer = 1 To m_CsvPartList.Count()
|
||||
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
||||
If String.Compare(sCSVFile, CurrPart.m_sPath, True) = 0 Then
|
||||
Return True
|
||||
End If
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function ReadCsvFile(sCsvPath As String, ByRef LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||
' Pulisco path e lista dei pezzi Csv
|
||||
m_sCsvPath = String.Empty
|
||||
m_CsvPartList.Clear()
|
||||
' Definizione variabili
|
||||
EgtLuaCreateGlobTable("CSV")
|
||||
EgtLuaSetGlobStringVar("CSV.FILE", sCsvPath)
|
||||
@@ -308,7 +442,10 @@ Module CsvM
|
||||
Dim nErr As Integer = 999
|
||||
Dim sReader As String = String.Empty
|
||||
GetMainPrivateProfileString(S_CSV, K_READER, "CsvRead.lua", sReader)
|
||||
If EgtLuaExecFile(OmagOFFICEMap.refMainWindowVM.MainWindowM.sCsvAutoDir & "\" & sReader) AndAlso
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
Dim sLuaScript As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sCsvAutoDir & If(bFull, "\" & sReader, "\CsvSimplRead.lua")
|
||||
If EgtLuaExecFile(sLuaScript) AndAlso
|
||||
EgtLuaCallFunction("CSV.Read") Then
|
||||
' Verifica stato di errore
|
||||
EgtLuaGetGlobIntVar("CSV.ERR", nErr)
|
||||
@@ -325,6 +462,7 @@ Module CsvM
|
||||
For i As Integer = 1 To nNbr
|
||||
Dim OnePart As New CsvPart
|
||||
Dim sN As String = i.ToString()
|
||||
OnePart.m_sPath = sCsvPath
|
||||
EgtLuaGetGlobStringVar("CSV.NAME" & sN, OnePart.m_sName)
|
||||
OnePart.m_bActive = True
|
||||
EgtLuaGetGlobStringVar("CSV.ORD" & sN, OnePart.m_sOrd)
|
||||
@@ -336,63 +474,50 @@ Module CsvM
|
||||
EgtLuaGetGlobNumVar("CSV.DIMX" & sN, OnePart.m_dDimX)
|
||||
EgtLuaGetGlobNumVar("CSV.DIMY" & sN, OnePart.m_dDimY)
|
||||
EgtLuaGetGlobNumVar("CSV.TH" & sN, OnePart.m_dTh)
|
||||
EgtLuaGetGlobNumVar("CSV.A1_" & sN, OnePart.m_dAng1)
|
||||
EgtLuaGetGlobNumVar("CSV.H1_" & sN, OnePart.m_dHeel1)
|
||||
EgtLuaGetGlobNumVar("CSV.A2_" & sN, OnePart.m_dAng2)
|
||||
EgtLuaGetGlobNumVar("CSV.H2_" & sN, OnePart.m_dHeel2)
|
||||
EgtLuaGetGlobNumVar("CSV.A3_" & sN, OnePart.m_dAng3)
|
||||
EgtLuaGetGlobNumVar("CSV.H3_" & sN, OnePart.m_dHeel3)
|
||||
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
|
||||
m_CsvPartList.Add(OnePart)
|
||||
LocalCsvPartList.Add(OnePart)
|
||||
Next
|
||||
EgtLuaResetGlobVar("CSV")
|
||||
' Ordinamento lista dei pezzi (ordine crescente su materiale e spessore)
|
||||
m_CsvPartList.Sort(Function(x, y)
|
||||
Dim nComp As Integer = String.Compare(x.m_sMaterial, y.m_sMaterial, True)
|
||||
If nComp = 0 Then
|
||||
If Math.Abs(x.m_dTh - y.m_dTh) < EPS_SMALL Then
|
||||
Return (x.m_nOriInd - y.m_nOriInd)
|
||||
LocalCsvPartList.Sort(Function(x, y)
|
||||
Dim nComp As Integer = String.Compare(x.m_sMaterial, y.m_sMaterial, True)
|
||||
If nComp = 0 Then
|
||||
If Math.Abs(x.m_dTh - y.m_dTh) < EPS_SMALL Then
|
||||
Return (x.m_nOriInd - y.m_nOriInd)
|
||||
Else
|
||||
Return CInt(Math.Ceiling(x.m_dTh - y.m_dTh))
|
||||
End If
|
||||
Else
|
||||
Return CInt(Math.Ceiling(x.m_dTh - y.m_dTh))
|
||||
Return nComp
|
||||
End If
|
||||
Else
|
||||
Return nComp
|
||||
End If
|
||||
End Function)
|
||||
' Salvo come epl
|
||||
m_bCsvPartListModified = True
|
||||
SaveCsvPartList()
|
||||
' Rinomino file originale
|
||||
Dim sBakPath As String = sCsvPath & ".bak"
|
||||
Dim sBakName As String = Path.GetFileName(sBakPath)
|
||||
' cancello eventuale vecchio backup
|
||||
If My.Computer.FileSystem.FileExists(sBakPath) Then
|
||||
My.Computer.FileSystem.DeleteFile(sBakPath)
|
||||
End If
|
||||
' eseguo rinomina
|
||||
My.Computer.FileSystem.RenameFile(sCsvPath, sBakName)
|
||||
End Function)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function SaveCsvPartList() As Boolean
|
||||
' Se non c'è nulla di attivo, non faccio alcunché
|
||||
If String.IsNullOrEmpty(m_sCsvPath) Then
|
||||
EgtOutLog("CSV List Save Skipped : missing")
|
||||
Return True
|
||||
End If
|
||||
' Se lista non modificata, non faccio alcunchhé
|
||||
If Not m_bCsvPartListModified Then
|
||||
EgtOutLog("CSV List Save Skipped : not modified")
|
||||
Return True
|
||||
End If
|
||||
' Path del file
|
||||
Dim sFile As String = Path.ChangeExtension(m_sCsvPath, ".epl")
|
||||
' Gestione file
|
||||
Public Function WriteCsvPartList(sFile As String, sCsvPath As String, LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||
Try
|
||||
' Apro file
|
||||
Dim Writer As New IO.StreamWriter(sFile, False)
|
||||
' Intestazione
|
||||
Writer.WriteLine("[General]")
|
||||
Writer.WriteLine("Path=" & m_sCsvPath)
|
||||
Writer.WriteLine("Path=" & sCsvPath)
|
||||
' Ciclo sui pezzi
|
||||
For i As Integer = 1 To m_CsvPartList.Count()
|
||||
Dim CurrPart As CsvPart = m_CsvPartList(i - 1)
|
||||
For i As Integer = 1 To LocalCsvPartList.Count()
|
||||
Dim CurrPart As CsvPart = LocalCsvPartList(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)
|
||||
@@ -405,7 +530,16 @@ Module CsvM
|
||||
Writer.WriteLine("DX=" & DoubleToString(CurrPart.m_dDimX, 4))
|
||||
Writer.WriteLine("DY=" & DoubleToString(CurrPart.m_dDimY, 4))
|
||||
Writer.WriteLine("Th=" & DoubleToString(CurrPart.m_dTh, 4))
|
||||
Writer.WriteLine("A1=" & DoubleToString(CurrPart.m_dAng1, 4))
|
||||
Writer.WriteLine("H1=" & DoubleToString(CurrPart.m_dHeel1, 4))
|
||||
Writer.WriteLine("A2=" & DoubleToString(CurrPart.m_dAng2, 4))
|
||||
Writer.WriteLine("H2=" & DoubleToString(CurrPart.m_dHeel2, 4))
|
||||
Writer.WriteLine("A3=" & DoubleToString(CurrPart.m_dAng3, 4))
|
||||
Writer.WriteLine("H3=" & DoubleToString(CurrPart.m_dHeel3, 4))
|
||||
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]")
|
||||
@@ -416,18 +550,80 @@ Module CsvM
|
||||
' Registro in ini path
|
||||
WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile)
|
||||
Return True
|
||||
' Errore
|
||||
' Errore
|
||||
Catch ex As Exception
|
||||
EgtOutLog("CSV List error writing " & sFile)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function LoadCsvPartList(sFile As String) As Boolean
|
||||
' Pulisco path e lista dei pezzi Csv
|
||||
m_sCsvPath = String.Empty
|
||||
m_CsvPartList.Clear()
|
||||
' Gestione file
|
||||
' 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 Sub SaveCsvPartList()
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
' Se Csv semplificato non va salvata
|
||||
If Not bFull Then Return
|
||||
' Se non c'è nulla di attivo, non faccio alcunché
|
||||
If String.IsNullOrEmpty(m_sCsvPath) Then
|
||||
EgtOutLog("CSV List missing")
|
||||
Return
|
||||
End If
|
||||
' Path del file
|
||||
Dim sFile As String = Path.ChangeExtension(m_sFilePath, ".epl")
|
||||
' Scrittura dei file
|
||||
If WriteCsvMergePartList(m_CsvPartList) Then
|
||||
' Scrittura dei file Merge
|
||||
If WriteCsvPartList(sFile, m_sCsvPath, m_CsvPartList) Then
|
||||
WriteMainPrivateProfileString(S_CSV, K_CSVLASTFILE, sFile)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub MySaveCsvPartList(ByVal CurrPartList As List(Of CsvPart))
|
||||
Dim bFull = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.CSV_AUTO) And
|
||||
(GetMainPrivateProfileInt(S_CSV, K_FULL, 1) <> 0)
|
||||
' Se Csv semplificato non va salvata
|
||||
If Not bFull Then Return
|
||||
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
|
||||
|
||||
Private Function ReadCsvPartList(sFile As String, LocalCsvPartList As List(Of CsvPart)) As Boolean
|
||||
Try
|
||||
' Apro file
|
||||
Dim Reader As New IO.StreamReader(sFile, False)
|
||||
@@ -456,7 +652,7 @@ Module CsvM
|
||||
' se esiste pezzo precedente, lo salvo
|
||||
If nI > 1 Then
|
||||
' inserisco in lista
|
||||
m_CsvPartList.Add(OnePart)
|
||||
LocalCsvPartList.Add(OnePart)
|
||||
End If
|
||||
' predisposizioni per prossimo pezzo
|
||||
nI += 1
|
||||
@@ -466,7 +662,9 @@ Module CsvM
|
||||
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)
|
||||
@@ -490,8 +688,26 @@ Module CsvM
|
||||
StringToDouble(sItems(1), OnePart.m_dDimY)
|
||||
ElseIf sItems(0) = "Th" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dTh)
|
||||
ElseIf sItems(0) = "A1" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dAng1)
|
||||
ElseIf sItems(0) = "H1" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dHeel1)
|
||||
ElseIf sItems(0) = "A2" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dAng2)
|
||||
ElseIf sItems(0) = "H2" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dHeel2)
|
||||
ElseIf sItems(0) = "A3" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dAng3)
|
||||
ElseIf sItems(0) = "H3" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dHeel3)
|
||||
ElseIf sItems(0) = "A4" Then
|
||||
StringToDouble(sItems(1), OnePart.m_dAng4)
|
||||
ElseIf sItems(0) = "H4" Then
|
||||
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
|
||||
@@ -502,18 +718,37 @@ Module CsvM
|
||||
' Dichiaro lista non modificata
|
||||
m_bCsvPartListModified = False
|
||||
Return True
|
||||
' Errore
|
||||
' Errore
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Error reading " & sFile)
|
||||
Return False
|
||||
End Try
|
||||
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
|
||||
CsvPartList.RemoveAt(i)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function RemoveWrongParts(ByRef CsvPartList As List(Of CsvPart)) As Boolean
|
||||
For i As Integer = CsvPartList.Count() - 1 To 0 Step -1
|
||||
If Not CsvPartList(i).m_bIsRect Or CsvPartList(i).m_dDimX < EPS_SMALL Or CsvPartList(i).m_dDimY < EPS_SMALL Then
|
||||
CsvPartList.RemoveAt(i)
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
End Module
|
||||
|
||||
Public 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
|
||||
@@ -526,6 +761,18 @@ Public Class CsvPart
|
||||
Public m_dDimX As Double = 0
|
||||
Public m_dDimY As Double = 0
|
||||
Public m_dTh As Double = 0
|
||||
Public m_dAng1 As Double = 0
|
||||
Public m_dHeel1 As Double = 0
|
||||
Public m_dAng2 As Double = 0
|
||||
Public m_dHeel2 As Double = 0
|
||||
Public m_dAng3 As Double = 0
|
||||
Public m_dHeel3 As Double = 0
|
||||
Public m_dAng4 As Double = 0
|
||||
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(IniFile.m_sIniFile)
|
||||
End Class
|
||||
|
||||
+262
-2
@@ -51,6 +51,68 @@ Module EstCalc
|
||||
End If
|
||||
End Function
|
||||
|
||||
#Region "PreGuidCode"
|
||||
|
||||
' recupero i primi 5 caratteri della stringa
|
||||
Friend Function GetPreGuidCode(sGuidCode As String) As String
|
||||
If sGuidCode.Count > 5 Then
|
||||
Return sGuidCode(0) & sGuidCode(1) & sGuidCode(2) & sGuidCode(3) & sGuidCode(4)
|
||||
End If
|
||||
Return String.Empty
|
||||
End Function
|
||||
|
||||
' sostituisce i primi 5 caratteri della stringa con qualle passata
|
||||
Friend Function UppDateGuidCode(ByRef sGuidCode As String, sPreGuidCode As String) As Boolean
|
||||
If sPreGuidCode.Count = 5 Then
|
||||
sGuidCode = sGuidCode.Remove(0, 5)
|
||||
sGuidCode = sPreGuidCode & sGuidCode
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' restituisce 5 caratteri
|
||||
Friend Function CreatePreGuidCode(nId As Integer) As String
|
||||
' recupero il frame dell'oggetto
|
||||
Dim frGlobFrame As New Frame3d
|
||||
If Not EgtGetGroupGlobFrame(nId, frGlobFrame) Then
|
||||
Return String.Empty
|
||||
End If
|
||||
' recupero il suo versore
|
||||
Dim vtX As Vector3d = frGlobFrame.VersX
|
||||
Dim Len As Double
|
||||
Dim AngV As Double
|
||||
Dim AngH As Double
|
||||
vtX.ToSpherical(Len, AngV, AngH)
|
||||
' costruisco il codice (6 caratteri!) che identifica la posizione del pezzo in parcheggio
|
||||
Dim sPreGuid As String = GetDirectionCode(AngH)
|
||||
Return sPreGuid
|
||||
End Function
|
||||
|
||||
Friend Function GetDirectionCode(dVal As Double) As String
|
||||
Dim bIsNegative As Boolean = False
|
||||
If dVal < 0 Then
|
||||
dVal = dVal + (-1)
|
||||
bIsNegative = True
|
||||
End If
|
||||
Dim sVal As String = DoubleToString(dVal * 1000, 0)
|
||||
Dim nCount As Integer = sVal.Count
|
||||
For Index As Integer = 1 To 4 - nCount
|
||||
sVal = "0" & sVal
|
||||
Next
|
||||
Dim vVal As Char() = {"+"c, "1"c, "0"c, "0"c, "0"c}
|
||||
If bIsNegative Then
|
||||
vVal = {"-"c, sVal(0), sVal(1), sVal(2), sVal(3)}
|
||||
Else
|
||||
vVal = {"+"c, sVal(0), sVal(1), sVal(2), sVal(3)}
|
||||
End If
|
||||
' ricostruisco la stringa dotata di segno
|
||||
sVal = vVal(0) & vVal(1) & vVal(2) & vVal(3) & vVal(4)
|
||||
Return sVal
|
||||
End Function
|
||||
|
||||
#End Region ' PreGiudCode
|
||||
|
||||
'--------------------------------------------------------------------------------------------------
|
||||
Private m_nRawId As Integer = GDB_ID.NULL
|
||||
Public Function GetRawId() As Integer
|
||||
@@ -626,6 +688,16 @@ Module EstCalc
|
||||
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
|
||||
@@ -702,12 +774,198 @@ Module EstCalc
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#Region "Manager Counter Part"
|
||||
|
||||
' lista delle famiglie di pezzi in parcheggio
|
||||
Public m_ListOfGroupInPark As New List(Of FamilyPart)
|
||||
' se seleniozato il layer CounterPz
|
||||
Public m_bIsCounterLy As Boolean = False
|
||||
Public m_nCurrNubrOfParts As Integer = 0
|
||||
|
||||
' 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
|
||||
If IsInRaw(nIdInPark) Then
|
||||
nIdInPark = EgtGetNextPart(nIdInPark)
|
||||
Continue While
|
||||
End If
|
||||
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
|
||||
If IsInRaw(nIdInPark) Then
|
||||
nIdInPark = EgtGetNextPart(nIdInPark)
|
||||
Continue While
|
||||
End If
|
||||
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
|
||||
If IsInRaw(nIdInPark) Then
|
||||
nIdInPark = EgtGetNextPart(nIdInPark)
|
||||
Continue While
|
||||
End If
|
||||
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
|
||||
If IsInRaw(nIdInPark) Then
|
||||
nIdInPark = EgtGetNextPart(nIdInPark)
|
||||
Continue While
|
||||
End If
|
||||
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
|
||||
If IsInRaw(nIdInPark) Then
|
||||
nIdInPark = EgtGetNextPart(nIdInPark)
|
||||
Continue While
|
||||
End If
|
||||
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
|
||||
|
||||
' verifico se il pezzo ha un gruppo che contiene le informazioni per il taglio
|
||||
Public Function IsInRaw(nIdGroup As Integer) As Boolean
|
||||
' verifico che il pezzo sia veramente uin parcheggio
|
||||
Dim nPV As Integer = EgtGetFirstNameInGroup(nIdGroup, "PV")
|
||||
If nPV <> GDB_ID.NULL Then
|
||||
' verifico che non ci siano delle lavorazioni
|
||||
If EgtGetFirstInGroup(nPV) <> GDB_ID.NULL Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
#End Region ' Manager Counter Part
|
||||
|
||||
Public Function StoreOnePart(ByVal nId As Integer, Optional ByVal bForced As Boolean = False) As Boolean
|
||||
' Se pezzo in grezzo, metto in parcheggio (sempre possibile)
|
||||
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
|
||||
@@ -730,7 +988,8 @@ Module EstCalc
|
||||
' Parcheggio
|
||||
Const STORE_LARGH As Double = 6000
|
||||
Const STORE_DIST As Double = 200
|
||||
Const STORE_OFFS As Double = 20
|
||||
' 40 il Font usato per indicare il numero di pezzi in parcheggio "# N"
|
||||
Const STORE_OFFS As Double = 20 + 40 + 20
|
||||
Dim dStXmin As Double = b3Tab.Min().x - 0.5 * (STORE_LARGH - b3Tab.DimX())
|
||||
Return EgtPackBox(nId, dStXmin, -INFINITO, dStXmin + STORE_LARGH, b3Tab.Min().y - STORE_DIST, STORE_OFFS, False)
|
||||
End Function
|
||||
@@ -831,3 +1090,4 @@ Module EstCalc
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
|
||||
+152
-5
@@ -8,7 +8,24 @@ Module VacuumCups
|
||||
Private m_nVacId As Integer = GDB_ID.NULL
|
||||
Private m_nRefId As Integer = GDB_ID.NULL
|
||||
Private m_dPreferredRot As Double = 0
|
||||
Private m_dPrefVertRotXMinus As Double = 0
|
||||
Private m_dPrefVertRotXPlus As Double = 0
|
||||
Private m_dPrefVertRotYMinus As Double = 0
|
||||
Private m_dPrefVertRotYPlus As Double = 0
|
||||
Private m_dDripRefAng As Double = 0
|
||||
' dati carico massimo manipolatore
|
||||
Private m_RawDensity As Double = 2500
|
||||
Private m_RawWeight As Double = 0
|
||||
Private m_MaxWeightSinglePlugger As Double = 250
|
||||
Private m_MaxWeightDoublePlugger As Double = 750
|
||||
Public bOverWeight As Boolean = False
|
||||
' dati per rotazione ventose vicono al fine corsa Y e X
|
||||
Private bRotateVacuumNearExtraStrokeY As Boolean = False
|
||||
Private bRotateVacuumNearExtraStrokeX As Boolean = False
|
||||
' dati stroke
|
||||
Public bExtraStroke As Boolean = False
|
||||
Public ptStartPointLift As Point3d
|
||||
Public dDegRotStartAng As Double
|
||||
|
||||
' Nome del gruppo temporaneo per le ventose
|
||||
Private Const VACTMP_GRP As String = "VacTmp"
|
||||
@@ -48,6 +65,20 @@ Module VacuumCups
|
||||
Return m_nVacType
|
||||
End Function
|
||||
|
||||
Friend Sub GetWeightInformation(Density As Double, MaxSingle As Double, MaxDouble As Double)
|
||||
m_RawDensity = Density
|
||||
m_MaxWeightSinglePlugger = MaxSingle
|
||||
m_MaxWeightDoublePlugger = MaxDouble
|
||||
End Sub
|
||||
|
||||
Friend Sub GetRotationForExtraStrokeY(Rotate As Boolean)
|
||||
bRotateVacuumNearExtraStrokeY = Rotate
|
||||
End Sub
|
||||
|
||||
Friend Sub GetRotationForExtraStrokeX(Rotate As Boolean)
|
||||
bRotateVacuumNearExtraStrokeX = Rotate
|
||||
End Sub
|
||||
|
||||
Friend Function GetVacuumId() As Integer
|
||||
Return m_nVacId
|
||||
End Function
|
||||
@@ -64,6 +95,8 @@ Module VacuumCups
|
||||
' Identificativo riferimento della testa nella macchina
|
||||
Dim nT1Id As Integer = EgtGetFirstNameInGroup(EgtGetHeadId(VACUUM_HEAD), HEAD_FIRST_EXIT)
|
||||
If nT1Id = GDB_ID.NULL Then Return False
|
||||
' imposto la l'uscita della ventosa come fosse l'uscita di un utensile
|
||||
EgtSetCalcTool("", "H4", 1)
|
||||
' Creo gruppo temporaneo in cui copiarli
|
||||
m_nTempId = EgtCreateGroup(GDB_ID.ROOT)
|
||||
If m_nTempId = GDB_ID.NULL Then Return False
|
||||
@@ -73,7 +106,12 @@ Module VacuumCups
|
||||
m_nVacId = EgtCopyGlob(nLayId, m_nTempId)
|
||||
If m_nVacId = GDB_ID.NULL Then Return False
|
||||
' Angolo di rotazione preferito
|
||||
EgtGetInfo( m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
|
||||
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFROT, m_dPreferredRot)
|
||||
' Angoli di rotazione preferiti per ventosa in verticale (lungo Y) a sinistra e a destra del centro tavola
|
||||
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXMINUS, m_dPrefVertRotXMinus)
|
||||
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTXPLUS, m_dPrefVertRotXPlus)
|
||||
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTYMINUS, m_dPrefVertRotYMinus)
|
||||
EgtGetInfo(m_nVacId, KEY_VACLAY_PREFVROTYPLUS, m_dPrefVertRotYPlus)
|
||||
' Direzione di riferimento per tagli Drip
|
||||
EgtGetInfo( m_nVacId, KEY_VACLAY_DRIPREFDIR, m_dDripRefAng)
|
||||
' Nascondo il gruppo ma rendo visibili le curve di contorno delle ventose
|
||||
@@ -160,6 +198,18 @@ Module VacuumCups
|
||||
EgtGetBBoxGlob(nRKerfId, GDB_BB.STANDARD, b3Kerf)
|
||||
Dim ptKerfCen As Point3d
|
||||
EgtCentroid(nRKerfId, GDB_ID.ROOT, ptKerfCen)
|
||||
|
||||
'-------------------- INIZIO CALCOLO PESO --------------------
|
||||
' recupero l'area del grezzo da muovere
|
||||
Dim RawArea As Double = 0
|
||||
' superficie del grezzo senza considerare eventuali fori
|
||||
EgtSurfFrGrossArea(nRKerfId, RawArea)
|
||||
' volume calcolato in mmc
|
||||
Dim RawVolume As Double = RawArea * b3Raw.DimZ()
|
||||
' peso calolato in kg
|
||||
m_RawWeight = RawVolume * m_RawDensity / Math.Pow(10, 9)
|
||||
'-------------------- FINE CALCOLO PESO --------------------
|
||||
|
||||
' Eseguo ricerca
|
||||
If FindVacuumCupsOnRaw(nRawId, ptRawCen, b3Kerf, ptKerfCen, nKerfId, nRKerfId, rmData) Then
|
||||
Return True
|
||||
@@ -261,6 +311,7 @@ Module VacuumCups
|
||||
Dim sCups() As String = Nothing
|
||||
Dim sCups2() As String = Nothing
|
||||
If Not GetVacuumCupSelection(nI, sCups, sCups2) Then Return False
|
||||
bExtraStroke = False
|
||||
' Determino validità soluzioni della configurazione
|
||||
Dim vtMove As New Vector3d
|
||||
Dim ptRotCen As New Point3d
|
||||
@@ -363,6 +414,26 @@ Module VacuumCups
|
||||
If b3Vac.IsEmpty() Then Return INFINITO
|
||||
' Se box maggiore di quello del pezzo, scarto soluzione
|
||||
If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
|
||||
'-------------------- INIZIO VERIFICA PESO --------------------
|
||||
bOverWeight = False
|
||||
Select Case GetPluggerFromCameras(sCups)
|
||||
Case 2
|
||||
' se peso del grezzo oltre il limite consentito allora scarto la soluzione
|
||||
If m_RawWeight > m_MaxWeightDoublePlugger Then
|
||||
bOverWeight = True
|
||||
Return INFINITO
|
||||
End If
|
||||
Case 1
|
||||
' se peso del grezzo oltre il limite consentito allora scarto la soluzione
|
||||
If m_RawWeight > m_MaxWeightSinglePlugger Then
|
||||
bOverWeight = True
|
||||
Return INFINITO
|
||||
End If
|
||||
End Select
|
||||
'-------------------- FINE VERIFICA PESO --------------------
|
||||
' Recupero l'area della tavola
|
||||
Dim b3Tab As New BBox3d
|
||||
EgtGetTableArea(1, b3Tab)
|
||||
' Determino il movimento
|
||||
vtMove = ptRawCen - b3Vac.Center()
|
||||
b3Vac.Move(vtMove)
|
||||
@@ -374,11 +445,26 @@ Module VacuumCups
|
||||
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
|
||||
dRotAngDeg = dAngOrizzDeg
|
||||
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
|
||||
Dim dPreferredRot As Double = m_dPreferredRot
|
||||
If bRotateVacuumNearExtraStrokeX And (Math.Abs(dRotAngDeg - 90) < 45 Or Math.Abs(dRotAngDeg - 270) < 45) Then
|
||||
If frMinRect.Orig().x < b3Tab.Center().x Then
|
||||
dPreferredRot = m_dPrefVertRotXMinus
|
||||
Else
|
||||
dPreferredRot = m_dPrefVertRotXPlus
|
||||
End If
|
||||
ElseIf bRotateVacuumNearExtraStrokeY And (Math.Abs(dRotAngDeg - 90) > 45 Or Math.Abs(dRotAngDeg - 270) > 45) Then
|
||||
' se l'orientemanto è orizzontale e la macchina è stata abilitata
|
||||
If frMinRect.Orig().y < b3Tab.Center().y Then
|
||||
dPreferredRot = m_dPrefVertRotYPlus
|
||||
Else
|
||||
dPreferredRot = m_dPrefVertRotYMinus
|
||||
End If
|
||||
End If
|
||||
Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180)
|
||||
While dRotAngDeg - m_dPreferredRot >= dAngDelta / 2
|
||||
While dRotAngDeg - dPreferredRot >= dAngDelta / 2
|
||||
dRotAngDeg -= dAngDelta
|
||||
End While
|
||||
While dRotAngDeg - m_dPreferredRot <= -dAngDelta / 2
|
||||
While dRotAngDeg - dPreferredRot <= -dAngDelta / 2
|
||||
dRotAngDeg += dAngDelta
|
||||
End While
|
||||
Else
|
||||
@@ -430,13 +516,53 @@ Module VacuumCups
|
||||
' Applico movimento e rotazione al punto
|
||||
ptRef.Move(vtMove)
|
||||
ptRef.Rotate(ptRotCen, Vector3d.Z_AX(), dRotAngDeg)
|
||||
' -------------- INIZIO verifica di essere nel limite delle corse macchina --------------
|
||||
If VerifyOutOfStrokes(ptRef, dRotAngDeg) <> 0 Then
|
||||
bExtraStroke = True
|
||||
Return INFINITO
|
||||
End If
|
||||
' se la posizione è accettbaile allora salvo i dati
|
||||
ptStartPointLift = ptRef
|
||||
dDegRotStartAng = dRotAngDeg
|
||||
' -------------- FINE verifica di essere nel limite delle corse macchina --------------
|
||||
' Ne calcolo la distanza dal centro della tavola
|
||||
Dim b3Tab As New BBox3d
|
||||
EgtGetTableArea(1, b3Tab)
|
||||
Dim dDist As Double = Point3d.DistXY(ptRef, b3Tab.Center())
|
||||
Return dDist
|
||||
End Function
|
||||
|
||||
' assegante le posizioni del centro delle ventose e l'angolo di posizionamento orizzontale verifica che la posizione sia raggiungibile
|
||||
Public Function VerifyOutOfStrokes(ptRef As Point3d, dRotAngDeg As Double) As Integer
|
||||
Dim dX, dY, dZ As Double
|
||||
Dim nStat As Integer
|
||||
Dim dCHome As Double
|
||||
EgtGetAxisHomePos("C", dCHome)
|
||||
' imposto la l'uscita della ventosa come fosse l'uscita di un utensile
|
||||
EgtSetCalcTool("", "H4", 1)
|
||||
EgtGetCalcPositions(ptRef, dRotAngDeg + dCHome, 0, nStat, dX, dY, dZ)
|
||||
EgtVerifyOutstroke(dX, dY, dZ, dRotAngDeg + dCHome, 0, nStat)
|
||||
Return nStat
|
||||
End Function
|
||||
|
||||
' dall'informazione di extra corsa recupera il valore indicato
|
||||
Public Function GetExtraStrokeValue(sInfo As String) As Double
|
||||
Dim dExtraStroke As Double = 0
|
||||
Dim sItems As String() = sInfo.Split("="c)
|
||||
If sItems.Count = 2 Then
|
||||
Dim nStartIndex As Integer = 0
|
||||
For Each ItemChar As Char In sItems(1)
|
||||
If ItemChar = "("c Then
|
||||
Exit For
|
||||
End If
|
||||
nStartIndex += 1
|
||||
Next
|
||||
If nStartIndex > 0 Then
|
||||
Dim sValue As String = sItems(1).Remove(nStartIndex, sItems(1).Count - nStartIndex)
|
||||
StringToLen(sValue, dExtraStroke)
|
||||
End If
|
||||
End If
|
||||
Return dExtraStroke
|
||||
End Function
|
||||
|
||||
Private Function TestVacuumCups(nCups() As Integer, nRawRegId As Integer,
|
||||
vtMove As Vector3d, ptRotCen As Point3d, dRotAngDeg As Double) As Boolean
|
||||
' Eseguo verifica delle ventose rispetto al grezzo
|
||||
@@ -457,6 +583,27 @@ Module VacuumCups
|
||||
Return bVacOk
|
||||
End Function
|
||||
|
||||
Private Function GetPluggerFromCameras(sCups() As String) As Integer
|
||||
Dim nCountPlunger As Integer = 1
|
||||
Dim bPlugger1 As Boolean = False
|
||||
Dim bPlugger2 As Boolean = False
|
||||
For Each Camera As String In sCups
|
||||
If (Camera.Contains("1") Or Camera.Contains("2") Or Camera.Contains("3")) Then
|
||||
bPlugger1 = True
|
||||
Else
|
||||
bPlugger2 = True
|
||||
End If
|
||||
Next
|
||||
' verifico quali sono le camere attive
|
||||
If bPlugger1 And bPlugger2 Then
|
||||
nCountPlunger = 2
|
||||
ElseIf Not bPlugger1 And Not bPlugger2 Then
|
||||
nCountPlunger = 0
|
||||
End If
|
||||
' restituisco il numero di Plugger in uso
|
||||
Return nCountPlunger
|
||||
End Function
|
||||
|
||||
Friend Function SaveOneMoveInfo(nId As Integer, rmData As RawMoveData) As Boolean
|
||||
' Assegno le informazioni
|
||||
EgtSetInfo(nId, "Id", rmData.m_nId)
|
||||
|
||||
@@ -984,7 +984,8 @@ Friend Module VeinMatching
|
||||
' Esporto il file come immagine
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
Dim bOk As Boolean = (EgtGetFileType(sFilePath) = FT.IMG)
|
||||
bOk = bOk AndAlso EgtGetImage(EgtGetShowMode(), New Color3d(255, 255, 255), New Color3d(255, 255, 255),
|
||||
bOk = bOk AndAlso EgtGetImage(DirectCast( EgtGetShowMode(), EgtInterface.SM),
|
||||
New Color3d(255, 255, 255), New Color3d(255, 255, 255),
|
||||
m_nImgWidth, m_nImgHeight, sFilePath)
|
||||
' Ripristino il contesto originale
|
||||
EgtSetCurrentContext(nMainCtx)
|
||||
|
||||
@@ -195,8 +195,8 @@ Public Class MainWindowM
|
||||
' Verifico abilitazione nesting automatico
|
||||
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2401, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(9423, 2401, 1, m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2405, 1, m_nKeyLevel) And
|
||||
EgtGetKeyOptions(9423, 2405, 1, m_nKeyOptions)
|
||||
' Verifico abilitazione prodotto
|
||||
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
|
||||
@@ -69,6 +69,6 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.1.3")>
|
||||
<Assembly: AssemblyFileVersion("2.4.1.3")>
|
||||
<Assembly: AssemblyVersion("2.4.5.1")>
|
||||
<Assembly: AssemblyFileVersion("2.4.5.1")>
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ Public Class MyMachGroupPanelVM
|
||||
Dim nTabInd As Integer = 1
|
||||
Dim nTabCnt As Integer = CamAuto.GetTableCount()
|
||||
If nTabCnt > 1 And nTabCnt <= 3 Then
|
||||
Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(nTabCnt))
|
||||
Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(DirectCast(nTabCnt, SelectTableWindowVM.TableNumOpt)))
|
||||
dlg.ShowDialog()
|
||||
nTabInd = dlg.m_SelTable
|
||||
End If
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -255,6 +255,10 @@
|
||||
<DependentUpon>SplitModeV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OptionPanel\MachiningTab\SplitModeVM.vb" />
|
||||
<Compile Include="OptionPanel\NestingTab\MultiSelectionV.xaml.vb">
|
||||
<DependentUpon>MultiSelectionV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OptionPanel\NestingTab\MultiSelectionVM.vb" />
|
||||
<Compile Include="OptionPanel\NestingTab\NestingTabV.xaml.vb">
|
||||
<DependentUpon>NestingTabV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -437,6 +441,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OptionPanel\NestingTab\MultiSelectionV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OptionPanel\NestingTab\NestingTabV.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
IsMinimizable="False"
|
||||
ShowInTaskbar="False"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
Height="200" Width="400"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
@@ -3,6 +3,15 @@ Imports EgtUILib
|
||||
|
||||
Public Class ModifStartEndCutWindowVM
|
||||
|
||||
Private m_Title As String = String.Empty
|
||||
Public Property Title As String
|
||||
Get
|
||||
Return m_Title
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Title = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property ValueMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SPLITPAGEUC + 35)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
IsMinimizable="False"
|
||||
ShowInTaskbar="False"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
Height="400" Width="400"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
@@ -6,6 +6,15 @@ Imports EgtWPFLib5
|
||||
Public Class ModifStartEndWjWindowVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Title As String = String.Empty
|
||||
Public Property Title As String
|
||||
Get
|
||||
Return m_Title
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Title = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property ValueMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SPLITPAGEUC + 35)
|
||||
|
||||
@@ -249,6 +249,108 @@ Public Class MoveRawModeVM
|
||||
NotifyPropertyChanged("MoveStep")
|
||||
End Sub
|
||||
|
||||
' verifica che la posizione di rialascio sia corretta, altrimenti coreggo il vettore di posizione
|
||||
Private Function VerifyReleasdPositionIsValid(ByRef vtMove As Vector3d) As Boolean
|
||||
Dim bOk As Boolean = True
|
||||
' determino il punto finale dello spostamento
|
||||
Dim ptEndPointLift As Point3d = VacuumCups.ptStartPointLift
|
||||
ptEndPointLift.x += vtMove.x
|
||||
ptEndPointLift.y += vtMove.y
|
||||
Dim sInfo As String = String.Empty
|
||||
Select Case VacuumCups.VerifyOutOfStrokes(ptEndPointLift, VacuumCups.dDegRotStartAng)
|
||||
Case 1
|
||||
' extra corsa sulla x-: devo ridurre del valore di extra corsa
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.x -= vtMove.x
|
||||
Dim dMaxMove As Double = VacuumCups.GetExtraStrokeValue(sInfo)
|
||||
If Math.Abs(dMaxMove - vtMove.x) <= EPS_SMALL * 100 Then
|
||||
vtMove.x = 0
|
||||
Else
|
||||
vtMove.x -= dMaxMove - EPS_SMALL * 100
|
||||
End If
|
||||
ptEndPointLift.x += vtMove.x
|
||||
bOk = False
|
||||
Case 2
|
||||
' extra corsa sulla x+: devo ridurre del valore di extra corsa
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.x -= vtMove.x
|
||||
Dim dMaxMove As Double = VacuumCups.GetExtraStrokeValue(sInfo)
|
||||
If Math.Abs(dMaxMove - vtMove.x) <= EPS_SMALL * 100 Then
|
||||
vtMove.x = 0
|
||||
Else
|
||||
vtMove.x -= dMaxMove + EPS_SMALL * 100
|
||||
End If
|
||||
ptEndPointLift.x += vtMove.x
|
||||
bOk = False
|
||||
Case 4
|
||||
' extra corsa sulla y-
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.y -= vtMove.y
|
||||
Dim dMaxMove As Double = VacuumCups.GetExtraStrokeValue(sInfo)
|
||||
If Math.Abs(dMaxMove - vtMove.y) <= EPS_SMALL * 100 Then
|
||||
vtMove.y = 0
|
||||
Else
|
||||
vtMove.y -= dMaxMove - EPS_SMALL * 100
|
||||
End If
|
||||
ptEndPointLift.y += vtMove.y
|
||||
bOk = False
|
||||
Case 8
|
||||
' extra corsa sulla y+
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.y -= vtMove.y
|
||||
Dim dMaxMove As Double = VacuumCups.GetExtraStrokeValue(sInfo)
|
||||
If Math.Abs(dMaxMove - vtMove.y) <= EPS_SMALL * 100 Then
|
||||
vtMove.y = 0
|
||||
Else
|
||||
vtMove.y -= dMaxMove + EPS_SMALL * 100
|
||||
End If
|
||||
ptEndPointLift.y += vtMove.y
|
||||
bOk = False
|
||||
End Select
|
||||
' il movimento del pezzo è accettabile, aggiorno le posizione per la verifica dello step successivo
|
||||
VacuumCups.ptStartPointLift = ptEndPointLift
|
||||
Return bOk
|
||||
End Function
|
||||
' verifica che la posizione di rialascio sia corretta, altrimenti coreggo l'angolo di posizione
|
||||
Private Function VerifyReleasdAngleIsValid(ByRef dAngDeg As Double, ByVal ptCenter As Point3d) As Boolean
|
||||
Dim bOk As Boolean = True
|
||||
' determino il punto finale dello spostamento
|
||||
Dim ptEndPointLift As Point3d = VacuumCups.ptStartPointLift
|
||||
Dim dDegRotEndAng As Double = VacuumCups.dDegRotStartAng + dAngDeg
|
||||
ptEndPointLift.Rotate(ptCenter, Vector3d.Z_AX(), dAngDeg)
|
||||
Dim sInfo As String = String.Empty
|
||||
Select Case VacuumCups.VerifyOutOfStrokes(ptEndPointLift, dDegRotEndAng)
|
||||
Case 16
|
||||
' extra corsa sulla c-
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.Rotate(ptCenter, Vector3d.Z_AX(), -dAngDeg)
|
||||
dDegRotEndAng -= dAngDeg
|
||||
dAngDeg += VacuumCups.GetExtraStrokeValue(sInfo) + EPS_SMALL
|
||||
dDegRotEndAng += dAngDeg
|
||||
ptEndPointLift.Rotate(ptCenter, Vector3d.Z_AX(), dAngDeg)
|
||||
bOk = False
|
||||
Case 34
|
||||
' extra corsa sulla c+
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, 3, MSG_TYPE.WARNING) 'Extracorsa ...
|
||||
ptEndPointLift.Rotate(ptCenter, Vector3d.Z_AX(), -dAngDeg)
|
||||
dDegRotEndAng -= dAngDeg
|
||||
dAngDeg -= VacuumCups.GetExtraStrokeValue(sInfo) + EPS_SMALL
|
||||
dDegRotEndAng += dAngDeg
|
||||
ptEndPointLift.Rotate(ptCenter, Vector3d.Z_AX(), dAngDeg)
|
||||
bOk = False
|
||||
End Select
|
||||
' il movimento del pezzo è accettabile, aggiorno le posizione per la verifica dello step successivo
|
||||
VacuumCups.ptStartPointLift = ptEndPointLift
|
||||
VacuumCups.dDegRotStartAng = dDegRotEndAng
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
@@ -286,9 +388,15 @@ Public Class MoveRawModeVM
|
||||
Else
|
||||
If m_bRawWithCups Then
|
||||
Dim vtMove As New Vector3d(0, m_dMoveStep, 0)
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdPositionIsValid(vtMove)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtMoveRawPart(nRawId, vtMove) Then
|
||||
EgtMove(GetVacuumId(), vtMove, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, vtMove, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.y -= vtMove.y
|
||||
End If
|
||||
Else
|
||||
' Pezzo troppo piccolo : non si può muovere
|
||||
@@ -320,9 +428,15 @@ Public Class MoveRawModeVM
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If m_bRawWithCups Then
|
||||
Dim vtMove As New Vector3d(-m_dMoveStep, 0, 0)
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdPositionIsValid(vtMove)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtMoveRawPart(nRawId, vtMove) Then
|
||||
EgtMove(GetVacuumId(), vtMove, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, vtMove, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.x -= vtMove.x
|
||||
End If
|
||||
Else
|
||||
' Pezzo troppo piccolo : non si può muovere
|
||||
@@ -353,9 +467,15 @@ Public Class MoveRawModeVM
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If m_bRawWithCups Then
|
||||
Dim vtMove As New Vector3d(m_dMoveStep, 0, 0)
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdPositionIsValid(vtMove)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtMoveRawPart(nRawId, vtMove) Then
|
||||
EgtMove(GetVacuumId(), vtMove, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, vtMove, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.x -= vtMove.x
|
||||
End If
|
||||
Else
|
||||
' Pezzo troppo piccolo : non si può muovere
|
||||
@@ -403,9 +523,15 @@ Public Class MoveRawModeVM
|
||||
Else
|
||||
If m_bRawWithCups Then
|
||||
Dim vtMove As New Vector3d(0, -m_dMoveStep, 0)
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdPositionIsValid(vtMove)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtMoveRawPart(nRawId, vtMove) Then
|
||||
EgtMove(GetVacuumId(), vtMove, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, vtMove, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.y -= vtMove.y
|
||||
End If
|
||||
Else
|
||||
' Pezzo troppo piccolo : non si può muovere
|
||||
@@ -437,12 +563,19 @@ Public Class MoveRawModeVM
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If m_bRawWithCups Then
|
||||
Dim dAng As Double = m_dRotationStep
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
' Recupero il centro del grezzo
|
||||
Dim ptRawCen As Point3d
|
||||
EgtGetRawPartCenter(nRawId, ptRawCen)
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdAngleIsValid(dAng, ptRawCen)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtRotateRawPart(nRawId, Vector3d.Z_AX(), dAng) Then
|
||||
' Recupero il centro del grezzo
|
||||
Dim ptRawCen As Point3d
|
||||
EgtGetRawPartCenter(nRawId, ptRawCen)
|
||||
EgtRotate(GetVacuumId(), ptRawCen, Vector3d.Z_AX(), dAng, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, dAng, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.Rotate(ptRawCen, Vector3d.Z_AX(), dAng)
|
||||
VacuumCups.dDegRotStartAng -= dAng
|
||||
End If
|
||||
Else
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2), 3, MSG_TYPE.WARNING)
|
||||
@@ -472,12 +605,19 @@ Public Class MoveRawModeVM
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If m_bRawWithCups Then
|
||||
Dim dAng As Double = -m_dRotationStep
|
||||
' ----------- INIZIO verifica di essere entro i limiti macchina -----------
|
||||
' Recupero il centro del grezzo
|
||||
Dim ptRawCen As Point3d
|
||||
EgtGetRawPartCenter(nRawId, ptRawCen)
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
VerifyReleasdAngleIsValid(dAng, ptRawCen)
|
||||
' ----------- FINE verifica di essere entro i limiti macchina -----------
|
||||
If EgtRotateRawPart(nRawId, Vector3d.Z_AX(), dAng) Then
|
||||
' Recupero il centro del grezzo
|
||||
Dim ptRawCen As Point3d
|
||||
EgtGetRawPartCenter(nRawId, ptRawCen)
|
||||
EgtRotate(GetVacuumId(), ptRawCen, Vector3d.Z_AX(), dAng, GDB_RT.GLOB)
|
||||
AddRawMoveData(nRawId, dAng, m_RawMoveDataList)
|
||||
Else
|
||||
VacuumCups.ptStartPointLift.Rotate(ptRawCen, Vector3d.Z_AX(), dAng)
|
||||
VacuumCups.dDegRotStartAng -= dAng
|
||||
End If
|
||||
Else
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2), 3, MSG_TYPE.WARNING)
|
||||
@@ -556,6 +696,16 @@ Public Class MoveRawModeVM
|
||||
' Se con ventose, le posiziono sul grezzo
|
||||
If Not OmagOFFICEMap.refMachiningTabVM.ByHand Then
|
||||
Dim rmData As New RawMoveData
|
||||
' inizializzo i dati del grezzo per il cacolo del peso
|
||||
Dim MaxSinglePlugger As Double = 250
|
||||
MaxSinglePlugger = GetPrivateProfileDouble(S_MACH_RAWMOVE, K_MACH_WEIGHT_SINGLEPLUGGER, MaxSinglePlugger, sMachIniFile)
|
||||
Dim MaxDoublePlugger As Double = 750
|
||||
MaxDoublePlugger = GetPrivateProfileDouble(S_MACH_RAWMOVE, K_MACH_WEIGHT_DOUBLEPLUGGER, MaxDoublePlugger, sMachIniFile)
|
||||
Dim AverageDensity As Double = 2700
|
||||
AverageDensity = GetPrivateProfileDouble(S_MATERIALS, K_AVERAGEDENSITY, AverageDensity, sMachIniFile)
|
||||
VacuumCups.GetWeightInformation(AverageDensity, MaxSinglePlugger, MaxDoublePlugger)
|
||||
VacuumCups.GetRotationForExtraStrokeY(GetPrivateProfileInt(S_MACH_RAWMOVE, K_MACH_ROTATEVACUUMFOREXTRASTROKEY, 0, sMachIniFile) <> 0)
|
||||
VacuumCups.GetRotationForExtraStrokeX(GetPrivateProfileInt(S_MACH_RAWMOVE, K_MACH_ROTATEVACUUMFOREXTRASTROKEX, 0, sMachIniFile) <> 0)
|
||||
If PutVacuumCupsOnRaw(nId, rmData) Then
|
||||
' Visualizzo le ventose
|
||||
EgtSetStatus(GetVacuumId(), GDB_ST.ON_)
|
||||
@@ -565,10 +715,19 @@ Public Class MoveRawModeVM
|
||||
' Reset eventuale messaggio
|
||||
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
|
||||
Else
|
||||
' Visualizzo le ventose
|
||||
EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
|
||||
' Aggiorno i dati
|
||||
m_bRawWithCups = False
|
||||
' Messaggio di avvertimento (Pezzo troppo piccolo : non si può muovere)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2), 3, MSG_TYPE.WARNING)
|
||||
If VacuumCups.bOverWeight Then
|
||||
' Messaggio di avvertimento (Pezzo troppo piccolo : non si può muovere)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 4), 3, MSG_TYPE.WARNING)
|
||||
ElseIf VacuumCups.bExtraStroke Then
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 5), 3, MSG_TYPE.WARNING) 'Pezzo oltre le corse : non si può muovere
|
||||
Else
|
||||
' Messaggio di avvertimento (Pezzo troppo piccolo : non si può muovere)
|
||||
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2), 3, MSG_TYPE.WARNING)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
IsEnabled="{Binding bEnabledCommandMove}"
|
||||
Style="{StaticResource OptionPanel_Button}"
|
||||
Command="{Binding MoveUpCommand}">
|
||||
<Image Source="/Resources/MachiningTab/UpArrow.png"/>
|
||||
</Button>
|
||||
<Button Grid.Column="2"
|
||||
IsEnabled="{Binding bEnabledCommandMove}"
|
||||
Style="{StaticResource OptionPanel_Button}"
|
||||
Command="{Binding MoveDownCommand}">
|
||||
<Image Source="/Resources/MachiningTab/DownArrow.png"/>
|
||||
|
||||
@@ -42,6 +42,17 @@ Public Class SplitModeVM
|
||||
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
|
||||
@@ -1054,16 +1065,21 @@ Public Class SplitModeVM
|
||||
Public Sub OnOff(ByVal param As Object)
|
||||
If m_CurrFirstInd = -1 Then Return
|
||||
For Index = m_CurrFirstInd To m_CurrLastInd
|
||||
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
|
||||
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
|
||||
ColorMachining(m_MachiningList(nI))
|
||||
ColorNumberArrow(nI)
|
||||
Next
|
||||
EgtDraw()
|
||||
' Imposto flag di modifica
|
||||
@@ -1156,6 +1172,9 @@ Public Class SplitModeVM
|
||||
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)
|
||||
@@ -1190,6 +1209,9 @@ Public Class SplitModeVM
|
||||
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
|
||||
@@ -1218,6 +1240,9 @@ Public Class SplitModeVM
|
||||
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
|
||||
@@ -1359,6 +1384,9 @@ Public Class SplitModeVM
|
||||
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)
|
||||
@@ -1496,6 +1524,9 @@ Public Class SplitModeVM
|
||||
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)
|
||||
@@ -1698,10 +1729,24 @@ Public Class SplitModeVM
|
||||
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)
|
||||
@@ -1710,14 +1755,19 @@ Public Class SplitModeVM
|
||||
Dim dOrigUsal As Double = 0
|
||||
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
||||
' Dialogo richiesta valore
|
||||
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
||||
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
||||
ModifStartWindow.DataContext = ModifStartWindowVM
|
||||
ModifStartWindow.Owner = Application.Current.MainWindow
|
||||
ModifStartWindowVM.SetVal(dOrigUsal)
|
||||
If Not ModifStartWindow.ShowDialog() Then Return
|
||||
' Modifica della lavorazione
|
||||
Dim dUsal As Double = ModifStartWindowVM.GetVal()
|
||||
If bFirstInd Then
|
||||
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
||||
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
||||
ModifStartWindowVM.Title = "Sawing"
|
||||
ModifStartWindow.DataContext = ModifStartWindowVM
|
||||
ModifStartWindow.Owner = Application.Current.MainWindow
|
||||
ModifStartWindowVM.SetVal(dOrigUsal)
|
||||
If Not ModifStartWindow.ShowDialog() Then Return
|
||||
' Modifica della lavorazione
|
||||
dUsal = ModifStartWindowVM.GetVal()
|
||||
bFirstInd = False
|
||||
End If
|
||||
|
||||
Dim bRepeat As Boolean = False
|
||||
Do
|
||||
EgtSetCurrMachining(nOperId)
|
||||
@@ -1739,41 +1789,81 @@ Public Class SplitModeVM
|
||||
ColorMachining(m_MachiningList(nI))
|
||||
ColorNumberArrow(nI)
|
||||
bGenModif = True
|
||||
' se altrimenti getto d'acqua
|
||||
ElseIf nMachiningType = MCH_MY.WATERJETTING Then
|
||||
' Recupero i valori attuali della lavorazione
|
||||
Dim dAddLen As Double = 0
|
||||
Dim bLiHole As Boolean = True
|
||||
Dim nTangDist As Double = 0
|
||||
Dim nPerpDist As Double = 0
|
||||
Dim LeadInTypeId As Integer = 0
|
||||
EgtSetCurrMachining(nOperId)
|
||||
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
||||
EgtGetMachiningParam(MCH_MP.LIHOLE, bLiHole)
|
||||
EgtGetMachiningParam(MCH_MP.LITANG, nTangDist)
|
||||
EgtGetMachiningParam(MCH_MP.LIPERP, nPerpDist)
|
||||
EgtGetMachiningParam(MCH_MP.LEADINTYPE, LeadInTypeId)
|
||||
' Dialogo richiesta valori
|
||||
Dim ModifStartWnd As New ModifStartEndWjWindowV
|
||||
Dim ModifStartWndVM As New ModifStartEndWjWindowVM
|
||||
ModifStartWnd.DataContext = ModifStartWndVM
|
||||
ModifStartWnd.Owner = Application.Current.MainWindow
|
||||
ModifStartWndVM.HoleVisibility = Visibility.Visible
|
||||
ModifStartWndVM.LeadInVisibility = Visibility.Visible
|
||||
ModifStartWndVM.LeadOutVisibility = Visibility.Hidden
|
||||
ModifStartWndVM.SetVal(dAddLen)
|
||||
ModifStartWndVM.SetHole(bLiHole)
|
||||
ModifStartWndVM.SetLeadInType(LeadInTypeId)
|
||||
ModifStartWndVM.SetLiTangDist(nTangDist)
|
||||
ModifStartWndVM.SetLiPerpDist(nPerpDist)
|
||||
If Not ModifStartWnd.ShowDialog() Then Return
|
||||
|
||||
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 = "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)
|
||||
EgtSetMachiningParam(MCH_MP.LIHOLE, ModifStartWndVM.GetHole())
|
||||
EgtSetMachiningParam(MCH_MP.STARTADDLEN, ModifStartWndVM.GetVal())
|
||||
EgtSetMachiningParam(MCH_MP.LEADINTYPE, ModifStartWndVM.GetLeadInType().Id)
|
||||
EgtSetMachiningParam(MCH_MP.LITANG, ModifStartWndVM.GetLiTangDist())
|
||||
EgtSetMachiningParam(MCH_MP.LIPERP, ModifStartWndVM.GetLiPerpDist())
|
||||
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 = "Water jetting"
|
||||
ModifStartWnd.DataContext = ModifStartWndVM
|
||||
ModifStartWnd.Owner = Application.Current.MainWindow
|
||||
ModifStartWndVM.HoleVisibility = Visibility.Visible
|
||||
ModifStartWndVM.LeadInVisibility = Visibility.Visible
|
||||
ModifStartWndVM.LeadOutVisibility = Visibility.Hidden
|
||||
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)
|
||||
@@ -1803,10 +1893,24 @@ Public Class SplitModeVM
|
||||
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)
|
||||
@@ -1815,14 +1919,18 @@ Public Class SplitModeVM
|
||||
Dim dOrigUeal As Double = 0
|
||||
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
||||
' Dialogo richiesta valore
|
||||
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
||||
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
||||
ModifStartWindow.DataContext = ModifStartWindowVM
|
||||
ModifStartWindow.Owner = Application.Current.MainWindow
|
||||
ModifStartWindowVM.SetVal(dOrigUeal)
|
||||
If Not ModifStartWindow.ShowDialog() Then Return
|
||||
' Modifica della lavorazione
|
||||
Dim dUeal As Double = ModifStartWindowVM.GetVal()
|
||||
If bFirstInd Then
|
||||
Dim ModifStartWindow As New ModifStartEndCutWindowV
|
||||
Dim ModifStartWindowVM As New ModifStartEndCutWindowVM
|
||||
ModifStartWindowVM.Title = "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
|
||||
EgtSetCurrMachining(nOperId)
|
||||
@@ -1846,37 +1954,75 @@ Public Class SplitModeVM
|
||||
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 = "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
|
||||
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
|
||||
ModifStartWnd.DataContext = ModifStartWndVM
|
||||
ModifStartWnd.Owner = Application.Current.MainWindow
|
||||
ModifStartWndVM.HoleVisibility = Visibility.Hidden
|
||||
ModifStartWndVM.LeadInVisibility = Visibility.Hidden
|
||||
ModifStartWndVM.LeadOutVisibility = Visibility.Visible
|
||||
ModifStartWndVM.SetVal(dAddLen)
|
||||
ModifStartWndVM.SetLeadOutType(LeadOutTypeId)
|
||||
ModifStartWndVM.SetLoTangDist(nTangDist)
|
||||
ModifStartWndVM.SetLoPerpDist(nPerpDist)
|
||||
If Not ModifStartWnd.ShowDialog() Then Return
|
||||
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 = "Water jetting"
|
||||
ModifStartWnd.DataContext = ModifStartWndVM
|
||||
ModifStartWnd.Owner = Application.Current.MainWindow
|
||||
ModifStartWndVM.HoleVisibility = Visibility.Hidden
|
||||
ModifStartWndVM.LeadInVisibility = Visibility.Hidden
|
||||
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, ModifStartWndVM.GetVal())
|
||||
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, ModifStartWndVM.GetLeadOutType().Id)
|
||||
EgtSetMachiningParam(MCH_MP.LOTANG, ModifStartWndVM.GetLoTangDist())
|
||||
EgtSetMachiningParam(MCH_MP.LOPERP, ModifStartWndVM.GetLoPerpDist())
|
||||
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)
|
||||
@@ -1908,6 +2054,9 @@ Public Class SplitModeVM
|
||||
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
|
||||
@@ -1940,6 +2089,9 @@ Public Class SplitModeVM
|
||||
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
|
||||
@@ -2252,29 +2404,34 @@ Public Class SplitModeVM
|
||||
' ------------------------ 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
|
||||
|
||||
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(x),
|
||||
OmagOFFICEMap.refSplitModeVM.m_ItemList.IndexOf(y)))
|
||||
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
|
||||
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
|
||||
@@ -2298,6 +2455,20 @@ Public Class SplitModeVM
|
||||
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
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="MultiSelectionV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:OmagOFFICE="clr-namespace:OmagOFFICE"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
Title="{Binding TitleMsg}"
|
||||
IsMinimizable="False"
|
||||
IsClosable="False"
|
||||
ShowInTaskbar="False"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Width="270" Height="150"
|
||||
ResizeMode="NoResize">
|
||||
|
||||
<DockPanel Margin="5,5,5,0">
|
||||
|
||||
<UniformGrid Columns="2"
|
||||
DockPanel.Dock="Top"
|
||||
Margin="0,15,0,15">
|
||||
<TextBlock Text="{Binding SelectionMsg}"/>
|
||||
<TextBox Text="{Binding nNbrOfParts}"/>
|
||||
</UniformGrid>
|
||||
|
||||
<UniformGrid Columns="4"
|
||||
DockPanel.Dock="Bottom"
|
||||
Margin="25,0,25,5">
|
||||
<Button Command="{Binding OkCommand}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"
|
||||
Content="{Binding OkMsg}">
|
||||
</Button>
|
||||
<ToggleButton Visibility="Hidden" />
|
||||
<ToggleButton Visibility="Hidden" />
|
||||
<Button Command="{Binding CancelCommand}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"
|
||||
Content="{Binding CancelMsg}">
|
||||
</Button>
|
||||
</UniformGrid>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,15 @@
|
||||
Public Class MultiSelectionV
|
||||
|
||||
Private WithEvents m_MultiSelectionVM As MultiSelectionVM
|
||||
|
||||
Sub New(Owner As Window, MultiSelVM As MultiSelectionVM)
|
||||
MyBase.New(Owner)
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
Me.DataContext = MultiSelVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_MultiSelectionVM = MultiSelVM
|
||||
Me.Show()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,97 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MultiSelectionVM
|
||||
Inherits VMBase
|
||||
|
||||
Private m_sRefGuidOfPart As String = String.Empty
|
||||
|
||||
Public ReadOnly Property TitleMsg As String
|
||||
Get
|
||||
Return "Multiple selection"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SelectionMsg As String
|
||||
Get
|
||||
Return "Number of Parts"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property OkMsg As String
|
||||
Get
|
||||
Return "Ok"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CancelMsg As String
|
||||
Get
|
||||
Return "Cancel"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MultiSelectionV As MultiSelectionV
|
||||
Public Sub SetMultiSelectionV(MultiSel As MultiSelectionV)
|
||||
m_MultiSelectionV = MultiSel
|
||||
End Sub
|
||||
|
||||
Private m_nNbrOfParts As Integer
|
||||
Public Property nNbrOfParts As String
|
||||
Get
|
||||
Return m_nNbrOfParts.ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
Dim nVal As Integer = 0
|
||||
StringToInt(value, nVal)
|
||||
m_nNbrOfParts = nVal
|
||||
NotifyPropertyChanged("nNbrOfParts")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_cmdOk As ICommand
|
||||
Private m_cmdCancel As ICommand
|
||||
|
||||
Public ReadOnly Property OkCommand As ICommand
|
||||
Get
|
||||
If m_cmdOk Is Nothing Then
|
||||
m_cmdOk = New Command(AddressOf OkCmd)
|
||||
End If
|
||||
Return m_cmdOk
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub OkCmd(ByVal param As Object)
|
||||
' il numero di elementi indicato è corretto
|
||||
' deseleziono il pezzo corrente
|
||||
DeselectPartInFaimily(m_sRefGuidOfPart)
|
||||
Select Case m_nNbrOfParts
|
||||
Case 0 ' Annulla
|
||||
' continuo senza eseguire niente
|
||||
Case Else
|
||||
' seleziono il numero di pezzi indicati
|
||||
SelectPartInFaimily(m_sRefGuidOfPart, m_nNbrOfParts)
|
||||
End Select
|
||||
' chiudo la finestra
|
||||
m_MultiSelectionV.Close()
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property CancelCommand As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf CancelCmd)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub CancelCmd(ByVal param As Object)
|
||||
' chiudo la fiestra senza eseguire niente
|
||||
m_MultiSelectionV.Close()
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Sub New(CurrNumberOfParts As Integer, sRefGuid As String)
|
||||
m_nNbrOfParts = CurrNumberOfParts
|
||||
m_sRefGuidOfPart = sRefGuid
|
||||
End Sub
|
||||
End Class
|
||||
@@ -148,22 +148,22 @@
|
||||
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 DragRettangle_Cl_Span}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"
|
||||
Command="{Binding RemovePartCommand}"
|
||||
Margin="0,0,2.5,0"/>
|
||||
<ToggleButton Content="{Binding DragRettangleMsg}" Grid.Column="1"
|
||||
Visibility="{Binding DragRettangle_Visibility}"
|
||||
<ToggleButton Content="{Binding DragRectangleMsg}" Grid.Column="1"
|
||||
Visibility="{Binding DragRectangle_Visibility}"
|
||||
Style="{StaticResource OptionPanel_ToggleButton}"
|
||||
IsChecked="{Binding bDragRettangle}"
|
||||
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">
|
||||
|
||||
@@ -36,16 +36,19 @@ Public Class NestingTabVM
|
||||
Private m_bCsvData As Boolean = False
|
||||
|
||||
' Id del rettangolo, del traglio e della curva da modificare tramite Drag
|
||||
Private m_nIdSelectedOutLoopRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedRegionRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedSawRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedCurvRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedTextRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedTextTopRettangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedFlatSurfRettangle As Integer = GDB_ID.NULL
|
||||
Private m_SideListRettangle(4) As Integer
|
||||
Private m_nIdSelectedOutLoopRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedRegionRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedSawRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedCurvRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedTextRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedTextTopRectangle As Integer = GDB_ID.NULL
|
||||
Private m_nIdSelectedFlatSurfRectangle As Integer = GDB_ID.NULL
|
||||
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
|
||||
@@ -115,8 +118,7 @@ Public Class NestingTabVM
|
||||
End Get
|
||||
Set(value As String)
|
||||
Dim dValue As Double
|
||||
'StringToDouble(value, m_dRotationAngle)
|
||||
If StringToLen(value, dValue) Then
|
||||
If StringToDouble(value, dValue) Then
|
||||
If dValue < 0 Then
|
||||
dValue = 0
|
||||
ElseIf dValue > 180 Then
|
||||
@@ -153,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
|
||||
@@ -173,9 +182,15 @@ Public Class NestingTabVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DragRettangleMsg As String
|
||||
Public ReadOnly Property DragRectangleMsg As String
|
||||
Get
|
||||
Return "Drag Rettangle"
|
||||
Return "Drag Rectangle"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property SplitCurvWJMsg As String
|
||||
Get
|
||||
Return "Split"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -199,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
|
||||
|
||||
@@ -229,13 +244,14 @@ Public Class NestingTabVM
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
If (GetMainPrivateProfileInt(S_NEST, K_DRAGRETTANGLE, 1) <> 0) Then
|
||||
m_DragRettangle_Visibility = Visibility.Visible
|
||||
If GetMainPrivateProfileInt(S_NEST, K_DRAGRECTANGLE, 1) <> 0 Then
|
||||
m_DragRectangle_Visibility = Visibility.Visible
|
||||
m_CountColumn += 1
|
||||
Else
|
||||
m_DragRettangle_Visibility = Visibility.Collapsed
|
||||
m_DragRectangle_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
NotifyPropertyChanged("DragRettangle_Visibility")
|
||||
NotifyPropertyChanged("DragRettangle_Cl_Span")
|
||||
NotifyPropertyChanged("DragRectangle_Visibility")
|
||||
NotifyPropertyChanged("CountColumn")
|
||||
' Creo riferimento a questa classe in OmagOFFICEMap
|
||||
OmagOFFICEMap.SetRefNestingTabVM(Me)
|
||||
End Sub
|
||||
@@ -414,8 +430,29 @@ Public Class NestingTabVM
|
||||
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
|
||||
' Rotazione del pezzo attorno al suo centro
|
||||
EgtRotate(nId, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
|
||||
' Sistemazione nel parcheggio
|
||||
PackPartInStore(nId)
|
||||
|
||||
'---------------------- COUNTER PART ----------------------
|
||||
' Aggiorno il Guid assegnando la nuova rotazione
|
||||
Dim sRefGroup As String = String.Empty
|
||||
If EgtGetInfo(nId, INFO_REFGROUP, sRefGroup) Then
|
||||
Dim sCurrRefGroup As String = sRefGroup
|
||||
If UppDateGuidCode(sRefGroup, CreatePreGuidCode(nId)) Then
|
||||
EgtSetInfo(nId, INFO_REFGROUP, sRefGroup)
|
||||
End If
|
||||
' aggiorno il layer che indica il numero di pezzi in parcheggio
|
||||
CountPartInFamily(sCurrRefGroup)
|
||||
End If
|
||||
' se esiste almento un pezzo del gruppo in parcheggio esco
|
||||
If Not ParkInGroupFamily(nId) Then
|
||||
PackPartInStore(nId)
|
||||
End If
|
||||
' ricarico l'lelenco dei pezzi in parcheggio
|
||||
GetFamilyGroupInPark()
|
||||
'---------------------- COUNTER PART ----------------------
|
||||
|
||||
|
||||
'' Sistemazione nel parcheggio
|
||||
'PackPartInStore(nId)
|
||||
End If
|
||||
' Passo al successivo selezionato
|
||||
nId = EgtGetNextSelectedObj()
|
||||
@@ -531,14 +568,12 @@ Public Class NestingTabVM
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#Region "DRAG RETTANGLE"
|
||||
#Region "DRAG RECTANGLE"
|
||||
|
||||
' funzione chiamata da OnMyMouseMoveScene: verifica che la selezione sia corretta (deve essere il lato di una figura rettangolare)
|
||||
Private Sub OnMyMouseDownSceneSelSideRettangle(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 Then
|
||||
Return
|
||||
End If
|
||||
Private Sub OnMyMouseDownSceneSelSideRectangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||
' Si può selezionare solo con il tasto sinistro
|
||||
If e.Button <> Windows.Forms.MouseButtons.Left Then Return
|
||||
' Verifico se selezionato indicativo di pezzo
|
||||
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
||||
Dim nSelMy As Integer
|
||||
@@ -554,8 +589,8 @@ Public Class NestingTabVM
|
||||
If sLayer = NAME_OUTLOOP Then
|
||||
If EgtGetType(nIdMy) = GDB_TY.CRV_LINE Then
|
||||
' -------------------------------- INIZIO VERIFICHE --------------------------------
|
||||
m_nIdSelectedOutLoopRettangle = nIdParent
|
||||
If Not IsRettangle(m_SideListRettangle) Then
|
||||
m_nIdSelectedOutLoopRectangle = nIdParent
|
||||
If Not IsRectangle(m_SideListRectangle) Then
|
||||
'm_CurrProjPage.ClearMessage()
|
||||
'm_CurrProjPage.SetWarningMessage("Non è un rettangolo (0)")
|
||||
Return
|
||||
@@ -579,26 +614,26 @@ Public Class NestingTabVM
|
||||
Dim nIdSaw As Integer = EgtGetFirstNameInGroup(nIdPV, "Saw" & nIdMy.ToString)
|
||||
' -------------------------------- FINE VERIFICHE --------------------------------
|
||||
|
||||
If Not EgtGetGroupObjs(nIdSaw) Then
|
||||
m_nIdSelectedSawRettangle = nIdSaw
|
||||
m_nIdSelectedCurvRettangle = nIdMy
|
||||
If EgtGetGroupObjs(nIdSaw) <> 0 Then
|
||||
m_nIdSelectedSawRectangle = nIdSaw
|
||||
m_nIdSelectedCurvRectangle = nIdMy
|
||||
|
||||
m_nIdSelectedRegionRettangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
|
||||
' recupero i testi cintenuti nel layer Region
|
||||
If m_nIdSelectedRegionRettangle <> GDB_ID.NULL Then
|
||||
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRettangle)
|
||||
m_nIdSelectedRegionRectangle = EgtGetFirstNameInGroup(nIdParentPart, NAME_REGION)
|
||||
' recupero i testi contenuti nel layer Region
|
||||
If m_nIdSelectedRegionRectangle <> GDB_ID.NULL Then
|
||||
Dim nCurrId As Integer = EgtGetFirstInGroup(m_nIdSelectedRegionRectangle)
|
||||
While nCurrId <> GDB_ID.NULL
|
||||
If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then
|
||||
Dim sVal As String = String.Empty
|
||||
EgtTextGetContent(nCurrId, sVal)
|
||||
If sVal = "*TOP*" Then
|
||||
m_nIdSelectedTextTopRettangle = nCurrId
|
||||
m_nIdSelectedTextTopRectangle = nCurrId
|
||||
Else
|
||||
m_nIdSelectedTextRettangle = nCurrId
|
||||
m_sTextContent = GetMyRettangleText(sVal)
|
||||
m_nIdSelectedTextRectangle = nCurrId
|
||||
m_sTextContent = GetMyRectangleText(sVal)
|
||||
End If
|
||||
ElseIf EgtGetType(nCurrId) = GDB_TY.SRF_FRGN Then
|
||||
m_nIdSelectedFlatSurfRettangle = nCurrId
|
||||
m_nIdSelectedFlatSurfRectangle = nCurrId
|
||||
End If
|
||||
nCurrId = EgtGetNext(nCurrId)
|
||||
End While
|
||||
@@ -611,15 +646,15 @@ Public Class NestingTabVM
|
||||
Exit While
|
||||
End If
|
||||
End If
|
||||
' se le'elemto corrente non è una linea
|
||||
' se l'elemento corrente non è una linea
|
||||
End If
|
||||
' se le'elemto corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
|
||||
' se l'elemento corrente non appartiene al layer OutLoop passo al prossimo elemento dell'elenco
|
||||
nIdMy = EgtGetNextObjInSelWin()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
' restituisce il valore del Text ripulito dalle dimensioni
|
||||
Private Function GetMyRettangleText(sTextPz As String) As String
|
||||
Private Function GetMyRectangleText(sTextPz As String) As String
|
||||
' da DrawPageUC.xaml.vb/MultipleInsert
|
||||
Dim sText As String = String.Empty
|
||||
If sTextPz.Contains("<br/>") Then
|
||||
@@ -630,56 +665,57 @@ Public Class NestingTabVM
|
||||
If sTextPz.Contains(" ") Then
|
||||
Dim sInfo() As String = sTextPz.Split(" "c)
|
||||
If sInfo.Count > 3 Then
|
||||
Return sText = sInfo(0) & " " & sInfo(1) & " "
|
||||
sText = sInfo(0) & " " & sInfo(1) & " "
|
||||
Return sText
|
||||
End If
|
||||
End If
|
||||
Return sText
|
||||
End Function
|
||||
|
||||
' verifico che la figura selezionata sia realmente un rettangolo
|
||||
Private Function IsRettangle(ByRef IdSideList() As Integer) As Boolean
|
||||
Private Function IsRectangle(ByRef IdSideList() As Integer) As Boolean
|
||||
' creo una lista con i lati del rettangolo
|
||||
Dim nCounter As Integer = 0
|
||||
' recupero i lati dal leyer "OutLoop"
|
||||
Dim IdSideRettangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRettangle)
|
||||
While IdSideRettangle <> GDB_ID.NULL And nCounter < 4
|
||||
Dim IdSideRectangle As Integer = EgtGetFirstInGroup(m_nIdSelectedOutLoopRectangle)
|
||||
While IdSideRectangle <> GDB_ID.NULL And nCounter < 4
|
||||
Dim sVal As String = String.Empty
|
||||
Dim dPrevAng As Double = 0
|
||||
EgtGetInfo(IdSideRettangle, "PrevAng", sVal)
|
||||
EgtGetInfo(IdSideRectangle, "PrevAng", sVal)
|
||||
StringToDouble(sVal, dPrevAng)
|
||||
Dim dNextAng As Double = 0
|
||||
EgtGetInfo(IdSideRettangle, "NextAng", sVal)
|
||||
EgtGetInfo(IdSideRectangle, "NextAng", sVal)
|
||||
StringToDouble(sVal, dNextAng)
|
||||
' se gli angoli non sono retti allora esco senza caricare il lato corrente
|
||||
If Math.Abs(dPrevAng - 90) > EPS_ANG_SMALL OrElse Math.Abs(dNextAng - 90) > EPS_ANG_SMALL Then
|
||||
Exit While
|
||||
End If
|
||||
IdSideList(nCounter) = IdSideRettangle
|
||||
IdSideList(nCounter) = IdSideRectangle
|
||||
nCounter += 1
|
||||
IdSideRettangle = EgtGetNext(IdSideRettangle)
|
||||
IdSideRectangle = EgtGetNext(IdSideRectangle)
|
||||
End While
|
||||
' verifico che siano solo quattro lati
|
||||
If IdSideRettangle = GDB_ID.NULL And nCounter = 4 Then
|
||||
If IdSideRectangle = GDB_ID.NULL And nCounter = 4 Then
|
||||
' solo se la figura ha 4 lati ortogonali
|
||||
Return True
|
||||
End If
|
||||
|
||||
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedOutLoopRectangle = GDB_ID.NULL
|
||||
' la figura presenta più/meno di 4 lati
|
||||
Return False
|
||||
End Function
|
||||
|
||||
' recupero le informazioni correnti per sapere se la figura è mdificabile
|
||||
Private Function GetRettangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
|
||||
Private Function GetRectangleInfoScale(ByRef frFixed As Frame3d, ByRef MaxLen As Double, ByRef MinLen As Double) As Vector3d
|
||||
' determino la direzione del lato selezionato
|
||||
Dim vtDirSelectedCurv As New Vector3d
|
||||
EgtStartVector(m_nIdSelectedCurvRettangle, GDB_ID.ROOT, vtDirSelectedCurv)
|
||||
EgtStartVector(m_nIdSelectedCurvRectangle, GDB_ID.ROOT, vtDirSelectedCurv)
|
||||
|
||||
' recupero il lato successivo a quello selezionato
|
||||
Dim Index As Integer = 0
|
||||
Dim Len As Double = 0
|
||||
For Ind As Integer = 0 To 3
|
||||
If m_SideListRettangle(Ind) = m_nIdSelectedCurvRettangle Then
|
||||
If m_SideListRectangle(Ind) = m_nIdSelectedCurvRectangle Then
|
||||
' verifico se esiste un lato Precedente altrimenti recupero l'ultimo della lista
|
||||
If Ind = 0 Then
|
||||
Index = 3
|
||||
@@ -689,8 +725,8 @@ Public Class NestingTabVM
|
||||
End If
|
||||
Next
|
||||
' recupero la dimensione del lato
|
||||
EgtCurveLength(m_SideListRettangle(Index), MaxLen)
|
||||
EgtCurveLength(m_nIdSelectedCurvRettangle, MinLen)
|
||||
EgtCurveLength(m_SideListRectangle(Index), MaxLen)
|
||||
EgtCurveLength(m_nIdSelectedCurvRectangle, MinLen)
|
||||
|
||||
' verifico che il lato selezionato sia il maggiore
|
||||
If MinLen > MaxLen Then Return Nothing
|
||||
@@ -698,11 +734,11 @@ Public Class NestingTabVM
|
||||
' determimo il versore dal lato appena calcolato
|
||||
Dim vtDir As New Vector3d
|
||||
|
||||
EgtStartVector(m_SideListRettangle(Index), GDB_ID.ROOT, vtDir)
|
||||
EgtStartVector(m_SideListRectangle(Index), GDB_ID.ROOT, vtDir)
|
||||
vtDir.Normalize()
|
||||
Dim dProjectionBaseX As Double = vtDir * Vector3d.X_AX
|
||||
Dim ptFixed As New Point3d
|
||||
EgtStartPoint(m_SideListRettangle(Index), GDB_ID.ROOT, ptFixed)
|
||||
EgtStartPoint(m_SideListRectangle(Index), GDB_ID.ROOT, ptFixed)
|
||||
|
||||
Dim vtPerp As New Vector3d(vtDir.x, vtDir.y, vtDir.z)
|
||||
vtPerp.Rotate(Vector3d.Z_AX, 90)
|
||||
@@ -715,7 +751,7 @@ Public Class NestingTabVM
|
||||
End Function
|
||||
|
||||
' funzione chiamata da OnMyMouseMoveScene: gestisce la modifica lungo una dimensione del rettangolo selezionato
|
||||
Private Sub OnMyMouseMoveSawRettangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||
Private Sub OnMyMouseMoveSawRectangle(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||
' Se drag non abilitato o già in esecuzione, esco
|
||||
If Not m_bDrag Or m_bDragging Then Return
|
||||
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
|
||||
@@ -733,7 +769,7 @@ Public Class NestingTabVM
|
||||
Dim MaxLen As Double = 0
|
||||
Dim MinLen As Double = 0
|
||||
' recupero info sul rettangolo selezionato
|
||||
Dim vtDir As Vector3d = GetRettangleInfoScale(frFixed, MaxLen, MinLen)
|
||||
Dim vtDir As Vector3d = GetRectangleInfoScale(frFixed, MaxLen, MinLen)
|
||||
If vtDir.Equals(Vector3d.NULL) Then
|
||||
Return
|
||||
End If
|
||||
@@ -754,30 +790,34 @@ Public Class NestingTabVM
|
||||
|
||||
' Modifico dimensione figura
|
||||
If Math.Abs(dScalefactor) > EPS_SMALL * EPS_SMALL Then
|
||||
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||
EgtScale(m_nIdSelectedOutLoopRectangle, frFixed, dScalefactor, 1, 1, GDB_RT.GLOB)
|
||||
EgtScale(m_nIdSelectedFlatSurfRectangle, frFixed, dScalefactor, 1, 1, GDB_RT.GLOB)
|
||||
Dim ptCen As Point3d
|
||||
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
|
||||
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
|
||||
EgtMove(m_nIdSelectedTextRettangle, vtMove * 0.5)
|
||||
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
||||
EgtMove(m_nIdSelectedTextTopRettangle, vtMove * 0.5)
|
||||
EgtCenterPoint(m_nIdSelectedTextRectangle, ptCen)
|
||||
EgtModifyText(m_nIdSelectedTextRectangle, m_sTextContent & LenToString(MaxLen + dProjection, 2) & " x " & LenToString(MinLen, 2))
|
||||
EgtMove(m_nIdSelectedTextRectangle, vtMove * 0.5, GDB_RT.GLOB)
|
||||
If m_nIdSelectedTextTopRectangle <> GDB_ID.NULL Then
|
||||
EgtMove(m_nIdSelectedTextTopRectangle, vtMove * 0.5, GDB_RT.GLOB)
|
||||
End If
|
||||
End If
|
||||
|
||||
' verifico che il il lato maggiore rimanga semore il lato maggiore
|
||||
Dim bRectangleCorrect As Boolean = False
|
||||
If (MaxLen + dProjection - MinLen) > EPS_SMALL Then bRectangleCorrect = True
|
||||
|
||||
Dim nWarn As Integer = 0
|
||||
ResetAllMachinings(nWarn)
|
||||
EnableReferenceRegion(False)
|
||||
' se la modifica genera un errore allora ripristino la figura prima della defomrazione
|
||||
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRettangle), True) Then
|
||||
EgtScale(m_nIdSelectedOutLoopRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||
EgtScale(m_nIdSelectedFlatSurfRettangle, frFixed, 1 / dScalefactor, 1, 1, GDB_ID.ROOT)
|
||||
If Not EgtVerifyPart(EgtGetParent(m_nIdSelectedOutLoopRectangle), True) Or Not bRectangleCorrect Then
|
||||
EgtScale(m_nIdSelectedOutLoopRectangle, frFixed, 1 / dScalefactor, 1, 1, GDB_RT.GLOB)
|
||||
EgtScale(m_nIdSelectedFlatSurfRectangle, frFixed, 1 / dScalefactor, 1, 1, GDB_RT.GLOB)
|
||||
Dim ptCen As Point3d
|
||||
EgtCenterPoint(m_nIdSelectedTextRettangle, ptCen)
|
||||
EgtModifyText(m_nIdSelectedTextRettangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
|
||||
EgtMove(m_nIdSelectedTextRettangle, -vtMove * 0.5)
|
||||
If m_nIdSelectedTextTopRettangle <> GDB_ID.NULL Then
|
||||
EgtMove(m_nIdSelectedTextTopRettangle, -vtMove * 0.5)
|
||||
EgtCenterPoint(m_nIdSelectedTextRectangle, ptCen)
|
||||
EgtModifyText(m_nIdSelectedTextRectangle, m_sTextContent & LenToString(MaxLen, 2) & " x " & LenToString(MinLen, 2))
|
||||
EgtMove(m_nIdSelectedTextRectangle, -vtMove * 0.5, GDB_RT.GLOB)
|
||||
If m_nIdSelectedTextTopRectangle <> GDB_ID.NULL Then
|
||||
EgtMove(m_nIdSelectedTextTopRectangle, -vtMove * 0.5, GDB_RT.GLOB)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -789,20 +829,20 @@ Public Class NestingTabVM
|
||||
End Sub
|
||||
|
||||
' funzione chiamata da OnMyMouseUp: gestisce il reset di tutti gli indici in uso
|
||||
Public Sub ResetDragRettangleParam()
|
||||
Public Sub ResetDragRectangleParam()
|
||||
' deseleziono l'elemento corrente
|
||||
EgtDeselectObj(m_nIdSelectedSawRettangle)
|
||||
EgtDeselectObj(m_nIdSelectedCurvRettangle)
|
||||
EgtResetMark(m_nIdSelectedSawRettangle)
|
||||
EgtDeselectObj(m_nIdSelectedSawRectangle)
|
||||
EgtDeselectObj(m_nIdSelectedCurvRectangle)
|
||||
EgtResetMark(m_nIdSelectedSawRectangle)
|
||||
' resetto gli indici
|
||||
m_nIdSelectedOutLoopRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedRegionRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedSawRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedCurvRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedTextRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedTextTopRettangle = GDB_ID.NULL
|
||||
m_nIdSelectedFlatSurfRettangle = GDB_ID.NULL
|
||||
m_SideListRettangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
|
||||
m_nIdSelectedOutLoopRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedRegionRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedSawRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedCurvRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedTextRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedTextTopRectangle = GDB_ID.NULL
|
||||
m_nIdSelectedFlatSurfRectangle = GDB_ID.NULL
|
||||
m_SideListRectangle = {GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL, GDB_ID.NULL}
|
||||
m_sTextContent = String.Empty
|
||||
' disattivo il drag
|
||||
m_bDrag = False
|
||||
@@ -816,32 +856,226 @@ Public Class NestingTabVM
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
Private m_bDragRettangle As Boolean
|
||||
Public Property bDragRettangle As Boolean
|
||||
Private m_bDragRectangle As Boolean
|
||||
Public Property bDragRectangle As Boolean
|
||||
Get
|
||||
Return m_bDragRettangle
|
||||
Return m_bDragRectangle
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bDragRettangle = value
|
||||
m_bDragRectangle = value
|
||||
m_bSplitCurvWJ = False
|
||||
NotifyPropertyChanged("bSplitCurvWJ")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DragRettangle_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property DragRettangle_Visibility As Visibility
|
||||
Private m_DragRectangle_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property DragRectangle_Visibility As Visibility
|
||||
Get
|
||||
Return m_DragRettangle_Visibility
|
||||
Return m_DragRectangle_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DragRettangle_Cl_Span As Integer
|
||||
Get
|
||||
If m_DragRettangle_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"
|
||||
|
||||
@@ -1236,6 +1470,8 @@ Public Class NestingTabVM
|
||||
End Property
|
||||
|
||||
Public Sub StorePart(ByVal param As Object)
|
||||
' creo la lista delle famiglie di pezzi presenti in parcheggio
|
||||
GetFamilyGroupInPark()
|
||||
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
||||
' Ciclo di parcheggio dei pezzi selezionati
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
@@ -1308,13 +1544,20 @@ Public Class NestingTabVM
|
||||
If bEraseCsvParts OrElse Not EgtExistsInfo(nId, INFO_CSV_PATH) Then
|
||||
' 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 ----------------------
|
||||
' Eventuale notifica al VeinMatching
|
||||
VeinMatching.OnRemovePart(nId, False)
|
||||
' 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) = EstCalc.GetRawId() Then
|
||||
If EgtRemovePartFromRawPart(nId) Then
|
||||
' Eventuale notifica al VeinMatching
|
||||
@@ -1418,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
|
||||
@@ -1480,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
|
||||
@@ -1504,17 +1749,23 @@ Public Class NestingTabVM
|
||||
#Region "EVENTS"
|
||||
|
||||
Friend Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs)
|
||||
' se in modalità DragRettangle (deformazione delle componenti rettangolari)
|
||||
If m_bDragRettangle Then
|
||||
OnMyMouseDownSceneSelSideRettangle(sender, e)
|
||||
' se in modalità DragRectangle (deformazione delle componenti rettangolari)
|
||||
If m_bDragRectangle Then
|
||||
OnMyMouseDownSceneSelSideRectangle(sender, e)
|
||||
' Dati per drag (abilito il Drag)
|
||||
m_locPrev = e.Location
|
||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRettangle <> GDB_ID.NULL
|
||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev) And m_nIdSelectedCurvRectangle <> GDB_ID.NULL
|
||||
m_bDragToStart = m_bDrag
|
||||
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
|
||||
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
|
||||
@@ -1529,13 +1780,35 @@ Public Class NestingTabVM
|
||||
If EgtIsPart(nPartId) Or bPartInTable Then
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nPartId, nStat)
|
||||
' Se già selezionato
|
||||
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("#"c)
|
||||
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
|
||||
@@ -1556,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
|
||||
@@ -1564,8 +1837,8 @@ Public Class NestingTabVM
|
||||
End If
|
||||
|
||||
' se devo muovere un lato del rettangolo
|
||||
If m_bDragRettangle Then
|
||||
OnMyMouseMoveSawRettangle(sender, e)
|
||||
If m_bDragRectangle Then
|
||||
OnMyMouseMoveSawRectangle(sender, e)
|
||||
Return
|
||||
End If
|
||||
|
||||
@@ -1588,7 +1861,20 @@ Public Class NestingTabVM
|
||||
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)
|
||||
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)
|
||||
' Imposto stato
|
||||
@@ -1657,9 +1943,15 @@ Public Class NestingTabVM
|
||||
End Sub
|
||||
|
||||
Friend Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
||||
If m_bDragRettangle Then
|
||||
If m_bDragRectangle Then
|
||||
' deseleziono gli oggeti, resetto le variabili usate, aggiorno il disegno
|
||||
ResetDragRettangleParam()
|
||||
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
|
||||
@@ -1693,12 +1985,34 @@ Public Class NestingTabVM
|
||||
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
|
||||
Else
|
||||
' Basta reset alla fine
|
||||
End If
|
||||
|
||||
' se è stato selezionato il layer del contatore mostro la finsetra
|
||||
ElseIf m_bIsCounterLy Then
|
||||
' devo csotruire la finestra per la selezione del numero di pezzi da muovere
|
||||
' apro una finestra di dialogo per chiedere se inserire tutti i pezzi della famiglia
|
||||
Dim sRefGroup As String = String.Empty
|
||||
EgtGetInfo(m_nIdToSel, INFO_REFGROUP, sRefGroup)
|
||||
Dim DataContextSlectWD As New MultiSelectionVM(m_nCurrNubrOfParts, sRefGroup)
|
||||
Dim SelectWD As MultiSelectionV = New MultiSelectionV(Application.Current.MainWindow, DataContextSlectWD)
|
||||
DataContextSlectWD.SetMultiSelectionV(SelectWD)
|
||||
m_bIsCounterLy = False
|
||||
|
||||
' Se selezione da eseguire
|
||||
ElseIf m_nIdToSel <> GDB_ID.NULL Then
|
||||
' Determino se pezzo in tavola o in parcheggio
|
||||
@@ -1772,3 +2086,48 @@ Public Class NestingTabVM
|
||||
#End Region ' EVENTS
|
||||
|
||||
End Class
|
||||
|
||||
Class FamilyPart
|
||||
|
||||
Private PtMinStoraged As Point3d
|
||||
Private PtMaxStoraged As Point3d
|
||||
|
||||
Private m_nHText As Integer = 40
|
||||
Public ReadOnly Property nHText As Double
|
||||
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
|
||||
|
||||
Sub New(Guid As String, IdPart As Integer)
|
||||
m_sRefGuid = Guid
|
||||
m_nIdPart = IdPart
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -1678,8 +1678,11 @@ Public Class RawPartTabVM
|
||||
End Sub
|
||||
|
||||
Private Sub AdjustRawPartOnExit()
|
||||
' Se non c'è il grezzo, esco
|
||||
If EstCalc.GetRawId() = GDB_ID.NULL Then Return
|
||||
' Se non c'è il grezzo, esco dopo aver nascosto eventuale foto
|
||||
If EstCalc.GetRawId() = GDB_ID.NULL Then
|
||||
ShowPhoto(False)
|
||||
Return
|
||||
End If
|
||||
' Disabilito impostazione modificato
|
||||
Dim bOldEnMod = EgtGetEnableModified()
|
||||
If bOldEnMod Then EgtDisableModified()
|
||||
|
||||
@@ -71,7 +71,7 @@ Public Class OptionWindowVM
|
||||
OmagOFFICEMap.refRawPartTabVM.Refresh(PrevMeasureUnit)
|
||||
OmagOFFICEMap.refNestingTabVM.Refresh(PrevMeasureUnit)
|
||||
OmagOFFICEMap.refMoveRawModeVM.Refresh(PrevMeasureUnit)
|
||||
OmagOFFICEMap.refSimulTabVM.MySimul.Refresh(PrevMeasureUnit)
|
||||
If Not IsNothing(OmagOFFICEMap.refSimulTabVM.MySimul) Then OmagOFFICEMap.refSimulTabVM.MySimul.Refresh(PrevMeasureUnit)
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -128,9 +128,9 @@ Public Class TopCommandBarVM
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Sub NewCmd(Optional bUseDefaults As Boolean = False)
|
||||
Friend Sub NewCmd()
|
||||
OmagOFFICEMap.refSceneHostVM.NewProject()
|
||||
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(bUseDefaults)
|
||||
OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(False)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewCommand
|
||||
|
||||
Reference in New Issue
Block a user