From 57ee7991dfbce3852cd106c702aa3fd97289475e Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Mon, 11 Dec 2017 18:58:06 +0000 Subject: [PATCH] EgtDOORCreator 1.8l4 : - Aggiunta dei template --- Assembly/Assembly.vb | 34 +++ AssemblyManager/AssemblyManagerVM.vb | 47 ++-- DdfFile.vb | 336 +++++++++++++-------------- DoorParameters/Part.vb | 14 +- DoorParameters/PartPageVM.vb | 3 +- My Project/AssemblyInfo.vb | 4 +- ProjectManager/ProjectManagerV.xaml | 2 +- ProjectManager/ProjectManagerVM.vb | 2 +- 8 files changed, 241 insertions(+), 201 deletions(-) diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index 363d3bd..618f1bc 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -1186,6 +1186,40 @@ Public Class Assembly '--------------------------------------------------------------------------------------------------------------------------------------------- #Region "RULES ASSEMBLY" + Public Sub SetVarAssembly() + Dim dHeight As Double + Dim dWidth As Double + Dim dThickness As Double + If Not IsNothing(Map.refPartPageVM.CurrPart) Then + If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then + If Not IsNothing(Map.refPartPageVM.CurrPart.Height) And Not IsNothing(Map.refPartPageVM.CurrPart.Width) And Not IsNothing(Map.refPartPageVM.CurrPart.Thickness) Then + If StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) Then + EgtLuaSetGlobNumVar("H", dHeight) + End If + If StringToDouble(Map.refPartPageVM.CurrPart.Width, dWidth) Then + EgtLuaSetGlobNumVar("W", dWidth) + End If + If StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThickness) Then + EgtLuaSetGlobNumVar("T", dThickness) + End If + End If + ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains("DO_2") Then + If Not IsNothing(Map.refPartPageVM.CurrPart.Height) And Not IsNothing(Map.refPartPageVM.CurrPart.Width) And Not IsNothing(Map.refPartPageVM.CurrPart.Thickness) Then + If StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) Then + EgtLuaSetGlobNumVar("H2", dHeight) + End If + If StringToDouble(Map.refPartPageVM.CurrPart.Width, dWidth) Then + EgtLuaSetGlobNumVar("W2", dWidth) + End If + If StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThickness) Then + EgtLuaSetGlobNumVar("T2", dThickness) + End If + End If + End If + End If + + End Sub + ' è chiamata ogni volta che viene modificato un parametro del general dell'assemblato Public Sub UpDateAllCompo() Dim IdexDoorNumber As Integer = 0 diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index 9b77d31..df0cd01 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -334,19 +334,19 @@ Public Class AssemblyManagerVM '--------------------------------------------------------------------------------------------------------------------------------------------------- ' CHIEDO SE SI VUOLE IMPORTARE UN TEMPLATE 'Prima di tutto chiedo se vuole aprire un template - 'Dim ImportTemplate As String = String.Empty - 'If MessageBox.Show(EgtMsg(50146), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then - ' ' Apro la finestra di dialogo aperta direttamente sulla cartella cercata - ' Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With { - ' .InitialDirectory = IniFile.m_TemplateDir - ' } - ' If OpenFileDialog.ShowDialog() <> True Then - ' ' se la risposta è diversa da OK esce - ' Return - ' End If - ' ' carico l'indirizzo del template che voglio aprire - ' ImportTemplate = OpenFileDialog.FileName - 'End If + Dim ImportTemplate As String = String.Empty + If MessageBox.Show(EgtMsg(50146), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then + ' Apro la finestra di dialogo aperta direttamente sulla cartella cercata + Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With { + .InitialDirectory = IniFile.m_TemplateDir + } + If OpenFileDialog.ShowDialog() <> True Then + ' se la risposta è diversa da OK esce + Return + End If + ' carico l'indirizzo del template che voglio aprire + ImportTemplate = OpenFileDialog.FileName + End If '---------------------------------------------------------------------------------------------------------------------------------------------------- ' Creo nuovo assembly ' Lancio la finestra per chiedere il nome dell'assemblato @@ -402,16 +402,17 @@ Public Class AssemblyManagerVM ''CurrProject.NotifyPropertyChanged("AssemblyList") '------------------------------------------------------------------------------------------------------------------------------------------------ ' LETTURA DI UN FILE DI TIPO TEMPLATE - 'If String.IsNullOrEmpty(ImportTemplate) Then - ' NewAssembly = True - 'Else - ' ' !!!!se sto aprendo un template significa che devo leggere un file già esistente!!!! - ' NewAssembly = False - ' ' creo il file ddf associato al template - ' Map.refAssemblyPageVM.CurrAssembly = CreateNewAssembly(ImportTemplate) - ' Assembly.ReadDDFAssembly(ImportTemplate, Map.refAssemblyPageVM.CurrAssembly) - ' DdfFile.WriteDDFPart(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door, Local_AssemblyName.Name, True, False) - 'End If + If Not String.IsNullOrEmpty(ImportTemplate) Then + ' creo il file ddf associato al template + m_CurrProject.SelAssemblyName.SelAssembly = CreateNewAssembly(ImportTemplate) + Assembly.ReadDDFAssembly(ImportTemplate, m_CurrProject.SelAssemblyName.SelAssembly) + DdfFile.WriteDDFAssembly(m_CurrProject.SelAssemblyName.SelAssembly, Local_AssemblyName.Name, False) + If Open(m_CurrProject.SelAssemblyName) Then + m_CurrProject.SelAssemblyName.IsModified = True + File.Delete(m_CurrProject.SelAssemblyName.Name) + Return + End If + End If '------------------------------------------------------------------------------------------------------------------------------------------------ ' Creo nuovo assembly NewCmd(Local_AssemblyName) diff --git a/DdfFile.vb b/DdfFile.vb index 2fc3a7f..87fe14b 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -14,7 +14,7 @@ Friend Module DdfFile ' Questa funzione dovrà sostituire quella precedente (Scritta sopra) Private IdIndex As Integer = 0 - Friend Sub WriteDDFPart(Part As Part, sPath As String, bIsTemplate As Boolean, bIsForAssembly As Boolean) + Friend Sub WriteDDFPart(Part As Part, sPath As String, bIsDDF As Boolean, bIsForAssembly As Boolean) ' pulisco lista prima di iniziare a scrivere Dim DdfFileContent As New List(Of String) ' quindi significa che non è mai stato caricato il valore @@ -56,167 +56,167 @@ Friend Module DdfFile DdfFileContent.Add("") End If - DdfFileContent.Add(ConstCompo.S_ORDER & ":") - ' Probabilmente da cambiare - If Not IsNothing(Part.Customer) Then - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": " & Part.Customer) - Else - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": ") - End If - If Not IsNothing(Part.Elevation) Then - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": " & Part.Elevation) - Else - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": ") - End If - If Not IsNothing(Part.Project) Then - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": " & Part.Project) - Else - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": ") - End If - If Not IsNothing(Part.PO) Then - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": " & Part.PO) - Else - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": ") - End If - If Not IsNothing(Part.Line) Then - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": " & Part.Line) - Else - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": ") - End If - ' aggiungo una riga vuota per separare la lista successiva - DdfFileContent.Add("") - DdfFileContent.Add(ConstCompo.K_DATE & ":" & " " & System.DateTime.Now.ToString("dd/MM/yyyy")) - ' aggiungo una riga vuota per separare la lista successiva - DdfFileContent.Add("") - ' è specificato il tipo significa che abbiamo un assemblato - DdfFileContent.Add("piece: " & Part.TypePart) - DdfFileContent.Add("") - ' posizionamento porte - If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then - If Not IsNothing(Part.TypePart) Then - ' il posizionamento della prima porta sta nell'origine - If Part.TypePart = "DO_1" Then - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & "0") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & "0") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & "0") - ElseIf Part.TypePart = "DO_2" Then - ' si trova traslata verso destra dello spessore DO_1 sommato a LightLock" - Dim x_DO_1 As Double - Dim dLightLock As Double - StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, x_DO_1) - StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock) - Dim x As String = DoubleToString(x_DO_1 + dLightLock, 4) - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & x) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & "0") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & "0") - ' Jamb Sinistro serratura - ElseIf Part.TypePart.Contains("FL_") Then - Dim x As String = PositionJamb_X(Part) - Dim y As String = PositionJamb_Y(Part) - Dim z As String = PositionJamb_Z(Part) - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & x) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & y) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & z) - ElseIf Part.TypePart.Contains("FR_") Then - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) - ElseIf Part.TypePart.Contains("FT_") Then - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) - ElseIf Part.TypePart.Contains("FB_") Then - DdfFileContent.Add("position: ") - DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) - End If - DdfFileContent.Add("") + DdfFileContent.Add(ConstCompo.S_ORDER & ":") + ' Probabilmente da cambiare + If Not IsNothing(Part.Customer) Then + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": " & Part.Customer) + Else + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": ") + End If + If Not IsNothing(Part.Elevation) Then + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": " & Part.Elevation) + Else + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": ") + End If + If Not IsNothing(Part.Project) Then + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": " & Part.Project) + Else + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": ") + End If + If Not IsNothing(Part.PO) Then + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": " & Part.PO) + Else + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": ") + End If + If Not IsNothing(Part.Line) Then + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": " & Part.Line) + Else + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": ") + End If + ' aggiungo una riga vuota per separare la lista successiva + DdfFileContent.Add("") + DdfFileContent.Add(ConstCompo.K_DATE & ":" & " " & System.DateTime.Now.ToString("dd/MM/yyyy")) + ' aggiungo una riga vuota per separare la lista successiva + DdfFileContent.Add("") + ' è specificato il tipo significa che abbiamo un assemblato + DdfFileContent.Add("piece: " & Part.TypePart) + DdfFileContent.Add("") + ' posizionamento porte + If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then + If Not IsNothing(Part.TypePart) Then + ' il posizionamento della prima porta sta nell'origine + If Part.TypePart = "DO_1" Then + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & "0") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & "0") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & "0") + ElseIf Part.TypePart = "DO_2" Then + ' si trova traslata verso destra dello spessore DO_1 sommato a LightLock" + Dim x_DO_1 As Double + Dim dLightLock As Double + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, x_DO_1) + StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock) + Dim x As String = DoubleToString(x_DO_1 + dLightLock, 4) + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & x) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & "0") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & "0") + ' Jamb Sinistro serratura + ElseIf Part.TypePart.Contains("FL_") Then + Dim x As String = PositionJamb_X(Part) + Dim y As String = PositionJamb_Y(Part) + Dim z As String = PositionJamb_Z(Part) + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & x) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & y) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & z) + ElseIf Part.TypePart.Contains("FR_") Then + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) + ElseIf Part.TypePart.Contains("FT_") Then + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) + ElseIf Part.TypePart.Contains("FB_") Then + DdfFileContent.Add("position: ") + DdfFileContent.Add(ConstCompo.K_SPACE3 & "x: " & PositionJamb_X(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "y: " & PositionJamb_Y(Part)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & "z: " & PositionJamb_Z(Part)) End If + DdfFileContent.Add("") End If + End If - Dim dVal As Double = 0 - DdfFileContent.Add(ConstCompo.K_SIZE & ":") - If Not StringToDouble(Part.Width, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_WIDTH, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Dim dVal As Double = 0 + DdfFileContent.Add(ConstCompo.K_SIZE & ":") + If Not StringToDouble(Part.Width, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_WIDTH, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 5)) + If Not StringToDouble(Part.Height, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_HEIGHT, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 5)) + If Not StringToDouble(Part.Thickness, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_THICKNESS, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 5)) + ' aggiungo il peso della porta + If Part.IsCheckedWeight = Visibility.Visible Then + If Not StringToDouble(Part.Weight, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_WEIGHT, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return End If - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 5)) - If Not StringToDouble(Part.Height, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_HEIGHT, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 5)) - If Not StringToDouble(Part.Thickness, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_THICKNESS, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 5)) - ' aggiungo il peso della porta - If Part.IsCheckedWeight = Visibility.Visible Then - If Not StringToDouble(Part.Weight, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_WEIGHT, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WEIGHT & ": " & Part.Weight) - End If - ' aggiungo una riga vuota per separare la lista successiva - DdfFileContent.Add("") - DdfFileContent.Add("" & ConstCompo.K_SWING & ": " & Part.Swing) - ' aggiungo una riga vuota per separare la lista successiva - DdfFileContent.Add("") + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WEIGHT & ": " & Part.Weight) + End If + ' aggiungo una riga vuota per separare la lista successiva + DdfFileContent.Add("") + DdfFileContent.Add("" & ConstCompo.K_SWING & ": " & Part.Swing) + ' aggiungo una riga vuota per separare la lista successiva + DdfFileContent.Add("") - ' aggiungo il secure nullo al DDF - DdfFileContent.Add("" & ConstCompo.K_SECURE & ": " & "0") - ' aggiungo una riga vuota per separare la lista successiva - DdfFileContent.Add("") - DdfFileContent.Add("" & ConstCompo.K_PROFILES & ":") - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Part.LockEdgeType.Name) - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining)) - If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_LOCKEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Part.HingeEdgeType.Name) - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining)) - If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_HINGEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Part.TopType.Name) - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining)) - If Not StringToDouble(Part.TopOverMaterial, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_TOPOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Part.BottomType.Name) - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining)) - If Not StringToDouble(Part.BottomOverMaterial, dVal) Then - MessageBox.Show(EgtMsg(50106) & K_BOTTOMOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) - Return - End If - DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) + ' aggiungo il secure nullo al DDF + DdfFileContent.Add("" & ConstCompo.K_SECURE & ": " & "0") + ' aggiungo una riga vuota per separare la lista successiva + DdfFileContent.Add("") + DdfFileContent.Add("" & ConstCompo.K_PROFILES & ":") + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Part.LockEdgeType.Name) + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining)) + If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_LOCKEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Part.HingeEdgeType.Name) + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining)) + If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_HINGEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Part.TopType.Name) + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining)) + If Not StringToDouble(Part.TopOverMaterial, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_TOPOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) + DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Part.BottomType.Name) + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining)) + If Not StringToDouble(Part.BottomOverMaterial, dVal) Then + MessageBox.Show(EgtMsg(50106) & K_BOTTOMOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5)) - ' Riordino e stampo le compo - SearchCompo(DdfFileContent, Part, bIsTemplate) - If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then - Directory.CreateDirectory(Path.GetDirectoryName(sPath)) - End If - '----------------------------------------------------------------------------------------------------------------------------------- - 'Stampa su file - If bIsForAssembly Then - File.AppendAllLines(sPath, DdfFileContent, Text.Encoding.UTF8) - Else - File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8) - End If + ' Riordino e stampo le compo + SearchCompo(DdfFileContent, Part, bIsDDF) + If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then + Directory.CreateDirectory(Path.GetDirectoryName(sPath)) + End If + '----------------------------------------------------------------------------------------------------------------------------------- + 'Stampa su file + If bIsForAssembly Then + File.AppendAllLines(sPath, DdfFileContent, Text.Encoding.UTF8) + Else + File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8) + End If End Sub #Region "Funzioni per il posizionamento" @@ -372,7 +372,7 @@ Friend Module DdfFile End Function ' stampa le compo seguedo l'ordine della lista delle componenti del ddf - Public Sub SearchCompo(DdfFileContent As List(Of String), ByRef Door As Part, bIsDDf As Boolean) + Public Sub SearchCompo(DdfFileContent As List(Of String), ByRef Door As Part, bIsDDF As Boolean) Dim NewCompoNameDDF = False Dim WritingError As String = String.Empty ' cerco la prima componente da aggiungere alla lista delle componenti @@ -388,7 +388,7 @@ Friend Module DdfFile DdfFileContent.Add("") End If ' Carico nella lista dei componenti la lista di stringhe da stampare - DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList(Index2), WritingError, NewCompoNameDDF, bIsDDf)) + DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList(Index2), WritingError, NewCompoNameDDF, bIsDDF)) End If NewCompoNameDDF = False Next @@ -491,7 +491,7 @@ Friend Module DdfFile #Region "SCRITTURA ASSEMBLATO" ' serve per pulire il file temporaneo la prima volta che viene creato - Friend Function WriteDDFAssembly(ByVal CurrAssembly As Assembly, sPath As String, bIsTemplate As Boolean) As Boolean + Friend Function WriteDDFAssembly(ByVal CurrAssembly As Assembly, sPath As String, bIsDDF As Boolean) As Boolean ' verifico esistenza assemblato If IsNothing(CurrAssembly) Then Return False @@ -515,36 +515,36 @@ Friend Module DdfFile ' inizio stampando l'elenco delle porte Select Case CurrAssembly.DoorNumber Case "1" - WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) FirstPart = True File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) Case "2" If Not CurrAssembly.GetArrayPartDoor(0).Door.Swing.Contains("I") Then - WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) FirstPart = True File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) Else - WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) FirstPart = True File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) End If End Select - WriteDDFPart(CurrAssembly.LeftJamb, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.LeftJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.RightJamb, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.RightJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) ' il sill è stampato solo se è nella selezione If CurrAssembly.Exterior Then - WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - WriteDDFPart(CurrAssembly.BottomJamb, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.BottomJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8) Else - WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsTemplate, FirstPart) + WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8) End If '------------------------------------------------------------------------------------------------------------------ diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index 19c8fa1..a664d41 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -60,7 +60,7 @@ Public Class Part End Get Set(value As List(Of String)) m_SwingTypeList = value - NotifyPropertyChanged("SwingTypeList") + 'NotifyPropertyChanged("SwingTypeList") End Set End Property @@ -162,7 +162,8 @@ Public Class Part Map.refAssemblyPageVM.CurrAssembly.HeightJamb(m_Height) Map.refAssemblyPageVM.CurrAssembly.HeightDoor(m_Height) Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() - SetVarSize() + Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'SetVarSize() UpdateToolTip() NotifyPropertyChanged("Height") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True @@ -189,7 +190,8 @@ Public Class Part ' ricalcola la dimensione larghezza dei Jamb FT e FB Map.refAssemblyPageVM.CurrAssembly.SetTopWidth() Map.refAssemblyPageVM.CurrAssembly.UpDateAllCompo() - SetVarSize() + Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'SetVarSize() UpdateToolTip() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set @@ -212,7 +214,8 @@ Public Class Part Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If - SetVarSize() + Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'SetVarSize() UpdateToolTip() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set @@ -1316,7 +1319,8 @@ Public Class Part Index += 1 Else m_Thickness = Thickness - SetVarSize() + Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'SetVarSize() Index += 1 End If ' restituisco la riga successiva all'ultimo valore letto diff --git a/DoorParameters/PartPageVM.vb b/DoorParameters/PartPageVM.vb index 79b0927..bf0afc1 100644 --- a/DoorParameters/PartPageVM.vb +++ b/DoorParameters/PartPageVM.vb @@ -15,7 +15,8 @@ Public Class PartPageVM Set(value As Part) m_CurrPart = value If Not IsNothing(m_CurrPart) Then - m_CurrPart.SetVarSize() + Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly() + 'm_CurrPart.SetVarSize() End If NotifyPropertyChanged("CurrPart") End Set diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 3638bd2..c298d11 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/ProjectManager/ProjectManagerV.xaml b/ProjectManager/ProjectManagerV.xaml index 058a448..453858a 100644 --- a/ProjectManager/ProjectManagerV.xaml +++ b/ProjectManager/ProjectManagerV.xaml @@ -29,7 +29,7 @@ -