3dc7cb4c9f
- aggiunta della funzione per cancellare i part - aggiunto evento per la creazione del fondello split.
197 lines
8.3 KiB
VB.net
197 lines
8.3 KiB
VB.net
Imports System.Security.Cryptography
|
|
Imports EgtUILib.EgtInterface
|
|
|
|
Public Class PanelVM
|
|
Inherits SceneUserControlVM
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_MsgList As New List(Of String)({TopBar_Msg_Stg0})
|
|
Public ReadOnly Property MsgList As List(Of String)
|
|
Get
|
|
Return m_MsgList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Stage As PairStage = PairStage.FirstLine
|
|
Private Property Stage As PairStage
|
|
Get
|
|
Return m_Stage
|
|
End Get
|
|
Set(value As PairStage)
|
|
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
|
|
|
|
#End Region ' Messages
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
Title = "Aggiungi Paretina".ToUpper()
|
|
DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Annulla.Visibility = Visibility.Hidden
|
|
DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden
|
|
LoadParamList()
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Public Overrides Sub LoadParamList()
|
|
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(0), Visibility.Visible))
|
|
Dim PanelType As New List(Of ParamCmBx)({New ParamCmBx("Alzatina"), New ParamCmBx("Frontalino"), New ParamCmBx("SplitBottom")})
|
|
AddGenericParam(New _ComboBoxParam("TipoParetina", PanelType, 0, Visibility.Visible))
|
|
AddGenericParam(New _TextBoxParam("Altezza", 100, Visibility.Visible))
|
|
AddGenericParam(New _TextBoxParam("Spessore", 10, Visibility.Visible))
|
|
AddGenericParam(New _TextBoxParam("Inclinazione", 0.1, Visibility.Collapsed))
|
|
AddGenericParam(New _TextBoxParam("Diametro foro", 30, 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(4).nVisibility = Visibility.Visible
|
|
ParamList(5).nVisibility = Visibility.Visible
|
|
'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Visible
|
|
Else
|
|
ParamList(4).nVisibility = Visibility.Collapsed
|
|
ParamList(5).nVisibility = Visibility.Collapsed
|
|
'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
|
|
'Dim lEdgeList As New List(Of Integer)
|
|
'For Each nPart As Integer In Map.refSceneHostV.m_PanelPartList
|
|
' Dim nOutLay As Integer = EgtGetFirstNameInGroup(nPart, "OutLoop")
|
|
' Dim nEdge As Integer = EgtGetFirstNameInGroup(nOutLay, "A3")
|
|
' lEdgeList.Add(nEdge)
|
|
'Next
|
|
|
|
Dim lEdgeList As New List(Of Integer)({9422, 9233, 9361, 9300})
|
|
For i As Integer = 0 To lEdgeList.Count - 1
|
|
EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString, lEdgeList(i).ToString())
|
|
Next
|
|
Dim dTh As Double = GetValue(ParamList(3))
|
|
EgtLuaSetGlobNumVar("TOOL.dTh", dTh)
|
|
Dim dDiam As Double = GetValue(ParamList(5))
|
|
EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam)
|
|
Dim dAng As Double = GetValue(ParamList(4))
|
|
EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng)
|
|
EgtLuaCallFunction("TOOL.CreateSplitBottom")
|
|
End If
|
|
|
|
' gestisco le attivazioni di undo/redo
|
|
SolidManagerM.ManageUndoRedo()
|
|
' chiudo lo user control
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub Close()
|
|
SolidManagerM.ResetOperationMarks(Map.refSceneHostV.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
|
|
' rimuovo lo UC dalla griglia
|
|
Map.refSceneButtonV.RemovePanelUC()
|
|
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)
|
|
End If
|
|
End Sub
|
|
|
|
Public Function GetPanelType()
|
|
Return DirectCast(ParamList(1), _ComboBoxParam).SelParamCmBx.Name
|
|
End Function
|
|
|
|
Private Function GetValue(textBox As _TextBoxParam)
|
|
Dim sValue As String = textBox.sValue
|
|
If String.IsNullOrEmpty(sValue) Then Return 0
|
|
If Not IsNumeric(sValue) Then Return 0
|
|
Dim dAng As Double = CDbl(sValue)
|
|
Return dAng
|
|
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 nJunctionTypeAlz = 1
|
|
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString())
|
|
Dim bOnLoop As Boolean = False
|
|
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
|
|
' setto le varibili generiche per il pezzo
|
|
Dim dTh As Double = GetValue(ParamList(3))
|
|
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
|
|
Dim dH As Double = GetValue(ParamList(2))
|
|
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)
|
|
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 dAngFrontalino As Double = -90
|
|
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngFrontalino) Then AssLog("TOOL.dPairAng = " & dAngFrontalino.ToString())
|
|
Dim nJunctionTypeAlz = 3
|
|
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString())
|
|
Dim bOnLoop As Boolean = True
|
|
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
|
|
' setto le varibili generiche per il pezzo
|
|
Dim dTh As Double = GetValue(ParamList(3))
|
|
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
|
|
Dim dH As Double = GetValue(ParamList(2))
|
|
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
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|