93bc8aaf9c
-> correzione annullamento nuovo assemblato, -> gestione automatico del ricalcolo della ferramenta in caso di inversione delle ante (cambio Swing) -> evidenziazione dei parametri modificati (sui telai) e segnalazione in caso di ricalcolo (si: ricalcolo, no: ognora il ricalcolo, annulla: ripristina l'ultimo valore inserito) -> aggiunta dei bottoni per il ricalcolo su ogni componente della porta (solo se la componente ha un riferimento valido)
3771 lines
173 KiB
VB.net
3771 lines
173 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports System.Text.RegularExpressions
|
|
|
|
Public Class Assembly
|
|
Implements INotifyPropertyChanged
|
|
|
|
' questa variabile se settata a vero da la possibilità di costruire un riferimento sui Jamb
|
|
Friend Shared BuiltReffCompo As Boolean = False
|
|
Public bIsNewAssembly As Boolean = False
|
|
Public Shared FirstReadingWeight As Boolean = False
|
|
|
|
Public bOldVersion As Boolean = False
|
|
|
|
' è usata per abilitare la TextBox associata all'OverlapLock
|
|
Private m_OneDoorProperty As Boolean = True
|
|
Public Property OneDoorProperty As Boolean
|
|
Get
|
|
Return m_OneDoorProperty
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_OneDoorProperty = value
|
|
NotifyPropertyChanged("OneDoorProperty")
|
|
End Set
|
|
End Property
|
|
|
|
' tutte queste proprietà interagiscono direttamente con le dimensioni del TELAIO
|
|
' per questo motivo la funzione set può ospitare la chiamata ad una funzione che modifica le dimensioni della porta
|
|
|
|
#Region "GENERAL"
|
|
|
|
#Region "Light Up/Bottom"
|
|
|
|
Private m_LightUp As String
|
|
Public Property LightUp As String
|
|
Get
|
|
Return m_LightUp
|
|
End Get
|
|
Set(value As String)
|
|
m_LightUp = value
|
|
NotifyPropertyChanged("LightUp")
|
|
' viene ricalcolata la dimensione dell'anta
|
|
HeightDoor()
|
|
' viene ricalcolata l'altezza della porta e dei jamb laterali a partire dalla dimensione della porta
|
|
HeightJamb()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
' questo metodo è utilizzato per caricare e aggiornare il valore m_lightUp senza eseguire le operazioni del Set
|
|
Public Sub SetLightUp(sLightUp As String)
|
|
m_LightUp = sLightUp
|
|
NotifyPropertyChanged("LightUp")
|
|
End Sub
|
|
|
|
Private m_LightBottom As String
|
|
Public Property LightBottom As String
|
|
Get
|
|
Return m_LightBottom
|
|
End Get
|
|
Set(value As String)
|
|
m_LightBottom = value
|
|
' viene ricalcolata la dimensione dell'anta
|
|
HeightDoor()
|
|
' viene ricalcolata l'altezza dei jamb laterali a partire dalla dimensione della porta
|
|
HeightJamb()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetLightBottom(sLightBottom As String)
|
|
m_LightBottom = sLightBottom
|
|
NotifyPropertyChanged("LightBottom")
|
|
End Sub
|
|
|
|
#End Region ' Light Up/Bottom
|
|
|
|
#Region "Light Hinge/Lock"
|
|
|
|
Private m_LightHinge As String
|
|
Public Property LightHinge As String
|
|
Get
|
|
Return m_LightHinge
|
|
End Get
|
|
Set(value As String)
|
|
m_LightHinge = value
|
|
' viene ricalcolata la larghezza dei jamb orizzonati (le dimensioni della porta devono esistere)
|
|
TopBottomWidth()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetLightHinge(sSetLightHinge As String)
|
|
m_LightHinge = sSetLightHinge
|
|
NotifyPropertyChanged("LightHinge")
|
|
End Sub
|
|
|
|
Private m_LightLock As String
|
|
Public Property LightLock As String
|
|
Get
|
|
Return m_LightLock
|
|
End Get
|
|
Set(value As String)
|
|
m_LightLock = value
|
|
' viene ricalcolata la larghezza dei jamb orizzonati (le dimensioni della porta devono esistere)
|
|
TopBottomWidth()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetLightLock(sLightLock As String)
|
|
m_LightLock = sLightLock
|
|
NotifyPropertyChanged("LightLock")
|
|
End Sub
|
|
|
|
#End Region ' Light Hinge/Lock
|
|
|
|
#Region "ThicknessHead"
|
|
|
|
Private m_ThicknessHead As String
|
|
Public Property ThicknessHead As String
|
|
Get
|
|
Return m_ThicknessHead
|
|
End Get
|
|
Set(value As String)
|
|
m_ThicknessHead = value
|
|
NotifyPropertyChanged("ThicknessHead")
|
|
' viene ricalcolata l'altezza del JambTop
|
|
HeightJambTop()
|
|
' viene ricalcolata l'altezza della porta e dei jamb laterali a partire dalla dimensione della porta
|
|
' per il fatto che anche i jamb lateriali devono allungarsi
|
|
HeightJamb()
|
|
' viene ricalcolata la dimsione dei rabbet sui jamb laterali (per ospitare la nuova dimansione del JambTop)
|
|
TopRabbetJamb()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetThicknessHead(sThicknessHead As String)
|
|
m_ThicknessHead = sThicknessHead
|
|
NotifyPropertyChanged("ThicknessHead")
|
|
End Sub
|
|
|
|
#End Region ' ThicknessHead
|
|
|
|
#Region "Thickness/Depth Bottom"
|
|
|
|
Private m_ThicknessBottom As String
|
|
Public Property ThicknessBottom As String
|
|
Get
|
|
Return m_ThicknessBottom
|
|
End Get
|
|
Set(value As String)
|
|
m_ThicknessBottom = value
|
|
NotifyPropertyChanged("ThicknessBottom")
|
|
' viene ricalcolata l'altezza del JambTop
|
|
HeightJambBottom()
|
|
' viene ricalcolata l'altezza della porta e dei jamb laterali a partire dalla dimensione della porta
|
|
' per il fatto che anche i jamb lateriali devono allungarsi
|
|
HeightJamb()
|
|
' viene ricalcolata la dimsione dei rabbet sui jamb laterali (per ospitare la nuova dimansione del JambTop)
|
|
BottomRabbetJamb()
|
|
' esegue il riposizionamento delle componeti sul telaio
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetThicknessBottom(sThicknessBottom As String)
|
|
m_ThicknessBottom = sThicknessBottom
|
|
NotifyPropertyChanged("ThicknessBottom")
|
|
End Sub
|
|
|
|
Private m_DepthBottom As String
|
|
Public Property DepthBottom As String
|
|
Get
|
|
Return m_DepthBottom
|
|
End Get
|
|
Set(value As String)
|
|
m_DepthBottom = value
|
|
NotifyPropertyChanged("DepthBottom")
|
|
' viene ricalcolata la profondità del JambBottom
|
|
SetThicKnessJamb()
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetDepthBottom(sDepthBottom As String)
|
|
m_DepthBottom = sDepthBottom
|
|
NotifyPropertyChanged("DepthBottom")
|
|
End Sub
|
|
|
|
#End Region ' Thickness Depth Bottom
|
|
|
|
#Region "Overlap Hinge/Lock/Top/DeltaT"
|
|
|
|
Private m_OverlapHinge As String
|
|
Public Property OverlapHinge As String
|
|
Get
|
|
Return m_OverlapHinge
|
|
End Get
|
|
Set(value As String)
|
|
m_OverlapHinge = value
|
|
' modifico le dimensioni dei Jambs
|
|
'DoorVisibilityNew()
|
|
' deve essere ricalcolata la dimensione del Top e del Bottom del telaio
|
|
TopBottomWidth()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'SetWidthJamb()
|
|
' viene ricalcolato il valore dei rabbet (sui Jamb laterali)
|
|
TopRabbetJamb()
|
|
HingeRabbetJamb()
|
|
BottomRabbetJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetOverlapHinge(sOverlapHinge As String)
|
|
m_OverlapHinge = sOverlapHinge
|
|
NotifyPropertyChanged("OverlapHinge")
|
|
End Sub
|
|
|
|
Private m_OverlapLock As String
|
|
Public Property OverlapLock As String
|
|
Get
|
|
Return m_OverlapLock
|
|
End Get
|
|
Set(value As String)
|
|
m_OverlapLock = value
|
|
' modifico le dimensioni dei Jambs
|
|
'DoorVisibilityNew()
|
|
TopBottomWidth()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'SetWidthJamb()
|
|
TopRabbetJamb()
|
|
HingeRabbetJamb()
|
|
BottomRabbetJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetOverlapLock(sOverlapLock As String)
|
|
m_OverlapLock = sOverlapLock
|
|
NotifyPropertyChanged("OverlapLock")
|
|
End Sub
|
|
|
|
Private m_OverlapTop As String
|
|
Public Property OverlapTop As String
|
|
Get
|
|
Return m_OverlapTop
|
|
End Get
|
|
Set(value As String)
|
|
m_OverlapTop = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
HeightJamb()
|
|
SetWidthJamb()
|
|
'HingeRabbetJamb()
|
|
'BottomRabbetJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetOverlapTop(sOverlapTop As String)
|
|
m_OverlapTop = sOverlapTop
|
|
NotifyPropertyChanged("OverlapTop")
|
|
End Sub
|
|
|
|
Private m_OverlapBottom As String
|
|
Public Property OverlapBottom As String
|
|
Get
|
|
Return m_OverlapBottom
|
|
End Get
|
|
Set(value As String)
|
|
m_OverlapBottom = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
HeightJamb()
|
|
SetWidthJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetOverlapBottom(sOverlapBottom As String)
|
|
m_OverlapBottom = sOverlapBottom
|
|
NotifyPropertyChanged("OverlapBottom")
|
|
End Sub
|
|
|
|
Private m_DeltaThickness As String
|
|
Public Property DeltaThickness As String
|
|
Get
|
|
Return m_DeltaThickness
|
|
End Get
|
|
Set(value As String)
|
|
m_DeltaThickness = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
HingeRabbetJamb()
|
|
BottomRabbetJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetDeltaThickness(sDeltaThickness As String)
|
|
m_DeltaThickness = sDeltaThickness
|
|
NotifyPropertyChanged("DeltaThickness")
|
|
End Sub
|
|
#End Region ' Overlap Hinge/Lock/Top/DeltaT
|
|
|
|
#Region "Jamb Thckness/Width"
|
|
|
|
Private m_Thickness As String
|
|
Public Property Thickness As String
|
|
Get
|
|
Return m_Thickness
|
|
End Get
|
|
Set(value As String)
|
|
m_Thickness = value
|
|
SetThicKnessJamb()
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetThickness(sThickness As String)
|
|
m_Thickness = sThickness
|
|
NotifyPropertyChanged("Thickness")
|
|
End Sub
|
|
|
|
Private m_Width As String
|
|
Public Property Width As String
|
|
Get
|
|
Return m_Width
|
|
End Get
|
|
Set(value As String)
|
|
m_Width = value
|
|
HeightJamb()
|
|
SetWidthJamb()
|
|
UpDateAllCompo()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetWidth(sWidth As String)
|
|
m_Width = sWidth
|
|
NotifyPropertyChanged("Width")
|
|
End Sub
|
|
#End Region ' Jamb Thickness/Width
|
|
|
|
#Region "EdgeType/Machining"
|
|
|
|
Friend Shared m_FrameEdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
Public ReadOnly Property EdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
Return m_FrameEdgeTypeList
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DispositionList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
Return Part.m_DispositionList
|
|
End Get
|
|
End Property
|
|
|
|
' elemento selezionato dalla lista delle disposizinioni
|
|
Private m_DispositionItem As EdgeType
|
|
Public Property DispositionItem As EdgeType
|
|
Get
|
|
Return m_DispositionItem
|
|
End Get
|
|
Set(value As EdgeType)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.DispositionItem = value
|
|
Next
|
|
m_DispositionItem = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("DispositionItem")
|
|
End Set
|
|
End Property
|
|
Public Sub SetDispositionItem(ObjDisposition As EdgeType)
|
|
If IsNothing(m_DispositionItem) Then
|
|
m_DispositionItem = ObjDisposition
|
|
End If
|
|
NotifyPropertyChanged("DispositionItem")
|
|
End Sub
|
|
|
|
Private m_LockEdgeType As New EdgeType("", Visibility.Visible)
|
|
Public Property LockEdgeType As EdgeType
|
|
Get
|
|
If m_LockEdgeType.IsActive = Visibility.Collapsed Then
|
|
m_LockEdgeType = EdgeTypeList(0)
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
Return m_LockEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeType = value
|
|
Next
|
|
m_LockEdgeType = value
|
|
NotifyPropertyChanged("LockEdgeType")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.SetLockEdgeType(value)
|
|
'm_RightJamb.SetLockEdgeType(value)
|
|
'm_TopJamb.SetLockEdgeType(value)
|
|
'm_BottomJamb.SetLockEdgeType(value)
|
|
End Set
|
|
End Property
|
|
Public Sub SetLockEdgeType(sLockEdgeType As EdgeType)
|
|
m_LockEdgeType = sLockEdgeType
|
|
NotifyPropertyChanged("LockEdgeType")
|
|
End Sub
|
|
|
|
Private m_HingeEdgeType As New EdgeType("", Visibility.Visible)
|
|
Public Property HingeEdgeType As EdgeType
|
|
Get
|
|
If m_HingeEdgeType.IsActive = Visibility.Collapsed Then
|
|
m_HingeEdgeType = EdgeTypeList(0)
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
Return m_HingeEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeType = value
|
|
Next
|
|
m_HingeEdgeType = value
|
|
NotifyPropertyChanged("HingeEdgeType")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.SetHingeEdgeType(value)
|
|
'm_RightJamb.SetHingeEdgeType(value)
|
|
'm_TopJamb.SetHingeEdgeType(value)
|
|
'm_BottomJamb.SetHingeEdgeType(value)
|
|
End Set
|
|
End Property
|
|
Public Sub SetHingeEdgeType(sHingeEdgeType As EdgeType)
|
|
m_HingeEdgeType = sHingeEdgeType
|
|
NotifyPropertyChanged("HingeEdgeType")
|
|
End Sub
|
|
|
|
Private m_TopType As New EdgeType("", Visibility.Visible)
|
|
Public Property TopType As EdgeType
|
|
Get
|
|
If m_TopType.IsActive = Visibility.Collapsed Then
|
|
m_TopType = EdgeTypeList(0)
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
Return m_TopType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopType = value
|
|
Next
|
|
m_TopType = value
|
|
NotifyPropertyChanged("TopType")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.SetTopType(value)
|
|
'm_RightJamb.SetTopType(value)
|
|
'm_TopJamb.SetTopType(value)
|
|
'm_BottomJamb.SetTopType(value)
|
|
End Set
|
|
End Property
|
|
Public Sub SetTopType(sTopType As EdgeType)
|
|
m_TopType = sTopType
|
|
NotifyPropertyChanged("TopType")
|
|
End Sub
|
|
|
|
Private m_BottomType As New EdgeType("", Visibility.Visible)
|
|
Public Property BottomType As EdgeType
|
|
Get
|
|
If m_BottomType.IsActive = Visibility.Collapsed Then
|
|
m_BottomType = EdgeTypeList(0)
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
Return m_BottomType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomType = value
|
|
Next
|
|
m_BottomType = value
|
|
NotifyPropertyChanged("BottomType")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.SetBottomType(value)
|
|
'm_RightJamb.SetBottomType(value)
|
|
'm_TopJamb.SetBottomType(value)
|
|
'm_BottomJamb.SetBottomType(value)
|
|
End Set
|
|
End Property
|
|
Public Sub SetBottomType(sBottomType As EdgeType)
|
|
m_BottomType = sBottomType
|
|
NotifyPropertyChanged("BottomType")
|
|
End Sub
|
|
|
|
Private m_TopMachining As Boolean
|
|
Public Property TopMachining As Boolean
|
|
Get
|
|
Return m_TopMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopMachining = value
|
|
Next
|
|
m_TopMachining = value
|
|
NotifyPropertyChanged("TopMachining")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.TopMachining = m_TopMachining
|
|
'm_RightJamb.TopMachining = m_TopMachining
|
|
'm_TopJamb.TopMachining = m_TopMachining
|
|
'm_BottomJamb.TopMachining = m_TopMachining
|
|
End Set
|
|
End Property
|
|
Public Sub SetTopMachining(sTopMachining As Boolean)
|
|
m_TopMachining = sTopMachining
|
|
NotifyPropertyChanged("TopMachining")
|
|
End Sub
|
|
|
|
Private m_LockEdgeMachining As Boolean
|
|
Public Property LockEdgeMachining As Boolean
|
|
Get
|
|
Return m_LockEdgeMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeMachining = value
|
|
Next
|
|
m_LockEdgeMachining = value
|
|
NotifyPropertyChanged("LockEdgeMachining")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.LockEdgeMachining = m_LockEdgeMachining
|
|
'm_RightJamb.LockEdgeMachining = m_LockEdgeMachining
|
|
'm_TopJamb.LockEdgeMachining = m_LockEdgeMachining
|
|
'm_BottomJamb.LockEdgeMachining = m_LockEdgeMachining
|
|
End Set
|
|
End Property
|
|
Public Sub SetLockEdgeMachining(sLockEdgeMachining As Boolean)
|
|
m_LockEdgeMachining = sLockEdgeMachining
|
|
NotifyPropertyChanged("LockEdgeMachining")
|
|
End Sub
|
|
|
|
Private m_HingeEdgeMachining As Boolean
|
|
Public Property HingeEdgeMachining As Boolean
|
|
Get
|
|
Return m_HingeEdgeMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeMachining = value
|
|
Next
|
|
m_HingeEdgeMachining = value
|
|
NotifyPropertyChanged("HingeEdgeMachining")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.HingeEdgeMachining = value
|
|
'm_RightJamb.HingeEdgeMachining = value
|
|
'm_TopJamb.HingeEdgeMachining = value
|
|
'm_BottomJamb.HingeEdgeMachining = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetHingeEdgeMachining(sHingeEdgeMachining As Boolean)
|
|
m_HingeEdgeMachining = sHingeEdgeMachining
|
|
NotifyPropertyChanged("HingeEdgeMachining")
|
|
End Sub
|
|
|
|
Private m_BottomMachining As Boolean
|
|
Public Property BottomMachining As Boolean
|
|
Get
|
|
Return m_BottomMachining
|
|
End Get
|
|
Set(value As Boolean)
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomMachining = value
|
|
Next
|
|
m_BottomMachining = value
|
|
NotifyPropertyChanged("BottomMachining")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
'm_LeftJamb.BottomMachining = value
|
|
'm_RightJamb.BottomMachining = value
|
|
'm_TopJamb.BottomMachining = value
|
|
'm_BottomJamb.BottomMachining = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetBottomMachining(sBottomMachining As Boolean)
|
|
m_BottomMachining = sBottomMachining
|
|
NotifyPropertyChanged("BottomMachining")
|
|
End Sub
|
|
|
|
#End Region ' EdgeType
|
|
|
|
#Region "EXTERIOR"
|
|
|
|
Private m_Exterior As Boolean
|
|
Public Property Exterior As Boolean
|
|
Get
|
|
Return m_Exterior
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Exterior = value
|
|
NotifyPropertyChanged("Exterior")
|
|
SetDimension("JambIsCheked")
|
|
'JambBIsChecked = value
|
|
SetJambBTIsChecked(value)
|
|
NotifyPropertyChanged("JambBIsChecked")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
SetThicKnessJamb()
|
|
'HingeRabbetJamb()
|
|
'BottomRabbetJamb()
|
|
End Set
|
|
End Property
|
|
Public Sub SetExterior(bExterior As Boolean)
|
|
m_Exterior = bExterior
|
|
NotifyPropertyChanged("Exterior")
|
|
End Sub
|
|
|
|
Private m_DeltaBottom As String
|
|
Public Property DeltaBottom As String
|
|
Get
|
|
Return m_DeltaBottom
|
|
End Get
|
|
Set(value As String)
|
|
m_DeltaBottom = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
BottomRabbetJamb()
|
|
UpDateAllCompo()
|
|
End Set
|
|
End Property
|
|
Public Sub SetDeltaBottom(sDeltaBottom As String)
|
|
m_DeltaBottom = sDeltaBottom
|
|
NotifyPropertyChanged("DeltaBottom")
|
|
End Sub
|
|
|
|
#End Region ' Exterior
|
|
|
|
#Region "ASSEMBLY DIMENSION"
|
|
|
|
Private m_Dimension As Boolean = OptionModule.m_TotalDimension
|
|
Public Property Dimension As Boolean
|
|
Get
|
|
Return m_Dimension
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Dimension = value
|
|
NotifyPropertyChanged("Dimension")
|
|
End Set
|
|
End Property
|
|
Public Sub SetDimension(bDimension As Boolean)
|
|
m_Dimension = bDimension
|
|
NotifyPropertyChanged("Dimension")
|
|
End Sub
|
|
|
|
Private m_AssemblyHeight As String
|
|
Public Property AssemblyHeight As String
|
|
Get
|
|
' calcolo la dimensione dell'assemblato
|
|
If Not IsNothing(m_Door1) AndAlso Not m_Dimension Then
|
|
Dim nLU As Double = 0
|
|
Dim nLB As Double = 0
|
|
Dim nTH As Double = 0
|
|
Dim nBH As Double = 0
|
|
Dim nOLB As Double = 0
|
|
Dim nDO_1H As Double = 0
|
|
Dim nOLT As Double = 0
|
|
StringToDouble(LightUp, nLU)
|
|
StringToDouble(LightBottom, nLB)
|
|
StringToDouble(ThicknessHead, nTH)
|
|
StringToDouble(ThicknessBottom, nBH)
|
|
StringToDouble(OverlapBottom, nOLB)
|
|
StringToDouble(m_Door1.Height, nDO_1H)
|
|
StringToDouble(OverlapTop, nOLT)
|
|
m_AssemblyHeight = DoubleToString(nLU + nLB + nTH + nDO_1H - nOLT, 4)
|
|
If Exterior Then
|
|
|
|
m_AssemblyHeight = DoubleToString(nLU + nLB + nTH + nBH + nDO_1H - nOLT - nOLB, 4)
|
|
End If
|
|
End If
|
|
Return m_AssemblyHeight
|
|
End Get
|
|
Set(value As String)
|
|
m_AssemblyHeight = value
|
|
NotifyPropertyChanged("AssemblyHeight")
|
|
SetDimension("Height")
|
|
End Set
|
|
End Property
|
|
Public Sub SetAssemblyHeight(sAssemblyHeight As String)
|
|
m_AssemblyHeight = sAssemblyHeight
|
|
NotifyPropertyChanged("AssemblyHeight")
|
|
End Sub
|
|
|
|
Private m_AssemblyWidth As String
|
|
Public Property AssemblyWidth As String
|
|
Get
|
|
If Not Dimension AndAlso Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("FT_")) AndAlso
|
|
Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("FT_").Door.Width) Then
|
|
Dim nFTW As Double = 0
|
|
Dim nJW As Double = 0
|
|
Dim nOLL As Double
|
|
Dim nOLH As Double
|
|
StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("FT_").Door.Width, nFTW)
|
|
StringToDouble(Width, nJW)
|
|
StringToDouble(OverlapLock, nOLL)
|
|
StringToDouble(OverlapHinge, nOLH)
|
|
If DoorNumber = "1" Then
|
|
m_AssemblyWidth = DoubleToString(nFTW + 2 * nJW - nOLL - nOLH, 4)
|
|
Else
|
|
m_AssemblyWidth = DoubleToString(nFTW + 2 * nJW - 2 * nOLH, 4)
|
|
End If
|
|
End If
|
|
Return m_AssemblyWidth
|
|
End Get
|
|
Set(value As String)
|
|
m_AssemblyWidth = value
|
|
SetWidthJamb()
|
|
SetDimension("Width")
|
|
NotifyPropertyChanged("AssemblyWidth")
|
|
End Set
|
|
End Property
|
|
Public Sub SetAssemblyWidth(sAssemblyWidth As String)
|
|
m_AssemblyWidth = sAssemblyWidth
|
|
NotifyPropertyChanged("AssemblyWidth")
|
|
End Sub
|
|
|
|
' questa proprietà è utilizzata per stampare l'altezza della porta nella sezione dei jamb
|
|
Public ReadOnly Property OrigHeightDoor As String
|
|
Get
|
|
If Not IsNothing(m_Door1) Then
|
|
Return m_Door1.Height
|
|
ElseIf Not IsNothing(m_Door2) Then
|
|
Return m_Door2.Height
|
|
End If
|
|
Return "0"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Assembly Dimension
|
|
|
|
#Region "OverMaterial"
|
|
|
|
Private m_LockEdgeOverMaterial As String = String.Empty
|
|
Public Property LockEdgeOverMaterial As String
|
|
Get
|
|
Return m_LockEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
If String.IsNullOrEmpty(value) Then value = "0"
|
|
Dim dVal As Double
|
|
If StringToDouble(value, dVal) Then
|
|
m_LockEdgeOverMaterial = value
|
|
Else
|
|
MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
End If
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeOverMaterial = value
|
|
Next
|
|
'm_LeftJamb.LockEdgeOverMaterial = value
|
|
'm_RightJamb.LockEdgeOverMaterial = value
|
|
'm_TopJamb.LockEdgeOverMaterial = value
|
|
'm_BottomJamb.LockEdgeOverMaterial = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetLockEdgeOverMaterial(sLockEdgeOverMaterial As String)
|
|
m_LockEdgeOverMaterial = sLockEdgeOverMaterial
|
|
NotifyPropertyChanged("LockEdgeOverMaterial")
|
|
End Sub
|
|
|
|
Private m_HingeEdgeOverMaterial As String = String.Empty
|
|
Public Property HingeEdgeOverMaterial As String
|
|
Get
|
|
Return m_HingeEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
If String.IsNullOrEmpty(value) Then value = "0"
|
|
Dim dVal As Double
|
|
If StringToDouble(value, dVal) Then
|
|
m_HingeEdgeOverMaterial = value
|
|
Else
|
|
MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
End If
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeOverMaterial = value
|
|
Next
|
|
'm_LeftJamb.HingeEdgeOverMaterial = value
|
|
'm_RightJamb.HingeEdgeOverMaterial = value
|
|
'm_TopJamb.HingeEdgeOverMaterial = value
|
|
'm_BottomJamb.HingeEdgeOverMaterial = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetHingeEdgeOverMaterial(sHingeEdgeOverMaterial As String)
|
|
m_HingeEdgeOverMaterial = sHingeEdgeOverMaterial
|
|
NotifyPropertyChanged("HingeEdgeOverMaterial")
|
|
End Sub
|
|
|
|
Private m_TopOverMaterial As String = String.Empty
|
|
Public Property TopOverMaterial As String
|
|
Get
|
|
Return m_TopOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
If String.IsNullOrEmpty(value) Then value = "0"
|
|
Dim dVal As Double
|
|
If StringToDouble(value, dVal) Then
|
|
m_TopOverMaterial = value
|
|
Else
|
|
MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
End If
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopOverMaterial = value
|
|
Next
|
|
'm_LeftJamb.TopOverMaterial = value
|
|
'm_RightJamb.TopOverMaterial = value
|
|
'm_TopJamb.TopOverMaterial = value
|
|
'm_BottomJamb.TopOverMaterial = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetTopOverMaterial(sTopOverMaterial As String)
|
|
m_TopOverMaterial = sTopOverMaterial
|
|
NotifyPropertyChanged("TopOverMaterial")
|
|
End Sub
|
|
|
|
Private m_BottomOverMaterial As String = String.Empty
|
|
Public Property BottomOverMaterial As String
|
|
Get
|
|
Return m_BottomOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
If String.IsNullOrEmpty(value) Then value = "0"
|
|
Dim dVal As Double
|
|
If StringToDouble(value, dVal) Then
|
|
m_BottomOverMaterial = value
|
|
Else
|
|
MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
End If
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
|
|
For Each ItemPartDoor In CurrAssembly.ListPartDoor
|
|
If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomOverMaterial = value
|
|
Next
|
|
'm_LeftJamb.BottomOverMaterial = value
|
|
'm_RightJamb.BottomOverMaterial = value
|
|
'm_TopJamb.BottomOverMaterial = value
|
|
'm_BottomJamb.BottomOverMaterial = value
|
|
End Set
|
|
End Property
|
|
Public Sub SetBottomOverMaterial(sBottomOverMaterial As String)
|
|
m_BottomOverMaterial = sBottomOverMaterial
|
|
NotifyPropertyChanged("BottomOverMaterial")
|
|
End Sub
|
|
|
|
#End Region ' OverMaterial
|
|
|
|
#End Region ' General
|
|
|
|
Private m_JambT As Part = Nothing
|
|
Private m_JambB As Part = Nothing
|
|
Private m_JambL As Part = Nothing
|
|
Private m_JambR As Part = Nothing
|
|
Private m_Door1 As Part = Nothing
|
|
Private m_Door2 As Part = Nothing
|
|
|
|
Public Property JambTIsChecked As Boolean
|
|
Get
|
|
If IsNothing(m_JambT) Then Return False
|
|
Return m_JambT.IsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
' se il pezzo non esiste deve essere creato
|
|
OptionModule.m_TopJambChk = value
|
|
' setto la sua variabile
|
|
If Not IsNothing(m_JambT) Then
|
|
m_JambT.IsActive = value
|
|
NotifyPropertyChanged("JambTIsChecked")
|
|
End If
|
|
' se non esiste l'oggeto prima lo creo
|
|
SetDimension("JambIsCheked")
|
|
End Set
|
|
End Property
|
|
|
|
Public Property JambBIsChecked As Boolean
|
|
Get
|
|
If IsNothing(m_JambB) Then Return False
|
|
Return m_JambB.IsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_BottomJambChk = value
|
|
' setto la sua variabile
|
|
If Not IsNothing(m_JambB) Then
|
|
m_JambB.IsActive = value
|
|
NotifyPropertyChanged("JambBIsChecked")
|
|
End If
|
|
' se non esiste l'oggeto prima lo creo
|
|
SetDimension("JambIsCheked")
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetJambBTIsChecked(value As Boolean)
|
|
OptionModule.m_BottomJambChk = value
|
|
If Not IsNothing(m_JambB) Then
|
|
m_JambB.IsActive = value
|
|
NotifyPropertyChanged("JambBIsChecked")
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End If
|
|
End Sub
|
|
|
|
Public Property JambLIsChecked As Boolean
|
|
Get
|
|
If IsNothing(m_JambL) Then Return False
|
|
Return m_JambL.IsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_LeftJambChk = value
|
|
' setto la sua variabile
|
|
If Not IsNothing(m_JambL) Then
|
|
m_JambL.IsActive = value
|
|
NotifyPropertyChanged("JambLIsChecked")
|
|
End If
|
|
' se non esiste l'oggeto prima lo creo
|
|
SetDimension("JambIsCheked")
|
|
|
|
End Set
|
|
End Property
|
|
|
|
Public Property JambRIsChecked As Boolean
|
|
Get
|
|
If IsNothing(m_JambR) Then Return False
|
|
Return m_JambR.IsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
OptionModule.m_RightJambChk = value
|
|
' setto la sua variabile
|
|
If Not IsNothing(m_JambR) Then
|
|
m_JambR.IsActive = value
|
|
NotifyPropertyChanged("JambRIsChecked")
|
|
End If
|
|
' se non esiste l'oggeto prima lo creo
|
|
SetDimension("JambIsCheked")
|
|
End Set
|
|
End Property
|
|
|
|
#Region "DOOR NUMBER"
|
|
|
|
' carica il numero di porte da mostrare nella combobox
|
|
Private m_DoorListNumber As New List(Of String)
|
|
Public Property DoorListNumber As List(Of String)
|
|
Get
|
|
Return m_DoorListNumber
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_DoorListNumber = value
|
|
End Set
|
|
End Property
|
|
|
|
' converto il numero di porte letto nella combobox in una lista di stringhe (sDoorList)
|
|
Private m_DoorNumber As String
|
|
Public Property DoorNumber As String
|
|
Get
|
|
Return m_DoorNumber
|
|
End Get
|
|
Set(value As String)
|
|
m_DoorNumber = value
|
|
If Trim(m_DoorNumber) = "1" Then
|
|
OneDoorProperty = True
|
|
Else
|
|
OneDoorProperty = False
|
|
End If
|
|
NotifyPropertyChanged("DoorNumber")
|
|
SetDimension("DoorNumber")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetDoorNumber(sDoorNumber As String)
|
|
DoorListNumber = OptionModule.m_DoorsListNumber
|
|
For Each sNumber In DoorListNumber
|
|
If sNumber = sDoorNumber Then
|
|
m_DoorNumber = sNumber
|
|
End If
|
|
Next
|
|
If Trim(m_DoorNumber) = "1" Then
|
|
OneDoorProperty = True
|
|
Else
|
|
OneDoorProperty = False
|
|
End If
|
|
NotifyPropertyChanged("DoorNumber")
|
|
End Sub
|
|
|
|
#End Region ' Door Number
|
|
|
|
#Region "LIST PART"
|
|
' al momento della creazione di un nuovo assembalto vengono caricati di defualt:
|
|
' JambLeft, JambTop, JambRight, JambBottom, Door_1
|
|
Private m_ListPartDoor As New ObservableCollection(Of PartDoor)
|
|
Public Property ListPartDoor As ObservableCollection(Of PartDoor)
|
|
Get
|
|
Return m_ListPartDoor
|
|
End Get
|
|
Set(value As ObservableCollection(Of PartDoor))
|
|
m_ListPartDoor = value
|
|
' ogni volta che si aggiunge una compoenente riallinea la lista sotto
|
|
NotifyPropertyChanged("ListPartDoorOfDoor")
|
|
End Set
|
|
End Property
|
|
|
|
' questo elenco estrae dall'elenco sopra tutte le ante, cosi da poter essre passata come lista di solo ante nella grafica
|
|
Private m_ListPartDoorOfDoor As New ObservableCollection(Of PartDoor)
|
|
Public ReadOnly Property ListPartDoorOfDoor As ObservableCollection(Of PartDoor)
|
|
Get
|
|
m_ListPartDoorOfDoor.Clear()
|
|
For Each ItemPartDoor In m_ListPartDoor
|
|
If ItemPartDoor.Type.Contains("DO_") Then
|
|
m_ListPartDoorOfDoor.Add(ItemPartDoor)
|
|
End If
|
|
Next
|
|
Return m_ListPartDoorOfDoor
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' List Part
|
|
|
|
#Region "Lettura Assemblato"
|
|
|
|
' messaggi che possono essere restituiti in fase di lettura dell'assemblato
|
|
Public Enum ResultReadingAssembInfo
|
|
MissingAssembInfo
|
|
ErrorInAssembInfo
|
|
CorrectAssembInfo
|
|
End Enum
|
|
|
|
' carico il valore finale restituito dalla lettura dell'assembalto (di default errore)
|
|
Public bOk As ResultReadingAssembInfo = ResultReadingAssembInfo.ErrorInAssembInfo
|
|
|
|
' vettore di righe del file ddf in lettura
|
|
Private FileContent() As String
|
|
|
|
Shared Sub ReadDDFAssembly(sPathDDF As String, ByRef ReadAssembly As Assembly)
|
|
' durante la lettura del ddf disabilito la costruzione degli hardware sui jamb
|
|
BuiltReffCompo = False
|
|
Dim sErrorInfo As String = String.Empty
|
|
' controllo se esiste il file DDF
|
|
If Not File.Exists(sPathDDF) Then
|
|
Return
|
|
End If
|
|
ReadAssembly.FileContent = File.ReadAllLines(sPathDDF)
|
|
' se il file esiste ma è vuoto
|
|
If ReadAssembly.FileContent.Count = 0 Then
|
|
' 50107: Emplyu file, 50101: Error
|
|
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
'---------------------------------------------------------------------------------------------------------------------------------
|
|
Dim IndexLine As Integer = 0
|
|
' carico i valori di default dell'assemblato (dalla pagina delle opzioni)
|
|
Map.refAssemblyManagerVM.LoadAssemblyInformation(ReadAssembly)
|
|
ReadAssembly.bOk = ReadAssembly.GetGeneralAssembly(IndexLine, sErrorInfo)
|
|
Part.bFirstConfigRead = False
|
|
'---------------------------------------------------------------------------------------------------------------------------------
|
|
If ReadAssembly.bOk <> ResultReadingAssembInfo.ErrorInAssembInfo Then
|
|
If IndexLine = -1 Then
|
|
' 50163= Error in reading General Assembly in DDF
|
|
sErrorInfo += String.Format(EgtMsg(50102), EgtMsg(50163) + vbCrLf)
|
|
ReadAssembly = Nothing
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
Else
|
|
Map.refSceneManagerVM.EnableRefresh = False
|
|
If ReadAssembly.GetDDFDoor(IndexLine, sErrorInfo) = -1 Then
|
|
' errore nella lettura di un part: blocco tutto
|
|
ReadAssembly = Nothing
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
End If
|
|
End If
|
|
Map.refSceneManagerVM.EnableRefresh = True
|
|
If Not IsNothing(ReadAssembly) AndAlso ReadAssembly.bOldVersion Then
|
|
ReadAssembly.CalcOverlapTop()
|
|
ReadAssembly.CalcOverlapBottom()
|
|
ReadAssembly.GetSizeBottom()
|
|
End If
|
|
Else
|
|
' 50163= Error in reading General Assembly in DDF
|
|
sErrorInfo += String.Format(EgtMsg(50102), EgtMsg(50163) + vbCrLf)
|
|
ReadAssembly = Nothing
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
End If
|
|
If Not String.IsNullOrWhiteSpace(sErrorInfo) Then
|
|
' 50164=In General Assembly:
|
|
sErrorInfo = EgtMsg(50164) & vbCrLf & sErrorInfo
|
|
MessageBox.Show(sErrorInfo, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
End Sub
|
|
|
|
' lettura dei parametri generali dell'assemblato
|
|
Private Function GetGeneralAssembly(ByRef IndexLine As Integer, sErrorInfo As String) As ResultReadingAssembInfo
|
|
' salta le righe vuote e quelle che non contengono "##",
|
|
' restituisce la prima riga successiva valida,
|
|
' termina quando incontra la riga "measure" oppure "produce" restituiendo il valore 0
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
' se non carico nessuna informazione allora non è un assemblato, esco
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
|
|
' Size
|
|
If IndexLine < FileContent.Count - 1 Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.S_SIZE_INI) Then
|
|
' leggo le dimemensioni dei Jamb e restituisco la riga successiva
|
|
IndexLine = GetSize(IndexLine + 1)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_SIZE_INI + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
' Light
|
|
If IndexLine < FileContent.Count - 1 Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.S_LIGHT) Then
|
|
IndexLine = GetLight(IndexLine + 1)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_LIGHT + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
' Overlap
|
|
If IndexLine < FileContent.Count - 1 Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.S_OVERLAP) Then
|
|
IndexLine = GetOverlap(IndexLine + 1)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_OVERLAP + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
' Exterior
|
|
If IndexLine < FileContent.Count - 1 Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.K_EXTERIOR) Then
|
|
IndexLine = GetExterior(IndexLine + 1)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.K_EXTERIOR + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
' Profiles
|
|
If IndexLine < FileContent.Count - 1 Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.S_PROFILES) Then
|
|
IndexLine = GetProfiles(IndexLine + 1)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_PROFILES + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
IndexLine = SkipWhiteSpace(IndexLine)
|
|
If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo
|
|
' Doors
|
|
If IndexLine < FileContent.Count Then
|
|
If SearchKey(FileContent(IndexLine), ConstIni.S_DOORS_ASSEMBY) Then
|
|
' assegno ad una variabile il valore in lettura
|
|
IndexLine = GetValue(IndexLine, ConstIni.S_DOORS_ASSEMBY, m_DoorNumber)
|
|
' assegno il numero di ante
|
|
SetDoorNumber(m_DoorNumber)
|
|
If IndexLine = -1 Then
|
|
' 50102: Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_DOORS_ASSEMBY + vbCrLf)
|
|
Return ResultReadingAssembInfo.ErrorInAssembInfo
|
|
End If
|
|
' se sono arrivato fino a qui significa che ormai è terminata la pagina
|
|
If IsNothing(m_Exterior) OrElse Not m_Exterior Then
|
|
m_Exterior = False
|
|
m_OverlapBottom = m_OverlapTop
|
|
m_DepthBottom = m_Thickness
|
|
m_ThicknessBottom = m_Width
|
|
' il delta è sempre definito nullo di default, quindi è inutile scriverlo qui
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Return ResultReadingAssembInfo.CorrectAssembInfo
|
|
End Function
|
|
|
|
' salta le righe che non contengono un metadata
|
|
Private Function SkipWhiteSpace(Index As Integer) As Integer
|
|
Dim ExitLoop As Boolean = False
|
|
While Not ExitLoop And Index < FileContent.Count - 1
|
|
' se la riga contiene un commeto allora faccio questo controllo
|
|
If FileContent(Index).Contains(ConstCompo.DDF_METADATA) Then
|
|
If Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*" & DDF_METADATA & "\s*(.*?\b)\s*:\s*$").Groups(1).Value) Then
|
|
ExitLoop = True
|
|
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*" & DDF_METADATA & "\s*(.*?\b)\s*:\s*(.*?\.*)$").Groups(1).Value) Then
|
|
ExitLoop = True
|
|
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_MEASURES & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Then
|
|
ExitLoop = True
|
|
Else
|
|
Index += 1
|
|
End If
|
|
' utilizzando una funzione regex
|
|
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_MEASURES & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Or
|
|
Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_PRODUCE & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Then
|
|
'' utilizzando il semplice controllo se la stringa contiene le parole
|
|
'ElseIf Not FileContent(Index).Contains(ConstCompo.S_MEASURES) Or
|
|
' Not FileContent(Index).Contains(ConstCompo.S_PRODUCE) Then
|
|
Index = 0
|
|
ExitLoop = True
|
|
Else
|
|
Index += 1
|
|
End If
|
|
End While
|
|
Return Index
|
|
End Function
|
|
|
|
' 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 -1
|
|
Dim Local_Var As String = GetValueWithKey(FileContent(Index), Name)
|
|
If String.IsNullOrWhiteSpace(Local_Var) Then
|
|
' se non c'è la parola chiave allora esci
|
|
If Not SearchKey(FileContent(Index), Name) Then Return -1
|
|
' altrimenti lascia il valore vuoto
|
|
Else
|
|
Var = Local_Var
|
|
End If
|
|
Return Index + 1
|
|
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, ByRef VarOverMaterial As String) As Integer
|
|
' Creo una stringa per scrivere gli errori
|
|
Dim bError As Boolean = False
|
|
If Index = -1 Then
|
|
Return Index
|
|
Else
|
|
' Lock
|
|
Dim Bevel As String
|
|
Bevel = GetValueWithKey(FileContent(Index), Name)
|
|
' se il valore restituito è nullo o vuoto
|
|
If String.IsNullOrWhiteSpace(Bevel) Then
|
|
' se non c'è la parola chiave allora esci
|
|
If Not SearchKey(FileContent(Index), Bevel) Then
|
|
' restituisco il valore -1
|
|
Return -1
|
|
Else
|
|
Var = EdgeTypeList(0)
|
|
End If
|
|
Index += 1
|
|
Else
|
|
'Dim IndexEdge As Integer = EdgeTypeList.IndexOf(Var)
|
|
Dim IndexEdge As Integer = 0
|
|
For I As Integer = 0 To EdgeTypeList.Count - 1
|
|
If Bevel = EdgeTypeList(I).Name And EdgeTypeList(I).IsActive = Visibility.Visible Then
|
|
Var = EdgeTypeList(I)
|
|
IndexEdge = I
|
|
Exit For
|
|
Else
|
|
IndexEdge = -1
|
|
End If
|
|
Next
|
|
|
|
If IndexEdge = -1 And Bevel = ConstGen.BEVEL_UP Then
|
|
Var = EdgeTypeList(0)
|
|
bError = True
|
|
MsgBevel(bError, Bevel)
|
|
Index += 1
|
|
Else
|
|
Var.Name = EdgeTypeList(IndexEdge).Name
|
|
' restituisco la riga successiva all'ultimo valore letto
|
|
Index += 1
|
|
End If
|
|
End If
|
|
End If
|
|
If Index = -1 Then
|
|
Return Index
|
|
Else
|
|
Dim Machining = GetValueWithKey(FileContent(Index), K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(Machining) Then
|
|
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
VarMachining = Utility.ConvertOnOffToBoolean(Machining)
|
|
Index += 1
|
|
End If
|
|
End If
|
|
If Index = -1 Then
|
|
Return Index
|
|
Else
|
|
VarOverMaterial = GetValueWithKey(FileContent(Index), K_OVERMATERIAL)
|
|
If String.IsNullOrWhiteSpace(VarOverMaterial) Then
|
|
If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1
|
|
Index += 1
|
|
Else
|
|
Index += 1
|
|
End If
|
|
End If
|
|
Return Index
|
|
End Function
|
|
|
|
Private Sub MsgBevel(bFound As Boolean, Edge As String)
|
|
If bFound And Not Part.FirstReadingEdge Then
|
|
' Bevel {0} can not be acceptable in Jamb
|
|
Dim CautionBevel As String = String.Format(EgtMsg(50158), Edge)
|
|
MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
End Sub
|
|
|
|
' Size
|
|
Private Function GetSize(Index As Integer) As Integer
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, "thickness", m_Thickness)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, "width", m_Width)
|
|
Return Index
|
|
End Function
|
|
|
|
' light
|
|
Private Function GetLight(Index As Integer) As Integer
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, SIDE_UP, m_LightUp)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, SIDE_LOCK, m_LightLock)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, SIDE_HINGE, m_LightHinge)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_BOTTOM, m_LightBottom)
|
|
Return Index
|
|
End Function
|
|
|
|
' Overlap
|
|
Private Function GetOverlap(Index As Integer) As Integer
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, "thickness", m_ThicknessHead)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, SIDE_HINGE, m_OverlapHinge)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, SIDE_LOCK, m_OverlapLock)
|
|
If Index = -1 Then Return -1
|
|
' per retrocompatibilità: se questo parametro manca dall'elenco devo comunque continuare
|
|
Dim TempIndex = GetValue(Index, K_TOP, m_OverlapTop)
|
|
If TempIndex > -1 Then
|
|
Index = TempIndex
|
|
Else
|
|
bOldVersion = True
|
|
End If
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, "deltaT", m_DeltaThickness)
|
|
Return Index
|
|
End Function
|
|
|
|
' Profiles
|
|
Private Function GetProfiles(Index As Integer) As Integer
|
|
If Index = -1 Then Return -1
|
|
Index = GetValueProfiles(Index, K_LOCKEDGE, m_LockEdgeType, m_LockEdgeMachining, m_LockEdgeOverMaterial)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValueProfiles(Index, K_HINGEEDGE, m_HingeEdgeType, m_HingeEdgeMachining, m_HingeEdgeOverMaterial)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValueProfiles(Index, K_TOP, m_TopType, m_TopMachining, m_TopOverMaterial)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValueProfiles(Index, K_BOTTOM, m_BottomType, m_BottomMachining, m_BottomOverMaterial)
|
|
Return Index
|
|
End Function
|
|
|
|
' exterior
|
|
Private Function GetExterior(Index As Integer) As Integer
|
|
' devo distingiure la lettura in funzione della versione del file DDF
|
|
m_Exterior = True
|
|
If Not bOldVersion Then
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_OVERLAP_BOTTOM, m_OverlapBottom)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_THICKNESS_BOTTOM, m_ThicknessBottom)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_DEPTH_BOTTOM, m_DepthBottom)
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_DELTA_BOTTOM, m_DeltaBottom)
|
|
Else
|
|
If Index = -1 Then Return -1
|
|
Index = GetValue(Index, K_TOP, m_OverlapTop)
|
|
End If
|
|
'If Index = -1 Then Return -1
|
|
'Index = GetValue(Index, "deltaT", m_DeltaThickness)
|
|
Return Index
|
|
End Function
|
|
|
|
' dopo la lettura delle informazioni dell'assemblato
|
|
Private Function GetDDFDoor(IndexLine As Integer, ByRef sErrorInfo As String) As Integer
|
|
Dim Line As Integer = IndexLine
|
|
While Line < FileContent.Count - 1 AndAlso Not Search3Dots(FileContent(Line))
|
|
Dim Local_PartDoor As New PartDoor
|
|
Dim Local_Door As New Part(Local_PartDoor)
|
|
' carcio la liste delle propiretà
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
If Line > 0 Then
|
|
' per saltare la riga che è stata appena restituita che contiene "---"
|
|
Line += 1
|
|
End If
|
|
' se la lettura di un oggetto fallisce allora restituisce nothing
|
|
Part.ReadDDFPartDoor(FileContent, Line, Local_Door)
|
|
' se l'oggetto appena restituito non esiste allora esco
|
|
If IsNothing(Local_Door) Then Return -1
|
|
' se l'getto appena caricato non specifica il tipo di pezzo allora di default è la prima anta
|
|
If String.IsNullOrEmpty(Local_Door.TypePart) Then Local_Door.TypePart = ConstGen.PART_DO_ & "1"
|
|
Dim sDoorPiece As String = Local_Door.TypePart
|
|
|
|
' ricavo il tipo di pezzo eliminando la descrizione dello swing da "TypePart"
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
|
|
If sDoorPiece.Count > 3 AndAlso sDoorPiece.Contains(ConstGen.PART_FRAME) Then
|
|
sDoorPiece = sDoorPiece.Remove(sDoorPiece.LastIndexOf("_"c) + 1)
|
|
End If
|
|
Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
|
|
Else
|
|
' significa che stiamo per leggere una porta singola, cerco una porta
|
|
If Not Local_Door.TypePart.Contains("DO_") Then
|
|
sErrorInfo = "The current ddf is an Assembly. Any modify will be saved as single door."
|
|
Continue While
|
|
End If
|
|
Local_Door.IsActive = True
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.Door.SwingTypeList = OptionModule.m_SwingTypeList
|
|
Local_PartDoor.Door.MaterialsList = OptionModule.m_MaterialList
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
Map.refPartPageVM.CurrPart = Local_Door
|
|
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
|
|
Exit While
|
|
End If
|
|
|
|
' impedisco di costruire i riferminti
|
|
BuiltReffCompo = False
|
|
Select Case sDoorPiece
|
|
Case ConstGen.PART_DO_ & "1"
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
Case ConstGen.PART_DO_ & "2"
|
|
Local_PartDoor.Door = Local_Door
|
|
If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then
|
|
Local_PartDoor.Door.SwingTypeList = m_SwingTypeListRightDoor
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = m_SwingTypeListLeftDoor
|
|
Else
|
|
Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor
|
|
End If
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
|
|
Case ConstGen.PART_DO_ & "3"
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'SetArrayPartDoor(Local_PartDoor, 2)
|
|
Case ConstGen.PART_DO_ & "4"
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'SetArrayPartDoor(Local_PartDoor, 3)
|
|
Case ConstGen.PART_DO_ & "5"
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
'SetArrayPartDoor(Local_PartDoor, 4)
|
|
Case ConstGen.PART_DO_ & "6"
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'SetArrayPartDoor(Local_PartDoor, 5)
|
|
|
|
Case ConstGen.PART_FRAME_LEFT
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_Door.SwingTypeList = m_SwingTypeList
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'm_LeftJamb = Local_Door
|
|
Case ConstGen.PART_FRAME_RIGHT
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_Door.SwingTypeList = m_SwingTypeList
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'm_RightJamb = Local_Door
|
|
Case ConstGen.PART_FRAME_TOP
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_Door.SwingTypeList = m_SwingTypeList
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'm_TopJamb = Local_Door
|
|
Case ConstGen.PART_FRAME_BOTTOM
|
|
Local_PartDoor.Door = Local_Door
|
|
Local_Door.SwingTypeList = m_SwingTypeList
|
|
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
|
CreateNewPropertiesList(Local_Door)
|
|
ListPartDoor.Add(Local_PartDoor)
|
|
'm_BottomJamb = Local_Door
|
|
If Not m_Exterior Then Local_PartDoor.Door.IsActive = False
|
|
End Select
|
|
End While
|
|
|
|
' controllo che gli oggetti che sono stati caricati
|
|
If Not ControlAssemblyInformation() Then
|
|
Return -1
|
|
Else
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
|
|
End If
|
|
' scrivo in locale un a copia dei riferiemti ai part
|
|
SetPartDoorCurrAssembly()
|
|
If Not OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
|
|
If Not ControlListDoor() Then
|
|
Return -1
|
|
End If
|
|
If Not ControlSwing() Then
|
|
Return -1
|
|
End If
|
|
End If
|
|
BuiltReffCompo = True
|
|
Map.refAssemblyManagerVM.CreateAssociation(Me)
|
|
MatchCompo()
|
|
'Map.refProjectManagerVM.NotifyPropertyChanged("VisibilityCreateAssembly")
|
|
Return 1
|
|
End Function
|
|
|
|
' verifico che la dicitaura delle porte sia coerente
|
|
Private Function ControlListDoor() As Boolean
|
|
Dim WritingError As String = String.Empty
|
|
Select Case ListPartDoorOfDoor.Count
|
|
Case 1
|
|
' se ho una porta soltanto deve essere la prima
|
|
If IsNothing(m_Door1) Then
|
|
WritingError = EgtMsg(50506)
|
|
MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
Case 2
|
|
If ListPartDoorOfDoor.Count < 2 Then Return False
|
|
If IsNothing(m_Door1) OrElse IsNothing(m_Door2) Then
|
|
' 50513=Impossible to find the first door (DO_1) or the second door (DO_2)!
|
|
WritingError = EgtMsg(50513)
|
|
MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
If Not ListPartDoorOfDoor(0).Door.TypePart = "DO_1" Then
|
|
' 50515=The first door is not realy the first, check the ddf.
|
|
WritingError = EgtMsg(50515)
|
|
MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
Return True
|
|
End Select
|
|
Return False
|
|
End Function
|
|
|
|
' controllo che gli swing siano coerenti:
|
|
Private Function ControlSwing() As Boolean
|
|
Dim ErrorSwingMessages As String = String.Empty
|
|
Select Case ListPartDoorOfDoor.Count
|
|
Case 1
|
|
Dim Local_Door1 As Part = ListPartDoorOfDoor(0).Door
|
|
Dim Local_Swing As String = Local_Door1.Swing
|
|
Local_Door1.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor
|
|
If String.IsNullOrEmpty(Local_Swing) Then Return False
|
|
Dim Index As Integer = Local_Door1.SwingTypeList.FindIndex(Function(sValue) Trim(sValue) = Trim(Local_Swing))
|
|
' se Index = -1 significa che non è stata trovata nessuna corrispondenza
|
|
If Index < 0 Then
|
|
' 50507=The swing is not a member of the swing list of single door.
|
|
ErrorSwingMessages = EgtMsg(50507)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
Local_Door1.Swing = Local_Door1.SwingTypeList(Index)
|
|
Return True
|
|
Case 2
|
|
Dim Index_1 As Integer = -1
|
|
Dim Index_2 As Integer = -1
|
|
If Not IsNothing(m_Door1) Then
|
|
Index_1 = OptionModule.m_SwingTypeListLeftDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door1.Swing))
|
|
End If
|
|
If Not IsNothing(m_Door2) Then
|
|
Index_2 = OptionModule.m_SwingTypeListRightDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door2.Swing))
|
|
End If
|
|
' Se uno swing è corretto e l'altro è sbagliato
|
|
If (Index_1 < 0 AndAlso Index_2 > -1) Then
|
|
' 50508=The swing of left door is not a member of the swing list of left door.
|
|
ErrorSwingMessages = EgtMsg(50508)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
ElseIf (Index_1 > -1 AndAlso Index_2 < 0) Then
|
|
' 50509=The swing of right door is not a member of the swing list of right door.
|
|
ErrorSwingMessages = EgtMsg(50509)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
' se sono entrambi sbagliati provo a verificare che non siano invertite le ante
|
|
If Index_1 < 0 OrElse Index_2 < 0 Then
|
|
If Not IsNothing(m_Door2) Then
|
|
Index_1 = OptionModule.m_SwingTypeListLeftDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door2.Swing))
|
|
End If
|
|
If Not IsNothing(m_Door1) Then
|
|
Index_2 = OptionModule.m_SwingTypeListRightDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door1.Swing))
|
|
End If
|
|
' verifico i risultati ottenuti
|
|
If (Index_1 > -1 AndAlso Index_2 > -1) Then
|
|
' 50510=The swing of left door is on the right door and viceverse.
|
|
ErrorSwingMessages = EgtMsg(50510)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
ElseIf (Index_1 < 0 AndAlso Index_2 > -1) Then
|
|
' 50511=The swing of left door is not a member of the swing list of left door.
|
|
ErrorSwingMessages = EgtMsg(50511)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
ElseIf (Index_1 > -1 AndAlso Index_2 < 0) Then
|
|
' 50512=The swing of right door is not a member of the swing list of right door.
|
|
ErrorSwingMessages = EgtMsg(50512)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
Else
|
|
' 50514=The swing are absolutly wrong!
|
|
ErrorSwingMessages = EgtMsg(50514)
|
|
MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
End If
|
|
Return True
|
|
End Select
|
|
Return False
|
|
End Function
|
|
|
|
' controllo degli oggetti caricati nell'assemblato
|
|
Private Function ControlAssemblyInformation() As Boolean
|
|
Dim ErrorMessages As String = String.Empty
|
|
Select Case bOk
|
|
Case ResultReadingAssembInfo.CorrectAssembInfo
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
|
|
' 50520=The current ddf is an assembly
|
|
ErrorMessages = EgtMsg(50520)
|
|
MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return True
|
|
End If
|
|
' verifico se è un assemblato
|
|
If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count > 0 Then
|
|
' 50516=The current ddf contains {0} jambs.
|
|
ErrorMessages = EgtMsg(50516)
|
|
Dim sVal As String = Utility.DoubleToString(ListPartDoor.Count - ListPartDoorOfDoor.Count, 0)
|
|
' 50144=Warning
|
|
MessageBox.Show(String.Format(ErrorMessages, sVal), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return True
|
|
End If
|
|
If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count = 0 Then
|
|
' 50517=The current ddf does not contains doors!
|
|
ErrorMessages = EgtMsg(50517)
|
|
MessageBox.Show(ErrorMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
Case ResultReadingAssembInfo.MissingAssembInfo
|
|
' verifico se è un assemblato
|
|
If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count > 0 Then
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return True
|
|
' 50518=The current ddf is not an assembly.
|
|
ErrorMessages = EgtMsg(50518)
|
|
MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return True
|
|
End If
|
|
' verifico che se è una porta singola oppure un assemblato vecchio
|
|
If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count = 0 Then
|
|
' 50519=Impossible to open a ddf with no doors.
|
|
ErrorMessages = EgtMsg(50519)
|
|
MessageBox.Show(ErrorMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return False
|
|
End If
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door AndAlso ListPartDoor.Count > 4 Then
|
|
' 50520=The current ddf is an assembly
|
|
ErrorMessages = EgtMsg(50520)
|
|
MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return True
|
|
End If
|
|
Case Else
|
|
Return False
|
|
End Select
|
|
Return True
|
|
End Function
|
|
|
|
Public Function ControlAssembly(Optional ByVal bSaving As Boolean = False) As String
|
|
' se è una porta singola oppure le info generali non sono state caricate correttamente non controllo l'assemblato
|
|
If bSaving Then
|
|
If bOk <> ResultReadingAssembInfo.MissingAssembInfo Then Return String.Empty
|
|
Else
|
|
If bOk = ResultReadingAssembInfo.ErrorInAssembInfo OrElse bOk = ResultReadingAssembInfo.MissingAssembInfo Then Return String.Empty
|
|
End If
|
|
Dim WritingError As String = String.Empty
|
|
Dim DoorTypeList As String = String.Empty
|
|
If ListPartDoor.Count < 3 Then
|
|
For Each ItemPart In ListPartDoor
|
|
DoorTypeList &= " ," & ItemPart.Door.TypePart
|
|
Next
|
|
DoorTypeList = DoorTypeList.Remove(1, 1)
|
|
WritingError = String.Format(EgtMsg(50505), DoorTypeList)
|
|
End If
|
|
Return WritingError
|
|
End Function
|
|
|
|
' ricavo dal JambT il valore di OverlabTop
|
|
Public Sub CalcOverlapTop()
|
|
Dim Jamb As Part = m_JambT
|
|
Dim IndexSide As Integer = 2
|
|
Dim Indexparam As Integer = 2
|
|
If Not IsNothing(Jamb) Then
|
|
Dim IndexCompo As Integer = GetRabbetCompo(Jamb, IndexSide)
|
|
SetOverlapTop(GetValueParam(Jamb, IndexSide, Indexparam))
|
|
End If
|
|
End Sub
|
|
|
|
' ricavo dal JambB il valore di OverlabBottom
|
|
Public Sub CalcOverlapBottom()
|
|
Dim Jamb As Part = m_JambB
|
|
Dim IndexSide As Integer = 2
|
|
Dim Indexparam As Integer = 2
|
|
If Not IsNothing(Jamb) Then
|
|
Dim IndexCompo As Integer = GetRabbetCompo(Jamb, IndexSide)
|
|
SetOverlapBottom(GetValueParam(Jamb, IndexSide, Indexparam))
|
|
End If
|
|
End Sub
|
|
|
|
' restituisce l'indice della componente nella lista delle componeti del jamb
|
|
Public Function GetRabbetCompo(ByVal Jamb As Part, ByVal IndexSide As Integer) As Integer
|
|
' IndexSide: 0->Top, 1->bottom , 2->hinge , 3->lock
|
|
' se ritorna "-2" significa che non esiste la componente rabbet nell'elenco dei direttori
|
|
' se ritorna "-1" significa che non esiste la componente rabbet nell'elenco delle componenti del Jamb
|
|
Dim IndexCompo As Integer
|
|
Dim IndexCompoPanel As Integer = -1
|
|
' ricerco la posizione del rabbet nella lista dei componenti
|
|
IndexCompoPanel = nCompoRabbet()
|
|
' se la ricerca ha dato un esito positivo allora procedo
|
|
If IndexCompoPanel = -1 Then Return -2
|
|
If Jamb.CompoList.Count > 0 Then
|
|
' inizio la ricerca della componente di tipo rabbet
|
|
For IndexCompo = 0 To Jamb.CompoList.Count - 1
|
|
If Jamb.CompoList(IndexCompo).CompoType.DDFName = OptionModule.m_CompoPaneOrder(IndexCompoPanel) Then
|
|
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(IndexSide) Then
|
|
Return IndexCompo
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
Return -1
|
|
End Function
|
|
|
|
' utlizzata per recuperare il valore di un parametro del rabbet
|
|
Public Function GetValueParam(Jamb As Part, IndexSide As Integer, IndexParam As Integer) As String
|
|
If Not IsNothing(Jamb) Then
|
|
' verifico che il rabbet indicato sia costruito su uno specifico lato
|
|
Dim IndexCompo As Integer = GetRabbetCompo(Jamb, IndexSide)
|
|
If IndexCompo < 0 Then
|
|
Return "0"
|
|
End If
|
|
' ricerco il parametro "depth"
|
|
If Jamb.CompoList(IndexCompo).CompoParamList.Count - 1 >= IndexParam Then
|
|
Dim sValue As String = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value
|
|
If Not String.IsNullOrEmpty(sValue) Then Return sValue
|
|
End If
|
|
End If
|
|
Return "0"
|
|
End Function
|
|
|
|
' carico le dimensioni del bottom direttamente del frame
|
|
Public Sub GetSizeBottom()
|
|
If IsNothing(m_JambB) Then Return
|
|
SetThicknessBottom(m_JambB.Height)
|
|
SetDepthBottom(m_JambB.Thickness)
|
|
' calcolo il delta del bottom
|
|
If Not IsNothing(m_Door1) Then
|
|
Dim dPositionZ As Double
|
|
Dim dThicknessBottom As Double
|
|
Dim dThicknessDoor As Double
|
|
Dim dDeltaThickness As Double
|
|
StringToDouble(m_JambB.Height, dThicknessBottom)
|
|
StringToDouble(m_Door1.Thickness, dThicknessDoor)
|
|
StringToDouble(m_DeltaThickness, dDeltaThickness)
|
|
StringToDouble(m_JambB.Position(2), dPositionZ)
|
|
Dim dDeltaBottom As Double = dThicknessBottom - dThicknessDoor - dDeltaThickness - dPositionZ
|
|
SetDeltaBottom(DoubleToString(dDeltaBottom, 4))
|
|
End If
|
|
End Sub
|
|
|
|
#Region "Associazione delle compo lette da ddf"
|
|
|
|
Public Sub MatchCompo()
|
|
If IsNothing(m_Door1) Then Return
|
|
For Each ItemDoor In ListPartDoorOfDoor
|
|
If Not IsNothing(m_JambL) Then ResearchMatchJamb(ItemDoor.Door, m_JambL)
|
|
If Not IsNothing(m_JambR) Then ResearchMatchJamb(ItemDoor.Door, m_JambR)
|
|
If Not IsNothing(m_JambT) Then ResearchMatchJamb(ItemDoor.Door, m_JambT)
|
|
If Not IsNothing(m_JambB) Then ResearchMatchJamb(ItemDoor.Door, m_JambB)
|
|
Next
|
|
If Not IsNothing(m_Door2) Then
|
|
ResearchMatchDoor(m_Door1, m_Door2)
|
|
ResearchMatchDoor(m_Door2, m_Door1)
|
|
SetDoorNumber("2")
|
|
Else
|
|
SetDoorNumber("1")
|
|
End If
|
|
End Sub
|
|
|
|
' setta per ogni componente sul telaio la proprietà "IsReadOnly" letta dal file Matching
|
|
Private Sub ResearchMatchJamb(Door As Part, Jamb As Part)
|
|
For IndexCompo As Integer = 0 To Door.CompoList.Count - 1
|
|
ReSearchFrameFile(Door.CompoList(IndexCompo))
|
|
If Not String.IsNullOrEmpty(Door.CompoList(IndexCompo).IdCode) Then
|
|
' cerco l'associazione delle compo sulla porta con le componenti sul telaio
|
|
For IndexCompoJamb As Integer = 0 To Jamb.CompoList.Count - 1
|
|
If Jamb.CompoList(IndexCompoJamb).IdCode = Door.CompoList(IndexCompo).IdCode Then
|
|
Door.CompoList(IndexCompo).refJambCompo = Jamb.CompoList(IndexCompoJamb)
|
|
Jamb.CompoList(IndexCompoJamb).refCompoDoor = Door.CompoList(IndexCompo)
|
|
Door.CompoList(IndexCompo).refJambCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
Door.CompoList(IndexCompo).refJambCompo.IsReadOnly = False
|
|
Door.CompoList(IndexCompo).IsReadOnly = True
|
|
' definisco la proprietà ReadOnly per i parametri inseriti
|
|
If Not LoadCompoParam(Door.CompoList(IndexCompo), Door.TypePart) Then Return
|
|
For IndexParam As Integer = 0 To Door.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1
|
|
Dim CmpRefPar As CompoParam = Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam)
|
|
If TypeOf CmpRefPar Is TextBoxOnOffParam Then
|
|
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam)
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is TextBoxParam Then
|
|
Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam)
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is ComboBoxOnOffParam Then
|
|
Dim TBoxRefPar As ComboBoxOnOffParam = DirectCast(CmpRefPar, ComboBoxOnOffParam)
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is ComboBoxParam Then
|
|
Dim TBoxRefPar As ComboBoxParam = DirectCast(CmpRefPar, ComboBoxParam)
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
End If
|
|
Next
|
|
ResetCompoParam()
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
Door.CompoList(IndexCompo).IsReadOnly = True
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
' setta per ogni componente (associata) sulla porta inattiva la proprietà "IsReadOnly" letta dal file Matching
|
|
Private Sub ResearchMatchDoor(DoorActive As Part, DoorInactive As Part)
|
|
If Not DoorActive.SwingAlias.Name.Contains(ConstGen.INACTIVE) Then
|
|
For IndexCompo As Integer = 0 To DoorActive.CompoList.Count - 1
|
|
If Not String.IsNullOrEmpty(DoorActive.CompoList(IndexCompo).IdCode) Then
|
|
For IndexCompoInactiveDoor As Integer = 0 To DoorInactive.CompoList.Count - 1
|
|
' cerco l'associazione delle compo sulla porta attiva con le componenti sulla porta inattiva
|
|
If DoorInactive.CompoList(IndexCompoInactiveDoor).IdCode = DoorActive.CompoList(IndexCompo).IdCode Then
|
|
DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoInactiveDoor)
|
|
DoorInactive.CompoList(IndexCompoInactiveDoor).refCompoDoor = DoorActive.CompoList(IndexCompo).refJambCompo
|
|
DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = False
|
|
DoorActive.CompoList(IndexCompo).IsReadOnly = True
|
|
If Not LoadCompoParam(DoorActive.CompoList(IndexCompo), DoorActive.TypePart) Then Return
|
|
For IndexParam As Integer = 0 To DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1
|
|
'Dim CmpPar As CompoParam = DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam)
|
|
Dim CmpRefPar As CompoParam = DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam)
|
|
If TypeOf CmpRefPar Is TextBoxOnOffParam Then
|
|
'Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam)
|
|
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam)
|
|
'CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
'TBoxPar.IsReadOnly = True
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is TextBoxParam Then
|
|
'Dim TBoxPar As TextBoxParam = DirectCast(CmpPar, TextBoxParam)
|
|
Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam)
|
|
'CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
'TBoxPar.IsReadOnly = True
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is ComboBoxOnOffParam Then
|
|
'Dim TBoxPar As ComboBoxOnOffParam = DirectCast(CmpPar, ComboBoxOnOffParam)
|
|
Dim TBoxRefPar As ComboBoxOnOffParam = DirectCast(CmpRefPar, ComboBoxOnOffParam)
|
|
'CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
'TBoxPar.IsReadOnly = True
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
ElseIf TypeOf CmpRefPar Is ComboBoxParam Then
|
|
'Dim TBoxPar As ComboBoxParam = DirectCast(CmpPar, ComboBoxParam)
|
|
Dim TBoxRefPar As ComboBoxParam = DirectCast(CmpRefPar, ComboBoxParam)
|
|
'CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
'TBoxPar.IsReadOnly = True
|
|
CalcCompoParamVisibility(TBoxRefPar.DDFName, TBoxRefPar.IsReadOnly)
|
|
End If
|
|
Next
|
|
ResetCompoParam()
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
DoorActive.CompoList(IndexCompo).IsReadOnly = True
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
End Sub
|
|
|
|
' in fase di cricamento della porta verifico se posso esistere delle componenti da associare
|
|
' infatti potrebbe esistere una componente sull'anta ma non sul telaio
|
|
' il caso contrario è vietato dal programma (a meno che non sia stato modificato il ddf manualmente)
|
|
Public Function ReSearchFrameFile(ByVal CurrCompo As Compo) As Boolean
|
|
' se è la configurazione è di songola porta allora interrompi la costruzione
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False
|
|
' nome del file Matchting.ini
|
|
Dim FrameFile As String = String.Empty
|
|
' percorso del file di Config.ini del file frame
|
|
Dim FrameFileConfig As String = String.Empty
|
|
' numero di ante presenti nel progetto corrente
|
|
Dim nDoorNbr As Integer = 1
|
|
|
|
' cerco il nome della componente da associare FrameFile
|
|
Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem
|
|
If Path.GetExtension(CurrDoorHArdwareFile) <> NGE_EXTENSION Then
|
|
CurrDoorHArdwareFile &= LUA_EXTENSION
|
|
End If
|
|
' cerco il campo [Match file] nel file lua della componente
|
|
If File.Exists(CurrDoorHArdwareFile) Then
|
|
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile)
|
|
For LineIndex = 0 To ReadCurrCompo.Count - 1
|
|
If RegexFunction.IsMatchingParameterTitle(ReadCurrCompo(LineIndex)) Then
|
|
' mi preparo per leggere la prima riga dopo il titolo
|
|
Dim ParamIndex As Integer = 1
|
|
FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
|
|
While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count
|
|
ParamIndex += 1
|
|
FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
|
|
End While
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
' se non esiste nessun accoppiamento allora esco ed elimino la componente
|
|
If FrameFile.Contains("None") Then
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
' converto il numero di porte da string a int
|
|
Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr)
|
|
' cerco il nome nella tabella: se lo script lua da errori, e la variabile FrameFile è vuota esco
|
|
If String.IsNullOrEmpty(FrameFile) AndAlso
|
|
Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) Then
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' Associazione delle compo lette da ddf
|
|
|
|
#End Region ' Lettura Assemblato
|
|
|
|
#Region "RULES ASSEMBLY"
|
|
|
|
#Region "CreateRefCompo"
|
|
|
|
' questo metodo è chiamato dalla proprietà CompoBtn nella classe CompoPanelVM
|
|
' dopo aver aggiunto una componente da pulsantiera viene chiamato questo metodo che costruisce il riferimento
|
|
' o anche solo esegue la modifica dell'associzaione
|
|
Public Function CreateCompoOnJamb(ByRef CurrCompo As Compo, Optional sSide As String = "") As Boolean
|
|
' se è la configurazione è di songola porta allora interrompi la costruzione
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False
|
|
' nome del file Matchting.ini
|
|
Dim FrameFile As String = String.Empty
|
|
' percorso del file di Config.ini del file frame
|
|
Dim FrameFileConfig As String = String.Empty
|
|
' numero di ante presenti nel progetto corrente
|
|
Dim nDoorNbr As Integer = 1
|
|
|
|
' cerco nella configurazione della componente sulla porta il parametro Side
|
|
Dim Side As String = String.Empty
|
|
If Not String.IsNullOrEmpty(sSide) Then Side = sSide
|
|
' cerco nel file Config.ini il campo [PositionSide]
|
|
If String.IsNullOrEmpty(Side) Then
|
|
GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME)
|
|
End If
|
|
' controllo sempre nell'elenco dei parametri se esiste un parametro di tipo Side
|
|
For IndexParam As Integer = 0 To CurrCompo.CompoParamList.Count - 1
|
|
If CurrCompo.CompoParamList(IndexParam).DDFName.ToLower = K_SIDE.ToLower Then
|
|
Side = DirectCast(CurrCompo.CompoParamList(IndexParam), ComboBoxParam).SelItem
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
' a questo punto ricerco nella lista delle associazioni se esite il frame sul quale costruire il riferimento
|
|
' converto la posizione letta in valore numerico
|
|
' queste associazioni funzionano sulle ante, per i Jamb non ho studiato una conversione
|
|
If IsNothing(Map.refPartPageVM.CurrPart) Then Return False
|
|
Dim nSide As Integer = 0
|
|
Select Case Side
|
|
Case "Lock"
|
|
' se è LeftHand
|
|
If Map.refPartPageVM.CurrPart.SwingAlias.Name.Contains("L") Then
|
|
nSide = 100
|
|
Else
|
|
nSide = 300
|
|
End If
|
|
Case "Hinge"
|
|
If Map.refPartPageVM.CurrPart.SwingAlias.Name.Contains("L") Then
|
|
nSide = 300
|
|
Else
|
|
nSide = 100
|
|
End If
|
|
Case "Top"
|
|
nSide = 200
|
|
Case "Bottom"
|
|
nSide = 400
|
|
End Select
|
|
|
|
' ricerco il PartDoor associato al side
|
|
Dim refPartDoor As PartDoor = Nothing
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
|
|
For Each ItemPartDoor In ListPartDoor
|
|
If ItemPartDoor.Type = Map.refPartPageVM.CurrPart.TypePart Then
|
|
For Each ItemAssociation In ItemPartDoor.ListAssociation
|
|
' verifico che esiesta un Part sul lato indicato dal side
|
|
If ItemAssociation.Side > nSide AndAlso ItemAssociation.Side < nSide + 100 Then
|
|
refPartDoor = ItemAssociation.refPartDoor
|
|
End If
|
|
Next
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
refPartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart)
|
|
End If
|
|
' se non è stata trovata nessuna associazione esco
|
|
If IsNothing(refPartDoor) Then
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
|
|
' cerco il nome della componente da associare FrameFile
|
|
Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem
|
|
If Path.GetExtension(CurrDoorHArdwareFile) <> NGE_EXTENSION Then
|
|
CurrDoorHArdwareFile &= LUA_EXTENSION
|
|
End If
|
|
' cerco il campo [Match file] nel file lua della componente
|
|
If File.Exists(CurrDoorHArdwareFile) Then
|
|
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile)
|
|
For LineIndex = 0 To ReadCurrCompo.Count - 1
|
|
If RegexFunction.IsMatchingParameterTitle(ReadCurrCompo(LineIndex)) Then
|
|
' mi preparo per leggere la prima riga dopo il titolo
|
|
Dim ParamIndex As Integer = 1
|
|
FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
|
|
While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count
|
|
ParamIndex += 1
|
|
FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
|
|
End While
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
' se non esiste nessun accoppiamento allora esco ed elimino la componente
|
|
If FrameFile.Contains("None") Then
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
|
|
CurrCompo.refJambCompo = Nothing
|
|
End If
|
|
' 50144 =Warning, 50166 =Jamb compo does not exist
|
|
'MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
' converto il numero di porte da string a int
|
|
Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr)
|
|
' cerco il nome nella tabella: se lo script lua da errori, e la variabile FrameFile è vuota esco
|
|
If String.IsNullOrEmpty(FrameFile) AndAlso
|
|
Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) Then
|
|
' elimino la componente di riferimento
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
|
|
CurrCompo.refJambCompo = Nothing
|
|
End If
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
|
|
' costruisco il percosrso del file Config.ini associato al FrameFile
|
|
If Not SearchFileConfig(FrameFile, FrameFileConfig) Then
|
|
' 50144 =Warning, 50166 =Jamb compo does not exist
|
|
' MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
' se il file FrameFileConfig.ini non esiste allora elimino il riferimento
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
|
|
CurrCompo.refJambCompo = Nothing
|
|
End If
|
|
' restituisco false perchè la componente non è stata creata
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
Else
|
|
' inizio la lettura di FrameFileConfig
|
|
Dim FrameNameDDF As String = String.Empty
|
|
Dim FrameName As String = String.Empty
|
|
Dim FrameSide As String = String.Empty
|
|
Dim FrameFolderName As String = String.Empty
|
|
GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameNameDDF, FrameName, FrameFileConfig)
|
|
GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, FrameSide, FrameFileConfig)
|
|
GetPrivateProfileFolderName(S_TEMPLATE, K_FOLDER_NAME, FrameFolderName, FrameFileConfig)
|
|
|
|
'Ogni volta che creo una componente elimino i precedenti riferimenti
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
|
|
If IsNothing(CurrCompo.refJambCompo) Then
|
|
' costruisco sul riferiento la nuova componente inserita
|
|
Dim refCompoType As New CompoType(FrameName, FrameNameDDF, Path.GetDirectoryName(FrameFileConfig), FrameSide, FrameFolderName)
|
|
' aggiungo la componete sul riferiento passato (caricando la lista dei file di tipo Frame)
|
|
CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, True)
|
|
CurrCompo.refJambCompo.refCompoDoor = CurrCompo
|
|
' definsco se la componente deve essre ribalata (Top-Door2; Bottom-Door1 e una sola anta)
|
|
If Side = "Top" And Map.refPartPageVM.CurrPart.TypePart.Contains("DO_2") Then
|
|
CurrCompo.refJambCompo.OtherDoor = True
|
|
ElseIf Side = "Bottom" And Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") And m_DoorNumber <> "1" Then
|
|
CurrCompo.refJambCompo.OtherDoor = True
|
|
End If
|
|
End If
|
|
' setto il nome della componente da caricare
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
CurrCompo.refJambCompo.SplitBrandFile(FrameFile)
|
|
CurrCompo.refJambCompo.refCompoDoor = CurrCompo
|
|
Else
|
|
MessageBox.Show("File '" & FrameFile & "' exist, but it is not in the correct Directory!", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
End If
|
|
|
|
' assegno i parametri letti dallo script per il corretto posizionamento del pezzo ( solo se il pezzo corrente è un DO_)
|
|
If LoadCompoParam(CurrCompo, Map.refPartPageVM.CurrPart.TypePart) Then
|
|
UpDateCurrCompoJamb(CurrCompo, Map.refPartPageVM.CurrPart.TypePart)
|
|
ResetSTU()
|
|
ResetCompoParam()
|
|
Else
|
|
Dim Msg As String = String.Format(EgtMsg(50157), CurrCompo.CompoType.Path, MATCHING_FILE_NAME)
|
|
MessageBox.Show(Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
' se sono arrivato in fondo significa che il riferiemnto è stato costruito
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
CurrCompo.refJambCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
Return True
|
|
End Function
|
|
|
|
' questa funzione è utilizzata per ricostruire (da Matching.lua) una componente del telaio a partire da essa stessa
|
|
Public Function CreateCompoOnJambFromJamb(ByRef CurrCompo As Compo, ByVal sSide As String) As Boolean
|
|
Dim IndexRefCompo As Integer = -1
|
|
' se è la configurazione è di songola porta allora interrompi la costruzione
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False
|
|
' nome del file Matchting.ini
|
|
Dim FrameFile As String = String.Empty
|
|
' percorso del file di Config.ini del file frame
|
|
Dim FrameFileConfig As String = String.Empty
|
|
' numero di ante presenti nel progetto corrente
|
|
Dim nDoorNbr As Integer = 1
|
|
|
|
' ricerco il PartDoor associato al side
|
|
Dim refPartDoor As PartDoor = Nothing
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
|
|
Return False
|
|
Else
|
|
refPartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart)
|
|
End If
|
|
' se non è stata trovata nessuna associazione esco
|
|
If IsNothing(refPartDoor) Then
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
|
|
' ricerco l'indice della componente che sto modificando
|
|
For Index As Integer = 0 To refPartDoor.Door.CompoList.Count - 1
|
|
If refPartDoor.Door.CompoList(Index).IdCode = CurrCompo.IdCode Then
|
|
IndexRefCompo = Index
|
|
End If
|
|
Next
|
|
|
|
' ricerco l'anta a cui devo fare riferimento (dalle informazioni della Compo e del tipo di Frame)
|
|
Dim LocalDoor As Part = Map.refAssemblyPageVM.ReserchPartDoor("DO_1").Door
|
|
If IsNothing(LocalDoor) Then
|
|
Return False
|
|
End If
|
|
If m_DoorNumber <> "1" Then
|
|
If refPartDoor.Door.TypePart.Contains("FT_") AndAlso CurrCompo.OtherDoor Then
|
|
LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door
|
|
ElseIf refPartDoor.Door.TypePart.Contains("FB_") AndAlso Not CurrCompo.OtherDoor Then
|
|
LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door
|
|
ElseIf refPartDoor.Door.TypePart.Contains("FR_") Then
|
|
LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door
|
|
End If
|
|
End If
|
|
|
|
' costruisco il nome del FrameFile
|
|
Dim DirectoryCompo As String = Path.GetFileName(CurrCompo.refJambCompo.CompoType.Path)
|
|
FrameFile = DirectoryCompo & "\" & CurrCompo.refJambCompo.TemplateSelItem
|
|
|
|
' costruisco il percosrso del file Config.ini associato al FrameFile
|
|
If Not SearchFileConfig(FrameFile, FrameFileConfig) Then
|
|
' 50144 =Warning, 50166 =Jamb compo does not exist
|
|
' MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
' se il file FrameFileConfig.ini non esiste allora elimino il riferimento
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
LocalDoor.RemoveCompo(CurrCompo, True)
|
|
CurrCompo.refJambCompo = Nothing
|
|
End If
|
|
' restituisco false perchè la componente non è stata creata
|
|
Return False
|
|
Else
|
|
' inizio la lettura di FrameFileConfig
|
|
Dim FrameNameDDF As String = String.Empty
|
|
Dim FrameName As String = String.Empty
|
|
Dim FrameSide As String = String.Empty
|
|
Dim FrameFolderName As String = String.Empty
|
|
GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameNameDDF, FrameName, FrameFileConfig)
|
|
GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, FrameSide, FrameFileConfig)
|
|
GetPrivateProfileFolderName(S_TEMPLATE, K_FOLDER_NAME, FrameFolderName, FrameFileConfig)
|
|
|
|
'Ogni volta che creo una componente elimino i precedenti riferimenti
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then LocalDoor.RemoveCompo(CurrCompo, True)
|
|
If IsNothing(CurrCompo.refJambCompo) Then
|
|
' costruisco sul riferiento la nuova componente inserita
|
|
Dim refCompoType As New CompoType(FrameName, FrameNameDDF, Path.GetDirectoryName(FrameFileConfig), FrameSide, FrameFolderName)
|
|
' aggiungo la componete sul riferiento passato (caricando la lista dei file di tipo Frame)
|
|
CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, True, IndexRefCompo)
|
|
CurrCompo.refJambCompo.refCompoDoor = CurrCompo
|
|
' definsco se la componente deve essre ribalata (Top-Door2; Bottom-Door1 e una sola anta)
|
|
If sSide = "Top" And LocalDoor.TypePart.Contains("DO_2") Then
|
|
CurrCompo.refJambCompo.OtherDoor = True
|
|
ElseIf sSide = "Bottom" And LocalDoor.TypePart.Contains("DO_1") And m_DoorNumber <> "1" Then
|
|
CurrCompo.refJambCompo.OtherDoor = True
|
|
End If
|
|
End If
|
|
' setto il nome della componente da caricare
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
CurrCompo.refJambCompo.SplitBrandFile(FrameFile)
|
|
CurrCompo.refJambCompo.refCompoDoor = CurrCompo
|
|
Else
|
|
MessageBox.Show("File '" & FrameFile & "' exist, but it is not in the correct Directory!", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed
|
|
Return False
|
|
End If
|
|
End If
|
|
|
|
' assegno i parametri letti dallo script per il corretto posizionamento del pezzo ( solo se il pezzo corrente è un DO_)
|
|
If LoadCompoParam(CurrCompo, LocalDoor.TypePart) Then
|
|
UpDateCurrCompoJamb(CurrCompo, LocalDoor.TypePart)
|
|
ResetSTU()
|
|
ResetCompoParam()
|
|
Else
|
|
Dim Msg As String = String.Format(EgtMsg(50157), CurrCompo.CompoType.Path, MATCHING_FILE_NAME)
|
|
MessageBox.Show(Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
' se sono arrivato in fondo significa che il riferiemnto è stato costruito
|
|
CurrCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
CurrCompo.refJambCompo.VisibilitiReloadBtn = Visibility.Visible
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' CreateRefCompo
|
|
|
|
' ha lo scopo di creare una copia dei riferimenti dei PartDoor
|
|
' per permettere di scrivere in modo più semplice i metodi
|
|
Private Sub SetPartDoorCurrAssembly()
|
|
m_JambT = Nothing
|
|
m_JambB = Nothing
|
|
m_JambL = Nothing
|
|
m_JambR = Nothing
|
|
m_Door1 = Nothing
|
|
m_Door2 = Nothing
|
|
For IndexPartDoor As Integer = 0 To ListPartDoor.Count - 1
|
|
If ListPartDoor(IndexPartDoor).Type.Contains("FT_") Then
|
|
m_JambT = ListPartDoor(IndexPartDoor).Door
|
|
ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FB_") Then
|
|
m_JambB = ListPartDoor(IndexPartDoor).Door
|
|
ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FL_") Then
|
|
m_JambL = ListPartDoor(IndexPartDoor).Door
|
|
ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FR_") Then
|
|
m_JambR = ListPartDoor(IndexPartDoor).Door
|
|
ElseIf ListPartDoor(IndexPartDoor).Type.Contains("DO_1") Then
|
|
m_Door1 = ListPartDoor(IndexPartDoor).Door
|
|
ElseIf ListPartDoor(IndexPartDoor).Type.Contains("DO_2") Then
|
|
m_Door2 = ListPartDoor(IndexPartDoor).Door
|
|
End If
|
|
Next
|
|
NotifyPropertyChanged("JambExists")
|
|
End Sub
|
|
|
|
Public ReadOnly Property JambExists As Boolean
|
|
Get
|
|
If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso Not IsNothing(m_JambT) Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Get
|
|
End Property
|
|
|
|
' gestisce la chimata delle funzioni a seconda della modifica eseguita
|
|
#Region "DIMENSIONING"
|
|
|
|
' Durante la costruzione di un nuovo assemblato, oppure quando viene aggiunta/rimossa un'anta
|
|
' una volta creata la prima porta questa funzione calcola le dimensioni del telaio
|
|
Public Sub SetNewDimensionAssembly(ByVal Optional IsNewAssembly As Boolean = False)
|
|
' permette di creare una copia degli oggetti di tipo PartDoor presenti nell'assemblato
|
|
SetPartDoorCurrAssembly()
|
|
' se non esiste la prima porta allora non calcolo le dimensioni del telaio
|
|
If IsNothing(m_Door1) Then Return
|
|
' i parametri che devono ancora essere definiti affinchè funzioni tutto sono
|
|
' Size, Swing, Rabbet
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return
|
|
SwingJamb()
|
|
HeightJamb(IsNewAssembly)
|
|
TopBottomWidth()
|
|
HeightDoor()
|
|
TopRabbetJamb()
|
|
HingeRabbetJamb()
|
|
BottomRabbetJamb()
|
|
MaterialJamb()
|
|
End Sub
|
|
|
|
' riceve il nome del parametro modificato ed associa la funzione per il ridimensionamento
|
|
Public Sub SetDimension(sParameter As String, Optional CurrCompo As Compo = Nothing)
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return
|
|
' riceve il nome della modifica, e indirizza la funzione preposta alla modifica
|
|
Select Case sParameter
|
|
|
|
Case "CreateRefCompo"
|
|
If BuiltReffCompo Then CreateCompoOnJamb(CurrCompo)
|
|
|
|
Case "JambIsCheked"
|
|
Map.refAssemblyManagerVM.CreateJamb(Me, False)
|
|
Map.refAssemblyManagerVM.LoadOM_M_ET(Me)
|
|
Map.refAssemblyManagerVM.CreateAssociation(Me)
|
|
SetNewDimensionAssembly()
|
|
' UpDateAllCompo()
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
|
|
Case "Height"
|
|
HeightJamb()
|
|
HeightDoor()
|
|
TopRabbetJamb()
|
|
BottomRabbetJamb()
|
|
HingeRabbetJamb()
|
|
SetVarAssembly()
|
|
UpDateAllCompo()
|
|
|
|
Case "Width"
|
|
TopBottomWidth()
|
|
TopRabbetJamb()
|
|
BottomRabbetJamb()
|
|
HingeRabbetJamb()
|
|
SetVarAssembly()
|
|
UpDateAllCompo()
|
|
|
|
Case "Thickness"
|
|
TopRabbetJamb()
|
|
UpDateAllCompo()
|
|
|
|
Case "Swing"
|
|
UpDateCompolistOnJamb()
|
|
SwingJamb()
|
|
SetPartDoorCurrAssembly()
|
|
CreateAssembly(True)
|
|
'UpDateAllCompo()
|
|
|
|
Case "DoorNumber"
|
|
ClearRefOnAssembly()
|
|
SetPartDoorCurrAssembly()
|
|
ReverseDoor()
|
|
Map.refAssemblyManagerVM.CreateDoor(Me)
|
|
Map.refAssemblyManagerVM.CreateAssociation(Me)
|
|
SetPartDoorCurrAssembly()
|
|
SetVarAssembly()
|
|
ReloadAllCompoDoor1()
|
|
ReverseDoor()
|
|
UpDateAllCompo()
|
|
TopBottomWidth()
|
|
SwingJamb()
|
|
HeightDoor()
|
|
TopRabbetJamb()
|
|
End Select
|
|
End Sub
|
|
|
|
#End Region ' Dimensioning
|
|
|
|
#Region "UpDateRefCompo"
|
|
|
|
' ricostruisce tutte le componenti del telaio
|
|
Public Sub CreateAssembly(Optional bAllDoors As Boolean = False)
|
|
If ListPartDoorOfDoor.Count < 1 Then Return
|
|
'If Not JambExists Then SetDimension("JambIsCheked")
|
|
Dim nIndexDoor As Integer = 0
|
|
If Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage AndAlso Not bAllDoors Then
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
|
|
If IsThereModifyCompoParamRef(Map.refPartPageVM.CurrPart.CompoList) Then
|
|
If MessageBox.Show("Every componente on jambs will be relocated, do you want to continue", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) = MessageBoxResult.No Then
|
|
Return
|
|
End If
|
|
End If
|
|
For IndexCompo = 0 To Map.refPartPageVM.CurrPart.CompoList.Count - 1
|
|
CreateCompoOnJamb(Map.refPartPageVM.CurrPart.CompoList(IndexCompo))
|
|
Next
|
|
End If
|
|
ElseIf Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage AndAlso bAllDoors Then
|
|
' verifico per entrmabe le ante se posso procedere
|
|
For Each ItemPart In ListPartDoorOfDoor
|
|
For IndexCompo = 0 To ItemPart.Door.CompoList.Count - 1
|
|
If IsThereModifyCompoParamRef(ItemPart.Door.CompoList) Then
|
|
If MessageBox.Show("Every componente on jambs will be relocated, do you want to continue", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) = MessageBoxResult.No Then
|
|
Return
|
|
Else
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
For Each ItemPart In ListPartDoorOfDoor
|
|
For IndexCompo = 0 To ItemPart.Door.CompoList.Count - 1
|
|
CreateCompoOnJamb(ItemPart.Door.CompoList(IndexCompo))
|
|
Next
|
|
Next
|
|
End If
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Sub
|
|
|
|
' appena verifico che esiste anche solo una componente modificata esco
|
|
Private Function IsThereModifyCompoParamRef(ByVal CompoList As ObservableCollection(Of Compo)) As Boolean
|
|
For Each ItemCompo In CompoList
|
|
If Not IsNothing(ItemCompo.refJambCompo) Then
|
|
For Each ItemParam In ItemCompo.refJambCompo.CompoParamList
|
|
If ItemParam.IsModifingRefCompoParam Then Return True
|
|
Next
|
|
End If
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
' è chiamata ogni volta che viene modificato un parametro del general dell'assemblato
|
|
Public Sub UpDateAllCompo()
|
|
Dim IdexDoorNumber As Integer = 0
|
|
IdexDoorNumber = CInt(m_DoorNumber)
|
|
If ListPartDoorOfDoor.Count < 1 Then Return
|
|
For IndexDoor As Integer = 0 To IdexDoorNumber - 1
|
|
For IndexCompo As Integer = 0 To ListPartDoorOfDoor(IndexDoor).Door.CompoList.Count - 1
|
|
' per ogni componente di ogni porta, se esiste una componente di riferimento
|
|
Dim CurrCompo As Compo = ListPartDoorOfDoor(IndexDoor).Door.CompoList(IndexCompo)
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
' ricerco il file lua che gestisce le associazioni delle componenti
|
|
If LoadCompoParam(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart) Then
|
|
UpDateCurrCompoJamb(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart)
|
|
ResetCompoParam()
|
|
Else
|
|
Dim Msg As String = String.Format(EgtMsg(50157), CurrCompo.CompoType.Path, MATCHING_FILE_NAME)
|
|
MessageBox.Show(Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
' quando carico un assemblato devo ricalcolare tutti i parametri OrigValue
|
|
Public Sub UpDateAllOrigValue()
|
|
Dim IdexDoorNumber As Integer = 0
|
|
IdexDoorNumber = CInt(m_DoorNumber)
|
|
If ListPartDoorOfDoor.Count < 1 Then Return
|
|
For IndexDoor As Integer = 0 To IdexDoorNumber - 1
|
|
For IndexCompo As Integer = 0 To ListPartDoorOfDoor(IndexDoor).Door.CompoList.Count - 1
|
|
' per ogni componente di ogni porta, se esiste una componente di riferimento
|
|
Dim CurrCompo As Compo = ListPartDoorOfDoor(IndexDoor).Door.CompoList(IndexCompo)
|
|
If Not IsNothing(CurrCompo.refJambCompo) Then
|
|
' ricerco il file lua che gestisce le associazioni delle componenti
|
|
If LoadCompoParam(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart) Then
|
|
UpdateOrigValue(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart)
|
|
ResetCompoParam()
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
' Ricevuta la componente Compo aggiorna la refCompo - Usata fino alla versione 2.2e1 del 7/5/2020
|
|
Public Sub UpDateCurrCompoJamb_OldVersion(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String)
|
|
CurrCompo.refJambCompo.IsReadOnly = False
|
|
' devo distinguere il caso della componente sulla porta o sul jamb
|
|
' se il numero di elementi presenti nella lista riferita al jamb sono diversi da quelli riferiti all'anta
|
|
If CurrCompo.refJambCompo.CompoParamList.Count <> CurrCompo.CompoParamList.Count Then Return
|
|
|
|
' se il primo controllo è andato a buon fine passo al caricamento dei dati
|
|
For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1
|
|
If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso
|
|
CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
Dim TBoxPar As TextBoxOnOffParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
|
|
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
TBoxRefPar.SetIsActive(TBoxPar.IsActive)
|
|
ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxOnOffParam AndAlso
|
|
CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
' l'unica operazione che eseguo è di abilitare la combobox
|
|
Dim CBoxRefPar As ComboBoxOnOffParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxOnOffParam)
|
|
CBoxRefPar.IsReadOnly = False
|
|
Dim CBoxPar As ComboBoxOnOffParam = DirectCast(CurrCompo.CompoParamList(IndexParam), ComboBoxOnOffParam)
|
|
For Each ItemCombo In CBoxRefPar.ItemList
|
|
If ItemCombo = CBoxPar.SelItem Then
|
|
CBoxRefPar.SetSelItem(ItemCombo)
|
|
Exit For
|
|
End If
|
|
Next
|
|
CBoxRefPar.SetIsActive(CBoxPar.IsActive)
|
|
ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso
|
|
CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
Dim TBoxPar As TextBoxParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam)
|
|
Dim TBoxRefPar As TextBoxParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam)
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso
|
|
CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
' l'unica operazione che eseguo è di abilitare la combobox
|
|
Dim CBoxRefPar As ComboBoxParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam)
|
|
CBoxRefPar.IsReadOnly = False
|
|
Dim CBoxPar As ComboBoxParam = DirectCast(CurrCompo.CompoParamList(IndexParam), ComboBoxParam)
|
|
For Each ItemCombo In CBoxRefPar.ItemList
|
|
If ItemCombo = CBoxPar.SelItem Then
|
|
CBoxRefPar.SetSelItem(ItemCombo)
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
' Ricevuta la componente Compo aggiorna la refCompo - In uso dalla versione 2.2e1 del 8/5/2020
|
|
Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String, Optional bOverWrite As Boolean = True)
|
|
CurrCompo.refJambCompo.IsReadOnly = False
|
|
' ad ogni parametro (sul compo frame) associo il parametro con lo stesso nome (sul compo door)
|
|
For Each ItemCompoRef In CurrCompo.refJambCompo.CompoParamList
|
|
' cerco il parametro con lo stesso nome nella componente della porta
|
|
For Each ItemCompo In CurrCompo.CompoParamList
|
|
' se trovo lo stesso nome
|
|
If ItemCompoRef.DDFName = ItemCompo.DDFName Then
|
|
' verifico che siano anche dello stesso tipo
|
|
If TypeOf ItemCompoRef Is TextBoxOnOffParam AndAlso TypeOf ItemCompo Is TextBoxOnOffParam Then
|
|
Dim TBoxPar As TextBoxOnOffParam = DirectCast(ItemCompo, TextBoxOnOffParam)
|
|
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(ItemCompoRef, TextBoxOnOffParam)
|
|
' non ricalcolo il parametro
|
|
If TBoxRefPar.IsModifingRefCompoParam AndAlso Not bOverWrite Then
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
Continue For
|
|
End If
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
TBoxRefPar.OrigValue = TBoxRefPar.m_Value
|
|
TBoxRefPar.SetIsActive(TBoxPar.IsActive)
|
|
ElseIf TypeOf ItemCompoRef Is ComboBoxOnOffParam AndAlso TypeOf ItemCompo Is ComboBoxOnOffParam Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
' l'unica operazione che eseguo è di abilitare la combobox
|
|
Dim CBoxRefPar As ComboBoxOnOffParam = DirectCast(ItemCompoRef, ComboBoxOnOffParam)
|
|
CBoxRefPar.IsReadOnly = False
|
|
Dim CBoxPar As ComboBoxOnOffParam = DirectCast(ItemCompo, ComboBoxOnOffParam)
|
|
For Each ItemCombo In CBoxRefPar.ItemList
|
|
If ItemCombo = CBoxPar.SelItem Then
|
|
CBoxRefPar.SetSelItem(ItemCombo)
|
|
Exit For
|
|
End If
|
|
Next
|
|
CBoxRefPar.SetIsActive(CBoxPar.IsActive)
|
|
ElseIf TypeOf ItemCompoRef Is TextBoxParam AndAlso TypeOf ItemCompo Is TextBoxParam Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
Dim TBoxRefPar As TextBoxParam = DirectCast(ItemCompoRef, TextBoxParam)
|
|
Dim TBoxPar As TextBoxParam = DirectCast(ItemCompo, TextBoxParam)
|
|
If TBoxRefPar.IsModifingRefCompoParam AndAlso Not bOverWrite Then
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
Continue For
|
|
End If
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
TBoxRefPar.OrigValue = TBoxRefPar.m_Value
|
|
ElseIf TypeOf ItemCompoRef Is ComboBoxParam AndAlso TypeOf ItemCompo Is ComboBoxParam Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
' l'unica operazione che eseguo è di abilitare la combobox
|
|
Dim CBoxRefPar As ComboBoxParam = DirectCast(ItemCompoRef, ComboBoxParam)
|
|
CBoxRefPar.IsReadOnly = False
|
|
Dim CBoxPar As ComboBoxParam = DirectCast(ItemCompo, ComboBoxParam)
|
|
For Each ItemCombo In CBoxRefPar.ItemList
|
|
If ItemCombo = CBoxPar.SelItem Then
|
|
CBoxRefPar.SetSelItem(ItemCombo)
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
' passo al parametro successivo della lista del CompoRef
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
' carico i valori OrigValue in fase di lettura di un assemblato nuovo
|
|
Public Sub UpdateOrigValue(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String)
|
|
CurrCompo.refJambCompo.IsReadOnly = False
|
|
' ad ogni parametro (sul compo frame) associo il parametro con lo stesso nome (sul compo door)
|
|
For Each ItemCompoRef In CurrCompo.refJambCompo.CompoParamList
|
|
' cerco il parametro con lo stesso nome nella componente della porta
|
|
For Each ItemCompo In CurrCompo.CompoParamList
|
|
' se trovo lo stesso nome
|
|
If ItemCompoRef.DDFName = ItemCompo.DDFName Then
|
|
' verifico che siano anche dello stesso tipo
|
|
If TypeOf ItemCompoRef Is TextBoxOnOffParam AndAlso TypeOf ItemCompo Is TextBoxOnOffParam Then
|
|
Dim TBoxPar As TextBoxOnOffParam = DirectCast(ItemCompo, TextBoxOnOffParam)
|
|
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(ItemCompoRef, TextBoxOnOffParam)
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
' confronto il valore calcolato con il parametro caricato da DDF
|
|
If Trim(TBoxRefPar.m_Value) <> Trim(TBoxRefPar.OrigValue) Then
|
|
TBoxRefPar.IsModifingRefCompoParam = True
|
|
End If
|
|
ElseIf TypeOf ItemCompoRef Is TextBoxParam AndAlso TypeOf ItemCompo Is TextBoxParam Then
|
|
' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta
|
|
Dim TBoxRefPar As TextBoxParam = DirectCast(ItemCompoRef, TextBoxParam)
|
|
Dim TBoxPar As TextBoxParam = DirectCast(ItemCompo, TextBoxParam)
|
|
' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb
|
|
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
|
|
' confronto il valore calcolato con il parametro caricato da DDF
|
|
If Trim(TBoxRefPar.m_Value) <> Trim(TBoxRefPar.OrigValue) Then
|
|
TBoxRefPar.IsModifingRefCompoParam = True
|
|
End If
|
|
End If
|
|
' passo al parametro successivo della lista del CompoRef
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
' copia i parametri di una componente (PrecCompo) su un'altra componente (NewCompo, solo se hanno lo stesso nome)
|
|
Public Sub CopyParam(ByRef PrecCompo As Compo, ByRef NewCompo As Compo)
|
|
If PrecCompo.TemplateSelItem <> NewCompo.TemplateSelItem Then Return
|
|
For IndexParam As Integer = 0 To PrecCompo.CompoParamList.Count - 1
|
|
If TypeOf PrecCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso
|
|
PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then
|
|
Dim TBoxPar As TextBoxOnOffParam = DirectCast(PrecCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
|
|
Dim TBoxNewPar As TextBoxOnOffParam = DirectCast(NewCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
|
|
If TBoxPar.EnableCopy Then
|
|
TBoxNewPar.SetValue(TBoxPar.Value)
|
|
TBoxNewPar.SetIsActive(TBoxPar.IsActive)
|
|
End If
|
|
ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso
|
|
PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then
|
|
Dim TBoxPar As TextBoxParam = DirectCast(PrecCompo.CompoParamList(IndexParam), TextBoxParam)
|
|
Dim TBoxNewPar As TextBoxParam = DirectCast(NewCompo.CompoParamList(IndexParam), TextBoxParam)
|
|
If TBoxPar.EnableCopy Then
|
|
TBoxNewPar.SetValue(TBoxPar.Value)
|
|
End If
|
|
ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is ComboBoxOnOffParam AndAlso
|
|
PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then
|
|
Dim CBoxPar As ComboBoxOnOffParam = DirectCast(PrecCompo.CompoParamList(IndexParam), ComboBoxOnOffParam)
|
|
Dim CBoxNewPar As ComboBoxOnOffParam = DirectCast(NewCompo.CompoParamList(IndexParam), ComboBoxOnOffParam)
|
|
If CBoxNewPar.EnableCopy Then
|
|
CBoxNewPar.SetSelItem(CBoxNewPar.ItemList(CBoxPar.ItemList.IndexOf(CBoxPar.SelItem)))
|
|
CBoxNewPar.SetIsActive(CBoxPar.IsActive)
|
|
End If
|
|
ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso
|
|
PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then
|
|
Dim CBoxPar As ComboBoxParam = DirectCast(PrecCompo.CompoParamList(IndexParam), ComboBoxParam)
|
|
Dim CBoxNewPar As ComboBoxParam = DirectCast(NewCompo.CompoParamList(IndexParam), ComboBoxParam)
|
|
If CBoxNewPar.EnableCopy Then
|
|
CBoxNewPar.SetSelItem(CBoxNewPar.ItemList(CBoxNewPar.ItemList.IndexOf(CBoxPar.SelItem)))
|
|
End If
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
|
|
|
|
#End Region ' UpDateRefCompo
|
|
|
|
#Region "HEIGHT"
|
|
|
|
' calcola l'altezza dei JambLeft e JambRight
|
|
Public Sub HeightJamb(ByVal Optional IsNewAssembly As Boolean = False)
|
|
' se ho impostanto l'area di lavoro non modifico l'altezza dei jamb
|
|
If Dimension Then
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetHeight(m_AssemblyHeight)
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetHeight(m_AssemblyHeight)
|
|
Return
|
|
End If
|
|
|
|
' vericfico che almeno uno su due esista
|
|
If (IsNothing(m_JambL) OrElse IsNothing(m_JambR)) AndAlso IsNothing(m_Door1) Then Return
|
|
' se almeno un jamb esiste continuo
|
|
Dim dLightUp As Double
|
|
Dim dLightBottom As Double
|
|
Dim dThicknessHead As Double
|
|
Dim dHeight As Double
|
|
Dim dOverlapTop As Double
|
|
Dim dThicknessJamb As Double
|
|
Dim dThicknessBottm As Double
|
|
Dim dOverlapBottom As Double
|
|
StringToDouble(LightUp, dLightUp)
|
|
StringToDouble(LightBottom, dLightBottom)
|
|
StringToDouble(ThicknessHead, dThicknessHead)
|
|
StringToDouble(m_Door1.Height, dHeight)
|
|
StringToDouble(ThicknessBottom, dThicknessBottm)
|
|
StringToDouble(OverlapBottom, dOverlapBottom)
|
|
|
|
'If IsNothing(Map.refPartPageVM.CurrPart) OrElse Not Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
|
|
' StringToDouble(m_Door1.Height, dHeight)
|
|
'Else
|
|
' StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight)
|
|
'End If
|
|
|
|
If Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") AndAlso
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage AndAlso
|
|
Not IsNewAssembly Then
|
|
StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight)
|
|
Else
|
|
StringToDouble(m_Door1.Height, dHeight)
|
|
End If
|
|
|
|
StringToDouble(OverlapTop, dOverlapTop)
|
|
StringToDouble(Width, dThicknessJamb)
|
|
Dim HJamb As Double = dLightBottom + dHeight + dLightUp + dThicknessHead - dOverlapTop
|
|
Dim HJambExterior As Double = HJamb + dThicknessBottm - dOverlapBottom
|
|
' se è exterior
|
|
If Map.refAssemblyPageVM.CurrAssembly.Exterior Then
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetHeight(DoubleToString(HJambExterior, 4))
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetHeight(DoubleToString(HJambExterior, 4))
|
|
Else
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetHeight(DoubleToString(HJamb, 4))
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetHeight(DoubleToString(HJamb, 4))
|
|
End If
|
|
NotifyPropertyChanged("AssemblyHeight")
|
|
|
|
End Sub
|
|
|
|
' Ricalcola la dimensione di tutte le porte ricevendo come valore esterno la dimensione della porta modificata
|
|
Public Sub HeightDoor()
|
|
Dim HeightDoor As String = String.Empty
|
|
Dim nTH As Double = 0
|
|
Dim nTB As Double = 0
|
|
Dim nLU As Double = 0
|
|
Dim nLB As Double = 0
|
|
Dim nOLT As Double = 0
|
|
Dim nOLB As Double = 0
|
|
StringToDouble(m_LightUp, nLU)
|
|
StringToDouble(m_LightBottom, nLB)
|
|
StringToDouble(m_ThicknessHead, nTH)
|
|
StringToDouble(m_OverlapTop, nOLT)
|
|
StringToDouble(m_ThicknessBottom, nTB)
|
|
StringToDouble(m_OverlapBottom, nOLB)
|
|
|
|
' carico il valore che è stato modificato
|
|
If Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then
|
|
HeightDoor = Map.refPartPageVM.CurrPart.Height
|
|
Else
|
|
' altrienti prendo quello della prima porta
|
|
If Not IsNothing(m_Door1) Then
|
|
HeightDoor = m_Door1.Height
|
|
Else
|
|
Return
|
|
End If
|
|
End If
|
|
|
|
' devo verificare che l'altezza che è stata imposta non sia maggiore di quella consentita
|
|
If Dimension Then
|
|
Dim nHeightDoor As Double
|
|
' se riesco ad eseguire la conversione numerica
|
|
If StringToDouble(HeightDoor, nHeightDoor) Then
|
|
Dim nTotalHeight As Double = 0
|
|
StringToDouble(m_AssemblyHeight, nTotalHeight)
|
|
' dimensiono la porta sempre in funzione delle dimensioni dell'assemblato
|
|
nHeightDoor = nTotalHeight - (nLU + nLB) - nTH
|
|
If Exterior Then
|
|
nHeightDoor = nHeightDoor + nOLT + nOLB - nTB
|
|
End If
|
|
m_Door1.SetHeight(DoubleToString(nHeightDoor, 4))
|
|
HeightDoor = m_Door1.Height
|
|
End If
|
|
End If
|
|
|
|
Dim nDN As Integer = 1
|
|
Int32.TryParse(m_DoorNumber, nDN)
|
|
If nDN < 2 Then Return
|
|
For Each PDOfDoor In ListPartDoorOfDoor
|
|
PDOfDoor.Door.SetHeight(HeightDoor)
|
|
Next
|
|
End Sub
|
|
|
|
' riassegna il TicnkessHead
|
|
Public Sub HeightJambTop()
|
|
Dim nTH As Double = 0
|
|
Dim nTB As Double = 0
|
|
Dim nLU As Double = 0
|
|
Dim nLB As Double = 0
|
|
Dim nOLT As Double = 0
|
|
Dim nOLB As Double = 0
|
|
Dim nHD As Double = 0
|
|
StringToDouble(m_LightUp, nLU)
|
|
StringToDouble(m_LightBottom, nLB)
|
|
StringToDouble(m_ThicknessHead, nTH)
|
|
StringToDouble(m_OverlapTop, nOLT)
|
|
StringToDouble(m_OverlapBottom, nOLB)
|
|
StringToDouble(m_ThicknessBottom, nTB)
|
|
|
|
If Not IsNothing(m_JambT) Then
|
|
m_JambT.SetHeight(ThicknessHead)
|
|
End If
|
|
|
|
If IsNothing(m_Door1) Then Return
|
|
StringToDouble(m_Door1.Height, nHD)
|
|
' se non sono definite le quote esterne del telaio esco
|
|
If Not Dimension Then Return
|
|
Dim nTotalHeight As Double = 0
|
|
StringToDouble(AssemblyHeight, nTotalHeight)
|
|
|
|
If nTotalHeight < nTH Then
|
|
' se le quote sono totalmente sbagliate
|
|
nTH = nTotalHeight - (nLU + nLB) - nHD
|
|
If Exterior Then
|
|
nTH = nTH + nOLT - nTB
|
|
End If
|
|
ThicknessHead = DoubleToString(nTH, 4)
|
|
Else
|
|
' ridimensiono la porta
|
|
nHD = nTotalHeight - (nLU + nLB) - (nTH - nOLT)
|
|
If Exterior Then
|
|
nHD = nHD + nOLT - nTB
|
|
End If
|
|
For Each ItemListPDOD In ListPartDoorOfDoor
|
|
ItemListPDOD.Door.SetHeight(DoubleToString(nHD, 4))
|
|
Next
|
|
End If
|
|
|
|
End Sub
|
|
|
|
' riassegna il TicnkessBottom
|
|
Public Sub HeightJambBottom()
|
|
Dim nTB As Double = 0
|
|
Dim nTH As Double = 0
|
|
Dim nLU As Double = 0
|
|
Dim nLB As Double = 0
|
|
Dim nOLB As Double = 0
|
|
Dim nOLT As Double = 0
|
|
Dim nHD As Double = 0
|
|
StringToDouble(m_LightUp, nLU)
|
|
StringToDouble(m_LightBottom, nLB)
|
|
StringToDouble(m_ThicknessBottom, nTB)
|
|
StringToDouble(m_OverlapBottom, nOLB)
|
|
StringToDouble(m_OverlapTop, nOLT)
|
|
StringToDouble(m_ThicknessHead, nTH)
|
|
|
|
If Not IsNothing(m_JambB) Then
|
|
m_JambB.SetHeight(ThicknessBottom)
|
|
End If
|
|
|
|
If IsNothing(m_Door1) Then Return
|
|
StringToDouble(m_Door1.Height, nHD)
|
|
' se non sono definite le quote esterne del telaio esco
|
|
If Not Dimension Then Return
|
|
|
|
Dim nTotalHeight As Double = 0
|
|
StringToDouble(AssemblyHeight, nTotalHeight)
|
|
|
|
If nTotalHeight < nTB Then
|
|
' se lo spessore è esageratamente grande è un erore
|
|
nTB = nTotalHeight - (nLU + nLB) - nHD - nTH + nOLT
|
|
ThicknessBottom = DoubleToString(nTB, 4)
|
|
Else
|
|
nHD = nTotalHeight - (nLU + nLB) - (nTH - nOLT) - (nTB - nOLB)
|
|
For Each ItemListPDOD In ListPartDoorOfDoor
|
|
ItemListPDOD.Door.SetHeight(DoubleToString(nHD, 4))
|
|
Next
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region ' Height
|
|
|
|
#Region "WIDTH"
|
|
|
|
' calcola la larghezza dei jamb orizzonatli
|
|
Private Sub TopBottomWidth()
|
|
' vericfico che almeno uno su tre esista
|
|
If (IsNothing(m_JambT) OrElse IsNothing(m_JambB)) AndAlso IsNothing(m_Door1) Then Return
|
|
' se almeno uno esiste
|
|
Dim dLightHinge As Double
|
|
Dim dLightLock As Double
|
|
Dim dOverlapLock As Double
|
|
Dim dOverlapHinge As Double
|
|
Dim dWidth1 As Double
|
|
Dim dWidth2 As Double
|
|
Dim dActualWidth As Double
|
|
Dim dThicknessJamb As Double
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightHinge, dLightHinge)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapLock, dOverlapLock)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapHinge, dOverlapHinge)
|
|
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Thickness, dThicknessJamb)
|
|
StringToDouble(m_Door1.Width, dWidth1)
|
|
|
|
Select Case m_DoorNumber
|
|
Case "1"
|
|
dActualWidth = dLightHinge + dLightLock
|
|
If Not IsNothing(m_JambB) Then m_JambB.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
|
|
If Not IsNothing(m_JambT) Then m_JambT.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
|
|
Case "2"
|
|
If Not IsNothing(m_Door2) Then
|
|
StringToDouble(m_Door2.Width, dWidth2)
|
|
Else
|
|
' se la seconda anta non esiste allora devo ridimensionare il progetto ad una sola anta
|
|
For Each sNumber In m_DoorListNumber
|
|
If Trim(sNumber) = "1" Then
|
|
m_DoorNumber = sNumber
|
|
Return
|
|
End If
|
|
Next
|
|
Return
|
|
End If
|
|
' se la seconda anta esiste allora procedo nel calcolo
|
|
dActualWidth = dLightHinge + dLightHinge + dLightLock + dWidth1
|
|
If Not IsNothing(m_JambB) Then m_JambB.SetWidth(DoubleToString(dWidth2 + dActualWidth, 4))
|
|
If Not IsNothing(m_JambT) Then m_JambT.SetWidth(DoubleToString(dWidth2 + dActualWidth, 4))
|
|
End Select
|
|
NotifyPropertyChanged("AssemblyWidth")
|
|
|
|
End Sub
|
|
|
|
' calcola la larghezza dei Jamb laterali
|
|
Public Sub SetWidthJamb()
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetWidth(m_Width)
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetWidth(m_Width)
|
|
'If Not IsNothing(m_JambB) Then m_JambB.Height = m_Width
|
|
|
|
' ricalcolo la dimensione dell'anta
|
|
If Not Dimension Then Return
|
|
'Dim DO_1 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")
|
|
'Dim DO_2 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2")
|
|
Dim LL As String = LightLock
|
|
Dim LH As String = LightHinge
|
|
Dim JW As String = Width
|
|
Dim TotW As String = m_AssemblyWidth
|
|
'If Not IsNothing(DO_1) Then
|
|
' Dim nDO_1Width As Double = 0
|
|
' Dim nDO_2Width As Double = 0
|
|
' StringToDouble(DO_1.Door.Width, nDO_1Width)
|
|
' Dim nJW As Double = 0
|
|
' StringToDouble(JW, nJW)
|
|
' Dim nLL As Double = 0
|
|
' StringToDouble(LL, nLL)
|
|
' Dim nLH As Double = 0
|
|
' StringToDouble(LH, nLH)
|
|
' Dim nTotW As Double = 0
|
|
' StringToDouble(TotW, nTotW)
|
|
' ' due ante
|
|
' If Not IsNothing(DO_2) Then
|
|
' ' la seconda anta viene ricalcolata mantenedo fissa la dimensione della prima
|
|
' StringToDouble(DO_2.Door.Width, nDO_2Width)
|
|
' nDO_2Width = nTotW - (nLL + nLH * 2 + 2 * nJW + nDO_1Width)
|
|
' If Exterior Then
|
|
' Dim nOLL As Double = 0
|
|
' StringToDouble(OverlapLock, nOLL)
|
|
' Dim nOLH As Double = 0
|
|
' StringToDouble(OverlapHinge, nOLH)
|
|
' nDO_2Width = nDO_2Width + 2 * nOLH
|
|
' End If
|
|
' DO_2.Door.SetWidth(DoubleToString(nDO_2Width, 4))
|
|
' Else
|
|
' ' singol anta
|
|
' nDO_1Width = nTotW - (nLL + nLH + 2 * nJW)
|
|
' If Exterior Then
|
|
' Dim nOLL As Double = 0
|
|
' StringToDouble(OverlapLock, nOLL)
|
|
' Dim nOLH As Double = 0
|
|
' StringToDouble(OverlapHinge, nOLH)
|
|
' nDO_1Width = nDO_1Width + nOLH + nOLL
|
|
' End If
|
|
' DO_1.Door.SetWidth(DoubleToString(nDO_1Width, 4))
|
|
' End If
|
|
'End If
|
|
|
|
If Not IsNothing(m_Door1) Then
|
|
Dim nDO_1Width As Double = 0
|
|
Dim nDO_2Width As Double = 0
|
|
StringToDouble(m_Door1.Width, nDO_1Width)
|
|
Dim nJW As Double = 0
|
|
StringToDouble(JW, nJW)
|
|
Dim nLL As Double = 0
|
|
StringToDouble(LL, nLL)
|
|
Dim nLH As Double = 0
|
|
StringToDouble(LH, nLH)
|
|
Dim nTotW As Double = 0
|
|
StringToDouble(TotW, nTotW)
|
|
' due ante
|
|
If Not IsNothing(m_Door2) Then
|
|
' la seconda anta viene ricalcolata mantenedo fissa la dimensione della prima
|
|
StringToDouble(m_Door2.Width, nDO_2Width)
|
|
nDO_2Width = nTotW - (nLL + nLH * 2 + 2 * nJW + nDO_1Width)
|
|
If Exterior Then
|
|
Dim nOLL As Double = 0
|
|
StringToDouble(OverlapLock, nOLL)
|
|
Dim nOLH As Double = 0
|
|
StringToDouble(OverlapHinge, nOLH)
|
|
nDO_2Width = nDO_2Width + 2 * nOLH
|
|
End If
|
|
m_Door2.SetWidth(DoubleToString(nDO_2Width, 4))
|
|
Else
|
|
' singol anta
|
|
nDO_1Width = nTotW - (nLL + nLH + 2 * nJW)
|
|
If Exterior Then
|
|
Dim nOLL As Double = 0
|
|
StringToDouble(OverlapLock, nOLL)
|
|
Dim nOLH As Double = 0
|
|
StringToDouble(OverlapHinge, nOLH)
|
|
nDO_1Width = nDO_1Width + nOLH + nOLL
|
|
End If
|
|
m_Door1.SetWidth(DoubleToString(nDO_1Width, 4))
|
|
End If
|
|
End If
|
|
TopBottomWidth()
|
|
'm_BottomJamb.SetHeight(m_Width)
|
|
'm_TopJamb.SetHeight(m_ThicknessHead)
|
|
'm_LeftJamb.SetWidth(m_Width)
|
|
'm_RightJamb.SetWidth(m_Width)
|
|
End Sub
|
|
|
|
#End Region ' Width
|
|
|
|
#Region "THICKNESS"
|
|
|
|
' calcola la dimensione spessore dei Jamb (per tutti lo stesso)
|
|
Public Sub SetThicKnessJamb()
|
|
If Not IsNothing(m_JambB) Then
|
|
If m_Exterior Then
|
|
m_JambB.Thickness = m_DepthBottom
|
|
Else
|
|
m_JambB.Thickness = m_Thickness
|
|
End If
|
|
End If
|
|
If Not IsNothing(m_JambT) Then m_JambT.Thickness = m_Thickness
|
|
If Not IsNothing(m_JambR) Then m_JambR.Thickness = m_Thickness
|
|
If Not IsNothing(m_JambR) Then m_JambL.Thickness = m_Thickness
|
|
End Sub
|
|
|
|
#End Region ' Thickness
|
|
|
|
#Region "SWING"
|
|
|
|
' se sulla porta singola avviene cambio swing (da LeftHand a RightHand) allora devo invertire i Jamb laterali
|
|
' se eistono entrambi i Jamb laterali inverto allora li inverto
|
|
Public Sub UpDateCompolistOnJamb()
|
|
Dim sSwing1 As SwingItemTypeList = Nothing
|
|
' in AssemblyManager ho assegnato ai Jamb la lista completa degli swing
|
|
For Each Item In OptionModule.m_SwingTypeList
|
|
If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then
|
|
OptionModule.SetCurrSwing(sSwing1, Item)
|
|
Exit For
|
|
End If
|
|
Next
|
|
If IsNothing(sSwing1) Then Return
|
|
Select Case DoorNumber
|
|
Case "1"
|
|
' passo da un'anta LeftHand ad una RightHand
|
|
If Not IsNothing(m_JambL) Then
|
|
If (m_JambL.SwingAlias.Name.Contains("LH") And sSwing1.Name.Contains("RH")) OrElse
|
|
(m_JambL.SwingAlias.Name.Contains("RH") And sSwing1.Name.Contains("LH")) Then
|
|
If Not IsNothing(m_JambR) Then
|
|
Dim TempJambL As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door.ShallowCopy()
|
|
Dim TempJambR As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.ShallowCopy()
|
|
TempJambR.IsActive = TempJambL.IsActive
|
|
TempJambL.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.IsActive
|
|
TempJambR.TypePart = ConstGen.PART_FRAME_LEFT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door = TempJambR
|
|
TempJambL.TypePart = ConstGen.PART_FRAME_RIGHT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door = TempJambL
|
|
' aggiorno le copie presenti nell'assemblato
|
|
SetPartDoorCurrAssembly()
|
|
End If
|
|
End If
|
|
End If
|
|
Case "2"
|
|
' passo da un'anta Active ad una Inactive
|
|
If IsNothing(m_Door2) Then Return
|
|
' sicuramente la porta corrente è quella modificata
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then
|
|
SwingDoor(m_Door2, m_Door1)
|
|
Else
|
|
SwingDoor(m_Door1, m_Door2)
|
|
End If
|
|
' in AssemblyManager ho assegnato ai Jamb la lista completa degli swing
|
|
For Each Item In OptionModule.m_SwingTypeList
|
|
If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then
|
|
OptionModule.SetCurrSwing(sSwing1, Item)
|
|
Exit For
|
|
End If
|
|
Next
|
|
If Not IsNothing(m_JambL) Then
|
|
If (m_JambL.SwingAlias.Name.Contains("I") And Not sSwing1.Name.Contains("I")) OrElse
|
|
(Not m_JambL.SwingAlias.Name.Contains("I") And sSwing1.Name.Contains("I")) Then
|
|
Dim TempDoor1 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.ShallowCopy()
|
|
Dim TempDoor2 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.ShallowCopy()
|
|
TempDoor2.IsActive = TempDoor1.IsActive
|
|
TempDoor1.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.IsActive
|
|
TempDoor2.TypePart = "DO_1"
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door = TempDoor2
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SetSwing(TempDoor1.Swing)
|
|
|
|
TempDoor1.TypePart = "DO_2"
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door = TempDoor1
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2")
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor
|
|
SwingDoor(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door, Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door)
|
|
|
|
If Not IsNothing(m_JambR) Then
|
|
Dim TempJambL As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door.ShallowCopy()
|
|
Dim TempJambR As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.ShallowCopy()
|
|
TempJambR.IsActive = TempJambL.IsActive
|
|
TempJambL.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.IsActive
|
|
TempJambR.TypePart = ConstGen.PART_FRAME_LEFT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door = TempJambR
|
|
TempJambL.TypePart = ConstGen.PART_FRAME_RIGHT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door = TempJambL
|
|
End If
|
|
' aggiorno le copie presenti nell'assemblato
|
|
SetPartDoorCurrAssembly()
|
|
End If
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then
|
|
Map.refPartPageVM.CurrPart = m_Door1
|
|
Else
|
|
Map.refPartPageVM.CurrPart = m_Door2
|
|
End If
|
|
End If
|
|
End Select
|
|
End Sub
|
|
|
|
Public Sub MaterialJamb()
|
|
If Not IsNothing(m_JambB) Then
|
|
m_JambB.SetMaterial(OptionModule.m_CurrMaterial)
|
|
'CreateNewPropertiesListJamb(m_JambB.PropertiesList, m_JambB.SelectedMaterial)
|
|
CreateNewPropertiesList(m_JambB)
|
|
End If
|
|
If Not IsNothing(m_JambT) Then
|
|
m_JambT.SetMaterial(OptionModule.m_CurrMaterial)
|
|
'CreateNewPropertiesListJamb(m_JambT.PropertiesList, m_JambT.SelectedMaterial)
|
|
CreateNewPropertiesList(m_JambT)
|
|
End If
|
|
If Not IsNothing(m_JambR) Then
|
|
m_JambR.SetMaterial(OptionModule.m_CurrMaterial)
|
|
'CreateNewPropertiesListJamb(m_JambR.PropertiesList, m_JambR.SelectedMaterial)
|
|
CreateNewPropertiesList(m_JambR)
|
|
End If
|
|
If Not IsNothing(m_JambR) Then
|
|
m_JambL.SetMaterial(OptionModule.m_CurrMaterial)
|
|
'CreateNewPropertiesListJamb(m_JambL.PropertiesList, m_JambL.SelectedMaterial)
|
|
CreateNewPropertiesList(m_JambL)
|
|
End If
|
|
End Sub
|
|
|
|
' assegna gli swing ai jamb
|
|
Public Sub SwingJamb()
|
|
' se la prima anta non esiste allora interrompo
|
|
If IsNothing(m_Door1) Then Return
|
|
Dim sSwing1 As String = String.Empty
|
|
' in AssemblyManager assegno ai Jamb la lista completa degli swing
|
|
For Each Item In OptionModule.m_SwingTypeList
|
|
If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then
|
|
sSwing1 = Item
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
Select Case DoorNumber
|
|
Case "1"
|
|
If Not IsNothing(m_JambB) Then m_JambB.SetSwing(sSwing1)
|
|
If Not IsNothing(m_JambT) Then m_JambT.SetSwing(sSwing1)
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetSwing(sSwing1)
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetSwing(sSwing1)
|
|
|
|
If Exterior Then
|
|
' se di tipo LeftHand
|
|
If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso m_JambL.SwingAlias.Name.Contains("LH") Then
|
|
m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE & ConstGen.EXTERIOR
|
|
m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.LOCK & ConstGen.EXTERIOR
|
|
Else
|
|
If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.LOCK & ConstGen.EXTERIOR
|
|
If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE & ConstGen.EXTERIOR
|
|
End If
|
|
If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM & ConstGen.EXTERIOR
|
|
If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP & ConstGen.EXTERIOR
|
|
Else
|
|
If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso m_JambL.SwingAlias.Name.Contains("LH") Then
|
|
m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE
|
|
m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.LOCK
|
|
Else
|
|
If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.LOCK
|
|
If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE
|
|
End If
|
|
If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM
|
|
If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP
|
|
End If
|
|
|
|
Case "2"
|
|
If IsNothing(m_Door2) Then
|
|
' se la seconda anta non esiste allora devo ridimensionare il progetto ad una sola anta
|
|
For Each sNumber In m_DoorListNumber
|
|
If Trim(sNumber) = "1" Then
|
|
m_DoorNumber = sNumber
|
|
Return
|
|
End If
|
|
Next
|
|
Return
|
|
End If
|
|
' sicuramente la porta corrente è quella modificata
|
|
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then
|
|
SwingDoor(m_Door2, m_Door1)
|
|
Else
|
|
SwingDoor(m_Door1, m_Door2)
|
|
End If
|
|
' ricerco nell'elenco degli swing
|
|
Dim sSwing2 As String = String.Empty
|
|
' in AssemblyManager assegno ai Jamb la lista completa degli swing
|
|
For Each Item In OptionModule.m_SwingTypeList
|
|
If Trim(m_Door2.SwingAlias.Name) = Trim(Item) Then
|
|
sSwing2 = Item
|
|
Exit For
|
|
End If
|
|
Next
|
|
' assegno gli swing
|
|
If Not IsNothing(m_JambB) Then m_JambB.SetSwing(sSwing2)
|
|
If Not IsNothing(m_JambT) Then m_JambT.SetSwing(sSwing1)
|
|
If Not IsNothing(m_JambL) Then m_JambL.SetSwing(sSwing1)
|
|
If Not IsNothing(m_JambR) Then m_JambR.SetSwing(sSwing2)
|
|
' assegno il nome del tipo completo
|
|
If Exterior Then
|
|
If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE & ConstGen.EXTERIOR
|
|
If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE & ConstGen.EXTERIOR
|
|
If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM & ConstGen.EXTERIOR
|
|
If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP & ConstGen.EXTERIOR
|
|
Else
|
|
If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE
|
|
If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE
|
|
If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM
|
|
If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP
|
|
End If
|
|
End Select
|
|
End Sub
|
|
|
|
' elimina tutti i riferimenti esistenti
|
|
Public Sub ClearRefOnAssembly()
|
|
' elimino tutti i riferimenti esistenti
|
|
If Not IsNothing(m_Door1) Then
|
|
For Each ItemCompo In m_Door1.CompoList
|
|
If Not IsNothing(ItemCompo.refJambCompo) Then
|
|
m_Door1.RemoveCompo(ItemCompo, True)
|
|
End If
|
|
Next
|
|
End If
|
|
' elimino tutti i riferimenti esistenti
|
|
If Not IsNothing(m_Door2) Then
|
|
For Each ItemCompo In m_Door2.CompoList
|
|
If Not IsNothing(ItemCompo.refJambCompo) Then
|
|
m_Door2.RemoveCompo(ItemCompo, True)
|
|
End If
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
' costruisce i riferminti della prima anta
|
|
Public Sub ReloadAllCompoDoor1()
|
|
If IsNothing(m_Door1) Then Return
|
|
' ricalcolo tutti i riferimenti
|
|
Map.refPartPageVM.CurrPart = m_Door1
|
|
For Each ItemCompo In m_Door1.CompoList
|
|
CreateCompoOnJamb(ItemCompo)
|
|
Next
|
|
End Sub
|
|
|
|
' inverte la prima anta con la seconda anta
|
|
Public Sub ReverseDoor()
|
|
If IsNothing(m_Door1) OrElse IsNothing(m_Door2) Then Return
|
|
If Not m_Door1.SwingAlias.Name.Contains("I") Then Return
|
|
' copio l'anta uno al posto dell'anta due e viceversa
|
|
Dim TempDoor1 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.ShallowCopy()
|
|
Dim TempDoor2 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.ShallowCopy()
|
|
TempDoor2.IsActive = TempDoor1.IsActive
|
|
TempDoor1.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.IsActive
|
|
TempDoor2.TypePart = "DO_1"
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door = TempDoor2
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SetSwing(TempDoor1.Swing)
|
|
|
|
TempDoor1.TypePart = "DO_2"
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door = TempDoor1
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2")
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor
|
|
SwingDoor(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door, Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door)
|
|
|
|
If IsNothing(m_JambR) OrElse IsNothing(m_JambL) Then Return
|
|
Dim TempJambL As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door.ShallowCopy()
|
|
Dim TempJambR As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.ShallowCopy()
|
|
TempJambR.IsActive = TempJambL.IsActive
|
|
TempJambL.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.IsActive
|
|
TempJambR.TypePart = ConstGen.PART_FRAME_LEFT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door = TempJambR
|
|
TempJambL.TypePart = ConstGen.PART_FRAME_RIGHT
|
|
Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door = TempJambL
|
|
|
|
' aggiorno le copie presenti nell'assemblato
|
|
SetPartDoorCurrAssembly()
|
|
End Sub
|
|
|
|
' permette di settare lo swing della seconda anta in funzione della selezione dello swing sulla prima anta.
|
|
' riceve l'anta da modificare (ModifySwingDoor) e l'anta che comanda la modifica (ModifiedSwingDoor)
|
|
Public Sub SwingDoor(ModifySwingDoor As Part, ModifiedSwingDoor As Part)
|
|
If Not IsNothing(ModifiedSwingDoor) AndAlso Not IsNothing(ModifiedSwingDoor) Then
|
|
For IndexSwing As Integer = 0 To ModifiedSwingDoor.SwingTypeList.Count - 1
|
|
If ModifiedSwingDoor.Swing = ModifiedSwingDoor.SwingTypeList(IndexSwing) Then
|
|
ModifySwingDoor.SetSwing(ModifySwingDoor.SwingTypeList(IndexSwing))
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Swing
|
|
|
|
Public Sub RefreshJambCheck()
|
|
For Each Item In ListPartDoor
|
|
If Item.Door.TypePart.Contains("FL_") Then
|
|
JambLIsChecked = Item.Door.IsActive
|
|
ElseIf Item.Door.TypePart.Contains("FT_") Then
|
|
JambTIsChecked = Item.Door.IsActive
|
|
ElseIf Item.Door.TypePart.Contains("FB_") Then
|
|
JambBIsChecked = Item.Door.IsActive
|
|
ElseIf Item.Door.TypePart.Contains("FT_") Then
|
|
JambTIsChecked = Item.Door.IsActive
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
' definisc le costanti dell'assemblato
|
|
Public Sub SetVarAssembly()
|
|
Dim dHeight As Double
|
|
Dim dWidth As Double
|
|
Dim dThickness As Double
|
|
If Not IsNothing(m_Door1) Then
|
|
If Not IsNothing(m_Door1.Height) AndAlso StringToDouble(m_Door1.Height, dHeight) Then
|
|
EgtLuaSetGlobNumVar("H", dHeight)
|
|
EgtLuaSetGlobNumVar("H1", dHeight)
|
|
End If
|
|
If Not IsNothing(m_Door1.Width) AndAlso StringToDouble(m_Door1.Width, dWidth) Then
|
|
EgtLuaSetGlobNumVar("W", dWidth)
|
|
EgtLuaSetGlobNumVar("W1", dWidth)
|
|
End If
|
|
If Not IsNothing(m_Door1.Thickness) AndAlso StringToDouble(m_Door1.Thickness, dThickness) Then
|
|
EgtLuaSetGlobNumVar("T", dThickness)
|
|
EgtLuaSetGlobNumVar("T1", dThickness)
|
|
End If
|
|
End If
|
|
If Not IsNothing(m_Door2) Then
|
|
If Not IsNothing(m_Door2.Height) AndAlso StringToDouble(m_Door2.Height, dHeight) Then
|
|
EgtLuaSetGlobNumVar("H2", dHeight)
|
|
End If
|
|
If Not IsNothing(m_Door2.Width) AndAlso StringToDouble(m_Door2.Width, dWidth) Then
|
|
EgtLuaSetGlobNumVar("W2", dWidth)
|
|
End If
|
|
If Not IsNothing(m_Door2.Thickness) AndAlso StringToDouble(m_Door2.Thickness, dThickness) Then
|
|
EgtLuaSetGlobNumVar("T2", dThickness)
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#Region "RABBET"
|
|
|
|
' restituisce l'indice della componente "rabbet"
|
|
Private Function nCompoRabbet() As Integer
|
|
Dim RabbetIndex As Integer = -1
|
|
For Index As Integer = 0 To Map.refCompoPanelVM.CompoTypeList.Count - 1
|
|
If Trim(Map.refCompoPanelVM.CompoTypeList(Index).DDFName) = "rabbet" Then
|
|
RabbetIndex = Index
|
|
Exit For
|
|
End If
|
|
Next
|
|
Return RabbetIndex
|
|
End Function
|
|
|
|
' clacola il rabbet sul profilo top dei Jamb (quindi solo su quelli laterali)
|
|
Public Sub TopRabbetJamb()
|
|
Dim sThicknessHead As String = Map.refAssemblyPageVM.CurrAssembly.ThicknessHead
|
|
Dim sOverlapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge
|
|
Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock
|
|
Dim sLightUp As String = Map.refAssemblyPageVM.CurrAssembly.LightUp
|
|
Select Case DoorNumber
|
|
Case "1"
|
|
If Not m_JambL.SwingAlias.Name.Contains("L") Then
|
|
If Not IsNothing(m_JambL) Then SetTopRabbetJamb(m_JambL, sThicknessHead, sOverLapLock, sLightUp)
|
|
If Not IsNothing(m_JambR) Then SetTopRabbetJamb(m_JambR, sThicknessHead, sOverlapHinge, sLightUp)
|
|
Else
|
|
If Not IsNothing(m_JambL) Then SetTopRabbetJamb(m_JambL, sThicknessHead, sOverlapHinge, sLightUp)
|
|
If Not IsNothing(m_JambR) Then SetTopRabbetJamb(m_JambR, sThicknessHead, sOverLapLock, sLightUp)
|
|
End If
|
|
Case "2"
|
|
SetTopRabbetJamb(m_JambL, sThicknessHead, sOverlapHinge, sLightUp)
|
|
SetTopRabbetJamb(m_JambR, sThicknessHead, sOverlapHinge, sLightUp)
|
|
End Select
|
|
End Sub
|
|
|
|
' ricerca la componente Rabbet, se non esiete la aggiunge e poi la modifica, altrimenti la modifica
|
|
Private Sub SetTopRabbetJamb(ByRef Jamb As Part, sThicknessHead As String, sOverlap As String, sLightUp As String)
|
|
If IsNothing(Jamb) Then Return
|
|
Dim CurrCompo As Compo = Nothing
|
|
Dim IndexCompoPanel As Integer = -1
|
|
' ricerco la posizione del rabbet nella lista dei componenti
|
|
IndexCompoPanel = nCompoRabbet()
|
|
' se la ricerca ha dato un esito positivo allora procedo
|
|
If IndexCompoPanel = -1 Then Return
|
|
Dim bRabbet As Boolean = False
|
|
Dim IndexCompo As Integer
|
|
' se esisteno delle componenti allora cerco la componente rabbet
|
|
If Jamb.CompoList.Count > 0 Then
|
|
' inizio la ricerca della componente di tipo rabbet
|
|
For IndexCompo = 0 To Jamb.CompoList.Count - 1
|
|
If Jamb.CompoList(IndexCompo).CompoType.DDFName = OptionModule.m_CompoPaneOrder(IndexCompoPanel) Then
|
|
' controllo che il primo elemento selezionato nella ComboBox sia uguale al primo elemento della lista (questa cosa non mi convince)
|
|
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(0) Then
|
|
bRabbet = True
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
' se non eiste il rabbet lo aggiungo
|
|
If Not bRabbet Then
|
|
'Map.refPartPageVM.CurrPart = Jamb
|
|
CurrCompo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(IndexCompoPanel), True)
|
|
Else
|
|
CurrCompo = Jamb.CompoList(IndexCompo)
|
|
End If
|
|
' mofico la componete rabbet
|
|
If Not IsNothing(CurrCompo) Then
|
|
Dim dVal3 As Double = 0
|
|
StringToDouble(sOverlap, dVal3)
|
|
If dVal3 <= 0 Then
|
|
Jamb.CompoList.RemoveAt(IndexCompo)
|
|
Else
|
|
SetTopRabbetParam(sThicknessHead, sOverlap, CurrCompo, sLightUp)
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
' setta i parametri della componente Rabbet sul top
|
|
Private Sub SetTopRabbetParam(sThicknessHead As String, sOverlapTop As String, CurrCompo As Compo, sLightUp As String)
|
|
Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(1)
|
|
If TypeOf CurrCompoParam Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
TextParam.m_Value = sThicknessHead
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
CurrCompoParam = CurrCompo.CompoParamList(2)
|
|
If TypeOf CurrCompoParam Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
Dim sRabbetDepth As String = sOverlapTop
|
|
TextParam.m_Value = sRabbetDepth
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
CurrCompoParam = CurrCompo.CompoParamList(3)
|
|
If TypeOf CurrCompoParam Is TextBoxOnOffParam Then
|
|
Dim TextParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
|
|
TextParam.SetIsActive(False)
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
End Sub
|
|
|
|
' calcola il rabbet sul lato Bottom solo se è stata selezionata la proprietà exterior
|
|
Public Sub BottomRabbetJamb()
|
|
Dim sThicknessDoor As String
|
|
If Not IsNothing(m_Door1) Then
|
|
sThicknessDoor = m_Door1.Thickness
|
|
Else
|
|
sThicknessDoor = "0"
|
|
End If
|
|
Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge
|
|
Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock
|
|
Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop
|
|
'Dim sWidthJamb As String = Map.refAssemblyPageVM.CurrAssembly.Width
|
|
Dim sOverlapBottom As String = Map.refAssemblyPageVM.CurrAssembly.OverlapBottom
|
|
Dim sDeltaT As String = Map.refAssemblyPageVM.CurrAssembly.DeltaThickness
|
|
Dim sThicknessBottm As String = Map.refAssemblyPageVM.CurrAssembly.ThicknessBottom
|
|
Dim sDeltaBottom As String = Map.refAssemblyPageVM.CurrAssembly.DeltaBottom
|
|
Dim IndexBottom As Integer = 1
|
|
Dim IndexHinge As Integer = 2
|
|
|
|
Dim dValBottom As Double = 0
|
|
StringToDouble(sDeltaBottom, dValBottom)
|
|
Dim dValDoor As Double = 0
|
|
StringToDouble(sDeltaT, dValDoor)
|
|
Dim DeltaTotal As String = DoubleToString(dValDoor - dValBottom, 4)
|
|
|
|
Select Case DoorNumber
|
|
Case "1"
|
|
If Not m_JambL.SwingAlias.Name.Contains(ConstGen.LOCK) Then
|
|
RabbetExterior(m_JambL, sThicknessDoor, sThicknessBottm, sOverLapLock, IndexBottom)
|
|
RabbetExterior(m_JambR, sThicknessDoor, sThicknessBottm, sOverLapHinge, IndexBottom)
|
|
SetHingeRabbetJamb(m_JambB, sThicknessDoor, DeltaTotal, sOverlapBottom, IndexHinge)
|
|
Else
|
|
RabbetExterior(m_JambL, sThicknessDoor, sThicknessBottm, sOverLapHinge, IndexBottom)
|
|
RabbetExterior(m_JambR, sThicknessDoor, sThicknessBottm, sOverLapLock, IndexBottom)
|
|
SetHingeRabbetJamb(m_JambB, sThicknessDoor, DeltaTotal, sOverlapBottom, IndexHinge)
|
|
End If
|
|
Case "2"
|
|
RabbetExterior(m_JambL, sThicknessDoor, sThicknessBottm, sOverLapHinge, IndexBottom)
|
|
RabbetExterior(m_JambR, sThicknessDoor, sThicknessBottm, sOverLapHinge, IndexBottom)
|
|
SetHingeRabbetJamb(m_JambB, sThicknessDoor, DeltaTotal, sOverlapBottom, IndexHinge)
|
|
End Select
|
|
End Sub
|
|
|
|
' calcola il rabbet sul lato Hinge solo se è stata selezionata la proprietà exterior
|
|
Public Sub HingeRabbetJamb()
|
|
Dim sThicknessDoor As String
|
|
If Not IsNothing(m_Door1) Then
|
|
sThicknessDoor = m_Door1.Thickness
|
|
Else
|
|
sThicknessDoor = "0"
|
|
End If
|
|
Dim sDeltaT As String = Map.refAssemblyPageVM.CurrAssembly.DeltaThickness
|
|
Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge
|
|
Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock
|
|
Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop
|
|
Dim sOverlapBottom As String = Map.refAssemblyPageVM.CurrAssembly.OverlapBottom
|
|
' questo flag, che è poi passato alla funzione RabbetExterior, ha lo scopo di identificare chi sta esegunedo la chiamata
|
|
Dim IndexHinge As Integer = 2
|
|
Select Case DoorNumber
|
|
Case "1"
|
|
If Not m_JambL.SwingAlias.Name.Contains(ConstGen.LOCK) Then
|
|
'RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
|
|
'RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
'RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambL, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
Else
|
|
'RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
'RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
|
|
'RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambR, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
End If
|
|
Case "2"
|
|
'RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
'RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
'RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
|
|
SetHingeRabbetJamb(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
|
|
End Select
|
|
End Sub
|
|
|
|
Public Sub SetHingeRabbetJamb(ByRef Jamb As Part, sThicknessDoor As String, sDeltaT As String, sOverLap As String, nIndexSide As Integer)
|
|
If IsNothing(Jamb) Then Return
|
|
'Dim IndexHinge As Integer = 2
|
|
'Dim IndexBottom As Integer = 1
|
|
Dim CompoListIndex As Integer = nCompoRabbet()
|
|
If CompoListIndex = -1 Then Return
|
|
Dim Local_Compo As Compo
|
|
Dim bRabbet As Boolean = False
|
|
Dim IndexCompo As Integer
|
|
' cerco la componente
|
|
If Jamb.CompoList.Count > 0 Then
|
|
For IndexCompo = 0 To Jamb.CompoList.Count - 1
|
|
If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
|
|
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then
|
|
bRabbet = True
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
' se il rabbet non esiste
|
|
If Not bRabbet Then
|
|
' lo aggiungo
|
|
Local_Compo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex), True)
|
|
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SetSelItem(DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide))
|
|
Else
|
|
Local_Compo = Jamb.CompoList(IndexCompo)
|
|
End If
|
|
If Not IsNothing(Local_Compo) Then
|
|
Dim dVal1 As Double = 0
|
|
Dim dVal2 As Double = 0
|
|
Dim dVal3 As Double = 0
|
|
StringToDouble(sThicknessDoor, dVal1)
|
|
StringToDouble(sDeltaT, dVal2)
|
|
StringToDouble(sOverLap, dVal3)
|
|
If dVal1 + dVal2 <= 0 OrElse dVal3 <= 0 Then
|
|
Jamb.CompoList.RemoveAt(IndexCompo)
|
|
Else
|
|
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Local_Compo, nIndexSide)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
' cerca la compo Rabbet sul lato indicato (Top o Bottom)
|
|
Public Sub RabbetExterior(ByRef Jamb As Part, sThicknessDoor As String, sDeltaT As String, sOverLap As String, nIndexSide As Integer)
|
|
If IsNothing(Jamb) Then Return
|
|
'Dim IndexHinge As Integer = 2
|
|
'Dim IndexBottom As Integer = 1
|
|
Dim CompoListIndex As Integer = nCompoRabbet()
|
|
If CompoListIndex = -1 Then Return
|
|
Dim Local_Compo As Compo
|
|
Dim bRabbet As Boolean = False
|
|
Dim IndexCompo As Integer
|
|
' cerco la componente
|
|
If Jamb.CompoList.Count > 0 Then
|
|
For IndexCompo = 0 To Jamb.CompoList.Count - 1
|
|
If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
|
|
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then
|
|
bRabbet = True
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
If m_Exterior Then
|
|
' se il rabbet non esiste
|
|
If Not bRabbet Then
|
|
' lo aggiungo
|
|
Local_Compo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex), True)
|
|
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SetSelItem(DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide))
|
|
Else
|
|
Local_Compo = Jamb.CompoList(IndexCompo)
|
|
End If
|
|
If Not IsNothing(Local_Compo) Then
|
|
Dim dVal1 As Double = 0
|
|
Dim dVal2 As Double = 0
|
|
Dim dVal3 As Double = 0
|
|
StringToDouble(sThicknessDoor, dVal1)
|
|
StringToDouble(sDeltaT, dVal2)
|
|
StringToDouble(sOverLap, dVal3)
|
|
If dVal1 + dVal2 <= 0 OrElse dVal3 <= 0 Then
|
|
Jamb.CompoList.RemoveAt(IndexCompo)
|
|
Else
|
|
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Local_Compo, nIndexSide)
|
|
End If
|
|
End If
|
|
Else
|
|
' rimuovo dalla lista
|
|
If bRabbet Then Jamb.CompoList.RemoveAt(IndexCompo)
|
|
End If
|
|
|
|
End Sub
|
|
' assegna i valori ai parametri del rabbet
|
|
Private Sub SetHingeRabbetParam(sThicknessDoor As String, sDeltaT As String, sOverlap As String, CurrCompo As Compo, IndexSide As Integer)
|
|
Dim dThicknessDoor As Double
|
|
Dim dDeltaT As Double
|
|
StringToDouble(sThicknessDoor, dThicknessDoor)
|
|
StringToDouble(sDeltaT, dDeltaT)
|
|
|
|
Select Case IndexSide
|
|
' se è stata passata sul lato cerniera/serrattura
|
|
Case 2
|
|
Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0)
|
|
Dim Index As Integer = 0
|
|
' width
|
|
CurrCompoParam = CurrCompo.CompoParamList(1)
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
' definisce l'affondamento della porta nel telaio
|
|
If dDeltaT + dThicknessDoor < 0 Then
|
|
TextParam.m_Value = "0"
|
|
Else
|
|
TextParam.m_Value = DoubleToString(dDeltaT + dThicknessDoor, 4)
|
|
End If
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
' depth
|
|
CurrCompoParam = CurrCompo.CompoParamList(2)
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
Dim sRabbetDepth As String = sOverlap
|
|
' la profondità deve essere la stessa che è stata definita sul rabbet top
|
|
TextParam.m_Value = sRabbetDepth
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
' angle
|
|
CurrCompoParam = CurrCompo.CompoParamList(3)
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxOnOffParam Then
|
|
Dim TextOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
|
|
' disaativo il paramtro Angle
|
|
TextOnOffParam.SetIsActive(False)
|
|
TextOnOffParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
|
|
Case 1
|
|
' inseriamo i parametri per la creazione del rabbet sul fondo
|
|
Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0)
|
|
Dim Index As Integer = 0
|
|
CurrCompoParam = CurrCompo.CompoParamList(1)
|
|
' width
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
TextParam.m_Value = DoubleToString(dDeltaT, 4)
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
' Depth
|
|
CurrCompoParam = CurrCompo.CompoParamList(2)
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then
|
|
Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
Dim sRabbetDepth As String = sOverlap
|
|
TextParam.m_Value = sRabbetDepth
|
|
TextParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
CurrCompoParam = CurrCompo.CompoParamList(3)
|
|
If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxOnOffParam Then
|
|
Dim TextOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
|
|
Dim sAngle As String = "2"
|
|
TextOnOffParam.m_Value = sAngle
|
|
TextOnOffParam.SetIsActive(True)
|
|
TextOnOffParam.NotifyPropertyChanged("Value")
|
|
End If
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
#End Region ' Rabbet
|
|
|
|
#End Region ' Rules Assembly
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
End Class
|