diff --git a/DdfFile.vb b/DdfFile.vb index e8e7ab9..2fc3a7f 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -38,178 +38,185 @@ Friend Module DdfFile DdfFileContent.Add(ConstCompo.K_MEASURES & ": " & Part.Measure) ' aggiungo una riga vuota per separare la lista successiva DdfFileContent.Add("") - If Not IsNothing(Part.TypePart) Then + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then + Part.Code = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName + If Part.Code.Contains("*") Then + Part.Code = Part.Code.Replace("*", "") + End If + DdfFileContent.Add(ConstCompo.K_CODE & ": " & Part.Code) + DdfFileContent.Add("") + ElseIf Not IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then Part.Code = " " & PrintTitleDDFPart(Part.TypePart) DdfFileContent.Add(ConstCompo.K_CODE & ": " & Part.Code) ' aggiungo una riga vuota per separare la lista successiva DdfFileContent.Add("") - Else + ElseIf IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then DdfFileContent.Add(ConstCompo.K_CODE & ": " & "1111") ' aggiungo una riga vuota per separare la lista successiva 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 - 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) - 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) + 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_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_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("") - ' 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, 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 End Sub #Region "Funzioni per il posizionamento" diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index b65a307..1133079 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + +