e537861ca5
- aggiunta la scelta del tipo di giunzione alla creazione delle paretine - ricreazione dei vicini alla cancellazione di una paretina.
308 lines
14 KiB
VB.net
308 lines
14 KiB
VB.net
Imports EgtUILib.EgtInterface
|
|
|
|
Public Class NewPanelVM
|
|
Inherits SceneUserControlVM
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private ReadOnly m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2})
|
|
Public ReadOnly Property MsgList As List(Of String)
|
|
Get
|
|
Return m_MsgList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Stage As NewPanelStage = NewPanelStage.InsertParam
|
|
Private Property Stage As NewPanelStage
|
|
Get
|
|
Return m_Stage
|
|
End Get
|
|
Set(value As NewPanelStage)
|
|
m_Stage = value
|
|
DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage)
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property TopBar_Msg_Stg0 As String
|
|
Get
|
|
Return EgtMsg(110030) ' Clicca sull'edge di un pezzo per aggiungere una paretina del tipo selezionato
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TopBar_Msg_Stg1 As String
|
|
Get
|
|
Return EgtMsg(110038) ' frontalino
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property TopBar_Msg_Stg2 As String
|
|
Get
|
|
Return EgtMsg(110039) ' fondo
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
Title = "Aggiungi Paretina".ToUpper()
|
|
DirectCast(Map.refSceneButtonVM.m_NewPanelUC, SceneUserControlV).Annulla.Visibility = Visibility.Hidden
|
|
DirectCast(Map.refSceneButtonVM.m_NewPanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden
|
|
LoadParamList()
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Overrides Sub LoadParamList()
|
|
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(0), ParamType.STR, Visibility.Visible))
|
|
Dim PanelType As New List(Of ParamCmBx)({New ParamCmBx("Alzatina"), New ParamCmBx("Frontalino"), New ParamCmBx("SplitBottom"), New ParamCmBx("Tappa Buca")})
|
|
AddGenericParam(New _ComboBoxParam("TipoParetina", PanelType, 0, Visibility.Visible))
|
|
' sezione paretina
|
|
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(1), ParamType.STR, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Altezza", 100, ParamType.LEN, Visibility.Visible))
|
|
AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Visible))
|
|
Dim JunctionType As New List(Of ParamCmBx)({New ParamCmBx("Trim Start"), New ParamCmBx("Trim End"), New ParamCmBx("Trim Angled")})
|
|
AddGenericParam(New _ComboBoxParam("TipoGiunzione", JunctionType, 0, Visibility.Visible))
|
|
|
|
' sezione fondello
|
|
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(2), ParamType.STR, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Altezza", 100, ParamType.LEN, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Inclinazione", 0.1, ParamType.DOUB, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Diametro foro", 30, ParamType.LEN, Visibility.Collapsed))
|
|
End Sub
|
|
|
|
Public Sub AdvanceStage()
|
|
Stage += 1
|
|
End Sub
|
|
|
|
Public Function AtStage()
|
|
Return Stage
|
|
End Function
|
|
|
|
Public Overrides Sub OnComboboxSelectionChanged(sender As Object, Selection As ParamCmBx)
|
|
' quando viene selezionato lo split bottom devo mostrare le opzioni per il fondello
|
|
If DirectCast(sender, _ComboBoxParam).Name = "TipoParetina" Then
|
|
If DirectCast(Selection, ParamCmBx).Name = "SplitBottom" Then
|
|
ParamList(3).nVisibility = Visibility.Collapsed
|
|
ParamList(4).nVisibility = Visibility.Collapsed
|
|
ParamList(5).nVisibility = Visibility.Collapsed
|
|
|
|
ParamList(6).nVisibility = Visibility.Visible
|
|
ParamList(7).nVisibility = Visibility.Visible
|
|
ParamList(8).nVisibility = Visibility.Visible
|
|
ParamList(9).nVisibility = Visibility.Visible
|
|
ParamList(10).nVisibility = Visibility.Visible
|
|
Map.refSceneHostVM.m_SelType = GDB_TY.SRF_MESH
|
|
'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Visible
|
|
ElseIf DirectCast(Selection, ParamCmBx).Name = "Tappa Buca" Then
|
|
ParamList(2).nVisibility = Visibility.Visible
|
|
ParamList(3).nVisibility = Visibility.Visible
|
|
ParamList(4).nVisibility = Visibility.Visible
|
|
ParamList(5).nVisibility = Visibility.Visible
|
|
|
|
ParamList(6).nVisibility = Visibility.Visible
|
|
ParamList(7).nVisibility = Visibility.Visible
|
|
ParamList(8).nVisibility = Visibility.Visible
|
|
ParamList(9).nVisibility = Visibility.Visible
|
|
ParamList(10).nVisibility = Visibility.Visible
|
|
Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
|
|
Else
|
|
ParamList(2).nVisibility = Visibility.Collapsed
|
|
ParamList(3).nVisibility = Visibility.Visible
|
|
ParamList(4).nVisibility = Visibility.Visible
|
|
ParamList(5).nVisibility = Visibility.Visible
|
|
If DirectCast(Selection, ParamCmBx).Name = "Alzatina" Then
|
|
DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx = 0
|
|
ElseIf DirectCast(Selection, ParamCmBx).Name = "Frontalino" Then
|
|
DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx = 2
|
|
End If
|
|
|
|
ParamList(6).nVisibility = Visibility.Collapsed
|
|
ParamList(7).nVisibility = Visibility.Collapsed
|
|
ParamList(8).nVisibility = Visibility.Collapsed
|
|
ParamList(9).nVisibility = Visibility.Collapsed
|
|
ParamList(10).nVisibility = Visibility.Collapsed
|
|
Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
|
|
'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Public Overrides Sub Conferma()
|
|
' se sono in modalità fondello allora devo creare il pezzo
|
|
If DirectCast(ParamList(1), _ComboBoxParam).SelParamCmBx.Name = "SplitBottom" Then
|
|
AddSplitBottom(Map.refSceneHostVM.m_PanelPartList)
|
|
End If
|
|
' resetto la lista dei part selezionati per la creazione di uno splitBottom
|
|
Map.refSceneHostVM.m_PanelPartList.Clear()
|
|
' resetto il tipo di elementi da evidenziare
|
|
Map.refSceneHostVM.m_SelType = GDB_TY.NONE
|
|
|
|
' chiudo lo user control
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub Close()
|
|
SolidManagerM.ResetOperationMarks(Map.refSceneHostVM.m_nIdPart)
|
|
EgtDraw()
|
|
Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_PANEL)
|
|
If TypeOf (Btn) Is _ToggleButton Then
|
|
DirectCast(Btn, _ToggleButton).IsChecked = False
|
|
Else
|
|
EgtOutLog("CONFIG ERR: Il pulsante di Panel è stato definito come Button anziché ToggleButton")
|
|
End If
|
|
' ricostruisco l'elenco dei part solid
|
|
SolidManagerM.CreatePartSolid()
|
|
' rimuovo lo UC dalla griglia
|
|
Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_NewPanelUC)
|
|
' gestisco le attivazioni di undo/redo
|
|
SolidManagerM.ManageUndoRedo()
|
|
End Sub
|
|
|
|
Public Sub AddPanel(nId As Integer)
|
|
Dim ComboBoxParam As _ComboBoxParam = DirectCast(ParamList(1), _ComboBoxParam)
|
|
If ComboBoxParam.SelParamCmBx.Name = "Alzatina" Then
|
|
AddSplashTop(nId)
|
|
ElseIf ComboBoxParam.SelParamCmBx.Name = "Frontalino" Then
|
|
AddWaterfall(nId)
|
|
ElseIf ComboBoxParam.SelParamCmBx.Name = "Tappa Buca" Then
|
|
AddWaterfallAndBottom(nId)
|
|
End If
|
|
End Sub
|
|
|
|
Public Function GetPanelType()
|
|
Return DirectCast(ParamList(1), _ComboBoxParam).SelParamCmBx.Name
|
|
End Function
|
|
|
|
Private Sub AddSplashTop(nId As Integer)
|
|
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
' setto l'indice del lato e il parent
|
|
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString())
|
|
If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString())
|
|
' setto le variabili per l'alzatina
|
|
Dim dAngAlzatina As Double = 90
|
|
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngAlzatina) Then AssLog("TOOL.dPairAng = " & dAngAlzatina.ToString())
|
|
Dim nJunctionType As Integer = DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx + 1
|
|
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionType) Then AssLog("TOOL.nJunctionType = " & nJunctionType.ToString())
|
|
Dim bOnLoop As Boolean = False
|
|
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
|
|
Dim bInsideLoop As Boolean = True
|
|
If EgtLuaSetGlobBoolVar("TOOL.bInsideLoop", bInsideLoop) Then AssLog("TOOL.bInsideLoop = true")
|
|
' setto le varibili generiche per il pezzo
|
|
Dim dTh As Double = DirectCast(ParamList(4), _TextBoxParam).GetValue()
|
|
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
|
|
Dim dH As Double = DirectCast(ParamList(3), _TextBoxParam).GetValue()
|
|
If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString())
|
|
If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true")
|
|
If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true")
|
|
' chiamo la funzione per la creazione
|
|
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
|
|
End Sub
|
|
Private Sub AddWaterfall(nId As Integer, Optional sInfoKey As String = "", Optional bInfoValue As Boolean = False)
|
|
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
' setto l'indice del lato e il parent
|
|
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString())
|
|
If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString())
|
|
' setto le variabili per il frontalino
|
|
Dim dAngFrontalino As Double = -90
|
|
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngFrontalino) Then AssLog("TOOL.dPairAng = " & dAngFrontalino.ToString())
|
|
Dim nJunctionType As Integer = DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx + 1
|
|
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionType) Then AssLog("TOOL.nJunctionType = " & nJunctionType.ToString())
|
|
Dim bOnLoop As Boolean = True
|
|
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
|
|
Dim bInsideLoop As Boolean = True
|
|
If EgtLuaSetGlobBoolVar("TOOL.bInsideLoop", bInsideLoop) Then AssLog("TOOL.bInsideLoop = true")
|
|
' setto le varibili generiche per il pezzo
|
|
Dim dTh As Double = DirectCast(ParamList(4), _TextBoxParam).GetValue()
|
|
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
|
|
Dim dH As Double = DirectCast(ParamList(3), _TextBoxParam).GetValue()
|
|
If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString())
|
|
If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true")
|
|
If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true")
|
|
' se presente setto l'info addizionale
|
|
If sInfoKey <> String.Empty Then
|
|
If EgtLuaSetGlobStringVar("TOOL.tbInfo.InfoKey", sInfoKey) Then AssLog("TOOL.InfoKey = " & sInfoKey)
|
|
If EgtLuaSetGlobBoolVar("TOOL.tbInfo.InfoValue", bInfoValue) Then AssLog("TOOL.InfoKey = " & (bInfoValue.ToString()).ToLower())
|
|
End If
|
|
' chiamo la funzione per la creazione
|
|
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
|
|
End Sub
|
|
|
|
Private Sub AddSplitBottom(PartList As List(Of Integer), Optional sInfoKey As String = "", Optional bInfoValue As Boolean = False)
|
|
If PartList.Count = 0 Then
|
|
Close()
|
|
Return
|
|
End If
|
|
Dim lEdgeList As New List(Of Integer)
|
|
For Each nPart As Integer In PartList
|
|
Dim nOutLay As Integer = EgtGetFirstNameInGroup(nPart, "OutLoop")
|
|
Dim nEdge As Integer = EgtGetFirstNameInGroup(nOutLay, "A3")
|
|
lEdgeList.Add(nEdge)
|
|
Next
|
|
|
|
For i As Integer = 1 To lEdgeList.Count
|
|
EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString(), lEdgeList(i - 1).ToString())
|
|
Next
|
|
Dim dTh As Double = DirectCast(ParamList(8), _TextBoxParam).GetValue()
|
|
EgtLuaSetGlobNumVar("TOOL.dTh", dTh)
|
|
Dim dDiam As Double = DirectCast(ParamList(10), _TextBoxParam).GetValue()
|
|
EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam)
|
|
Dim dAng As Double = DirectCast(ParamList(9), _TextBoxParam).GetValue()
|
|
EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng)
|
|
' se presente setto l'info addizionale
|
|
If sInfoKey <> String.Empty Then
|
|
If EgtLuaSetGlobStringVar("TOOL.tbInfo.InfoKey", sInfoKey) Then AssLog("TOOL.InfoKey = " & sInfoKey)
|
|
If EgtLuaSetGlobBoolVar("TOOL.tbInfo.InfoValue", bInfoValue) Then AssLog("TOOL.InfoKey = " & (bInfoValue.ToString()).ToLower())
|
|
End If
|
|
EgtLuaCallFunction("TOOL.CreateSplitBottom")
|
|
End Sub
|
|
|
|
Private Sub AddWaterfallAndBottom(nId As Integer)
|
|
Dim nInLoopLay As Integer = EgtGetParent(nId)
|
|
Dim nEdges As Integer = EgtGetGroupObjs(nInLoopLay)
|
|
Dim nEdge As Integer = EgtGetFirstInGroup(nInLoopLay)
|
|
While nEdge <> GDB_ID.NULL
|
|
AddWaterfall(nEdge, "Sink", True)
|
|
nEdge = EgtGetNext(nEdge)
|
|
End While
|
|
' recupero le info dei part creati come frontalini dalle info del Parent
|
|
Dim nParent As Integer = EgtGetParent(nInLoopLay)
|
|
' scopro la posizione ordinale dell'inloop in questione
|
|
Dim nIn As Integer = 1
|
|
Dim nInLoop As Integer = EgtGetFirstNameInGroup(nParent, "InLoop")
|
|
While nInLoop <> nInLoopLay
|
|
nIn += 1
|
|
nInLoop = EgtGetNextName(nInLoop, "InLoop")
|
|
End While
|
|
Dim WaterFallList As New List(Of Integer)
|
|
For i As Integer = 1 To nEdges
|
|
Dim sInfoName As String = "A" & i.ToString() & "_I" & nIn.ToString()
|
|
Dim sPartName As String = String.Empty
|
|
EgtGetInfo(nParent, sInfoName, sPartName)
|
|
Dim PanelList As Array = sPartName.Split(","c)
|
|
For Each sChild As String In PanelList
|
|
Dim dPairAng As Double = 0
|
|
Dim nPartId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sChild)
|
|
EgtGetInfo(nPartId, "PairAng", dPairAng)
|
|
If dPairAng < 0 Then
|
|
sPartName = sChild
|
|
Exit For
|
|
End If
|
|
Next
|
|
WaterFallList.Add(EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName))
|
|
Next
|
|
' ora che ho la lista dei frontalini posso creare lo split bottom
|
|
AddSplitBottom(WaterFallList, "Sink", True)
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|