Aggiunto materiale su Machgroup

Corretta sezione
Rimossa selezione grezzo
Gestione blocco interfaccia su verifica e simula
Aggiunta correzione con cancellazione cartelle progetti
Tolto ricaricmento progetto nel passaggio da proj a prod
Iniziat studio esportazione statistiche
Migliorati messaggi su nesting
Cambiata gestione tipo progetto
This commit is contained in:
Emmanuele Sassi
2021-06-29 11:38:19 +02:00
parent c0b007994a
commit 891bbd4a08
44 changed files with 577 additions and 181 deletions
+6 -6
View File
@@ -67,13 +67,13 @@ Public Class BTLStructureM
End Set
End Property
Public m_sPROJTYPE As String
Public Property sPROJTYPE As String
Public m_nPROJTYPE As Integer
Public Property nPROJTYPE As Integer
Get
Return m_sPROJTYPE
Return m_nPROJTYPE
End Get
Set(value As String)
m_sPROJTYPE = value
Set(value As Integer)
m_nPROJTYPE = value
End Set
End Property
@@ -391,7 +391,7 @@ Public Class BTLStructureM
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNAME, NewBTLStructure.m_sPROJNAME)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJPART, NewBTLStructure.m_sPROJPART)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJGUID, NewBTLStructure.m_sPROJGUID)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJTYPE, NewBTLStructure.m_sPROJTYPE)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJTYPE, NewBTLStructure.m_nPROJTYPE)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_LISTNAME, NewBTLStructure.m_sLISTNAME)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_CUSTOMER, NewBTLStructure.m_sCUSTOMER)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_ARCHITECT, NewBTLStructure.m_sARCHITECT)
@@ -127,6 +127,7 @@ Public Class BeamMachGroupM
EgtGetInfo(Id, MGR_RPT_BARLEN, dL)
EgtGetInfo(Id, MGR_RPT_BARHEIGHT, dH)
EgtGetInfo(Id, MGR_RPT_BARWIDTH, dW)
EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL)
End Sub
End Class
@@ -275,6 +275,8 @@ Public MustInherit Class MyMachGroupM
End Function
Public Shared Sub ReadMachGroupData(NewMachgroup As MyMachGroupM)
' leggo materiale
EgtGetInfo(NewMachgroup.Id, MGR_RPT_MATERIAL, NewMachgroup.sMATERIAL)
' leggo calc error
Dim nErr As Integer = 0
Dim nRot As Integer = 0
@@ -145,7 +145,8 @@ Public Class MyMachGroupPanelM
End Function
Public Function NewMachGroupID() As Integer
If Not IsNothing(MachGroupMList) AndAlso MachGroupMList.Count > 0 Then Return MachGroupMList.Max(Function(x) x.Name) + 1
Dim nTemp As Integer = 0
If Not IsNothing(MachGroupMList) AndAlso MachGroupMList.Count > 0 Then Return MachGroupMList.Select(Of Integer)(Function(x) If(Integer.TryParse(x.Name, nTemp), nTemp, 0)).Max() + 1
Return 1
End Function
+9 -3
View File
@@ -77,16 +77,22 @@ Public Class SectionXMaterial
End Property
Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
Return (S1.m_dH = S2.m_dH AndAlso S1.m_dW = S2.m_dW AndAlso S1.m_dL = S2.m_dL AndAlso S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
Return (S1.m_dH < S2.m_dH + EPS_SMALL * 100 AndAlso S1.m_dH > S2.m_dH - EPS_SMALL * 100 AndAlso
S1.m_dW < S2.m_dW + EPS_SMALL * 100 AndAlso S1.m_dW > S2.m_dW - EPS_SMALL * 100 AndAlso
S1.m_dL < S2.m_dL + EPS_SMALL * 100 AndAlso S1.m_dL > S2.m_dL - EPS_SMALL * 100 AndAlso
S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
End Operator
Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
Return (S1.m_dH <> S2.m_dH OrElse S1.m_dW <> S2.m_dW OrElse S1.m_dL <> S2.m_dL) OrElse Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))
Return S1.m_dH > S2.m_dH + EPS_SMALL * 100 OrElse S1.m_dH < S2.m_dH - EPS_SMALL * 100 OrElse
S1.m_dW > S2.m_dW + EPS_SMALL * 100 OrElse S1.m_dW < S2.m_dW - EPS_SMALL * 100 OrElse
S1.m_dL > S2.m_dL + EPS_SMALL * 100 OrElse S1.m_dL < S2.m_dL - EPS_SMALL * 100 OrElse
Not S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x))
End Operator
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is SectionXMaterial Then
Return (m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
Return Me = DirectCast(obj, SectionXMaterial) '(m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
End If
Return False
End Function
+1
View File
@@ -97,6 +97,7 @@ Public Class WallMachGroupM
EgtGetInfo(Id, MGR_RPT_PANELLEN, dL)
EgtGetInfo(Id, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(Id, MGR_RPT_PANELHEIGHT, dH)
EgtGetInfo(Id, MGR_RPT_MATERIAL, sMATERIAL)
End Sub
End Class
@@ -62,8 +62,8 @@ Public Class BTLPartVM
Dim nDuploCount As Integer = 0
If EgtDuploCount(m_BTLPartM.nPartId, nDuploCount) AndAlso nDuploCount > 0 Then
' se modalità travi e trave
If CurrentMachine.nType = MachineType.BEAM OrElse
CurrentMachine.nType = MachineType.WALL Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM OrElse
Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
If dBtlW <> m_BTLPartM.dBtlW OrElse dBtlH <> m_BTLPartM.dBtlH OrElse dBtlL <> m_BTLPartM.dBtlL Then
' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare
If MessageBox.Show(String.Format(EgtMsg(61851), nDuploCount), EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
@@ -1584,8 +1584,8 @@ Public Class BTLPartVM
Dim nDuploCount As Integer = 0
If EgtDuploCount(m_BTLPartM.nPartId, nDuploCount) AndAlso nDuploCount > 0 Then
' se modalità travi e trave
If CurrentMachine.nType = MachineType.BEAM OrElse
CurrentMachine.nType = MachineType.WALL Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM OrElse
Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' avviso che tutti i pezzi verranno tolti dai grezzi e chiedo di confermare
If MessageBox.Show(String.Format(EgtMsg(61851), nDuploCount), EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
MyMachGroupPanelM.DuploSetToDelete(m_BTLPartM.nPartId)
@@ -1767,7 +1767,7 @@ Public Class BTLPartVM
Public Sub Invert()
' eseguo inversione
m_BTLPartM.Inversion(CurrentMachine.nType)
m_BTLPartM.Inversion(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' setto part e tutte le feature da ricalcolare
ResetCalcTotalPart()
EgtDraw()
@@ -1788,7 +1788,7 @@ Public Class BTLPartVM
End Property
Public Sub BackRotation()
Rotation(False, CurrentMachine.nType)
Rotation(False, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
End Sub
#End Region ' BackRotation
@@ -1805,7 +1805,7 @@ Public Class BTLPartVM
End Property
Public Sub ForwardRotation()
Rotation(True, CurrentMachine.nType)
Rotation(True, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
End Sub
#End Region ' ForwardRotation
@@ -68,7 +68,7 @@ Public Class BTLStructureVM
Map.refShowBeamPanelVM.bShowAll = False
' aggiorno vista
Dim view As VT = VT.ISO_SW
If CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = Core.ConstBeam.MachineType.WALL Then view = VT.TOP
EgtSetView(view, False)
EgtZoom(ZM.ALL)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
@@ -76,11 +76,9 @@ Public Class BTLStructureVM
EgtResetCurrMachGroup()
' seleziono pezzo nella scena
SceneSelPartSelection()
' resetto selezione machgroup
Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = Nothing
' aggiorno vista
Dim view As VT = VT.ISO_SW
If CurrentMachine.nType = Core.ConstBeam.MachineType.WALL Then view = VT.TOP
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = Core.ConstBeam.MachineType.WALL Then view = VT.TOP
EgtSetView(view, False)
EgtZoom(ZM.ALL)
End If
@@ -226,15 +224,15 @@ Public Class BTLStructureVM
End Set
End Property
Public Property sPROJTYPE As String
Public Property nPROJTYPE As BWType
Get
Return m_BTLStructureM.m_sPROJTYPE
Return m_BTLStructureM.m_nPROJTYPE
End Get
Set(value As String)
Set(value As BWType)
If EgtSetInfo(m_BTLStructureM.nBTLInfoId, BTL_GEN_PROJTYPE, value) Then
m_BTLStructureM.m_sPROJTYPE = value
m_BTLStructureM.m_nPROJTYPE = value
Else
NotifyPropertyChanged("sPROJTYPE")
NotifyPropertyChanged(NameOf(nPROJTYPE))
End If
End Set
End Property
@@ -836,7 +834,7 @@ Public Class BTLStructureVM
Friend Sub UpdateSection(NewPartSection As SectionXMaterial, OldPartSection As SectionXMaterial)
If IsNothing(BTLPartVMList) Then Return
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' verifico se era unico con vecchia sezione
If Not m_BTLPartVMList.Any(Function(x) x.Section = OldPartSection) Then
' nel caso seleziono filtro generico
@@ -849,7 +847,7 @@ Public Class BTLStructureVM
If Not m_SectionList.Any(Function(x) x = NewPartSection) Then
m_SectionList.Add(NewPartSection)
End If
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' se ruoto o inverto parete, la sezione non cambia
End If
End Sub
@@ -1,4 +1,5 @@
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtBEAMWALL.Core
Public Class PartInRawPartListV
@@ -6,8 +7,15 @@ Public Class PartInRawPartListV
If TypeOf sender Is DataGridRow Then
Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
If Not IsNothing(Row) AndAlso Row.IsSelected Then
Dim MyMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
MyMachGroup.SelPart = MyMachGroup.SelPart
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM Then
Dim BeamMachGroup As BeamMachGroupVM = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup
If EgtGetCurrMachGroup() = GDB_ID.NULL Then Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = BeamMachGroup
BeamMachGroup.SelPart = BeamMachGroup.SelPart
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL Then
Dim WallMachGroup As WallMachGroupVM = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup
If EgtGetCurrMachGroup() = GDB_ID.NULL Then Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = WallMachGroup
WallMachGroup.SelPart = WallMachGroup.SelPart
End If
End If
End If
End Sub
@@ -140,6 +140,11 @@
<KeyBinding Key="Delete" Command="{Binding Tag.SelectedMachGroup.DeleteMachGroup_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
</DataGrid.InputBindings>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<EventSetter Event="PreviewMouseDown" Handler="RawPartList_PreviewMouseDown"/>
</Style>
</DataGrid.RowStyle>
</EgtBEAMWALL:EgtDataGrid>
@@ -1,3 +1,12 @@
Public Class RawPartListV
Private Sub RawPartList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
If TypeOf sender Is DataGridRow Then
Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
If Not IsNothing(Row) AndAlso Row.IsSelected Then
Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup = Map.refProjectVM.MachGroupPanelVM.SelectedMachGroup
End If
End If
End Sub
End Class
@@ -26,7 +26,8 @@
ToolTip="{Binding ChangeParam_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding ChangeParameter_Command}"
Visibility="{Binding ChangeParam_Visibility}">
Visibility="{Binding ChangeParam_Visibility}"
IsEnabled="{Binding InstrumentPanel_IsEnabled}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
@@ -36,7 +37,7 @@
ToolTip="{Binding Verify_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Verify_Command}"
IsEnabled="{Binding Verify_IsEnabled}">
IsEnabled="{Binding InstrumentPanel_IsEnabled}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
<Button Content="S"
@@ -45,7 +46,7 @@
ToolTip="{Binding Simulate_ToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Simulate_Command}"
IsEnabled="{Binding Simulate_IsEnabled}">
IsEnabled="{Binding InstrumentPanel_IsEnabled}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
@@ -13,6 +13,16 @@ Public Class MyInstrumentPanelVM
End Get
End Property
Private m_InstrumentPanel_IsEnabled As Boolean = True
Public Property InstrumentPanel_IsEnabled As Boolean
Get
Return m_InstrumentPanel_IsEnabled
End Get
Set(value As Boolean)
m_InstrumentPanel_IsEnabled = value
End Set
End Property
Dim m_PrevBottomPanelPage As BottomPanelVM.PartFeatureTab = BottomPanelVM.PartFeatureTab.STRUCTURE_
Private m_Statistics_IsChecked As Boolean = False
Public Property Statistics_IsChecked As Boolean
@@ -109,6 +119,11 @@ Public Class MyInstrumentPanelVM
End If
End Sub
Friend Sub SetInstrumentPanelIsEnabled(bIsEnabled As Boolean)
m_InstrumentPanel_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(InstrumentPanel_IsEnabled))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -155,6 +170,8 @@ Public Class MyInstrumentPanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub ChangeParameter()
If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso (IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) OrElse
(Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso (IsNothing(Map.refProdManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)))) Then Return
Dim ChangeParameterWndVM As New ChangeParameterWndVM
Dim ChangeParameterWnd As New ChangeParameterWndV(Application.Current.MainWindow, ChangeParameterWndVM)
If ChangeParameterWnd.ShowDialog() Then
@@ -242,11 +259,13 @@ Public Class MyInstrumentPanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Verify()
If (Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso (IsNothing(Map.refProjManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) OrElse
(Map.refMainMenuVM.SelPage = Pages.MACHINING AndAlso (IsNothing(Map.refProdManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)))) Then Return
Dim Calc As New CalcIntegration
Dim BarList() As CalcIntegration.Bar
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then
Dim TempBarList As New List(of CalcIntegration.Bar)
Dim TempBarList As New List(Of CalcIntegration.Bar)
For PartIndex = 0 To Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1
Dim CurrPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
If Not CurrPart.bDO Then Continue For
@@ -283,6 +302,9 @@ Public Class MyInstrumentPanelVM
Else
Return
End If
' disabilito interfaccia
Map.refProjectVM.ManageIsEnabled(False)
' lancio calcolo
Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
@@ -315,7 +337,7 @@ Public Class MyInstrumentPanelVM
Bar.nCmdType = CalcIntegration.CmdType.GENERATE
Case Else
Dim sMachGroupFilePath As String = Map.refProdManagerVM.CurrProd.sProdDirPath & "\" & SelMachGroup.Name.ToString() & ".ori.bwe"
If File.Exists( sMachGroupFilePath) Then File.Delete( sMachGroupFilePath)
If File.Exists(sMachGroupFilePath) Then File.Delete(sMachGroupFilePath)
Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
End Select
TempBarList(0) = Bar
@@ -323,6 +345,9 @@ Public Class MyInstrumentPanelVM
Else
Return
End If
' disabilito interfaccia
Map.refProjectVM.ManageIsEnabled(False)
' lancio calcolo
Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
End If
End Sub
@@ -384,6 +409,9 @@ Public Class MyInstrumentPanelVM
Else
Return
End If
' disabilito interfaccia
Map.refProjectVM.ManageIsEnabled(False)
' lancio simulazione
Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
If Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
@@ -402,6 +430,9 @@ Public Class MyInstrumentPanelVM
Else
Return
End If
' disabilito interfaccia
Map.refProjectVM.ManageIsEnabled(False)
' lancio simulazione
Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
End If
End Sub
@@ -61,7 +61,14 @@ Public Class CalcIntegration
End If
Next
callback(0.1, "", bCancel)
Dim bIsSimulation As Boolean = False
' se sono in simulazione
If vBar.Count > 0 AndAlso vBar(0).nCmdType = CmdType.SIMULATE Then
bIsSimulation = True
callback(0, "Simulation opened", bCancel)
Else
callback(0.1, "", bCancel)
End If
Dim ExePath As String = String.Empty
GetMainPrivateProfileString(S_BEAM, K_CALCPATH, "", ExePath)
@@ -106,7 +113,7 @@ Public Class CalcIntegration
vProc(j).Proc = New Process()
vProc(j).Proc.StartInfo.FileName = ExePath
vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " &
"""" & CurrentMachine.nType & """ " &
"""" & Map.refProjectVM.BTLStructureVM.nPROJTYPE & """ " &
"""" & CurrentMachine.sMachineName & """ " & vBar(nCurrBar).nCmdType
vProc(j).Proc.StartInfo.UseShellExecute = False
@@ -156,27 +163,37 @@ Public Class CalcIntegration
End If
If bDone Then
' Dialog con Progress Bar
nDoneBar += 1
dProgress = 1 / numBars * nDoneBar
Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
' se non sono in simulazione
If bIsSimulation Then
callback(0, "Simulation closing", bCancel)
Else
' Dialog con Progress Bar
nDoneBar += 1
dProgress = 1 / numBars * nDoneBar
Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
End If
If bCancel Then
' fine
callback(1, "", bCancel)
' riabilito interfaccia
Map.refProjectVM.ManageIsEnabled(True)
Map.refMyStatusBarVM.ResetStopProgress()
Return
End If
nPgsCurrBar = 0
nPgsClock = 0
Else
If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then
nPgsCurrBar += 1
dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar
Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
nPgsClock = 0
' se non sono in simulazione
If Not bIsSimulation Then
' aggiorno conteggio
If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then
nPgsCurrBar += 1
dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar
Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
nPgsClock = 0
End If
End If
End If
nPgsClock += 1
@@ -200,8 +217,14 @@ Public Class CalcIntegration
Thread.Sleep(300)
' fine
callback(1, "Done", bCancel)
' se sono in simulazione
If bIsSimulation Then
callback(1, "Simulation closed", bCancel)
Else
callback(1, "Done", bCancel)
End If
' riabilito interfaccia
Map.refProjectVM.ManageIsEnabled(True)
Map.refMyStatusBarVM.ResetStopProgress()
End Sub
@@ -51,26 +51,31 @@
Command="{Binding NewRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding NewRawPart_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="A"
Command="{Binding AddToRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding AddToRawPart_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="C"
Command="{Binding CopyPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyPart_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="+"
Command="{Binding AddPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddPart_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="-"
Command="{Binding RemovePart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemovePart_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
</StackPanel>
<EgtBEAMWALL:PartListV DataContext="{StaticResource PartListVM}"
@@ -88,21 +93,25 @@
Command="{Binding CopyFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyFeature_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="M"
Command="{Binding MacroFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding MacroFeature_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="+"
Command="{Binding AddFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddFeature_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="-"
Command="{Binding RemoveFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemoveFeature_ToopTip}"
IsEnabled="{Binding LeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
</StackPanel>
<EgtBEAMWALL:FeatureListV DataContext="{ StaticResource FeatureListVM}"
@@ -20,6 +20,13 @@ Public Class LeftPanelVM
End Get
End Property
Private m_LeftPanel_IsEnabled As Boolean = True
Public ReadOnly Property LeftPanel_IsEnabled As Boolean
Get
Return m_LeftPanel_IsEnabled
End Get
End Property
' Definizione comandi
Private m_cmdNewRawPart As ICommand
Private m_cmdAddToRawPart As ICommand
@@ -99,8 +106,13 @@ Public Class LeftPanelVM
#Region "METHODS"
Friend Sub UpdateView()
NotifyPropertyChanged("ViewPage_Visibility")
NotifyPropertyChanged("MachiningPage_Visibility")
NotifyPropertyChanged(NameOf(ViewPage_Visibility))
NotifyPropertyChanged(NameOf(MachiningPage_Visibility))
End Sub
Friend Sub SetLeftPanelIsEnabled(bIsEnabled As Boolean)
m_LeftPanel_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(LeftPanel_IsEnabled))
End Sub
#End Region ' METHODS
@@ -130,8 +142,6 @@ Public Class LeftPanelVM
If IsNothing(SelPart) Then Return
' verifico se sono gia' stati messi tutti i pezzi richiesti
If Not VerifyPartCount(SelPart) Then Return
' Determino il tipo di macchina (travi o pareti)
Dim nMachType As MachineType = CurrentMachine.nType
' chiedo lunghezza grezzo
Dim dRawL As Double = SelPart.dL
Dim dRawW As Double = SelPart.dW
@@ -146,7 +156,7 @@ Public Class LeftPanelVM
dRawL += 2 * dKerf
dRawW += 2 * dKerf
End If
Dim AddRawPartWndVM As New AddRawPartWndVM(CurrentMachine.nType, dRawL, dRawW, dStartOffset)
Dim AddRawPartWndVM As New AddRawPartWndVM(Map.refProjectVM.BTLStructureVM.nPROJTYPE, dRawL, dRawW, dStartOffset)
Dim AddRawPartWnd As New AddRawPartWndV(Application.Current.MainWindow, AddRawPartWndVM)
If Not AddRawPartWnd.ShowDialog() Then Return
' creo nuovo gruppo di lavorazione
@@ -161,12 +171,13 @@ Public Class LeftPanelVM
' lo rendo std
EgtSetMode(nPartDuploId, GDB_MD.STD)
Dim sLogPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\RawPartLog.txt"
If CurrentMachine.nType = MachineType.BEAM Then
' scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refProdManagerVM.CurrProd.nProdId)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PATTID, nCurrMachGroup)
' scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_PRODID, Map.refProdManagerVM.CurrProd.nProdId)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PATTID, nCurrMachGroup)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' scrivo dati costruzione grezzo in gruppo di lavorazione
EgtSetInfo(nCurrMachGroup, MGR_RPT_BARLEN, AddRawPartWndVM.VariableList(0).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelPart.sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & AddRawPartWndVM.VariableList(1).dValue)
Dim BeamMachGroup As BeamMachGroupVM = Map.refMachGroupPanelVM.GetLastMachGroup()
' eseguo script creazione grezzo
@@ -186,20 +197,25 @@ Public Class LeftPanelVM
' aggiorno dati ultilizzo barra
BeamMachGroup.UpdateUsage()
EgtSetView(VT.ISO_SW, False)
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' scrivo dati in gruppo di lavorazione
Dim dPosX As Double = dKerf
Dim dPosY As Double = dKerf
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELLEN, AddRawPartWndVM.VariableList(0).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PANELWIDTH, AddRawPartWndVM.VariableList(1).dValue)
EgtSetInfo(nCurrMachGroup, MGR_RPT_MATERIAL, SelPart.sMATERIAL)
EgtSetInfo(nCurrMachGroup, MGR_RPT_PART & 1, nPartDuploId & "," & dPosX & "," & dPosY & "," & 0 & "," & 0)
Dim WallMachGroup As WallMachGroupVM = DirectCast(Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1), WallMachGroupVM)
' eseguo script creazione grezzo
If Not ExecWall(sLogPath, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then
WallMachGroup.DeleteMachGroup()
Dim LogFile As String() = File.ReadAllLines(sLogPath)
If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
MessageBox.Show(LogFile(1), EgtMsg(30007), MessageBoxButton.OK, MessageBoxImage.Error)
If File.Exists(sLogPath) Then
Dim LogFile As String() = File.ReadAllLines(sLogPath)
If LogFile.Count >= 2 AndAlso Not IsNothing(LogFile(1)) Then
MessageBox.Show(LogFile(1), EgtMsg(30007), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Else
MessageBox.Show("Impossible creating rawpart", EgtMsg(30007), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Return
End If
@@ -208,6 +224,8 @@ Public Class LeftPanelVM
EgtSetInfo(nPartDuploId, MGR_PRT_POSY, dPosY)
EgtSetInfo(nPartDuploId, MGR_PRT_ROT, 0)
EgtSetInfo(nPartDuploId, MGR_PRT_FLIP, False)
' aggiorno contatore pezzi usati in Prod
SelPart.RefreshPartInProd()
' aggiorno lista pezzi
WallMachGroup.m_WallMachGroupM.RefreshPartList()
WallMachGroup.m_WallMachGroupM.RefreshGroupData()
@@ -263,11 +281,19 @@ Public Class LeftPanelVM
If IsNothing(SelMachGroup) Then Return
' verifico se sono gia' stati messi tutti i pezzi richiesti
If Not VerifyPartCount(SelPart) Then Return
If CurrentMachine.nType = MachineType.BEAM Then
' verifico se impostato gruppo di lavorazione
Dim nCurrMachgroupId As Integer = EgtGetCurrMachGroup()
' se nullo o diverso da quello selezionato in lista
If nCurrMachgroupId = GDB_ID.NULL OrElse nCurrMachgroupId <> SelMachGroup.Id Then
' lo imposto
EgtSetCurrMachGroup(SelMachGroup.Id)
End If
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
Dim BeamMachGroup As BeamMachGroupVM = DirectCast(SelMachGroup, BeamMachGroupVM)
' verifico sezione
' verifico sezione e materiale
If SelPart.dW < BeamMachGroup.dW - EPS_SMALL OrElse SelPart.dW > BeamMachGroup.dW + EPS_SMALL OrElse
SelPart.dH < BeamMachGroup.dH - EPS_SMALL OrElse SelPart.dH > BeamMachGroup.dH + EPS_SMALL Then
SelPart.dH < BeamMachGroup.dH - EPS_SMALL OrElse SelPart.dH > BeamMachGroup.dH + EPS_SMALL OrElse
SelPart.Section <> BeamMachGroup.Section Then
MessageBox.Show(EgtMsg(61866), EgtMsg(30007))
Return
End If
@@ -283,7 +309,7 @@ Public Class LeftPanelVM
' aggiorno dati ultilizzo barra
BeamMachGroup.UpdateUsage()
EgtSetView(VT.ISO_SW, False)
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Dim WallMachGroup As WallMachGroupVM = DirectCast(SelMachGroup, WallMachGroupVM)
' verifico spessore
If SelPart.dH < WallMachGroup.dH - EPS_SMALL OrElse SelPart.dH > WallMachGroup.dH + EPS_SMALL Then
@@ -24,14 +24,14 @@ Public Class MyMachGroupPanelVM
Public ReadOnly Property sTotVolume As String
Get
Dim dMMTotVolume As Double = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.dUnitVolume, Func(Of MachGroupVM, Integer)))
Dim dMMTotVolume As Double = Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.dUnitVolume, Func(Of MachGroupVM, Double)))
Return If(EgtUiUnitsAreMM(), DoubleToString(dMMTotVolume / 1000000000, 3), DoubleToString(dMMTotVolume * (12 / ONEINCH), 3))
End Get
End Property
Public ReadOnly Property sTotTime As String
Get
Return TimeSpan.FromSeconds(Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.nCALC_TIME, Func(Of MachGroupVM, Integer)))).ToString()
Return TimeSpan.FromSeconds(Map.refProjectVM.MachGroupPanelVM.MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) x.nCALC_TIME, Func(Of MachGroupVM, Double)))).ToString()
End Get
End Property
@@ -180,20 +180,7 @@ Public Class MyMachGroupPanelVM
End Sub
Public Overrides Sub AddMachGroup()
Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, CurrentMachine.nType)
'' creo oggetto gruppo creato
'Dim sNewMachGroupName As String = String.Empty
'Dim sNewMachGroupMachineName As String = String.Empty
'EgtGetMachGroupName(nNewMachGroupID, sNewMachGroupName)
'EgtGetMachGroupMachineName(nNewMachGroupID, sNewMachGroupMachineName)
'Dim MyMachGroup As MyMachGroupM
'If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
' MyMachGroup = New BeamMachGroupVM(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
'Else
' MyMachGroup = New WallMachGroup(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
'End If
'' lo aggiungo alla lista
'MachGroupList.Add(MyMachGroup)
Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' e lo seleziono
SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MyMachGroupM)
End Sub
@@ -259,15 +259,25 @@ Public MustInherit Class MyMachGroupVM
End Get
End Property
Public ReadOnly Property Section As SectionXMaterial
Get
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.sMATERIAL)
End Get
End Property
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
#Region "CONSTRUCTORS"
Sub New(MyMachGroupM As MyMachGroupM)
MyBase.New(MyMachGroupM)
'aggiorno lista pezzi
RefreshPartList()
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Friend MustOverride Function Copy() As MyMachGroupVM
@@ -1,7 +1,8 @@
<StackPanel x:Class="MainMenuV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Horizontal">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Horizontal"
IsEnabled="{Binding MainMenu_IsEnabled}">
<!--Barra superiore dei comandi-->
<UniformGrid Rows="1">
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
@@ -9,6 +10,13 @@ Public Class MainMenuVM
#Region "FIELDS & PROPERTIES"
Private m_MainMenu_IsEnabled As Boolean = True
Public ReadOnly Property MainMenu_IsEnabled As Boolean
Get
Return m_MainMenu_IsEnabled
End Get
End Property
Public Property View_IsChecked As Boolean
Get
Return m_SelPage = Pages.VIEW
@@ -130,6 +138,11 @@ Public Class MainMenuVM
#Region "METHODS"
Friend Sub SetMainMenuIsEnabled(bIsEnabled As Boolean)
m_MainMenu_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(MainMenu_IsEnabled))
End Sub
Private Function InitVIEW() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(True)
@@ -143,14 +156,25 @@ Public Class MainMenuVM
Map.refProjectVM.NotifyAllPanelVisibility()
' apro progetto proj
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
If IsNothing(Map.refProjManagerVM.CurrProj) OrElse Map.refProjManagerVM.CurrProj.bReloadProject Then
Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
Else
' verifico se il prod di provenienza ha piu' proj
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
End If
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll()
Map.refProjManagerVM.CurrProj.SetReloadProject(True)
End If
DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
Else
Map.refSceneHostVM.MainController.NewProject()
Map.refProjectVM.BTLStructureVM = Nothing
Map.refProjectVM.MachGroupPanelVM = Nothing
End If
Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Return True
End Function
@@ -190,7 +214,17 @@ Public Class MainMenuVM
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd.nProdId) AndAlso Map.refProdManagerVM.CurrProd.nProdId > 0 Then
If File.Exists(Map.refProdManagerVM.CurrProd.sProdPath) Then
' apro progetto
Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False)
If IsNothing(Map.refProdManagerVM.CurrProd) OrElse Map.refProdManagerVM.CurrProd.bReloadProject Then
Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False)
Else
' verifico se il prod ha piu' proj
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' se si rigenero BTLStructure
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
End If
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
Map.refProjManagerVM.CurrProj.SetReloadProject(True)
End If
'DbControllers.m_ProdController.ResetController()
DbControllers.m_ProdController.LockByProdId(Map.refProdManagerVM.CurrProd.nProdId, True)
' seleziono prima barra
@@ -225,7 +259,6 @@ Public Class MainMenuVM
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
Dim x = EgtGetEnableModified()
EgtResetCurrMachGroup()
Return True
End Function
@@ -102,7 +102,8 @@
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!-- Delete --><!--
<!-- Delete -->
<!--
<DataGridTemplateColumn x:Key="colDELETE"
Width="Auto"
IsReadOnly="True">
@@ -22,16 +22,6 @@ Public Class OpenProjectFileDialogVM
Private m_FileNameTxBl As TextBlock
Private m_sDirectory As String
Public Property Directory As String
Get
Return m_sDirectory
End Get
Set(value As String)
m_sDirectory = value
End Set
End Property
Private m_sFilter As String
Public Property Filter As String
Get
@@ -284,8 +274,14 @@ Public Class OpenProjectFileDialogVM
MessageBox.Show(EgtMsg(61873), EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
' cancello progetto
' cancello progetto da Db
DbControllers.m_ProjController.DeleteProj(SelProject.nProjId)
' cancello cartella del Proj
Try
Directory.Delete(SelProject.sProjDirPath, True)
Catch ex As Exception
EgtOutLog("Error in deleting directory " & SelProject.sProjDirPath)
End Try
' aggiorno lista progetti
m_ProjectList.Clear()
Dim DbProjectList As New List(Of ProjFileM)
@@ -344,6 +340,12 @@ Public Class OpenProjectFileDialogVM
If Not IsNothing(Map.refProjManagerVM.CurrProj) AndAlso Map.refProjManagerVM.CurrProj.nProdId = SelProject.nProdId Then
Map.refProjManagerVM.UpdateCurrProj()
End If
' cancello cartella del Prod
Try
Directory.Delete(SelProject.sProdDirPath, True)
Catch ex As Exception
EgtOutLog("Error in deleting directory " & SelProject.sProdDirPath)
End Try
' aggiorno lista progetti
m_ProjectList.Clear()
Dim DbProjectList As New List(Of ProdFileM)
@@ -22,7 +22,8 @@
Width="70"
FontWeight="Light"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Optimize_Command}">
Command="{Binding Optimize_Command}"
IsEnabled="{Binding OptimizePanel_IsEnabled}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
@@ -6,6 +6,8 @@ Imports EgtWPFLib5
Public Class OptimizePanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend Enum PartType As Integer
MATERIAL = 0
ALL = 1
@@ -52,16 +54,13 @@ Public Class OptimizePanelVM
End Set
End Property
Private m_OptimizePanel_IsEnabled As Boolean = True
Public ReadOnly Property OptimizePanel_IsEnabled As Boolean
Get
Return m_OptimizePanel_IsEnabled
End Get
End Property
' Definizione comandi
Private m_cmdOptimize As ICommand
Private m_cmdWarehouse As ICommand
Sub New()
m_SelPartType = PartTypeList(0)
m_SelOriginType = OriginTypeList(0)
NotifyPropertyChanged(NameOf(SelPartType))
End Sub
#Region "Messages"
@@ -79,6 +78,33 @@ Public Class OptimizePanelVM
#End Region ' Messages
' Definizione comandi
Private m_cmdOptimize As ICommand
Private m_cmdWarehouse As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' aggiungo riferimento a Map
Map.SetRefOptimizePanelVM(Me)
m_SelPartType = PartTypeList(0)
m_SelOriginType = OriginTypeList(0)
NotifyPropertyChanged(NameOf(SelPartType))
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetOptimizePanelIsEnabled(bIsEnabled As Boolean)
m_OptimizePanel_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(OptimizePanel_IsEnabled))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Optimize"
@@ -105,6 +131,8 @@ Public Class OptimizePanelVM
Dim dSectionTime As Double = GetMainPrivateProfileDouble(S_NEST, K_SECTIONTIME, 1)
Dim dPartTime As Double = GetMainPrivateProfileDouble(S_NEST, K_PARTTIME, 1)
Dim SectionList As New List(Of SParam)
' disabilito interfaccia
Map.refProjectVM.ManageIsEnabled(False)
' se ho selezionato nest per materiale e c'è una sezione selezionata diversa da sezione nulla
If m_SelPartType.Id = PartType.MATERIAL AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelSection) AndAlso Map.refProjectVM.BTLStructureVM.SelSection.dH <> -1 Then
SectionList.Add(New SParam(Map.refProjectVM.BTLStructureVM.SelSection, 0, 0))
@@ -126,7 +154,7 @@ Public Class OptimizePanelVM
Case WarehouseType.BASIC
Dim nQuantity As Integer = 0
sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' leggo lunghezza barra
Dim nCurrentL As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_CURRENT & WRH_L, 1, sWarehouseIniPath)
dRawL = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_BEAM, WRH_L & nCurrentL, 0, sWarehouseIniPath)
@@ -139,13 +167,17 @@ Public Class OptimizePanelVM
Section.dL = dRawL
Section.nQuantity = nQuantity
Next
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
Dim sPanelDim As String = ""
Dim sPanelDims() As String
EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath)
If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c)
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then
' riabilito interfaccia
Map.refProjectVM.ManageIsEnabled(True)
Return
End If
' leggo start offset, offset e quantity
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
@@ -162,7 +194,7 @@ Public Class OptimizePanelVM
Dim nIndex As Integer = 1
sWarehouseIniPath = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
' aggiungo le sezioni con diverse lunghezze in base al warehouse
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' leggo start offset ed offset
dStartOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_STARTOFFSET, 0, sWarehouseIniPath)
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_BEAM, WRH_OFFSET, 0, sWarehouseIniPath)
@@ -177,13 +209,17 @@ Public Class OptimizePanelVM
Next
nIndex += 1
End While
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Dim nCurrentS As Integer = EgtUILib.GenInterface.GetPrivateProfileInt(WRH_WALL, WRH_CURRENT & WRH_S, nCurrentS, sWarehouseIniPath)
Dim sPanelDim As String = ""
Dim sPanelDims() As String
EgtUILib.GenInterface.GetPrivateProfileString(WRH_WALL, WRH_S & nCurrentS, "", sPanelDim, sWarehouseIniPath)
If Not String.IsNullOrWhiteSpace(sPanelDim) Then sPanelDims = sPanelDim.Split(","c)
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then Return
If Not sPanelDims.Count = 2 OrElse Not StringToDouble(sPanelDims(0), dRawL) OrElse Not StringToDouble(sPanelDims(1), dRawW) Then
' riabilito interfaccia
Map.refProjectVM.ManageIsEnabled(True)
Return
End If
dOffset = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_OFFSET, 0, sWarehouseIniPath)
dKerf = EgtUILib.GenInterface.GetPrivateProfileDouble(WRH_WALL, WRH_KERF, 0, sWarehouseIniPath)
' leggo lunghezza barra e quantity
@@ -217,6 +253,8 @@ Public Class OptimizePanelVM
Map.refMyStatusBarVM.EndLoading("Nesting completed")
' seleziono ultimo gruppo
Map.refProjectVM.MachGroupPanelVM.SelLastMachGroup()
' riabilito interfaccia
Map.refProjectVM.ManageIsEnabled(True)
End Sub
#End Region ' Optimize
@@ -2,58 +2,77 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Orientation="Horizontal"
Height="28">
Height="28"
IsEnabled="{Binding PartManager_IsEnabled}">
<TextBlock Text="BTL Qty"
Style="{StaticResource OptionTextBlock}"/>
<TextBlock Text="{Binding sCNT, UpdateSourceTrigger=Explicit}"
<TextBlock Text="{Binding Tag.sCNT,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}},
UpdateSourceTrigger=Explicit}"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<TextBlock Text="Added Qty"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sADDED, UpdateSourceTrigger=Explicit}"
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sADDED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}},
UpdateSourceTrigger=Explicit}"
Width="25"/>
<TextBlock Text="W"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sW, UpdateSourceTrigger=Explicit}" Width="45"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sW,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}},
UpdateSourceTrigger=Explicit}" Width="45"/>
<TextBlock Text="H"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sH, UpdateSourceTrigger=Explicit}" Width="45"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sH,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}},
UpdateSourceTrigger=Explicit}" Width="45"/>
<TextBlock Text="L"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sL, UpdateSourceTrigger=Explicit}" Width="65"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sL,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}},
UpdateSourceTrigger=Explicit}" Width="65"/>
<TextBlock Text="Inverti"
Style="{StaticResource OptionTextBlock}"
Margin="10,0,0,0"/>
<Button Content="&lt;"
Command="{Binding Invert_Command}"
Command="{Binding Tag.Invert_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="5,0,0,0"/>
<TextBlock Text="{Binding sINVERTED}"
<TextBlock Text="{Binding Tag.sINVERTED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
TextAlignment="Center"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<Button Content="&gt;"
Command="{Binding Invert_Command}"
Command="{Binding Tag.Invert_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="0,0,5,0"/>
<TextBlock Text="Ruota"
Style="{StaticResource OptionTextBlock}"
Margin="10,0,0,0"/>
<Button Content="&lt;"
Command="{Binding BackRotation_Command}"
Command="{Binding Tag.BackRotation_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="5,0,0,0"/>
<TextBlock Text="{Binding sROTATED}"
<TextBlock Text="{Binding Tag.sROTATED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
TextAlignment="Center"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<Button Content="&gt;"
Command="{Binding ForwardRotation_Command}"
Command="{Binding Tag.ForwardRotation_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="0,0,10,0"/>
<TextBlock Text="{Binding sNAM}"
<TextBlock Text="{Binding Tag.sNAM,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource OptionTextBlock}"/>
</StackPanel>
@@ -1,3 +1,22 @@
Public Class PartManagerVM
Inherits VMBase
Private m_PartManager_IsEnabled As Boolean = True
Public ReadOnly Property PartManager_IsEnabled As Boolean
Get
Return m_PartManager_IsEnabled
End Get
End Property
Sub New()
' salvo riferimento in Map
Map.SetRefPartManagerVM(Me)
End Sub
Friend Sub SetPartManagerIsEnabled(bIsEnabled As Boolean)
m_PartManager_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(PartManager_IsEnabled))
End Sub
End Class
@@ -4,6 +4,7 @@
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
IsRightDockable="False"
IsEnabled="{Binding ProdManager_IsEnabled}"
Style="{StaticResource ToolBar_EgtFloatingPanel}">
<!--Barra superiore dei comandi-->
@@ -11,6 +11,13 @@ Public Class ProdManagerVM
#Region "FIELDS & PROPERTIES"
Private m_ProdManager_IsEnabled As Boolean = True
Public ReadOnly Property ProdManager_IsEnabled As Boolean
Get
Return m_ProdManager_IsEnabled
End Get
End Property
Private m_CurrProd As ProdFileVM
Friend Property CurrProd As ProdFileVM
Get
@@ -102,6 +109,11 @@ Public Class ProdManagerVM
Return True
End Function
Friend Sub SetProdManagerIsEnabled(bIsEnabled As Boolean)
m_ProdManager_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(ProdManager_IsEnabled))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -244,6 +256,8 @@ Public Class ProdManagerVM
End If
' apro progetto proj
Map.refProjManagerVM.SetCurrProj(nProjId)
' ricarico progetto se il prod e' nullo (quindi e' stato cancellato)
Map.refProjManagerVM.CurrProj.SetReloadProject(IsNothing(CurrProd))
' vado in pagina proj
Map.refMainMenuVM.SetSelPage(Pages.VIEW, False)
End Sub
@@ -4,6 +4,7 @@
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
IsRightDockable="False"
IsEnabled="{Binding ProjManager_IsEnabled}"
Style="{StaticResource ToolBar_EgtFloatingPanel}">
<!--Barra superiore dei comandi-->
@@ -10,6 +10,13 @@ Public Class ProjManagerVM
#Region "FIELDS & PROPERTIES"
Private m_ProjManager_IsEnabled As Boolean = True
Public ReadOnly Property ProjManager_IsEnabled As Boolean
Get
Return m_ProjManager_IsEnabled
End Get
End Property
Private m_CurrProj As ProjFileVM
Friend Property CurrProj As ProjFileVM
Get
@@ -220,6 +227,11 @@ Public Class ProjManagerVM
Return SetCurrProj(CurrProj.nProjId)
End Function
Friend Sub SetProjManagerIsEnabled(bIsEnabled As Boolean)
m_ProjManager_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(ProjManager_IsEnabled))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -337,6 +349,9 @@ Public Class ProjManagerVM
''' </summary>
Public Sub Save()
If IsNothing(CurrProj) Then Return
' verifico se assemblato e lo annullo per salvataggio
Dim bShowBuilding As Boolean = Map.refShowBeamPanelVM.ShowBuilding_IsChecked
If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(False, False)
Map.refSceneHostVM.SaveProject()
Map.refMainWindowVM.SetTitle(CurrProj.nProjId.ToString("0000") & " - " & CurrProj.sBTLFileName & " - EgtBEAMWALL")
' aggiorno BTLParts su DB
@@ -347,6 +362,8 @@ Public Class ProjManagerVM
DbControllers.m_ProjController.ResetNew(CurrProj.nProjId)
m_CurrProj.bIsNew = False
End If
' se assemplato lo ripristino
If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False)
' aggiorno titolo
Map.refMainWindowVM.UpdateTitle()
End Sub
@@ -425,15 +442,6 @@ Public Class ProjManagerVM
End If
Dim sProjFileName As String = sProjDir & "\" & nProjId.ToString("0000") & ".nge"
If bOk Then
' scrivo info proj su tutti i pezzi
Dim nPartId = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
EgtSetInfo(nPartId, BTL_PRT_PROJ, nProjId)
nPartId = EgtGetNextPart(nPartId)
End While
' scrivo info proj su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, nProjId)
' salvo il progetto
bOk = EgtSaveFile(sProjFileName, NGE.CMPTEXT)
Else
@@ -780,6 +788,7 @@ Public Class ProjManagerVM
Dim nProdId As Integer = Map.refProjManagerVM.CurrProj.nProdId
If nProdId > 0 Then
Map.refProdManagerVM.SetCurrProd(nProdId)
Map.refProdManagerVM.CurrProd.SetReloadProject(False)
Else
'creo nuova ottimizzazione da progetto corrente
NewProdFromProj()
@@ -842,6 +851,7 @@ Public Class ProjManagerVM
'' End If
'' End If
'' Case MessageBoxResult.Cancel
'' m_bReloadProject = True
'' Return
''End Select
End If
@@ -42,7 +42,8 @@
DataContext="{Binding BTLStructure.SelPart}"
Visibility="{Binding DataContext.FeatureManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>-->
<EgtBEAMWALL:PartManagerV DockPanel.Dock="Bottom"
DataContext="{Binding BTLStructureVM.SelBTLPart}"
DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.PartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<EgtBEAMWALL:FreeContourInputV DockPanel.Dock="Right"
@@ -165,5 +165,23 @@
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub ManageIsEnabled(bIsEnabled As Boolean)
Map.refInstrumentPanelVM.SetInstrumentPanelIsEnabled(bIsEnabled)
Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled)
Map.refPartManagerVM.SetPartManagerIsEnabled(bIsEnabled)
Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled)
Map.refProjManagerVM.SetProjManagerIsEnabled(bIsEnabled)
Map.refProdManagerVM.SetProdManagerIsEnabled(bIsEnabled)
Map.refTopPanelVM.SetTopPanelIsEnabled(bIsEnabled)
Map.refOptimizePanelVM.SetOptimizePanelIsEnabled(bIsEnabled)
' aggiungere gestione colonne editabili delle tabelle
End Sub
#End Region ' METHODS
End Class
@@ -83,6 +83,14 @@ Public Class ProjectFileVM
End Get
End Property
' variabile che indica se ricaricare il progetto
Private m_bReloadProject As Boolean = True
Friend ReadOnly Property bReloadProject As Boolean
Get
Return m_bReloadProject
End Get
End Property
#Region "Messages"
Public ReadOnly Property Id_Msg As String
@@ -122,4 +130,8 @@ Public Class ProjectFileVM
#End Region ' CONSTRUCTORS
Friend Sub SetReloadProject(bValue As Boolean)
m_bReloadProject = bValue
End Sub
End Class
@@ -540,7 +540,7 @@ Public Class MySceneHostVM
' leggo struttura BTL
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
' setto il tipo di progetto nella BTLStructure creata
Map.refProjectVM.BTLStructureVM.sPROJTYPE = Map.refProjManagerVM.nProjType
Map.refProjectVM.BTLStructureVM.nPROJTYPE = Map.refProjManagerVM.nProjType
' Ricavo il tipo di Warehouse settato nell'INI
Dim nDefault As Integer = 1
If GetMainPrivateProfileInt(S_GENERAL, K_WAREHOUSE, nDefault) = WarehouseType.MEDIUM Then
@@ -550,12 +550,12 @@ Public Class MySceneHostVM
' scrivo in ogni pezzo ProjId
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
' guardo se esiste info numero progetto a cui appartiene
If Not EgtGetInfo(nPartId, PROJ, Map.refProjManagerVM.nLastProjId) Then
EgtSetInfo(nPartId, PROJ, Map.refProjManagerVM.nLastProjId)
End If
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
nPartId = EgtGetNextPart(nPartId)
End While
' scrivo info proj su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll()
Else
@@ -751,13 +751,21 @@ Public Class MySceneHostVM
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bFound As Boolean = False
If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then
Dim nLayerId As Integer = EgtGetParent(nPartId)
Dim sLayerName As String = ""
EgtGetName(nLayerId, sLayerName)
If sLayerName <> ASSEBASE Then Continue While
Else
If Not EgtIsPart(nPartId) Then Continue While
If sLayerName <> ASSEBASE Then
bFound = True
End If
End If
If Not EgtIsPart(nPartId) Then
bFound = True
End If
If Not bFound Then
nId = EgtGetNextObjInSelWin()
Continue While
End If
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
@@ -142,9 +142,10 @@ Public Class ShowBeamPanelVM
' mostro in parte bassa dati BTL
Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.STRUCTURE_)
' mostro tutti i pezzi
Map.refProjectVM.BTLStructureVM.ShowAll()
Map.refProjectVM.BTLStructureVM.ShowAll(False)
' se attivata opzione, li assemblo
Map.refProjectVM.BTLStructureVM.ShowBuilding(ShowBuilding_IsChecked)
Map.refProjectVM.BTLStructureVM.ShowBuilding(ShowBuilding_IsChecked, False)
EgtDraw()
End Sub
#End Region ' ShowAll
@@ -15,10 +15,11 @@
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
SelectionMode="Extended"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
x:Name="dgDisplay"
Margin="0,0,0,5">
<DataGrid.Columns>
<!--Id - Nome-->
@@ -32,12 +33,13 @@
</DataGridTextColumn>
<!--W - Larghezza-->
<DataGridTextColumn Binding="{Binding dW}"
Header="W"
IsReadOnly="True">
<DataGridTextColumn.HeaderTemplate>
<!--<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataContext.W_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn.HeaderTemplate>-->
</DataGridTextColumn>
<!--H - Altezza-->
<DataGridTextColumn Binding="{Binding dH}"
@@ -107,6 +109,9 @@
<TextBlock Text="{Binding TotMachGroups_Msg}"/>
<TextBlock Text="{Binding Tag.sTotParts,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
<Button Content="Print"
x:Name="PrintBtn"
Visibility="Collapsed"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding BTLTotVolume_Msg}"/>
@@ -1,3 +1,20 @@
Public Class OptimizerStatisticsV
Private Sub cc() Handles PrintBtn.Click
ExportToExcelAndCsv()
End Sub
Private Sub ExportToExcelAndCsv()
dgDisplay.SelectAllCells()
dgDisplay.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader
ApplicationCommands.Copy.Execute(Nothing, dgDisplay)
Dim resultat As String = CType(Clipboard.GetData(DataFormats.CommaSeparatedValue), String)
Dim result As String = CType(Clipboard.GetData(DataFormats.Text), String)
dgDisplay.UnselectAllCells()
Dim file1 As System.IO.StreamWriter = New System.IO.StreamWriter("C:\Temp\test.csv")
file1.WriteLine(result.Replace(","c, " "c))
file1.Close()
MessageBox.Show(" Exporting DataGrid data to Excel file created.xls")
End Sub
End Class
@@ -137,4 +137,29 @@ Public Class StatisticsVM
#End Region ' Messages
' Definizione comandi
Private m_cmdPrint As ICommand
#Region "COMMANDS"
#Region "Invert"
Public ReadOnly Property Print_Command As ICommand
Get
If m_cmdPrint Is Nothing Then
m_cmdPrint = New Command(AddressOf Print)
End If
Return m_cmdPrint
End Get
End Property
Public Sub Print()
End Sub
#End Region ' Invert
#End Region ' COMMANDS
End Class
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Height="300">
Height="350">
<TabControl SelectedIndex="{Binding SelTab}"
TabStripPlacement="Right"
@@ -31,18 +31,22 @@
<Button Content="P"
Command="{Binding ProduceRawPart_Command}"
ToolTip="{Binding ProduceRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="PA"
Command="{Binding ProduceAllRawPart_Command}"
ToolTip="{Binding ProduceAllRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="C"
Command="{Binding CopyRawPart_Command}"
ToolTip="{Binding CopyRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="-"
Command="{Binding RemoveRawPart_Command}"
ToolTip="{Binding RemoveRawPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
</StackPanel>
@@ -56,20 +60,24 @@
Command="{Binding ReOrderPart_Command}"
Visibility="{Binding MovePart_Visibility}"
ToolTip="{Binding ReOrderPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="˄"
Command="{Binding MoveUpPart_Command}"
Visibility="{Binding MovePart_Visibility}"
ToolTip="{Binding MoveUpPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownPart_Command}"
Visibility="{Binding MovePart_Visibility}"
ToolTip="{Binding MoveDownPart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
<Button Content="-"
Command="{Binding RemovePart_Command}"
ToolTip="{Binding RemovePart_ToolTip}"
IsEnabled="{Binding TopPanel_IsEnabled}"
Style="{StaticResource LeftPanel_SmallButton}"/>
</StackPanel>
<EgtBEAMWALL:PartInRawPartListV Grid.Row="3"
@@ -28,6 +28,13 @@ Public Class TopPanelVM
NotifyPropertyChanged(NameOf(SelTab))
End Sub
Private m_TopPanel_IsEnabled As Boolean = True
Public ReadOnly Property TopPanel_IsEnabled As Boolean
Get
Return m_TopPanel_IsEnabled
End Get
End Property
' Definizione comandi
Private m_cmdProduceAllRawPart As ICommand
Private m_cmdProduceRawPart As ICommand
@@ -108,6 +115,11 @@ Public Class TopPanelVM
#Region "METHODS"
Friend Sub SetTopPanelIsEnabled(bIsEnabled As Boolean)
m_TopPanel_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(TopPanel_IsEnabled))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -38,6 +38,7 @@
<EgtBEAMWALL:FreeContourInputVM x:Key="FreeContourInputVM"/>
<EgtBEAMWALL:FeatureManagerVM x:Key="FeatureManagerVM"/>
<EgtBEAMWALL:StatisticsVM x:Key="StatisticsVM"/>
<EgtBEAMWALL:PartManagerVM x:Key="PartManagerVM"/>
<!--<OmagOFFICE:VeinMatchPanelVM x:Key="VeinMatchPanelVM"/>
<OmagOFFICE:OptionPanelVM x:Key="OptionPanelVM"/>
<OmagOFFICE:RawPartTabVM x:Key="RawPartTabVM"/>
@@ -71,15 +71,19 @@ Module LuaExec
End Function
Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), dLength As Double, dWidth As Double, dStartOffset As Double, dOffset As Double, dKerf As Double, nQty As Integer, nNestTime As Integer) As Boolean
If PartList.Count = 0 Then
EgtOutLog("Exit nesting: no parts received!")
Return True
End If
EgtOutLog("-- Start ExecNest --")
' Recupero lo script da eseguire
Dim sExecPath As String = ""
Dim sExecName As String = ""
GetMainPrivateProfileString(S_NEST, K_NESTEXEC, "", sExecName)
Dim sRoot As String = ""
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot
End If
sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c})
@@ -96,6 +100,7 @@ Module LuaExec
EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset)
EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset)
EgtLuaSetGlobNumVar("NEST.KERF", dKerf)
EgtLuaSetGlobStringVar("NEST.MATERIAL", PartList(0).sMATERIAL)
EgtLuaSetGlobNumVar("NEST.QTY", nQty)
EgtLuaSetGlobNumVar("NEST.TIME", nNestTime)
EgtLuaSetGlobNumVar("NEST.PRODID", Map.refProdManagerVM.CurrProd.nProdId)
@@ -20,8 +20,10 @@ Module Map
Private m_refFeatureListVM As FeatureListVM
Private m_refFreeContourManagerVM As FreeContourManagerVM
Private m_refFreeContourInputVM As FreeContourInputVM
Private m_refPartManagerVM As PartManagerVM
Private m_refInstrumentPanelVM As InstrumentPanelVM
Private m_refTopPanelVM As TopPanelVM
Private m_refOptimizePanelVM As OptimizePanelVM
'Private m_refRawPartTabVM As RawPartTabVM
'Private m_refNestingTabVM As NestingTabVM
'Private m_refMachiningTabVM As MachiningTabVM
@@ -150,6 +152,12 @@ Module Map
End Get
End Property
Public ReadOnly Property refPartManagerVM As PartManagerVM
Get
Return m_refPartManagerVM
End Get
End Property
Public ReadOnly Property refInstrumentPanelVM As MyInstrumentPanelVM
Get
Return m_refInstrumentPanelVM
@@ -162,6 +170,12 @@ Module Map
End Get
End Property
Public ReadOnly Property refOptimizePanelVM As OptimizePanelVM
Get
Return m_refOptimizePanelVM
End Get
End Property
'Public ReadOnly Property refOptionPanelVM As OptionPanelVM
' Get
' Return m_refOptionPanelVM
@@ -303,6 +317,11 @@ Module Map
Return Not IsNothing(m_refFreeContourInputVM)
End Function
Friend Function SetRefPartManagerVM(PartManagerVM As PartManagerVM) As Boolean
m_refPartManagerVM = PartManagerVM
Return Not IsNothing(m_refPartManagerVM)
End Function
Friend Function SetRefInstrumentPanelVM(InstrumentPanelVM As InstrumentPanelVM) As Boolean
m_refInstrumentPanelVM = InstrumentPanelVM
Return Not IsNothing(m_refInstrumentPanelVM)
@@ -313,6 +332,11 @@ Module Map
Return Not IsNothing(m_refTopPanelVM)
End Function
Friend Function SetRefOptimizePanelVM(OptimizePanelVM As OptimizePanelVM) As Boolean
m_refOptimizePanelVM = OptimizePanelVM
Return Not IsNothing(m_refOptimizePanelVM)
End Function
'Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
' m_refOptionPanelVM = OptionPanelVM
' Return Not IsNothing(m_refOptionPanelVM)
@@ -375,6 +399,7 @@ Module Map
Not IsNothing(m_refFeatureListVM) AndAlso Not IsNothing(m_refPartInRawPartListVM) AndAlso
Not IsNothing(m_refFreeContourManagerVM) AndAlso Not IsNothing(m_refFreeContourInputVM) AndAlso
Not IsNothing(m_refInstrumentPanelVM) AndAlso Not IsNothing(m_refTopPanelVM) AndAlso
Not IsNothing(m_refPartManagerVM) AndAlso Not IsNothing(m_refOptimizePanelVM) AndAlso
Not IsNothing(m_refShowBeamPanelVM) AndAlso LibMap.EndInit()
End Function
@@ -11,7 +11,7 @@ Public Class WarehouseWndVM
Public ReadOnly Property CurrentS_Msg As String
Get
Select Case CurrentMachine.nType
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case MachineType.BEAM
Return EgtMsg(61752)
Case MachineType.WALL
@@ -41,7 +41,7 @@ Public Class WarehouseWndVM
Public ReadOnly Property SParams_Msg As String
Get
Select Case CurrentMachine.nType
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case MachineType.BEAM
Return EgtMsg(61757)
Case MachineType.WALL
@@ -367,7 +367,7 @@ Public Class WarehouseWndVM
Basic_Visibility = Visibility.Visible
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
StartOffset_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
@@ -386,7 +386,7 @@ Public Class WarehouseWndVM
EgtUILib.GetPrivateProfileString(S_BEAM, K_CURRENTL, String.Empty, sValue, sWarehousePath)
SelCurrentS = If(CInt(sValue) > 0 AndAlso CInt(sValue) <= SParamList.Count, SParamList(CInt(sValue) - 1), Nothing)
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Kerf_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
@@ -414,7 +414,7 @@ Public Class WarehouseWndVM
Medium_Visibility = Visibility.Visible
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
StartOffset_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_BEAM, K_STARTOFFSET, String.Empty, sValue, sWarehousePath)
@@ -428,7 +428,7 @@ Public Class WarehouseWndVM
ParamIndex += 1
End While
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
Kerf_Visibility = Visibility.Visible
EgtUILib.GetPrivateProfileString(S_WALL, K_KERF, String.Empty, sValue, sWarehousePath)
@@ -475,7 +475,7 @@ Public Class WarehouseWndVM
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' Verifico che i valori siano tutti > 0
If dStartOffset <= 0 OrElse dOffset <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
@@ -494,7 +494,7 @@ Public Class WarehouseWndVM
For Index = ParamIndex To ParamIndex + m_RemovedParamsCount
WritePrivateProfileString(S_BEAM, K_L & Index, Nothing, sWarehousePath)
Next
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' Verifico che i valori siano tutti > 0
If dKerf <= 0 OrElse dOffset <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
@@ -518,7 +518,7 @@ Public Class WarehouseWndVM
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
' Verifico che i valori siano tutti > 0
If dStartOffset <= 0 OrElse dOffset <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
@@ -543,7 +543,7 @@ Public Class WarehouseWndVM
sWarehousePath)
ParamIndex += 1
Next
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
' Verifico che i valori siano tutti > 0
If dKerf <= 0 OrElse dOffset <= 0 Then
MessageBox.Show(IncorrectValues_Msg, Error_Msg)
@@ -612,7 +612,7 @@ Public Class WarehouseWndVM
End Property
Public Sub AddParam()
Select Case CurrentMachine.nType
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case MachineType.BEAM
NewBeamParam_Visibility = Visibility.Visible
Case MachineType.WALL
@@ -636,7 +636,7 @@ Public Class WarehouseWndVM
Public Sub OkAddParam()
Dim dWValue As Double = 0
Dim dLValue As Double = 0
Select Case CurrentMachine.nType
Select Case Map.refProjectVM.BTLStructureVM.nPROJTYPE
Case MachineType.BEAM
If Not IsNothing(sNewL) Then StringToLen(sNewL, dLValue)
If dLValue > 0 Then
@@ -776,7 +776,7 @@ Public Class WarehouseWndVM
Dim SectXMatList As New List(Of SectionXMaterial)
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
While EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
@@ -796,7 +796,7 @@ Public Class WarehouseWndVM
End If
ParamIndex += 1
End While
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
While EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath)
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
@@ -828,12 +828,12 @@ Public Class WarehouseWndVM
Select Case WhType
Case WarehouseType.BASIC
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_BASIC_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
If EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
StringToLen(sValue, dValue)
Return New SParam(dValue)
End If
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
If EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
@@ -853,7 +853,7 @@ Public Class WarehouseWndVM
End If
Case WarehouseType.MEDIUM
Dim sWarehousePath As String = Map.refMainWindowVM.MainWindowM.sWarehouseDir & "\" & WH_MEDIUM_INI_FILE_NAME
If CurrentMachine.nType = MachineType.BEAM Then
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then
If EgtUILib.GetPrivateProfileString(S_BEAM, "L" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
@@ -874,7 +874,7 @@ Public Class WarehouseWndVM
Return New SParam(New SectionXMaterial(dW, dH, dL, sParamValues(2)), dL, nQty)
End If
End If
ElseIf CurrentMachine.nType = MachineType.WALL Then
ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then
If EgtUILib.GetPrivateProfileString(S_WALL, "S" & ParamIndex, String.Empty, sValue, sWarehousePath) Then
Dim sParamValues() As String = sValue.Split(","c)
' verifico numero minimo di parametri
@@ -970,16 +970,16 @@ Public Class SParam
Get
Select Case Map.refWarehouseWndVM.WhType
Case WarehouseType.BASIC
If CurrentMachine.nType = MachineType.BEAM Then Return LenToString(dL, 3)
If CurrentMachine.nType = MachineType.WALL Then Return LenToString(dW, 3) & "," & LenToString(dL, 3)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then Return LenToString(dL, 3)
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then Return LenToString(dW, 3) & "," & LenToString(dL, 3)
Case WarehouseType.MEDIUM
Dim sAlias As String = String.Empty
For Each sMatItem In SectXMat.sMaterial
sAlias &= sMatItem & ";"
Next
sAlias = sAlias.TrimEnd(";")
If CurrentMachine.nType = MachineType.BEAM Then Return LenToString(SectXMat.dW, 3) & "," & LenToString(SectXMat.dH, 3) & "," & sAlias
If CurrentMachine.nType = MachineType.WALL Then Return LenToString(SectXMat.dH, 3) & "," & sAlias
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then Return LenToString(SectXMat.dW, 3) & "," & LenToString(SectXMat.dH, 3) & "," & sAlias
If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then Return LenToString(SectXMat.dH, 3) & "," & sAlias
End Select
Return Nothing
End Get