0bc8e470b9
- creazione di assemblati
946 lines
48 KiB
VB.net
946 lines
48 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports System.Text.RegularExpressions
|
|
|
|
Friend Module DdfFile
|
|
|
|
' il vettore che conterrà tutti le linee del file DDF da leggere
|
|
Friend FileContent As String()
|
|
' lista ordinata delle componenti da stampare
|
|
Friend CompoListOrder As New List(Of String)
|
|
Friend UnitMeasure As String
|
|
|
|
#Region "SCRITTURA DDF"
|
|
|
|
''genero le stringhe che dovranno essere scritte nel DDF
|
|
'' !!! attenzione !!! tutte le volte che stampo sul file di CurrDoor.ddf la variabile booelana DEVE essere settata su True
|
|
'Friend Sub WriteDDF(Part As Part, sPath As String, bIsDDf As Boolean)
|
|
' ' pulisco lista prima di iniziare a scrivere
|
|
' Dim DdfFileContent As New List(Of String)
|
|
' If String.IsNullOrEmpty(Part.Measure) Then
|
|
' Part.Measure = OptionModule.m_SelectedMeasureUnit
|
|
' End If
|
|
' DdfFileContent.Add("#EGTDOORCREATOR")
|
|
' 'Genero una lista di stringhe
|
|
' If Part.Measure = "Inches" Then
|
|
' Part.Measure = "inches"
|
|
' End If
|
|
' DdfFileContent.Add(ConstCompo.K_MEASURES & ": " & Part.Measure)
|
|
' ' aggiungo una riga vuota per separare la lista successiva
|
|
' DdfFileContent.Add("")
|
|
' If String.IsNullOrEmpty(Part.Code) Then
|
|
' Part.Code = "1111"
|
|
' End If
|
|
' DdfFileContent.Add(ConstCompo.K_CODE & ": " & Part.Code)
|
|
' ' aggiungo una riga vuota per separare la lista successiva
|
|
' DdfFileContent.Add("")
|
|
' DdfFileContent.Add(ConstCompo.S_ORDER & ":")
|
|
' ' Probablimente da cambiare
|
|
' DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": ")
|
|
' DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": ")
|
|
' DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": ")
|
|
' DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": ")
|
|
' DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": ")
|
|
' ' 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
|
|
' If Not IsNothing(Part.TypePart) Then
|
|
' DdfFileContent.Add("piece: " & Part.TypePart)
|
|
' End If
|
|
' DdfFileContent.Add("")
|
|
' '---------------------------------------------------------------------------------------------------------
|
|
|
|
' 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_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))
|
|
|
|
' ' Riordino e stampo le compo
|
|
' SearchCompo(DdfFileContent, Part, bIsDDf)
|
|
' If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then
|
|
' Directory.CreateDirectory(Path.GetDirectoryName(sPath))
|
|
' End If
|
|
' File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8)
|
|
'End Sub
|
|
|
|
' Questa funzione dovrà sostituire quella precedente (Scritta sopra)
|
|
Private IdIndex As Integer = 0
|
|
|
|
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
|
|
If IsNothing(Part.Measure) Then
|
|
Part.Measure = OptionModule.m_SelectedMeasureUnit
|
|
End If
|
|
DdfFileContent.Add("#EGTDOORCREATOR")
|
|
If Not IsNothing(Part.TypePart) Then
|
|
DdfFileContent.Add("#" & PrintTitleDDFPart(Part.TypePart))
|
|
If Part.IsActive Then
|
|
DdfFileContent.Add("produce: " & "true")
|
|
Else
|
|
DdfFileContent.Add("produce: " & "false")
|
|
End If
|
|
End If
|
|
DdfFileContent.Add("")
|
|
'Genero una lista di stringhe
|
|
If Part.Measure = "Inches" Then
|
|
Part.Measure = "inches"
|
|
End If
|
|
DdfFileContent.Add(ConstCompo.K_MEASURES & ": " & Part.Measure)
|
|
' aggiungo una riga vuota per separare la lista successiva
|
|
DdfFileContent.Add("")
|
|
If Not IsNothing(Part.TypePart) 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
|
|
DdfFileContent.Add(ConstCompo.K_CODE & ": " & "1111")
|
|
' aggiungo una riga vuota per separare la lista successiva
|
|
DdfFileContent.Add("")
|
|
End If
|
|
|
|
DdfFileContent.Add(ConstCompo.S_ORDER & ":")
|
|
' Probablimente da cambiare
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_CUSTOMER & ": ")
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_ELEVATION & ": ")
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PROJECT & ": ")
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_PO & ": ")
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LINE & ": ")
|
|
' 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
|
|
If Not IsNothing(Part.TypePart) And Not Part.IsNotAssembly Then
|
|
DdfFileContent.Add("piece: " & Part.TypePart)
|
|
Else
|
|
DdfFileContent.Add("piece: " & "DO_1")
|
|
End If
|
|
DdfFileContent.Add("")
|
|
|
|
If Not Part.IsNotAssembly 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)
|
|
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("")
|
|
|
|
' 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, 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"
|
|
Private Function PositionJamb_Y(CurrPart As Part) As String
|
|
Dim y As String
|
|
Dim dLightBottom As Double
|
|
Dim dThicknessJamb As Double
|
|
Dim dLightUp As Double
|
|
Dim dOverlapTop As Double
|
|
Dim dHeightDoor As Double
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightUp, dLightUp)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapTop, dOverlapTop)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Width, dThicknessJamb)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightBottom, dLightBottom)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Height, dHeightDoor)
|
|
If CurrPart.TypePart.Contains("E") Then
|
|
If CurrPart.TypePart.Contains("FT_") Then
|
|
y = DoubleToString(dHeightDoor - dOverlapTop + dLightUp, 4)
|
|
Else
|
|
y = DoubleToString(dLightBottom + dThicknessJamb, 4)
|
|
End If
|
|
Else
|
|
If CurrPart.TypePart.Contains("FT_") Then
|
|
y = DoubleToString(dHeightDoor + dLightUp, 4)
|
|
Else
|
|
y = DoubleToString(dLightBottom, 4)
|
|
End If
|
|
End If
|
|
Return y
|
|
End Function
|
|
|
|
Private Function PositionJamb_X(CurrPart As Part) As String
|
|
Dim x As String = "0"
|
|
Dim dLightLock As Double
|
|
Dim dLightHinge As Double
|
|
Dim dOverlapLock As Double
|
|
Dim dOverlapHinge As Double
|
|
Dim dThicknessJamb As Double
|
|
Dim dWidthDoor_0 As Double
|
|
Dim dWidthDoor_1 As Double
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightHinge, dLightHinge)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapLock, dOverlapLock)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapHinge, dOverlapHinge)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Width, dThicknessJamb)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidthDoor_0)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.Width, dWidthDoor_1)
|
|
If CurrPart.TypePart.Contains("E") Then
|
|
' posizione del Jamb sinistro
|
|
If CurrPart.TypePart.Contains("FL_L") Then
|
|
x = DoubleToString(dThicknessJamb - dOverlapLock + dLightLock, 4)
|
|
ElseIf CurrPart.TypePart.Contains("FL_H") Then
|
|
x = DoubleToString(dThicknessJamb - dOverlapHinge + dLightHinge, 4)
|
|
End If
|
|
' posiziono il jamb destro
|
|
If CurrPart.TypePart.Contains("FR_") Then
|
|
If Map.refAssemblyPageVM.CurrAssembly.DoorNumber = "1" Then
|
|
If CurrPart.TypePart.Contains("FR_L") Then
|
|
x = DoubleToString(dWidthDoor_0 - dOverlapLock + dLightLock, 4)
|
|
ElseIf CurrPart.TypePart.Contains("FR_H") Then
|
|
x = DoubleToString(dWidthDoor_0 - dOverlapHinge + dLightHinge, 4)
|
|
End If
|
|
Else
|
|
x = DoubleToString(dWidthDoor_0 + dWidthDoor_1 - dOverlapHinge + dLightHinge + dLightLock, 4)
|
|
End If
|
|
End If
|
|
' posiziono il jamb sopra
|
|
If CurrPart.TypePart.Contains("FT_") Then
|
|
If CurrPart.Swing.Contains("L") Then
|
|
x = DoubleToString(dLightHinge, 4)
|
|
Else
|
|
x = DoubleToString(dLightLock, 4)
|
|
End If
|
|
End If
|
|
' posiziono il jamb sotto
|
|
If CurrPart.TypePart.Contains("FB_") Then
|
|
If CurrPart.Swing.Contains("L") Then
|
|
x = DoubleToString(dLightHinge, 4)
|
|
Else
|
|
x = DoubleToString(dLightLock, 4)
|
|
End If
|
|
End If
|
|
Else
|
|
' posizione del Jamb sinistro
|
|
If CurrPart.TypePart.Contains("FL_L") Then
|
|
x = DoubleToString(dThicknessJamb + dLightLock, 4)
|
|
ElseIf CurrPart.TypePart.Contains("FL_H") Then
|
|
x = DoubleToString(dThicknessJamb + dLightHinge, 4)
|
|
End If
|
|
' posiziono il jamb destro
|
|
If CurrPart.TypePart.Contains("FR_") Then
|
|
If Map.refAssemblyPageVM.CurrAssembly.DoorNumber = "1" Then
|
|
If CurrPart.TypePart.Contains("FR_L") Then
|
|
x = DoubleToString(dWidthDoor_0 + dLightLock, 4)
|
|
ElseIf CurrPart.TypePart.Contains("FR_H") Then
|
|
x = DoubleToString(dWidthDoor_0 + dLightHinge, 4)
|
|
End If
|
|
Else
|
|
x = DoubleToString(dWidthDoor_0 + dWidthDoor_1 + dLightHinge + dLightLock, 4)
|
|
End If
|
|
End If
|
|
' posiziono il jamb sopra
|
|
If CurrPart.TypePart.Contains("FT_") Then
|
|
If CurrPart.Swing.Contains("L") Then
|
|
x = DoubleToString(dOverlapHinge + dLightHinge, 4)
|
|
Else
|
|
x = DoubleToString(dOverlapLock + dLightLock, 4)
|
|
End If
|
|
End If
|
|
End If
|
|
Return x
|
|
End Function
|
|
|
|
Private Function PositionJamb_Z(CurrPart As Part) As String
|
|
Dim z As String
|
|
Dim dDeltaThickness As Double
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.DeltaThickness, dDeltaThickness)
|
|
If CurrPart.Swing.Contains("HR") Then
|
|
Dim dThicknessDoor As Double
|
|
Dim dThicknessJamb As Double
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Thickness, dThicknessDoor)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Thickness, dThicknessJamb)
|
|
z = DoubleToString(dThicknessJamb - dThicknessDoor - dDeltaThickness, 4)
|
|
Else
|
|
z = DoubleToString(dDeltaThickness, 4)
|
|
End If
|
|
Return z
|
|
End Function
|
|
|
|
#End Region ' Funzioni per il posizionamento
|
|
|
|
Private Function PrintTitleDDFPart(NamePart As String) As String
|
|
If NamePart.Contains("F") And NamePart.Count > 3 Then
|
|
NamePart = NamePart.Remove(3)
|
|
End If
|
|
Dim SelectPart As String = NamePart
|
|
Select Case SelectPart
|
|
Case "FL_"
|
|
Return "Frame Left"
|
|
Case "FR_"
|
|
Return "Frame Right"
|
|
Case "FT_"
|
|
Return "Frame Top"
|
|
Case "FB_"
|
|
' eseguo un controllo per verifiacre che sia attivo
|
|
If Not Map.refAssemblyPageVM.CurrAssembly.Exterior Then
|
|
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetIsActive(False)
|
|
End If
|
|
Return "Frame Bottom"
|
|
Case Else
|
|
Return "Door" & NamePart(NamePart.Count - 1)
|
|
End Select
|
|
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)
|
|
Dim NewCompoNameDDF = False
|
|
Dim WritingError As String = String.Empty
|
|
' cerco la prima componente da aggiungere alla lista delle componenti
|
|
For Index1 = 0 To DdfFile.CompoListOrder.Count() - 1
|
|
For Index2 = 0 To Door.CompoList.Count() - 1
|
|
' se trovo la componenete da aggiungere
|
|
If DdfFile.CompoListOrder(Index1) = Door.CompoList(Index2).CompoType.DDFName Then
|
|
' se il nome della componente da aggiungere già esiste
|
|
If Index2 >= 1 AndAlso String.Equals(Door.CompoList(Index2).CompoType.DDFName, Door.CompoList(Index2 - 1).CompoType.DDFName) Then
|
|
NewCompoNameDDF = True
|
|
Else
|
|
' aggiungo una riga vuota per separare il nome della nuova componente
|
|
DdfFileContent.Add("")
|
|
End If
|
|
' Carico nella lista dei componenti la lista di stringhe da stampare
|
|
DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList(Index2), WritingError, NewCompoNameDDF, bIsDDf))
|
|
End If
|
|
NewCompoNameDDF = False
|
|
Next
|
|
Next
|
|
' finto di leggere tutte le componenti stampo il messaggio degli errori
|
|
If Not String.IsNullOrWhiteSpace(WritingError) Then
|
|
MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
End Sub
|
|
|
|
'Genero la lista di parametri di ogni compo che vedo a video
|
|
Public Function GenerateCompolistDDF(Compo As Compo, ByRef sErrorList As String, bNewCompoNameDDF As Boolean, bIsDDF As Boolean) As List(Of String)
|
|
Dim CompoListDDF As New List(Of String)
|
|
' se il nome non esiste ancora nella lista lo aggiungo
|
|
If Not bNewCompoNameDDF Then
|
|
' aggiungo il nome DDF della componente
|
|
CompoListDDF.Add(Compo.CompoType.DDFName & ":")
|
|
End If
|
|
' se esiste il template
|
|
If Not String.IsNullOrWhiteSpace(Compo.TemplateDDFName) Then
|
|
' aggiungo " - nomeTemplate: TemplateSelezionato"
|
|
CompoListDDF.Add(K_SCORE & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
|
|
End If
|
|
' creo l'indice dei parametri della compo
|
|
Dim ParamIndex As Integer
|
|
' scrivo tutti i parametri della compo
|
|
For ParamIndex = 0 To Compo.CompoParamList.Count - 1
|
|
Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
|
|
' controllo il tipo di parametro: ComboBox
|
|
|
|
If TypeOf CurrCompoParam Is ComboBoxParam Then
|
|
' controllo che sia selezionato un elemento
|
|
If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, ComboBoxParam).SelItem) Then
|
|
Dim IndexDDF As Integer = 0
|
|
' carico la lista DDF
|
|
Dim List As List(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF
|
|
' rccolgo il valore IndexDDF come indice del valore selezionato dalla lista
|
|
IndexDDF = DirectCast(CurrCompoParam, ComboBoxParam).ItemList.IndexOf(DirectCast(CurrCompoParam, ComboBoxParam).SelItem)
|
|
' restituisco il valore DDF della lista associato all'indice passato
|
|
Dim SelItemDDF As String = Trim(List(IndexDDF))
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, ComboBoxParam).DDFName & ": " & SelItemDDF)
|
|
Else
|
|
' se non è selezionato nessun elemento (cosa impossibile...)
|
|
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
|
|
sErrorList &= String.Format(EgtMsg(50114), DirectCast(CurrCompoParam, ComboBoxParam).Name, CurrCompoParam.DDFName)
|
|
End If
|
|
|
|
ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
|
|
If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, TextBoxOnOffParam).ToolTipValue) AndAlso DirectCast(CurrCompoParam, TextBoxOnOffParam).IsActive Then
|
|
' se è stata inserita un'espressine non valida restituisco un errore
|
|
If DirectCast(CurrCompoParam, TextBoxOnOffParam).ToolTipValue = EgtMsg(50143) Then
|
|
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
|
|
sErrorList &= String.Format(EgtMsg(50141), DirectCast(CurrCompoParam, TextBoxOnOffParam).Name, CurrCompoParam.DDFName)
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxOnOffParam).DDFName & ": ")
|
|
Else
|
|
If bIsDDF Then
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxOnOffParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxOnOffParam).ToolTipValue)
|
|
Else
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxOnOffParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxOnOffParam).Value)
|
|
End If
|
|
End If
|
|
ElseIf Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, TextBoxOnOffParam).ToolTipValue) AndAlso Not DirectCast(CurrCompoParam, TextBoxOnOffParam).IsActive Then
|
|
' non restituire nessun tipo di errore
|
|
End If
|
|
' TextBox
|
|
ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
|
|
If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, TextBoxParam).ToolTipValue) Then
|
|
' se è stata inserita un'espressine non valida restituisco iun errore
|
|
If DirectCast(CurrCompoParam, TextBoxParam).ToolTipValue = EgtMsg(50143) Then
|
|
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
|
|
sErrorList &= String.Format(EgtMsg(50141), DirectCast(CurrCompoParam, TextBoxParam).Name, CurrCompoParam.DDFName)
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxParam).DDFName & ": ")
|
|
Else
|
|
If bIsDDF Then
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxParam).ToolTipValue)
|
|
Else
|
|
CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxParam).Value)
|
|
End If
|
|
End If
|
|
Else
|
|
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
|
|
sErrorList &= String.Format(EgtMsg(50141), DirectCast(CurrCompoParam, TextBoxParam).Name, CurrCompoParam.DDFName)
|
|
End If
|
|
End If
|
|
Next
|
|
' inserisco qui il riferimento da stampare (il codice è scelto dalla porta)
|
|
If Not IsNothing(Compo.refJambCompo) Then
|
|
Compo.IdCode = CStr(IdIndex)
|
|
Compo.refJambCompo.IdCode = Compo.IdCode
|
|
CompoListDDF.Add(K_SPACE5 & "##IdCodeComponent : " & IdIndex)
|
|
IdIndex += 1
|
|
ElseIf Not String.IsNullOrEmpty(Compo.IdCode) Then
|
|
CompoListDDF.Add(K_SPACE5 & "##IdCodeComponent : " & Compo.IdCode)
|
|
IdIndex += 1
|
|
End If
|
|
Return CompoListDDF
|
|
End Function
|
|
|
|
#End Region ' Scrittura DDF
|
|
|
|
#Region "SCRITTURA ASSEMBLATO"
|
|
' serve per pulire il file temporaneo la prima volta che viene creato
|
|
Private FirstPart As Boolean = True
|
|
Friend Sub WriteDDFAssembly(ByVal CurrAssembly As Assembly, sPath As String, bIsDDF As Boolean)
|
|
' serve per capire se almeno una Part è stata inserita e quindi inserire il separatore
|
|
Dim bSplit As Boolean = False
|
|
Dim SplitPart As New List(Of String)
|
|
SplitPart.Add("")
|
|
SplitPart.Add("---")
|
|
Dim EndAssebly As New List(Of String)
|
|
EndAssebly.Add("")
|
|
EndAssebly.Add("...")
|
|
|
|
' inizio stampando l'elenco delle porte
|
|
Dim FirstPart As Boolean = False
|
|
Select Case CurrAssembly.DoorNumber
|
|
Case "1"
|
|
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, bIsDDF, FirstPart)
|
|
FirstPart = True
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
Else
|
|
WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart)
|
|
FirstPart = True
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
End If
|
|
End Select
|
|
WriteDDFPart(CurrAssembly.LeftJamb, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
WriteDDFPart(CurrAssembly.RightJamb, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
If CurrAssembly.Exterior Then
|
|
WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
|
|
WriteDDFPart(CurrAssembly.BottomJamb, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8)
|
|
Else
|
|
WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart)
|
|
File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8)
|
|
End If
|
|
'------------------------------------------------------------------------------------------------------------------
|
|
' inizio ora a stampare le caratteristiche generali della finestra JambPageVM
|
|
Dim dVal As Double = 0
|
|
Dim GeneralAssembly As New List(Of String)
|
|
GeneralAssembly.Add("")
|
|
GeneralAssembly.Add("#GENERAL ASSEMBLY")
|
|
GeneralAssembly.Add("")
|
|
GeneralAssembly.Add(" " & "Size : ")
|
|
If StringToDouble(CurrAssembly.Thickness, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "thickness : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(ConstCompo.K_SPACE3 & EgtMsg(50106) & "thickness", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.Width, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "width : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(ConstCompo.K_SPACE3 & EgtMsg(50106) & "width", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add("")
|
|
GeneralAssembly.Add(" " & "Light : ")
|
|
If StringToDouble(CurrAssembly.LightUp, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "up : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(ConstCompo.K_SPACE3 & EgtMsg(50106) & "LightUp", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.LightLock, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "lock : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "LightLock", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.LightHinge, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "hinge : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "LightHinge", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.LightBottom, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "bottom : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "LightBottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add("")
|
|
GeneralAssembly.Add(" " & "Overlap : ")
|
|
If StringToDouble(CurrAssembly.ThicknessHead, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "thickness : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "ThicknessHead", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.OverlapHinge, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "hinge : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "Overlap Hinge", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.OverlapLock, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "lock : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "Overlap Lock", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
' i parametri associatia alla condizione di Exterior sono stampati solo se Exterior è true
|
|
If CurrAssembly.Exterior Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "Exterior :")
|
|
If StringToDouble(CurrAssembly.OverlapTop, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "top : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "Overlap Top", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If StringToDouble(CurrAssembly.DeltaThickness, dVal) Then
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & "deltaT : " & DoubleToString(dVal, 5))
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "Delta Thickness", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
End If
|
|
GeneralAssembly.Add("")
|
|
GeneralAssembly.Add(" " & ConstCompo.K_PROFILES & ":")
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & CurrAssembly.LockEdgeType.Name)
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(CurrAssembly.LockEdgeMachining))
|
|
If Not StringToDouble(CurrAssembly.LockEdgeOverMaterial, dVal) Then
|
|
MessageBox.Show(EgtMsg(50106) & K_LOCKEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & CurrAssembly.HingeEdgeType.Name)
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(CurrAssembly.HingeEdgeMachining))
|
|
If Not StringToDouble(CurrAssembly.HingeEdgeOverMaterial, dVal) Then
|
|
MessageBox.Show(EgtMsg(50106) & K_HINGEDGEOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & CurrAssembly.TopType.Name)
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(CurrAssembly.TopMachining))
|
|
If Not StringToDouble(CurrAssembly.TopOverMaterial, dVal) Then
|
|
MessageBox.Show(EgtMsg(50106) & K_TOPOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & CurrAssembly.BottomType.Name)
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(CurrAssembly.BottomMachining))
|
|
If Not StringToDouble(CurrAssembly.BottomOverMaterial, dVal) Then
|
|
MessageBox.Show(EgtMsg(50106) & K_BOTTOMOVERMATERIAL_INI, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
GeneralAssembly.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
|
|
|
|
GeneralAssembly.Add("")
|
|
If Not IsNothing(CurrAssembly.DoorNumber) Then
|
|
GeneralAssembly.Add(" " & "doors : " & CurrAssembly.DoorNumber)
|
|
Else
|
|
MessageBox.Show(EgtMsg(50106) & "Number of Doors", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
File.AppendAllLines(sPath, GeneralAssembly, Text.Encoding.UTF8)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
'eseguo il confronto tra il DDF Nuovo e quello in lettura nella finestra grafica: restituisce falso se i due file sono diversi
|
|
Friend Function ComparisonFileDDF(sPathNewDoor As String, sPathTempDoor As String) As Boolean
|
|
''Dim FileContentNewDoor As String()
|
|
''Dim FileContentTempDoor As String()
|
|
Dim bComparison As Boolean = False
|
|
''FileContentNewDoor = File.ReadAllLines(sPathNewDoor)
|
|
''FileContentTempDoor = File.ReadAllLines(sPathTempDoor)
|
|
''Dim nComparison As Integer
|
|
|
|
'' individuo il file più corto tra i due
|
|
''Dim EndOfFile As Integer
|
|
''If FileContentNewDoor.Count > FileContentTempDoor.Count Then
|
|
'' EndOfFile = FileContentTempDoor.Count
|
|
'' nComparison = 1
|
|
''ElseIf FileContentNewDoor.Count < FileContentTempDoor.Count Then
|
|
'' EndOfFile = FileContentNewDoor.Count
|
|
'' nComparison = -1
|
|
''ElseIf FileContentNewDoor.Count = FileContentTempDoor.Count Then
|
|
'' EndOfFile = FileContentNewDoor.Count
|
|
'' nComparison = 0
|
|
''End If
|
|
|
|
''Dim Line As Integer = 0
|
|
''Dim LineBis As Integer = 0
|
|
'' confronto riga per riga i due file
|
|
''For Line = 0 To EndOfFile - 1
|
|
|
|
'' SkipWhiteSpace(FileContentNewDoor, Line, FileContentNewDoor.Count - 1)
|
|
'' SkipWhiteSpace(FileContentTempDoor, LineBis, FileContentTempDoor.Count - 1)
|
|
|
|
'' If Trim(FindComments(FileContentNewDoor(Line))) = Trim(FindComments(FileContentTempDoor(LineBis))) Then
|
|
'' bComparison = True
|
|
'' LineBis += 1
|
|
'' Else
|
|
'' se la riga cercata è la data allora non considerare la modifica
|
|
'' If Trim(SearchName(FileContentNewDoor(Line))) = "date" Then
|
|
'' bComparison = True
|
|
'' LineBis += 1
|
|
'' ElseIf IsNumeric(SearchKeyValue(FileContentNewDoor(Line), SearchName(FileContentNewDoor(Line)))) Then
|
|
'' Dim sValNewDoor As Double
|
|
'' StringToDouble(SearchKeyValue(FileContentNewDoor(Line), SearchName(FileContentNewDoor(Line))), sValNewDoor)
|
|
'' Dim sValTempDoor As Double
|
|
'' StringToDouble(SearchKeyValue(FileContentTempDoor(Line), SearchName(FileContentTempDoor(LineBis))), sValTempDoor)
|
|
'' If sValNewDoor = sValTempDoor Then
|
|
'' bComparison = True
|
|
'' LineBis += 1
|
|
'' Else
|
|
'' bComparison = False
|
|
'' Exit For
|
|
'' End If
|
|
'' End If
|
|
'' End If
|
|
''Next
|
|
''studio le righe che non sono state analizzate sopra
|
|
''Select Case nComparison
|
|
'' Case 1
|
|
'' For MissinIndex = EndOfFile To FileContentNewDoor.Count - 1
|
|
'' If Not String.IsNullOrWhiteSpace(FindComments(FileContentNewDoor(MissinIndex))) Then
|
|
'' bComparison = False
|
|
'' Exit Select
|
|
'' Else
|
|
'' bComparison = True
|
|
'' End If
|
|
'' Next
|
|
'' Case -1
|
|
'' For MissinIndex = EndOfFile To FileContentTempDoor.Count - 1
|
|
'' If Not String.IsNullOrWhiteSpace(FindComments(FileContentTempDoor(MissinIndex))) Then
|
|
'' bComparison = False
|
|
'' Exit Select
|
|
'' Else
|
|
'' bComparison = True
|
|
'' End If
|
|
'' Next
|
|
''End Select
|
|
Return bComparison
|
|
|
|
End Function
|
|
|
|
#Region "LETTURA ASSEMBLATO"
|
|
Private m_Assembly As New Assembly
|
|
|
|
' controllo che il DDF che voglio leggere esista, e se esiste che non sia vuoto
|
|
Friend Sub DecomposeAssebly(ByVal sPathAssembly As String)
|
|
'Dim FileContent() As String
|
|
Dim nDDF As Integer = 1
|
|
' controllo che il file esista
|
|
If Not File.Exists(sPathAssembly) Then Return
|
|
' acrico tutto il file nel vettore
|
|
FileContent = File.ReadAllLines(sPathAssembly)
|
|
' se il file esiste ma è vuoto
|
|
If FileContent.Count = 0 Then
|
|
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
|
|
' riga corrente del file
|
|
Dim LineIndex As Integer = 0
|
|
' riga associata all'inizio di ogni ddf
|
|
Dim StartIndex As Integer = 0
|
|
' riga associata alla fine di ogni ddf
|
|
Dim StopIndex As Integer = 0
|
|
' serve per contare quante sono le righe vuote
|
|
Dim EmptyLine As Integer = 0
|
|
|
|
' fino a quando il file non è terminato
|
|
While (LineIndex < FileContent.Count)
|
|
' controlla se trova 3 lineette
|
|
If Search3Score(FileContent(LineIndex)) Or Search3Dots(FileContent(LineIndex)) Then
|
|
' assegno come riga terminela del ddf quella che precede i tre trattini
|
|
StopIndex = LineIndex - 1
|
|
' carica il vettore attraverso un ciclo for
|
|
For i As Integer = 0 To StopIndex - StartIndex
|
|
' scommentando le righe
|
|
FileContent(StartIndex + i) = Utility.FindComments(FileContent(StartIndex + i))
|
|
' verifico che la riga appena passata non sia vuota
|
|
If (String.IsNullOrEmpty(FileContent(StartIndex + i)) Or String.IsNullOrWhiteSpace(FileContent(StartIndex + i))) Then
|
|
EmptyLine += 1
|
|
End If
|
|
Next
|
|
' se il numero di righe bianche è ugule alla dimensione del vettore allora quel ddf non esiste e non deve essere stampato
|
|
If (EmptyLine = StopIndex - StartIndex + 1) Then
|
|
' decido quindi di passare a stampare il succesivo
|
|
nDDF += 1
|
|
Else
|
|
DDFFromAssembly(nDDF, StartIndex)
|
|
nDDF += 1
|
|
End If
|
|
EmptyLine = 0
|
|
' assegno come nuovo punto di partenza la riga successiva ai tre trattini
|
|
StartIndex = LineIndex + 1
|
|
|
|
End If
|
|
LineIndex += 1
|
|
End While
|
|
|
|
End Sub
|
|
' il vettore che contiene gli startpoint del file assembly
|
|
Friend ListPartsStartIndex As New ObservableCollection(Of Integer)
|
|
'la lista dei nomi della pulsantiera
|
|
Friend ListParts As New ObservableCollection(Of String)
|
|
' stampo nel direttorio dei files temporanei il ddf prelevato dall'assemblato
|
|
Private Sub DDFFromAssembly(ByVal nDDF As Integer, StartPoint As Integer)
|
|
Dim TempDoor As New Part
|
|
' con il seguente select-case stampo il file ddf temporaneo che si vuole leggere
|
|
Select Case nDDF
|
|
'Case 1
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
'Case 2
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
'Case 3
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
'Case 4
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
'Case 5
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
'Case 6
|
|
' Part.NewReadDDF(StartPoint, TempDoor)
|
|
' m_Assembly.DoorListAssembly.Add(TempDoor)
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region 'Lettura Assemblato
|
|
|
|
' se il titolo presenta * allora vuol dire che era stato modificato, altrinenti no .Trim("*"c)
|
|
Friend Function SetModify(rMainWindow As MainWindowVM) As Boolean
|
|
If Trim(rMainWindow.ProjectNameMsg) = Trim(rMainWindow.ProjectNameMsg.Trim("*"c)) Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
''Public Function SkipWhiteSpace(Array() As String, ByRef Index As Integer, LastIndex As Integer) As Integer
|
|
'' Array(Index) = FindComments(Array(Index))
|
|
'' While String.IsNullOrWhiteSpace(Array(Index)) And Index < LastIndex
|
|
'' Index += 1
|
|
'' Array(Index) = FindComments(Array(Index))
|
|
'' End While
|
|
'' Return Index
|
|
''End Function
|
|
|
|
End Module
|