Files
EgtDOORCreator/DdfFile.vb
2023-05-11 15:55:21 +02:00

1766 lines
94 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports System.Text.RegularExpressions
Friend Module DdfFile
' lista ordinata delle componenti da stampare
Friend CompoListOrder As New List(Of String)
' se riesco a scrivere un DDF (o una parte dell'essamblato) diventa true
Friend DDFIsCorrect As Boolean = False
' se no sono in grado di creare la porta devo fermare tutto
Friend DoorExists As Boolean = False
' scommenta le righe del file che contengono dei file mancanti
Friend SaveErrorCompo As Boolean = False
' raccoglie gli errori in fase di scrittura del ddf
Friend ErrorInWriting As String = String.Empty
' lista delle componenti della porta da stampare nel report
Friend OrderInReport As New ReportOrder
Friend ReportList As New List(Of ReportCompo)
' nuova gestione liste
Friend ReportDoor As New TableDoor
Private ParamInCompoIsCorrect As Boolean = True
#Region "SCRITTURA DDF"
' 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)
'if Not OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Then
ReportList.Clear()
'ReportDoor.Order.Clear()
'ReportDoor.Dimension.Clear()
'ReportDoor.Proflie.Clear()
'ReportDoor.OtherInfo.Clear()
ReportDoor.HardwareList.Clear()
ReportDoor.MachList.Clear()
ReportDoor.AttachmentsList.Clear()
End If
ReportDoor.Order.Clear()
ReportDoor.Dimension.Clear()
ReportDoor.Proflie.Clear()
ReportDoor.OtherInfo.Clear()
' definsco la componente porta (devo decidere come asseganre il Brand e il Template)
Dim CompoDoorReport As New ReportCompo("DOOR", "", Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName)
ReportList.Add(CompoDoorReport)
ErrorInWriting = String.Empty
DDFIsCorrect = False
DoorExists = False
' pulisco lista prima di iniziare a scrivere
Dim DdfFileContent As New List(Of String)
' quindi significa che non è mai stato caricato il valore
DdfFileContent.Add("#EGTDOORCREATOR")
Dim Config As String = IniFile.m_sDoorsDirPath
Config = Path.GetFileName(Config)
DdfFileContent.Add("#Config: " & Config)
If Not IsNothing(Part.TypePart) Then
DdfFileContent.Add("#" & PrintTitleDDFPart(Part.TypePart))
End If
DdfFileContent.Add("")
' dal 20/04/2023 inserita gestione della versione (da configurare nel programma)
If OptionModule.m_sVersionDDF <> "1" Then
DdfFileContent.Add("version: " & OptionModule.m_sVersionDDF)
End If
DdfFileContent.Add("")
' definisco se il pezzo deve essere prodotto
DdfFileContent.Add("produce: " & If(Part.IsActive, "true", "false"))
'Genero una lista di stringhe
DdfFileContent.Add("")
'If IsNothing(Part.Measure) Then Part.Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
'DdfFileContent.Add(ConstCompo.S_MEASURES & ": " & Part.Measure)
DdfFileContent.Add(ConstCompo.S_MEASURES & ": " & ConvertMmUnitsToString(OptionModule.m_bIsMmUnit))
' 50200=Unit measure
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50200), Part.Measure))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
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.S_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.S_CODE & ": " & Part.Code)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
ElseIf IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
DdfFileContent.Add(ConstCompo.S_CODE & ": " & "1111")
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
End If
DdfFileContent.Add(ConstCompo.S_ORDER & ":")
Dim TOrder As New TableOrder
TOrder.Order_ParametersList.Add(New ReportParameter("Door", Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName))
' Probabilmente da cambiare
If Not IsNothing(Part.Customer) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_CUSTOMER & ": " & Part.Customer)
' 50070=Customer
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50070), Part.Customer))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50070), Part.Customer))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_CUSTOMER & ": ")
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50070), ""))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50070), ""))
End If
If Not IsNothing(Part.Elevation) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_ELEVATION & ": " & Part.Elevation)
' 50406=Elevation
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50406), Part.Elevation))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50406), Part.Elevation))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_ELEVATION & ": ")
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50406), ""))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50406), ""))
End If
If Not IsNothing(Part.Project) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PROJECT & ": " & Part.Project)
' 50407=Project
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50407), Part.Project))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50407), Part.Project))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PROJECT & ": ")
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50407), ""))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50407), ""))
End If
If Not IsNothing(Part.PO) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PO & ": " & Part.PO)
' 50408=PO
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50408), Part.PO))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50408), Part.PO))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PO & ": ")
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50408), ""))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50408), ""))
End If
If Not IsNothing(Part.Line) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LINE & ": " & Part.Line)
' 50409=Line
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50409), Part.Line))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50409), Part.Line))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LINE & ": ")
OrderInReport.OrderParameterList.Add(New ReportParameter(EgtMsg(50409), ""))
TOrder.Order_ParametersList.Add(New ReportParameter(EgtMsg(50409), ""))
End If
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add(ConstCompo.S_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 = ConstGen.PART_DO_ & "1" Then
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & "0")
DdfFileContent.Add(m_sSpace1Tab & "y: " & "0")
DdfFileContent.Add(m_sSpace1Tab & "z: " & "0")
ElseIf Part.TypePart = ConstGen.PART_DO_ & "2" Then
' si trova traslata verso destra dello spessore DO_1 sommato a LightLock"
Dim x_DO_1 As Double = 0.0
Dim dLightLock As Double
'StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, x_DO_1)
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Width, x_DO_1)
End If
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock)
Dim x As String = DoubleToString(x_DO_1 + dLightLock, 4)
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & x)
DdfFileContent.Add(m_sSpace1Tab & "y: " & "0")
DdfFileContent.Add(m_sSpace1Tab & "z: " & "0")
' Jamb Sinistro serratura
ElseIf Part.TypePart.Contains(ConstGen.PART_FRAME_LEFT) Then
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & PositionJamb_X(Part))
DdfFileContent.Add(m_sSpace1Tab & "y: " & PositionJamb_Y(Part))
DdfFileContent.Add(m_sSpace1Tab & "z: " & PositionJamb_Z(Part))
ElseIf Part.TypePart.Contains(ConstGen.PART_FRAME_RIGHT) Then
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & PositionJamb_X(Part))
DdfFileContent.Add(m_sSpace1Tab & "y: " & PositionJamb_Y(Part))
DdfFileContent.Add(m_sSpace1Tab & "z: " & PositionJamb_Z(Part))
ElseIf Part.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & PositionJamb_X(Part))
DdfFileContent.Add(m_sSpace1Tab & "y: " & PositionJamb_Y(Part))
DdfFileContent.Add(m_sSpace1Tab & "z: " & PositionJamb_Z(Part))
ElseIf Part.TypePart.Contains(ConstGen.PART_FRAME_BOTTOM) Then
DdfFileContent.Add("position: ")
DdfFileContent.Add(m_sSpace1Tab & "x: " & PositionJamb_X(Part))
DdfFileContent.Add(m_sSpace1Tab & "y: " & PositionJamb_Y(Part))
DdfFileContent.Add(m_sSpace1Tab & "z: " & PositionJamb_Z(Part))
End If
DdfFileContent.Add("")
End If
End If
Dim dVal As Double = 0
DdfFileContent.Add(ConstCompo.S_SIZE & ":")
Dim TDimension As New TableDimension
If Not StringToDouble(Part.Width, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_WIDTH), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & Part.Width)
End If
End If
' 50001=Width
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50001), DoubleToString(dVal, 5)))
TDimension.Dimension_ParametersList.Add(New ReportParameter(EgtMsg(50001), DoubleToString(dVal, 5)))
If Not StringToDouble(Part.Height, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HEIGHT), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & Part.Height)
End If
End If
' 50002=Height
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50002), DoubleToString(dVal, 5)))
TDimension.Dimension_ParametersList.Add(New ReportParameter(EgtMsg(50002), DoubleToString(dVal, 5)))
If Not StringToDouble(Part.Thickness, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_THICKNESS), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & Part.Thickness)
End If
End If
' 50003=Thickness
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50003), DoubleToString(dVal, 5)))
TDimension.Dimension_ParametersList.Add(New ReportParameter(EgtMsg(50003), DoubleToString(dVal, 5)))
' origheightdoor: solo per i Jamb inserisco la dimensioe dell'verlap
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso
Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly) AndAlso
Part.TypePart.Contains("F") Then
DdfFileContent.Add("")
DdfFileContent.Add(ConstCompo.S_ORIGHEIGHTDOOR & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OrigHeightDoor)
End If
'' overlap: solo per i Jamb inserisco l'verlap
'If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso
' Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly) AndAlso
' Part.TypePart.Contains("F") Then
' DdfFileContent.Add("")
' If Part.TypePart.Contains("_H") Then
' DdfFileContent.Add(ConstCompo.S_OVERLAP_DDF & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OverlapHinge)
' ElseIf Part.TypePart.Contains("_L") Then
' If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.DoorNumber = "1" Then
' DdfFileContent.Add(ConstCompo.S_OVERLAP_DDF & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OverlapLock)
' Else
' DdfFileContent.Add(ConstCompo.S_OVERLAP_DDF & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OverlapHinge)
' End If
' ElseIf Part.TypePart.Contains("FT_") Then
' DdfFileContent.Add(ConstCompo.S_OVERLAP_DDF & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OverlapTop)
' ElseIf Part.TypePart.Contains("FB_") Then
' DdfFileContent.Add(ConstCompo.S_OVERLAP_DDF & ": " & Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.OverlapBottom)
' End If
'End If
' aggiungo il peso della porta
If Part.IsCheckedWeight = Visibility.Visible Then
If Not StringToDouble(Part.Weight, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), S_WEIGHT), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
DdfFileContent.Add("")
If bIsDDF Then
DdfFileContent.Add(ConstCompo.S_WEIGHT & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.S_WEIGHT & ": " & Part.Weight)
End If
End If
End If
' 50047=Weight
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50047), DoubleToString(dVal, 5)))
TDimension.Dimension_ParametersList.Add(New ReportParameter(EgtMsg(50047), DoubleToString(dVal, 5)))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add("" & ConstCompo.S_SWING & ": " & Part.Swing)
Dim TOtherInfo As New TableOtherInfo
' 50004=Swing
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50004), Part.Swing))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50004), Part.Swing))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
' aggiungo il secure nullo al DDF
If Part.TypePart.Contains(ConstGen.PART_DO_) Then
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & SetSecure(Part.SwingAlias.Name, Part.DispositionItem.Name, Part.Secure))
' aggiungo una riga vuota per separare la lista successiva
Else
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & ConstGen.SWING_DOWN)
End If
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
' aggiungo le Properties
' il tipo di materiale, se è selezionato deve sempre essere stampato
If Not IsNothing(Part.SelectedMaterial) AndAlso Part.SelectedMaterial.NameDDF <> GENERICMATERIAL Then
DdfFileContent.Add("" & ConstCompo.S_MATERIAL & ": " & Part.SelectedMaterial.NameDDF)
' 50710=Material
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50710), Part.SelectedMaterial.Name))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50710), Part.SelectedMaterial.Name))
DdfFileContent.Add("")
End If
'' scrittura utilizzata per la multi selezione
'Dim sProperties As String = String.Empty
'Dim ItemIndex As Integer
'For ItemIndex = 0 To Part.PropertiesList.Count - 1
' 'If Part.PropertiesList(ItemIndex).IsChecked Then
' ' sProperties &= Part.PropertiesList(ItemIndex).Name & ", "
' 'End If
'Next
'If Not String.IsNullOrEmpty(sProperties) Then
' sProperties = sProperties.Remove(sProperties.LastIndexOf(","c))
' DdfFileContent.Add("" & ConstCompo.S_PROPERTIES & ": " & sProperties)
' DdfFileContent.Add("")
'End If
' scrittura delle proprietà in caso di selezione da ComboBox
If Part.PropertiesIsVisible = Visibility.Visible Then
Dim sProperties As String = String.Empty
If Not IsNothing(Part.SelectedProperty) AndAlso Part.SelectedProperty.Name <> "none" Then
DdfFileContent.Add("" & ConstCompo.S_PROPERTIES & ": " & Part.SelectedProperty.Name)
' 50709=Properties
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50709), Part.SelectedProperty.Name))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50709), Part.SelectedProperty.Name))
DdfFileContent.Add("")
End If
End If
'----------------------------------------------------------------------------------------------------------------------------------------------------
DdfFileContent.Add("" & ConstCompo.S_PROFILES & ":")
Dim TProfile As New TableProfile
Dim BevelDDF As String = SetBevel(Part.TypePart, Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name, Part.InvertBevel)
If OptionModule.m_sVersionDDF = "2" Then ' K_TYPE
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LOCKEDGE & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & BevelDDF)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LOCKEDGE & ": " & BevelDDF)
End If
' 50005=Lock edge
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50005), BevelDDF))
TProfile.Profile_ParametersList.Add(New ReportParameter(EgtMsg(50005), BevelDDF))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining))
If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_LOCKEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.LockEdgeOverMaterial)
End If
End If
BevelDDF = SetBevel(Part.TypePart, Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name)
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HINGEEDGE & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & BevelDDF)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HINGEEDGE & ": " & BevelDDF)
End If
' 50006=Hinge edge
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50006), BevelDDF))
TProfile.Profile_ParametersList.Add(New ReportParameter(EgtMsg(50006), BevelDDF))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining))
If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HINGEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.HingeEdgeOverMaterial)
End If
End If
BevelDDF = SetBevel(Part.TypePart, Part.TopType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name)
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_TOP & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & BevelDDF)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_TOP & ": " & BevelDDF)
End If
' 50007=Top
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50007), BevelDDF))
TProfile.Profile_ParametersList.Add(New ReportParameter(EgtMsg(50007), BevelDDF))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining))
If Not StringToDouble(Part.TopOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_TOPOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.TopOverMaterial)
End If
End If
If Part.TopShapeIsChecked And Part.TopArcIsChecked And (Not IsNothing(Part.Radius) AndAlso Not IsNothing(Part.Posx)) Then
If Not StringToDouble(Part.Radius, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_RADIUS), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_RADIUS & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_RADIUS & ": " & Part.Radius)
End If
End If
If Not StringToDouble(Part.Posx, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_POSX), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_POSX & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_POSX & ": " & Part.Posx)
End If
End If
' 50707=Top Arc
CompoDoorReport.CompoParameterList.Add(New ReportParameter("Top shape", EgtMsg(50707)))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter("Top shape", EgtMsg(50707)))
' 50706=Pos_x
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50706), Part.Posx))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50706), Part.Posx))
' 50704=Radius
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50704), Part.Radius))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50704), Part.Radius))
End If
If Part.TopShapeIsChecked And Part.TopAngleIsChecked And (Not IsNothing(Part.Angle) AndAlso Not IsNothing(Part.Posx)) Then
If Not StringToDouble(Part.PosxAngle, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_POSX), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_POSX & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_POSX & ": " & Part.PosxAngle)
End If
End If
If Not StringToDouble(Part.Angle, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_ANGLE), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_ANGLE & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_ANGLE & ": " & Part.Angle)
End If
End If
' 50708=Top Angle
CompoDoorReport.CompoParameterList.Add(New ReportParameter("Top shape", EgtMsg(50708)))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter("Top shape", EgtMsg(50708)))
' 50706=Pos_x
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50706), Part.Posx))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50706), Part.Posx))
' 50705=Angle
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50705), Part.Angle))
TOtherInfo.OtherInfo_ParametersList.Add(New ReportParameter(EgtMsg(50705), Part.Angle))
End If
BevelDDF = SetBevel(Part.TypePart, Part.BottomType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name)
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_BOTTOM & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & BevelDDF)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_BOTTOM & ": " & BevelDDF)
End If
' 50008=Bottom
CompoDoorReport.CompoParameterList.Add(New ReportParameter(EgtMsg(50008), BevelDDF))
TProfile.Profile_ParametersList.Add(New ReportParameter(EgtMsg(50008), BevelDDF))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining))
If Not StringToDouble(Part.BottomOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_BOTTOMOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.BottomOverMaterial)
End If
End If
DoorExists = True
DdfFileContent.Add(" ")
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(ConstCompo.K_HARDWARE & ": ")
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
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(ConstCompo.K_OPTIONS & ": ")
DdfFileContent.Add(Part.sOptions)
End If
DdfFileContent.Add(" ")
DdfFileContent.Add("# End Part")
' se sono arrivato fin qui significa che tutto è andato a buon fine (posso quindisalvare il file corrente)
OrderInReport.ReportCompoList = ReportList
ReportDoor.Order.Add(TOrder)
ReportDoor.Dimension.Add(TDimension)
ReportDoor.Proflie.Add(TProfile)
ReportDoor.OtherInfo.Add(TOtherInfo)
DDFIsCorrect = ParamInCompoIsCorrect
'-----------------------------------------------------------------------------------------------------------------------------------
'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
' la funzione è quasi identica alla precedente per piccole differenze (evito di richiamare dei riferimenti all'assemblato)
Friend Sub WriteDDFPartForTestHardware(Part As Part, sPath As String, bIsDDF As Boolean, bIsForAssembly As Boolean)
Dim CurrHardwareReference As String = String.Empty
If Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
CurrHardwareReference = Map.refHardwarePageVM.CurrHardware.SelBrand.ModelDir & "\" & Map.refHardwarePageVM.CurrHardware.SelTemplate & LUA_EXTENSION
End If
DDFIsCorrect = False
' pulisco lista prima di iniziare a scrivere
Dim DdfFileContent As New List(Of String)
' quindi significa che non è mai stato caricato il valore
DdfFileContent.Add("#EGTDOORCREATOR")
If Not IsNothing(Part.TypePart) Then
DdfFileContent.Add("#" & PrintTitleDDFPart(Part.TypePart))
End If
If Not String.IsNullOrEmpty(CurrHardwareReference) Then
DdfFileContent.Add("#" & CurrHardwareReference)
End If
' dal 20/04/2023 inserita gestione della versione (da configurare nel programma)
If OptionModule.m_sVersionDDF <> "1" Then
DdfFileContent.Add("")
DdfFileContent.Add("version: " & OptionModule.m_sVersionDDF)
End If
DdfFileContent.Add("")
DdfFileContent.Add("produce: " & If(Part.IsActive, "true", "false"))
'Genero una lista di stringhe
DdfFileContent.Add("")
If IsNothing(Part.Measure) Then Part.Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
DdfFileContent.Add(ConstCompo.S_MEASURES & ": " & Part.Measure)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
Part.Code = "TestDoorHardware"
DdfFileContent.Add(ConstCompo.S_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.S_CODE & ": " & Part.Code)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
ElseIf IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
DdfFileContent.Add(ConstCompo.S_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(m_sSpace1Tab & ConstCompo.K_CUSTOMER & ": " & Part.Customer)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_CUSTOMER & ": ")
End If
If Not IsNothing(Part.Elevation) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_ELEVATION & ": " & Part.Elevation)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_ELEVATION & ": ")
End If
If Not IsNothing(Part.Project) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PROJECT & ": " & Part.Project)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PROJECT & ": ")
End If
If Not IsNothing(Part.PO) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PO & ": " & Part.PO)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_PO & ": ")
End If
If Not IsNothing(Part.Line) Then
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LINE & ": " & Part.Line)
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LINE & ": ")
End If
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add(ConstCompo.S_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("")
Dim dVal As Double = 0
Dim sVal As String = String.Empty
DdfFileContent.Add(ConstCompo.S_SIZE & ":")
If Not StringToDouble(Part.Width, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_WIDTH), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.Width
' ConvertCurrentUnitMeasure(sVal)
'Part.SetWidth(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & Part.Width)
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_WIDTH & ": " & sVal)
End If
End If
If Not StringToDouble(Part.Height, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HEIGHT), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.Height
' ConvertCurrentUnitMeasure(sVal)
'Part.SetHeight(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & Part.Height)
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HEIGHT & ": " & sVal)
End If
End If
If Not StringToDouble(Part.Thickness, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_THICKNESS), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.Thickness
' ConvertCurrentUnitMeasure(sVal)
'Part.SetThickness(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & Part.Thickness)
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_THICKNESS & ": " & sVal)
End If
End If
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add("" & ConstCompo.S_SWING & ": " & Part.Swing)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
' aggiungo il secure nullo al DDF
If Part.TypePart.Contains(ConstGen.PART_DO_) Then
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & SetSecure(Part.SwingAlias.Name, Part.DispositionItem.Name, Part.Secure))
' aggiungo una riga vuota per separare la lista successiva
Else
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & ConstGen.SWING_DOWN)
End If
DdfFileContent.Add("")
If Not IsNothing(Part.SelectedMaterial) AndAlso Part.SelectedMaterial.NameDDF <> GENERICMATERIAL Then
DdfFileContent.Add("" & ConstCompo.S_MATERIAL & ": " & Part.SelectedMaterial.NameDDF)
DdfFileContent.Add("")
End If
'----------------------------------------------------------------------------------------------------------------------------------------------------
DdfFileContent.Add("" & ConstCompo.S_PROFILES & ":")
If OptionModule.m_sVersionDDF = "2" Then ' K_TYPE
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LOCKEDGE & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & SetBevel(Part.TypePart, Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name, Part.InvertBevel))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_LOCKEDGE & ": " & SetBevel(Part.TypePart, Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name, Part.InvertBevel))
End If
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining))
If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_LOCKEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.LockEdgeOverMaterial
' ConvertCurrentUnitMeasure(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.LockEdgeOverMaterial)
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
End If
End If
If OptionModule.m_sVersionDDF = "2" Then ' K_TYPE
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HINGEEDGE & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & SetBevel(Part.TypePart, Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_HINGEEDGE & ": " & SetBevel(Part.TypePart, Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
End If
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining))
If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HINGEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.HingeEdgeOverMaterial
ConvertCurrentUnitMeasure(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.HingeEdgeOverMaterial)
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
End If
End If
If OptionModule.m_sVersionDDF = "2" Then ' K_TYPE
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_TOP & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & SetBevel(Part.TypePart, Part.TopType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_TOP & ": " & SetBevel(Part.TypePart, Part.TopType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
End If
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining))
If Not StringToDouble(Part.TopOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_TOPOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.TopOverMaterial
' ConvertCurrentUnitMeasure(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.TopOverMaterial)
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
End If
End If
If OptionModule.m_sVersionDDF = "2" Then ' K_TYPE
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_BOTTOM & ": ")
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_TYPEEDGE & ": " & SetBevel(Part.TypePart, Part.BottomType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
Else
DdfFileContent.Add(m_sSpace1Tab & ConstCompo.K_BOTTOM & ": " & SetBevel(Part.TypePart, Part.BottomType.Name, Part.DispositionItem.Name, Part.SwingAlias.Name))
End If
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining))
If Not StringToDouble(Part.BottomOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_BOTTOMOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
sVal = Part.BottomOverMaterial
' ConvertCurrentUnitMeasure(sVal)
If bIsDDF Then
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
Else
'DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & Part.BottomOverMaterial)
DdfFileContent.Add(m_sSpace2Tab & ConstCompo.K_OVERMATERIAL & ": " & sVal)
End If
End If
DdfFileContent.Add(" ")
If OptionModule.m_sVersionDDF = "2" Then
DdfFileContent.Add(ConstCompo.K_HARDWARE & ": ")
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
DdfFileContent.Add(" ")
DdfFileContent.Add("# End Part")
' se sono arrivato fin qui significa che tutto è andato a buon fine (posso quindisalvare il file corrente)
DDFIsCorrect = ParamInCompoIsCorrect
'-----------------------------------------------------------------------------------------------------------------------------------
'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
Dim dThicknessBottom As Double
Dim dOverlapBootm 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.ThicknessBottom, dThicknessBottom)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapBottom, dOverlapBootm)
'StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Height, dHeightDoor)
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Height, dHeightDoor)
Else
dHeightDoor = 0
End If
If CurrPart.TypePart.Contains(ConstGen.EXTERIOR) Then
If CurrPart.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then
y = DoubleToString(dHeightDoor - dOverlapTop + dLightUp, 4)
Else
y = DoubleToString(dOverlapBootm - dLightBottom - dThicknessBottom, 4)
End If
Else
If CurrPart.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then
y = DoubleToString(dHeightDoor - dOverlapTop + 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)
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Width, dWidthDoor_0)
Else
dWidthDoor_0 = 0
End If
' StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.Width, dWidthDoor_1)
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2")) Then
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.Width, dWidthDoor_1)
Else
dWidthDoor_1 = 0
End If
'If CurrPart.TypePart.Contains(ConstGen.EXTERIOR) 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(ConstGen.PART_FRAME_RIGHT) 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(ConstGen.PART_FRAME_TOP) Then
If Map.refAssemblyPageVM.CurrAssembly.DoorNumber = "1" Then
If CurrPart.SwingAlias.Name.Contains(ConstGen.LOCK) Then
x = DoubleToString(-dLightHinge, 4)
Else
x = DoubleToString(-dLightLock, 4)
End If
Else
x = DoubleToString(-dLightHinge, 4)
End If
End If
' posiziono il jamb sotto
If CurrPart.TypePart.Contains(ConstGen.PART_FRAME_BOTTOM) Then
If Map.refAssemblyPageVM.CurrAssembly.DoorNumber = "1" Then
If CurrPart.SwingAlias.Name.Contains(ConstGen.LOCK) Then
x = DoubleToString(-dLightHinge, 4)
Else
x = DoubleToString(-dLightLock, 4)
End If
Else
x = DoubleToString(-dLightHinge, 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(ConstGen.PART_FRAME_RIGHT) 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(ConstGen.PART_FRAME_TOP) Then
' If CurrPart.SwingAlias.Name.Contains(ConstGen.LOCK) 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.SwingAlias.Name.Contains(ConstGen.HAND_REVERSE) Then
Dim dThicknessDoor As Double
Dim dThicknessJamb As Double
' StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Thickness, dThicknessDoor)
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Thickness, dThicknessDoor)
Else
dThicknessDoor = 0
End If
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Thickness, dThicknessJamb)
z = DoubleToString(-dThicknessJamb + dThicknessDoor + dDeltaThickness, 4)
If CurrPart.TypePart.Contains("FB_") Then
Dim dDeltaBottom As Double
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.DeltaBottom, dDeltaBottom)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.DepthBottom, dThicknessJamb)
' questa espressione inversa è utilizzata nella funzione "GetSizeBottom()"
z = DoubleToString(-dThicknessJamb + dThicknessDoor + dDeltaThickness - dDeltaBottom, 4)
End If
Else
z = DoubleToString(-dDeltaThickness, 4)
If CurrPart.TypePart.Contains("FB_") Then
Dim dDeltaBottom As Double
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.DeltaBottom, dDeltaBottom)
z = DoubleToString(-dDeltaThickness + dDeltaBottom, 4)
End If
End If
Return z
End Function
#End Region ' Funzioni per il posizionamento
Private Function PrintTitleDDFPart(NamePart As String) As String
If NamePart.Contains(ConstGen.PART_FRAME) And NamePart.Count > 3 Then
NamePart = NamePart.Remove(3)
End If
Dim SelectPart As String = NamePart
Select Case SelectPart
Case ConstGen.PART_FRAME_LEFT
Return "Frame Left"
Case ConstGen.PART_FRAME_RIGHT
Return "Frame Right"
Case ConstGen.PART_FRAME_TOP
Return "Frame Top"
Case ConstGen.PART_FRAME_BOTTOM
' eseguo un controllo per verifiacre che sia attivo
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not Map.refAssemblyPageVM.CurrAssembly.Exterior Then
Dim FB As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("FB_")
If Not IsNothing(FB) Then
FB.Door.SetIsActive(False)
Else
FB.Door.SetIsActive(True)
End If
End If
End If
Return "Frame Bottom"
Case Else
Return "Door" & NamePart(NamePart.Count - 1)
End Select
End Function
#Region "Funzioni per la scrittura delle componenti"
' 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)
ParamInCompoIsCorrect = True
Dim NewCompoNameDDF = False
Dim WritingError As String = String.Empty
Dim TempList As New ObservableCollection(Of Compo)
If OptionModule.m_sVersionDDF = "1" Then
DdfFileContent.Add("")
End If
'------------------------------------------------------------------------------------------------------------------------------------------
' 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
TempList.Add(Door.CompoList(Index2))
End If
Next
Next
TidyCompo(DdfFileContent, TempList, bIsDDF)
' finito 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
Public Function TidyCompo(DdfFileContent As List(Of String), Door As ObservableCollection(Of Compo), bIsDDF As Boolean) As Boolean
Dim TempList As New ObservableCollection(Of Compo)
If Door.Count = 0 Then Return True
' se esiste un solo elemento lo carico
If Door.Count = 1 Then
TempList.Add(Door(0))
AscendingOrder(TempList, DdfFileContent, bIsDDF)
GenerateCompoListReport(TempList)
Return True
End If
For Index1 As Integer = 0 To Door.Count - 2
TempList = New ObservableCollection(Of Compo)
TempList.Add(Door(Index1))
For Index2 As Integer = Index1 + 1 To Door.Count - 1
If Door(Index1).CompoType.DDFName = Door(Index2).CompoType.DDFName Then
TempList.Add(Door(Index2))
End If
Next
AscendingOrder(TempList, DdfFileContent, bIsDDF)
GenerateCompoListReport(TempList)
Index1 += TempList.Count - 1
Next
TempList = New ObservableCollection(Of Compo)
' controllo che l'ultimo elemento non sia già stato caricato
If Door(Door.Count - 1).CompoType.DDFName <> Door(Door.Count - 2).CompoType.DDFName Then
TempList.Add(Door(Door.Count - 1))
AscendingOrder(TempList, DdfFileContent, bIsDDF)
GenerateCompoListReport(TempList)
End If
Return True
End Function
Private Function AscendingOrder(List As ObservableCollection(Of Compo), DdfFileContent As List(Of String), bIsDDF As Boolean) As Boolean
Dim tidyParamIndex1 As Integer = -1
Dim tidyParamIndex2 As Integer = -1
Dim WritingError As String = String.Empty
If List.Count >= 2 Then
For IndexList1 As Integer = 0 To List.Count - 2
For IndexList2 As Integer = IndexList1 + 1 To List.Count - 1
' se hanno lo stesso parametrro di posizionamento allora riordino
If Not String.IsNullOrEmpty(List(IndexList1).TidyParam) And Not String.IsNullOrEmpty(List(IndexList2).TidyParam) And
Not List(IndexList1).LoadByDefault And Not List(IndexList2).LoadByDefault Then
For IndexParam As Integer = 0 To List(0).CompoParamList.Count - 1
If List(IndexList1).CompoParamList(IndexParam).DDFName = List(IndexList1).TidyParam Then tidyParamIndex1 = IndexParam
Exit For
Next
For IndexParam As Integer = 0 To List(0).CompoParamList.Count - 1
If List(IndexList2).CompoParamList(IndexParam).DDFName = List(IndexList2).TidyParam Then tidyParamIndex2 = IndexParam
Exit For
Next
' se trovo il nome del parametro nell'elenco dei parametri
If Not tidyParamIndex1 = -1 And Not tidyParamIndex1 = -1 Then
If TypeOf List(IndexList1).CompoParamList(tidyParamIndex1) Is TextBoxParam And TypeOf List(IndexList2).CompoParamList(tidyParamIndex2) Is TextBoxParam Then
Dim Item1 As String = DirectCast(List(IndexList1).CompoParamList(tidyParamIndex1), TextBoxParam).Value
Dim Item2 As String = DirectCast(List(IndexList2).CompoParamList(tidyParamIndex2), TextBoxParam).Value
Dim dItem1 As Double
Dim dItem2 As Double
If StringToDouble(Item1, dItem1) And StringToDouble(Item2, dItem2) AndAlso dItem1 > dItem2 Then
Dim TempCompo As Compo = List(IndexList1)
List(IndexList1) = List(IndexList2)
List(IndexList2) = TempCompo
End If
End If
End If
End If
Next
Next
End If
' stampa lista
DdfFileContent.AddRange(GenerateCompolistDDF(List(0), WritingError, True, bIsDDF))
For IndexItem As Integer = 1 To List.Count - 1
DdfFileContent.AddRange(GenerateCompolistDDF(List(IndexItem), WritingError, False, bIsDDF))
Next
DdfFileContent.Add("")
' scrivo il messaggio di errore
If Not String.IsNullOrEmpty(WritingError) Then
WritingError &= Environment.NewLine
ErrorInWriting &= WritingError
End If
Return True
End Function
'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 bNewCompoNameDDF Then
' aggiungo il nome DDF della componente
CompoListDDF.Add(m_sSpaceTabCompo & Compo.CompoType.DDFName & ":")
End If
' se esiste il template
If Not String.IsNullOrWhiteSpace(Compo.TemplateDDFName) Then
' aggiungo " - nomeTemplate: TemplateSelezionato"
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & OptionModule.m_sSpaceHype & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
ElseIf Compo.LoadByDefault And SaveErrorCompo Then
CompoListDDF.Add(OptionModule.m_sSpaceHype & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50563=Compo {0} does not exist.
sErrorList &= String.Format(EgtMsg(50563), Compo.SelBrandPart & "\" & Compo.SelFile)
If Compo.m_ParameterDDfList.Count > 0 Then
For Each ItemLine In Compo.m_ParameterDDfList
CompoListDDF.Add(ItemLine)
Next
Return CompoListDDF
End If
ParamInCompoIsCorrect = False
Else
CompoListDDF.Add(OptionModule.m_sSpaceHype & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
End If
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)
' ComboBoxOnOff
If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
Dim cbParam As ComboBoxOnOffParam = DirectCast(CurrCompoParam, ComboBoxOnOffParam)
If cbParam.IsActive Then
' recupero l'indice dell'elemento selezionato
Dim IndexDDF As Integer = -1
If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
End If
' controllo che sia selezionato un elemento
If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
' restituisco il valore DDF della lista associato all'indice passato
Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
End If
Else
' se non è selezionato nessun elemento (cosa impossibile...)
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50125: Error reading {0} param in {1} compo: do not exist value.
sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
ParamInCompoIsCorrect = False
End If
End If
' ComboBox
ElseIf TypeOf CurrCompoParam Is ComboBoxParam Then
Dim cbParam As ComboBoxParam = DirectCast(CurrCompoParam, ComboBoxParam)
If Not cbParam.ErrorInReading And Not cbParam.MissingParameterInReading Then
' recupero l'indice dell'elemento selezionato
Dim IndexDDF As Integer = -1
If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
End If
' controllo che sia selezionato un elemento
If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
' restituisco il valore DDF della lista associato all'indice passato
Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
End If
Else
' se non è selezionato nessun elemento (cosa impossibile...)
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50125: Error reading {0} param in {1} compo: do not exist value.
sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
ParamInCompoIsCorrect = False
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
End If
End If
ElseIf Not cbParam.ErrorInReading And cbParam.MissingParameterInReading Then
' recupero l'indice dell'elemento selezionato
Dim IndexDDF As Integer = -1
If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
End If
' controllo che sia selezionato un elemento
If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
' restituisco il valore DDF della lista associato all'indice passato
Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & SelItemDDF)
End If
Else
' se non è selezionato nessun elemento (cosa impossibile...)
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50125: Error reading {0} param in {1} compo: do not exist value.
sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
ParamInCompoIsCorrect = False
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
End If
End If
Else
' 50125 =Error in reading {0} in compo {1}.
sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
ParamInCompoIsCorrect = False
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
Else
CompoListDDF.Add(m_sSpace3Tab & cbParam.DDFName & ": " & cbParam.SelItem)
End If
End If
' TextBox Opzionale
ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
Dim tboParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
If Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso tboParam.IsActive Then
' se è stata inserita un'espressione non valida restituisco un errore (50143: Invalid expression.)
If tboParam.ToolTipValue = EgtMsg(50143) Then
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tboParam.Name, Compo.CompoType.DDFName)
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tboParam.DDFName & ": ")
ParamInCompoIsCorrect = False
Else
CompoListDDF.Add(m_sSpace3Tab & tboParam.DDFName & ": " & tboParam.Value)
ParamInCompoIsCorrect = False
End If
Else
If bIsDDF Then
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tboParam.DDFName & ": " & tboParam.ToolTipValue)
Else
CompoListDDF.Add(m_sSpace3Tab & tboParam.DDFName & ": " & tboParam.ToolTipValue)
End If
Else
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tboParam.DDFName & ": " & tboParam.Value)
Else
CompoListDDF.Add(m_sSpace3Tab & tboParam.DDFName & ": " & tboParam.Value)
End If
End If
End If
ElseIf Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso Not tboParam.IsActive Then
' non restituire nessun tipo di errore
End If
' TextBox
ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
Dim tbParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
' se c'è scritto qualcosa
If Not String.IsNullOrWhiteSpace(tbParam.ToolTipValue) And Not Compo.MissingParameter Then
' se è stata inserita un'espressine non valida restituisco un errore
If tbParam.ToolTipValue = EgtMsg(50143) Then
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
End If
Else
If bIsDDF Then
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.ToolTipValue)
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.ToolTipValue)
End If
Else
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
End If
End If
End If
ElseIf Not String.IsNullOrWhiteSpace(tbParam.ToolTipValue) And Compo.MissingParameter Then
' If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' Missing parameter {0} in {1}.
' sErrorList &= String.Format("Missing parameter {0}.", tbParam.Name, Compo.CompoType.DDFName)
If tbParam.ToolTipValue = EgtMsg(50143) Then
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
End If
Else
If bIsDDF Then
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.ToolTipValue)
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.ToolTipValue)
End If
Else
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
Else
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
End If
End If
End If
Else
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
CompoListDDF.Add(m_sSpace3Tab & tbParam.DDFName & ": " & tbParam.Value)
End If
End If
Next
' inserisco qui il riferimento da stampare (il codice è scelto dalla porta)
If Not IsNothing(Compo.refJambCompo) Then
' stampo una componente dell'anta
If Not String.IsNullOrEmpty(Compo.IdCode) AndAlso Trim(Compo.refJambCompo.IdCode) = Trim(Compo.IdCode) Then
CompoListDDF.Add(m_sSpace3Tab & "##IdCodeComponent : " & Compo.IdCode)
Else
Compo.IdCode = CStr(IdIndex)
Compo.refJambCompo.IdCode = Trim(Compo.IdCode)
CompoListDDF.Add(m_sSpace3Tab & "##IdCodeComponent : " & Compo.IdCode)
End If
IdIndex += 1
ElseIf Not IsNothing(Compo.refCompoDoor) Then
' stampo una componente sul telaio
If Not String.IsNullOrEmpty(Compo.refCompoDoor.IdCode) Then
If Compo.OtherDoor Then
CompoListDDF.Add(m_sSpace3Tab & "other_door: 1")
End If
Compo.IdCode = Compo.refCompoDoor.IdCode
If Compo.MatchedDoor Then
' solo per il caso di sue ante
CompoListDDF.Add(m_sSpace3Tab & "##IdCodeComponent : " & Compo.IdCode & " , Matched")
Else
CompoListDDF.Add(m_sSpace3Tab & "##IdCodeComponent : " & Compo.IdCode)
End If
End If
ElseIf Not String.IsNullOrEmpty(Compo.IdCode) Then
If Compo.OtherDoor Then
CompoListDDF.Add(m_sSpace3Tab & "other_door: 1")
End If
CompoListDDF.Add(m_sSpace3Tab & "##IdCodeComponent : " & Compo.IdCode)
IdIndex += 1
End If
Return CompoListDDF
End Function
'Genero la lista delle componenti da passare al report
Private Sub GenerateCompoListReport(TempList As ObservableCollection(Of Compo))
For Each ItemCompo In TempList
Dim sImagePath As String = "Empty"
If File.Exists(ItemCompo.CompoType.Path & "\" & ItemCompo.SelBrandPart & "\" & ItemCompo.SelFile & ".png") Then
sImagePath = ItemCompo.CompoType.Path & "\" & ItemCompo.SelBrandPart & "\" & ItemCompo.SelFile & ".png"
End If
If ItemCompo.CompoType.DDFName.Trim = "vision_cut_outs" OrElse
ItemCompo.CompoType.DDFName.Trim = "louver_cut_outs" OrElse
ItemCompo.CompoType.DDFName.Trim = "mail_slots" OrElse
ItemCompo.CompoType.DDFName.Trim = "groove" OrElse
ItemCompo.CompoType.DDFName.Trim = "rabbet" OrElse
ItemCompo.CompoType.DDFName.Trim = "face_decoration" Then
ReportDoor.MachList.Add(New TableMach(ItemCompo.CompoType.Name, ItemCompo.SelFile, sImagePath))
For Each ItemParameter In ItemCompo.CompoParamList
Dim sValue As String = String.Empty
Dim bIsActive As Boolean = True
If TypeOf ItemParameter Is TextBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, TextBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, TextBoxOnOffParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, ComboBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, ComboBoxOnOffParam).m_SelItem
ElseIf TypeOf ItemParameter Is TextBoxParam Then
sValue = DirectCast(ItemParameter, TextBoxParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxParam Then
sValue = DirectCast(ItemParameter, ComboBoxParam).m_SelItem
End If
If bIsActive Then
ReportDoor.MachList(ReportDoor.MachList.Count - 1).Mach_ParametersList.Add(New ReportParameter(ItemParameter.Name, sValue))
End If
Next
Else
ReportDoor.HardwareList.Add(New TableHardaware(ItemCompo.CompoType.Name, ItemCompo.SelBrandPart, ItemCompo.SelFile, sImagePath))
For Each ItemParameter In ItemCompo.CompoParamList
Dim sValue As String = String.Empty
Dim bIsActive As Boolean = True
If TypeOf ItemParameter Is TextBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, TextBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, TextBoxOnOffParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, ComboBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, ComboBoxOnOffParam).m_SelItem
ElseIf TypeOf ItemParameter Is TextBoxParam Then
sValue = DirectCast(ItemParameter, TextBoxParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxParam Then
sValue = DirectCast(ItemParameter, ComboBoxParam).m_SelItem
End If
If bIsActive Then
ReportDoor.HardwareList(ReportDoor.HardwareList.Count - 1).Hardware_ParametersList.Add(New ReportParameter(ItemParameter.Name, sValue))
End If
Next
End If
Dim ReportompoItem As New ReportCompo(ItemCompo.CompoType.Name, ItemCompo.SelBrandPart, ItemCompo.SelFile)
For Each ItemParameter In ItemCompo.CompoParamList
Dim sValue As String = String.Empty
Dim bIsActive As Boolean = True
If TypeOf ItemParameter Is TextBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, TextBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, TextBoxOnOffParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxOnOffParam Then
bIsActive = DirectCast(ItemParameter, ComboBoxOnOffParam).IsActive
sValue = DirectCast(ItemParameter, ComboBoxOnOffParam).m_SelItem
ElseIf TypeOf ItemParameter Is TextBoxParam Then
sValue = DirectCast(ItemParameter, TextBoxParam).m_Value
ElseIf TypeOf ItemParameter Is ComboBoxParam Then
sValue = DirectCast(ItemParameter, ComboBoxParam).m_SelItem
End If
If bIsActive Then
ReportompoItem.CompoParameterList.Add(New ReportParameter(ItemParameter.Name, sValue))
End If
Next
ReportList.Add(ReportompoItem)
Next
End Sub
#End Region ' Funzioni per la scrittura delle componenti
' calcola il secure da salvare e il tipo di bevel
Public Function SetSecure(sSwing As String, DispositionItem As String, DoorSecure As String) As String
Dim sSecure As String
If DispositionItem = ConstGen.BEVEL_UP Then
If sSwing.Contains(ConstGen.HAND_REVERSE) Then
sSecure = ConstGen.SWING_UP
Else
sSecure = ConstGen.SWING_DOWN
End If
ElseIf DispositionItem = ConstGen.BEVEL_DOWN Then
If sSwing.Contains(ConstGen.HAND_REVERSE) Then
sSecure = ConstGen.SWING_DOWN
Else
sSecure = ConstGen.SWING_UP
End If
Else
If DoorSecure <> "0" Then
sSecure = DoorSecure
End If
sSecure = ConstGen.SWING_DOWN
End If
Return sSecure
End Function
' calcola il bevel da stamapare nel ddf
Public Function SetBevel(sTypePart As String, sCurrBevel As String, ByVal DispositionItem As String, sSwing As String, Optional ByVal InvertBevel As Boolean = False, Optional CurrSecure As String = "") As String
If sTypePart.Contains(ConstGen.PART_DO_) Then
If InvertBevel Then
' If sCurrBevel = ConstGen.BEVEL_GRAPHIC And DispositionItem = ConstGen.BEVEL_DOWN Then
If sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem = ConstGen.BEVEL_DOWN Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_UP) & m_sSpace1Tab & " ## Inverted"
' Return ConstGen.BEVEL_UP & m_sSpace1Tab & " ## Inverted"
ElseIf sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem = ConstGen.BEVEL_UP Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_DOWN) & m_sSpace1Tab & " ## Inverted"
'Return ConstGen.BEVEL_DOWN & m_sSpace1Tab & " ## Inverted"
ElseIf sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem <> ConstGen.BEVEL_UP And DispositionItem <> ConstGen.BEVEL_DOWN Then
If sSwing.Contains(ConstGen.HAND_REVERSE) Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_UP) & m_sSpace1Tab & " ## Inverted"
'Return ConstGen.BEVEL_UP & m_sSpace1Tab & " ## Inverted"
Else
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_DOWN) & m_sSpace1Tab & " ## Inverted"
'Return ConstGen.BEVEL_DOWN & m_sSpace1Tab & " ## Inverted"
End If
Else
Return sCurrBevel
End If
End If
' If sCurrBevel = ConstGen.BEVEL_GRAPHIC And DispositionItem = ConstGen.BEVEL_DOWN Then
If sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem = ConstGen.BEVEL_DOWN Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_DOWN)
ElseIf sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem = ConstGen.BEVEL_UP Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_UP)
ElseIf sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) And DispositionItem <> ConstGen.BEVEL_UP And DispositionItem <> ConstGen.BEVEL_DOWN Then
If sSwing.Contains(ConstGen.HAND_REVERSE) Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_DOWN)
Else
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_UP)
End If
Else
Return sCurrBevel
End If
Else
' If sCurrBevel = ConstGen.BEVEL_DOWN OrElse sCurrBevel = ConstGen.BEVEL_GRAPHIC OrElse sCurrBevel = ConstGen.BEVEL_UP Then
If sCurrBevel.Contains(ConstGen.BEVEL_DOWN) OrElse sCurrBevel.Contains(ConstGen.BEVEL_GRAPHIC) OrElse sCurrBevel.Contains(ConstGen.BEVEL_UP) Then
Return sCurrBevel.Replace(ConstGen.BEVEL_GRAPHIC, ConstGen.BEVEL_DOWN)
Else
Return sCurrBevel
End If
End If
End Function
#End Region ' Scrittura DDF
#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, bIsDDF As Boolean) As Boolean
' verifico esistenza assemblato
If IsNothing(CurrAssembly) Then Return False
' serve per capire se almeno un Part è stato inserito e quindi inserire il separatore
Dim bSplit As Boolean = False
Dim SplitPart As New List(Of String)
SplitPart.Add("")
SplitPart.Add(DDF_PARTIALEND)
Dim EndAssebly As New List(Of String)
EndAssebly.Add("")
EndAssebly.Add(DDF_END)
Dim FirstPart As Boolean = False
Dim GeneralAssembly As New List(Of String)
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
' scrive le informazioni relative all'assembalto
WriteGeneralAssembly(GeneralAssembly, CurrAssembly)
File.WriteAllLines(sPath, GeneralAssembly, Text.Encoding.UTF8)
FirstPart = True
ReportList.Clear()
ReportDoor.Order.Clear()
ReportDoor.Dimension.Clear()
ReportDoor.Proflie.Clear()
ReportDoor.OtherInfo.Clear()
ReportDoor.HardwareList.Clear()
ReportDoor.MachList.Clear()
ReportDoor.AttachmentsList.Clear()
End If
If CurrAssembly.ListPartDoor.Count > 0 Then
For IndexPartDoor As Integer = 0 To CurrAssembly.ListPartDoor.Count - 1
WriteDDFPart(CurrAssembly.ListPartDoor(IndexPartDoor).Door, sPath, bIsDDF, FirstPart)
If IndexPartDoor = CurrAssembly.ListPartDoor.Count - 1 Then
File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8)
Else
File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8)
End If
Next
End If
Return True
End Function
' scrive le informazioni generali dell'assemblato in forma di metadato ##
Public Function WriteGeneralAssembly(ByRef GeneralAssembly As List(Of String), CurrAssembly As Assembly) As Boolean
Dim dVal As Double = 0
GeneralAssembly.Add("#EGTDOORCREATOR")
GeneralAssembly.Add("#GENERAL ASSEMBLY")
GeneralAssembly.Add("#")
' dalla veresione 2.4l1 per gestione conversione mm/inch e viceversa
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "Unit : ")
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "measures : " & ConvertMmUnitsToString(OptionModule.m_bIsMmUnit))
GeneralAssembly.Add(DDF_METADATA)
' dati assemblato
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "Size : ")
If StringToDouble(CurrAssembly.Thickness, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "thickness : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(ConstCompo.DDF_METADATA & EgtMsg(50106) & "thickness", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.Width, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "width : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(ConstCompo.DDF_METADATA & EgtMsg(50106) & "width", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
GeneralAssembly.Add(DDF_METADATA)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "Light : ")
If StringToDouble(CurrAssembly.LightUp, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "up : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(ConstCompo.DDF_METADATA & EgtMsg(50106) & "LightUp", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.LightLock, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "lock : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "LightLock", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.LightHinge, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "hinge : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "LightHinge", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.LightBottom, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "bottom : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "LightBottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "Overlap : ")
If StringToDouble(CurrAssembly.ThicknessHead, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "thickness : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "ThicknessHead", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.OverlapHinge, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "hinge : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Overlap Hinge", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.OverlapLock, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "lock : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Overlap Lock", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.OverlapTop, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "top : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Overlap Top", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.DeltaThickness, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "deltaT : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Delta Thickness", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
' i parametri associatia alla condizione di Exterior sono stampati solo se Exterior è true
If CurrAssembly.Exterior Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "Exterior :")
If StringToDouble(CurrAssembly.OverlapBottom, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "overlap bottom : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Overlao Bottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.ThicknessBottom, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "thickness bottom : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Thickness Bottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.DepthBottom, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "depth bottom : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Depth Bottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
If StringToDouble(CurrAssembly.DeltaBottom, dVal) Then
GeneralAssembly.Add(ConstCompo.DDF_METADATA & "delta bottom : " & DoubleToString(dVal, 5))
Else
MessageBox.Show(EgtMsg(50106) & "Delta Bottom", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.S_PROFILES & ":")
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_LOCKEDGE & ": " & CurrAssembly.LockEdgeType.Name)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & 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 False
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_HINGEEDGE & ": " & CurrAssembly.HingeEdgeType.Name)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & 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 False
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_TOP & ": " & CurrAssembly.TopType.Name)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & 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 False
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_BOTTOM & ": " & CurrAssembly.BottomType.Name)
GeneralAssembly.Add(ConstCompo.DDF_METADATA & 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 False
End If
GeneralAssembly.Add(ConstCompo.DDF_METADATA & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
GeneralAssembly.Add(DDF_METADATA)
If Not IsNothing(CurrAssembly.DoorNumber) Then
GeneralAssembly.Add(DDF_METADATA & "doors : " & CurrAssembly.DoorNumber)
Else
MessageBox.Show(EgtMsg(50106) & "Number of Doors", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End If
GeneralAssembly.Add(" ")
'File.AppendAllLines(sPath, GeneralAssembly, Text.Encoding.UTF8)
Return True
End Function
#End Region
End Module