diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index aa63fa5..2982d4f 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -64,6 +64,7 @@ Public Class Assembly End Sub #End Region ' Light Up/Bottom +#Region "Light Hinge/Lock" Private m_LightHinge As String Public Property LightHinge As String Get @@ -99,6 +100,7 @@ Public Class Assembly m_LightLock = sLightLock NotifyPropertyChanged("LightLock") End Sub +#End Region ' Light Hinge/Lock Private m_ThicknessHead As String Public Property ThicknessHead As String @@ -120,6 +122,7 @@ Public Class Assembly NotifyPropertyChanged("ThicknessHead") End Sub +#Region "Overlap Hinge/Lock/Top/DeltaT" Private m_OverlapHinge As String Public Property OverlapHinge As String Get @@ -202,6 +205,7 @@ Public Class Assembly m_DeltaThickness = sDeltaThickness NotifyPropertyChanged("DeltaThickness") End Sub +#End Region ' Overlap Hinge/Lock/Top/DeltaT Private m_Exterior As Boolean Public Property Exterior As Boolean @@ -239,8 +243,10 @@ Public Class Assembly End Property Public Sub SetExterior(bExterior As Boolean) m_Exterior = bExterior + NotifyPropertyChanged("Exterior") End Sub +#Region "Jamb Thckness/Width" Private m_Thickness As String Public Property Thickness As String Get @@ -275,6 +281,8 @@ Public Class Assembly m_Width = sWidth NotifyPropertyChanged("Width") End Sub +#End Region ' Jamb Thickness/Width + '--------------------------------------------------------------------------------------------------------------------------------------------- #Region "EdgeType" @@ -756,7 +764,6 @@ Public Class Assembly If IsNothing(ReadAssembly.m_Exterior) Or Not ReadAssembly.m_Exterior Then ReadAssembly.m_Exterior = False ReadAssembly.m_OverlapTop = OptionModule.m_OverlapTop - ReadAssembly.m_DeltaThickness = OptionModule.m_DeltaThickness End If End If End If @@ -772,6 +779,7 @@ Public Class Assembly End If End Sub + ' funzione per la ricerca dei valori, restituice la riga successiva Private Function GetValue(Index As Integer, Name As String, ByRef Var As String) As Integer If Index = -1 Then Return Index @@ -790,8 +798,7 @@ Public Class Assembly End If End If End Function - - + ' funzione per la ricerca dei profili, restituisce la riga successiva Private Function GetValueProfiles(Index As Integer, Name As String, ByRef Var As EdgeType, ByRef VarMachining As Boolean, ByVal VarOverMaterial As String) As Integer ' Creo una stringa per scrivere gli errori Dim bError As Boolean = False @@ -900,6 +907,8 @@ Public Class Assembly Index = GetValue(Index, "hinge", m_OverlapHinge) If Index = -1 Then Return -1 Index = GetValue(Index, "lock", m_OverlapLock) + If Index = -1 Then Return -1 + Index = GetValue(Index, "deltaT", m_DeltaThickness) Return Index End Function @@ -921,8 +930,8 @@ Public Class Assembly m_Exterior = True If Index = -1 Then Return -1 Index = GetValue(Index, "top", m_OverlapTop) - If Index = -1 Then Return -1 - Index = GetValue(Index, "deltaT", m_DeltaThickness) + 'If Index = -1 Then Return -1 + 'Index = GetValue(Index, "deltaT", m_DeltaThickness) Return Index End Function @@ -944,13 +953,15 @@ Public Class Assembly DoorPiece = DoorPiece.Remove(3) End If Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible + 'Map.refPartPageVM.OrderButtonVisibility = Visibility.Collapsed Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage Else ' significa che stiamo per leggere una posrta singola + 'Map.refPartPageVM.OrderButtonVisibility = Visibility.Visible Local_Door.IsNotAssembly = True Local_Door.IsActive = True Local_PartDoor.Door = Local_Door - Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor + Local_PartDoor.Door.SwingTypeList = OptionModule.m_SwingTypeList Local_PartDoor.SetIsChecked(Local_Door.IsActive) SetArrayPartDoor(Local_PartDoor, 0) DdfFile.WriteDDFPart(GetArrayPartDoor(0).Door, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False) @@ -960,7 +971,6 @@ Public Class Assembly Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Exit While End If - Select Case DoorPiece Case "DO_1" Local_PartDoor.Door = Local_Door @@ -1014,6 +1024,7 @@ Public Class Assembly Return 1 End Function +#Region "Associazione delle compo lette da ddf" Public Sub MatchCompo() For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.LeftJamb) @@ -1026,7 +1037,6 @@ Public Class Assembly ResearchMatchDoor(GetArrayPartDoor(1).Door, GetArrayPartDoor(0).Door) End If End Sub - Private Sub ResearchMatchJamb(Door As Part, Jamb As Part) For IndexCompo As Integer = 0 To Door.CompoList.Count - 1 If Not String.IsNullOrEmpty(Door.CompoList(IndexCompo).IdCode) Then @@ -1073,7 +1083,6 @@ Public Class Assembly End If Next End Sub - Private Sub ResearchMatchDoor(DoorActive As Part, DoorInactive As Part) If Not DoorActive.Swing.Contains("I") Then For IndexCompo As Integer = 0 To DoorActive.CompoList.Count - 1 @@ -1121,6 +1130,8 @@ Public Class Assembly End If End Sub +#End Region ' Associazione delle compo lette da ddf + ' Agiorna IsVisible delle porte contenute nell'ArrayPartDoor Public Sub DoorVisibility() ' aggiorno la visibilità delle porte senza però modificare la dimensione dei Jamb caricati @@ -1136,6 +1147,9 @@ Public Class Assembly m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible") End If Next + If Not IsNothing(GetArrayPartDoor(0).Door) Then + If GetArrayPartDoor(0).Door.IsNotAssembly = True Then m_DoorNumber = "1" + End If If m_DoorNumber = "1" Then OneDoorProperty = True Else @@ -1145,7 +1159,9 @@ Public Class Assembly End Sub #End Region ' Lettura Assemblato + '--------------------------------------------------------------------------------------------------------------------------------------------- #Region "RULES ASSEMBLY" + ' carica la maggior parte dei valori da passare allo script lua. Public Function LoadModuleParam(CurrCompo As Compo) As Boolean Dim bExterior As Boolean = Exterior Dim dThicknessDoor As Double @@ -1232,6 +1248,10 @@ Public Class Assembly UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) Case "Lock" UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + Case "Top" + UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) + Case "Bottom" + UpDateCurrCompoJamb(GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)) End Select End If @@ -1241,62 +1261,43 @@ Public Class Assembly End Sub Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo) - If Not IsNothing(CurrCompo.refJambCompo) AndAlso CurrCompo.refJambCompo.CompoParamList.Count = CurrCompo.CompoParamList.Count Then - LoadModuleParam(CurrCompo) - CurrCompo.refJambCompo.IsReadOnly = False - '-------------------------------------------------------------------------------------------------------------------------------------------------------------- - ' devo distinguere il caso della componente sulla porta o sul jamb - For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 - 'ParamFunction.ParamName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName - If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then - Dim x = EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) - 'If EgtLuaCallFunction("STU.CalcParam") Then - Dim dInParamValue As Double - StringToDouble(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value, dInParamValue) - EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue) - x = EgtLuaCallFunction("STU.CalcParam") - Dim sVal As String = String.Empty - EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) - DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(CStr(sVal)) - EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) - 'End If - ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then - DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = False - ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then - EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) - If EgtLuaCallFunction("STU.CalcParam") Then + If Not IsNothing(CurrCompo.refJambCompo) Then + If LoadModuleParam(CurrCompo) Then + CurrCompo.refJambCompo.IsReadOnly = False + ' devo distinguere il caso della componente sulla porta o sul jamb + For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 + If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).DDFName) + Dim dInParamValue As Double + StringToDouble(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value, dInParamValue) + EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue) + EgtLuaCallFunction("STU.CalcParam") Dim sVal As String = String.Empty - EgtLuaSetGlobStringVar("STU.InParamValue", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) - DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(CStr(sVal)) - EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).IsReadOnly) + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = False + ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then + EgtLuaSetGlobStringVar("STU.InParamName", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).DDFName) + If EgtLuaCallFunction("STU.CalcParam") Then + Dim sVal As String = String.Empty + EgtLuaSetGlobStringVar("STU.InParamValue", DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) + EgtLuaGetGlobStringVar("STU.OutParamValue", sVal) + DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(CStr(sVal)) + EgtLuaGetGlobBoolVar("STU.IsEnable", DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).IsReadOnly) + End If End If - End If - Next - '-------------------------------------------------------------------------------------------------------------------------------------------------------------- - + Next + Else + MessageBox.Show("Script Lua (" & CurrCompo.CompoType.Path & "\" & "Matching.lua" & ")has not been found", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + End If Else MessageBox.Show("Error in matching component in jamb, the compo on the jamb will not be modify", "Caution Matching", MessageBoxButton.OK, MessageBoxImage.Warning) End If EgtLuaResetGlobVar("STU") End Sub - 'Public Sub UpDateCurrCompoDoor(ByRef CurrCompo As Compo) - ' If Not IsNothing(CurrCompo.refJambCompo) AndAlso CurrCompo.refJambCompo.CompoParamList.Count = CurrCompo.CompoParamList.Count Then - ' LoadModuleParam(CurrCompo) - ' For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 - ' ParamFunction.ParamName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName - ' If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then - ' DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam).SetValue(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam).m_Value) - ' ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then - ' DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam).SetValue(DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam).m_Value) - ' End If - ' Next - ' Else - ' MessageBox.Show("Error in matching component in jamb, the compo on the jamb will not be modify", "Caution Matching", MessageBoxButton.OK, MessageBoxImage.Warning) - ' End If - 'End Sub - ' calcola la giusta lista di swing per ogni porta e ricalcolo la dimensione dei Jamb Top e Bottom (width) Public Sub DoorVisibilityNew() ' definisco gli swing riferiti ai Jamb e quindi anche i nomi da associare alle porte durante la creazione di una nuova porta @@ -1305,6 +1306,7 @@ Public Class Assembly Select Case DoorNumber Case "1" ' passaggio da due porte ad una porta OneDoorProperty = True + NotifyPropertyChanged("OneDoorProperty") ' inverto la posizioned delle porte If GetArrayPartDoor(0).Door.Swing.Contains("I") Then AppPartDoor = GetArrayPartDoor(1) @@ -1332,30 +1334,44 @@ Public Class Assembly End If '-------------------------------------------------------------------------------------------------------------------------------------------------------------- ' Elimino tutti le componenti sul Jamb (che ora diventa di Tipo L) eliminando dalla porta due + Map.refPartPageVM.CurrPart = GetArrayPartDoor(1).Door For IndexDeleteCompo As Integer = GetArrayPartDoor(1).Door.CompoList.Count - 1 To 0 Step -1 - GetArrayPartDoor(1).Door.CompoList(IndexDeleteCompo).Delete() + Map.refPartPageVM.CurrPart.CompoList(IndexDeleteCompo).Delete() Next ' ricarico tutti i riferimenti della porta vecchia sul jamb - For IndexDeleteCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1 - If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexDeleteCompo).refJambCompo) Then - - End If - Next + Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door + SetTopWidth() + ReplaceHardware() '-------------------------------------------------------------------------------------------------------------------------------------------------------------- ' riassegno gli swing ai Jamb LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) RightJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) BottomJamb.SetSwing(GetArrayPartDoor(0).Door.Swing) - If LeftJamb.Swing.Contains("L") Then - LeftJamb.TypePart = "FL_H" - RightJamb.TypePart = "FR_L" + If Not Exterior Then + If LeftJamb.Swing.Contains("L") Then + LeftJamb.TypePart = "FL_H" + RightJamb.TypePart = "FR_L" + Else + LeftJamb.TypePart = "FL_L" + RightJamb.TypePart = "FR_H" + End If + BottomJamb.TypePart = "FB_B" + TopJamb.TypePart = "FT_T" Else - LeftJamb.TypePart = "FL_L" - RightJamb.TypePart = "FR_H" + If LeftJamb.Swing.Contains("L") Then + LeftJamb.TypePart = "FL_HE" + RightJamb.TypePart = "FR_LE" + Else + LeftJamb.TypePart = "FL_LE" + RightJamb.TypePart = "FR_HE" + End If + BottomJamb.TypePart = "FB_BE" + TopJamb.TypePart = "FT_TE" End If - BottomJamb.TypePart = "FB_B" - TopJamb.TypePart = "FT_T" + TopRabbetJamb() + BottomRabbetJamb() + HingeRabbetJamb() NotifyPropertyChanged("CurrAssembly") Case "2" ' passaggio da una porta a due porte OneDoorProperty = False @@ -1440,11 +1456,9 @@ Public Class Assembly RightJamb.TypePart = "FR_H" BottomJamb.TypePart = "FB_B" TopJamb.TypePart = "FT_T" + ReplaceHardware() NotifyPropertyChanged("CurrAssembly") End Select - ' azzero le dimensioni appena create della porta - m_BottomJamb.SetWidth("0") - m_TopJamb.SetWidth("0") For Index As Integer = 0 To CInt(m_DoorNumber) - 1 If Not IsNothing(m_ArrayPartDoor(Index)) Then m_ArrayPartDoor(Index).IsVisible = Visibility.Visible @@ -1888,11 +1902,12 @@ Public Class Assembly End If End Sub - ' ricalcola la posizione di tutti gli hardware + ' ricalcola la posizione di tutti gli hardware se esiste un riferimento Public Sub ReplaceHardware() For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then + Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1 If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value @@ -1903,6 +1918,21 @@ Public Class Assembly Next End Sub + 'Public Sub AddHardware() + ' For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 + ' For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 + ' If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then + ' 'If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.Si Then + ' Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem + ' For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1 + ' If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then + ' DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value + ' End If + ' Next + ' End If + ' Next + ' Next + 'End Sub #End Region ' Rules Assembly Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged diff --git a/Assembly/AssemblyPageV.xaml b/Assembly/AssemblyPageV.xaml index eff1ea6..38a0588 100644 --- a/Assembly/AssemblyPageV.xaml +++ b/Assembly/AssemblyPageV.xaml @@ -20,6 +20,11 @@ + + + + + @@ -28,7 +33,7 @@ - + @@ -134,7 +139,7 @@ - + @@ -243,7 +248,7 @@ - + - + - - - - + + + +