diff --git a/CompoWindow/CompoListPage/CompoListPageV.xaml b/CompoWindow/CompoListPage/CompoListPageV.xaml
index 39c1706..a641324 100644
--- a/CompoWindow/CompoListPage/CompoListPageV.xaml
+++ b/CompoWindow/CompoListPage/CompoListPageV.xaml
@@ -27,15 +27,20 @@
-
+
+
+
+
+
+
+
diff --git a/CompoWindow/CompoListPage/CompoListPageVM.vb b/CompoWindow/CompoListPage/CompoListPageVM.vb
index 3da6812..374e0b6 100644
--- a/CompoWindow/CompoListPage/CompoListPageVM.vb
+++ b/CompoWindow/CompoListPage/CompoListPageVM.vb
@@ -14,6 +14,17 @@ Public Class CompoListPageVM
End Get
End Property
+ Private m_CompoManagerControl As CompoManagerV
+ Public Property CompoManagerControl As CompoManagerV
+ Get
+ Return m_CompoManagerControl
+ End Get
+ Set(value As CompoManagerV)
+ m_CompoManagerControl = value
+ NotifyPropertyChanged("CompoManagerControl")
+ End Set
+ End Property
+
Private m_BackVisibility As Visibility
Public ReadOnly Property BackVisibility As Visibility
Get
@@ -40,6 +51,16 @@ Public Class CompoListPageVM
Friend Sub InitCompoListPage()
RefreshCompoList()
+ ' porto in CompoParam il CompoManager
+ If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompo) Then
+ CompoWindowMap.refCompoParamPageVM.CompoManagerControl = Nothing
+ CompoManagerControl = Nothing
+ Else
+ CompoWindowMap.refCompoParamPageVM.CompoManagerControl = Nothing
+ CompoManagerControl = CompoWindowMap.refCompoWindowVM.CompoManagerV
+ End If
+ ' lancio inizializzazione CompoManager
+ CompoWindowMap.refCompoManagerVM.InitCompoManager()
End Sub
Private Sub RefreshCompoList()
@@ -47,9 +68,12 @@ Public Class CompoListPageVM
If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompoFamily) Then
LoadMainCompoList()
m_BackVisibility = Visibility.Collapsed
- Else
+ ElseIf IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompo) Then
LoadSelCompoList()
m_BackVisibility = Visibility.Visible
+ Else
+ LoadInternalCompoList()
+ m_BackVisibility = Visibility.Visible
End If
NotifyPropertyChanged("BackVisibility")
End Sub
@@ -73,12 +97,18 @@ Public Class CompoListPageVM
Private Sub LoadSelCompoList()
Dim SelCompoIndex As Integer = CompoWindowMap.refCompoWindowVM.m_SelCompoFamily.Index
Dim CompoNumber As Integer = GetMainPrivateProfileInt("Compo" & SelCompoIndex, "Count", 0)
- Dim sCompoImage As String = String.Empty
For CompoIndex = 1 To CompoNumber
m_CompoList.Add(GetPrivateProfileCompo("Compo" & SelCompoIndex, "Compo" & CompoIndex))
Next
End Sub
+ Private Sub LoadInternalCompoList()
+ Dim CompoNumber As Integer = GetMainPrivateProfileInt("InternalCompo", "Count", 0)
+ For CompoIndex = 1 To CompoNumber
+ m_CompoList.Add(GetPrivateProfileCompo("InternalCompo" & CompoIndex, "InternalCompo" & CompoIndex))
+ Next
+ End Sub
+
Public Function GetPrivateProfileCompo(
ByVal lpAppName As String,
ByVal lpKeyName As String) As CompoItem
@@ -124,9 +154,12 @@ Public Class CompoListPageVM
Else
RefreshCompoList()
End If
- Else
+ ElseIf IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompo) Then
CompoWindowMap.refCompoWindowVM.m_SelCompo = DirectCast(param, CompoItem)
CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.PARAM
+ Else
+ CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = DirectCast(param, CompoItem)
+ CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.PARAM
End If
End Sub
@@ -146,8 +179,15 @@ Public Class CompoListPageVM
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub Back(ByVal param As Object)
- CompoWindowMap.refCompoWindowVM.m_SelCompoFamily = Nothing
- RefreshCompoList()
+ If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompo) Then
+ CompoWindowMap.refCompoWindowVM.m_SelCompoFamily = Nothing
+ InitCompoListPage()
+ Else
+ CompoWindowMap.refCompoWindowVM.m_SelCompo = Nothing
+ InitCompoListPage()
+ EgtNewFile()
+ EgtDraw()
+ End If
End Sub
#End Region ' BackCommand
diff --git a/CompoWindow/CompoManager/CompoManagerV.xaml b/CompoWindow/CompoManager/CompoManagerV.xaml
new file mode 100644
index 0000000..6e6c5f5
--- /dev/null
+++ b/CompoWindow/CompoManager/CompoManagerV.xaml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CompoWindow/CompoManager/CompoManagerV.xaml.vb b/CompoWindow/CompoManager/CompoManagerV.xaml.vb
new file mode 100644
index 0000000..f76a706
--- /dev/null
+++ b/CompoWindow/CompoManager/CompoManagerV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class CompoManagerV
+
+End Class
diff --git a/CompoWindow/CompoManager/CompoManagerVM.vb b/CompoWindow/CompoManager/CompoManagerVM.vb
new file mode 100644
index 0000000..180810a
--- /dev/null
+++ b/CompoWindow/CompoManager/CompoManagerVM.vb
@@ -0,0 +1,215 @@
+Imports EgtUILib
+
+Public Class CompoManagerVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Private Const LUA_CMP_VARS As String = "CMP"
+ Friend Const LUA_CMP_WITHTOP As String = LUA_CMP_VARS & ".WithTop"
+
+ Private m_TopIsChecked As Boolean
+ Public Property TopIsChecked As Boolean
+ Get
+ Return m_TopIsChecked
+ End Get
+ Set(value As Boolean)
+ m_TopIsChecked = value
+ End Set
+ End Property
+
+ Private m_Top_Visibility As Visibility
+ Public Property Top_Visibility As Visibility
+ Get
+ Return m_Top_Visibility
+ End Get
+ Set(value As Visibility)
+ m_Top_Visibility = value
+ NotifyPropertyChanged("Top_Visibility")
+ End Set
+ End Property
+
+ Private m_PartName As String
+ Public Property PartName As String
+ Get
+ Return m_PartName
+ End Get
+ Set(value As String)
+ m_PartName = value
+ NotifyPropertyChanged("PartName")
+ End Set
+ End Property
+
+ Private m_PartName_Visibility As Visibility
+ Public Property PartName_Visibility As Visibility
+ Get
+ Return m_PartName_Visibility
+ End Get
+ Set(value As Visibility)
+ m_PartName_Visibility = value
+ NotifyPropertyChanged("PartName_Visibility")
+ End Set
+ End Property
+
+ Private m_PartNum As String
+ Public Property PartNum As String
+ Get
+ Return m_PartNum
+ End Get
+ Set(value As String)
+ m_PartNum = value
+ NotifyPropertyChanged("PartNum")
+ End Set
+ End Property
+
+ Private m_PartNum_Visibility As Visibility
+ Public Property PartNum_Visibility As Visibility
+ Get
+ Return m_PartNum_Visibility
+ End Get
+ Set(value As Visibility)
+ m_PartNum_Visibility = value
+ NotifyPropertyChanged("PartNum_Visibility")
+ End Set
+ End Property
+
+ Private m_OkIsEnabled As Boolean
+ Public Property OkIsEnabled As Boolean
+ Get
+ Return m_OkIsEnabled
+ End Get
+ Set(value As Boolean)
+ m_OkIsEnabled = value
+ NotifyPropertyChanged("OkIsEnabled")
+ End Set
+ End Property
+
+ Private m_OkExit_Visibility As Visibility
+ Public Property OkExit_Visibility As Visibility
+ Get
+ Return m_OkExit_Visibility
+ End Get
+ Set(value As Visibility)
+ m_OkExit_Visibility = value
+ NotifyPropertyChanged("OkExit_Visibility")
+ End Set
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property TopMsg As String
+ Get
+ Return EgtMsg(MSG_DRAWPAGEUC + 4)
+ End Get
+ End Property
+ Public ReadOnly Property PartNameMsg As String
+ Get
+ Return "Nome"
+ End Get
+ End Property
+ Public ReadOnly Property PartNumMsg As String
+ Get
+ Return EgtMsg(MSG_DRAWPAGEUC + 1)
+ End Get
+ End Property
+ Public ReadOnly Property OkMsg As String
+ Get
+ Return "Ok"
+ End Get
+ End Property
+ Public ReadOnly Property ExitMsg As String
+ Get
+ Return "Exit"
+ End Get
+ End Property
+
+#End Region ' Messages
+
+ ' definizione comandi
+ Private m_cmdOk As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in CompoWindowMap
+ CompoWindowMap.SetRefCompoManagerVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+#End Region ' METHODS
+
+ Friend Sub InitCompoManager()
+ If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelInternalCompo) Then
+ PartName_Visibility = Visibility.Visible
+ PartNum_Visibility = Visibility.Visible
+ OkExit_Visibility = Visibility.Visible
+ ' Verifico se il compo selezionato ha la segnalazione del Top abilitata
+ Dim bHasTop As Boolean = False
+ EgtLuaGetGlobBoolVar(LUA_CMP_WITHTOP, bHasTop)
+ Top_Visibility = If(bHasTop, Visibility.Visible, Visibility.Collapsed)
+ Else
+ Top_Visibility = Visibility.Collapsed
+ PartName_Visibility = Visibility.Collapsed
+ PartNum_Visibility = Visibility.Collapsed
+ OkExit_Visibility = Visibility.Collapsed
+ End If
+ ' assegno valori di default numero e nome pezzi
+ PartNum = 1.ToString
+ PartName = String.Empty
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "OkCommand"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property OkCommand() As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub Ok(ByVal param As Object)
+ ' se errore esco
+ If Not CompoWindowMap.refCompoWindowVM.m_bDrawOk Then
+ Return
+ End If
+ ' Leggo numero di pezzi da inserire
+ Dim InsNbr As Integer
+ StringToInt(m_PartNum, InsNbr)
+ ' Verifico se ci sono componenti interni
+ Dim bHasIntCompo As Boolean = False
+ EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
+ If EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "InLoop") <> GDB_ID.NULL Then
+ bHasIntCompo = True
+ End If
+ ' Passo al contesto principale
+ EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
+ ' Inserisco il componente nel DB geometrico principale
+ If bHasIntCompo Then
+ CompoWindowMap.refCompoWindowVM.MakeCompoInsert(InsNbr, m_PartName)
+ Else
+ CompoWindowMap.refCompoWindowVM.MakeInsert(InsNbr, m_PartName)
+ End If
+ ' Aggiorno ambiente principale
+ EgtZoom(ZM.ALL)
+ ' Elimino riferimento con delegato
+ CompoParamItem.m_refUpdateView = Nothing
+ ' Chiudo la finestra Compo
+ CompoWindowMap.refCompoWindowVM.Close(True)
+ End Sub
+
+#End Region ' OkCommand
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/CompoWindow/CompoParamPage/CompoParamPageV.xaml b/CompoWindow/CompoParamPage/CompoParamPageV.xaml
index 76cc67e..33aea46 100644
--- a/CompoWindow/CompoParamPage/CompoParamPageV.xaml
+++ b/CompoWindow/CompoParamPage/CompoParamPageV.xaml
@@ -8,55 +8,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CompoWindow/CompoParamPage/CompoParamPageVM.vb b/CompoWindow/CompoParamPage/CompoParamPageVM.vb
index 93d3c8a..dd234c4 100644
--- a/CompoWindow/CompoParamPage/CompoParamPageVM.vb
+++ b/CompoWindow/CompoParamPage/CompoParamPageVM.vb
@@ -7,18 +7,16 @@ Public Class CompoParamPageVM
#Region "FIELDS & PROPERTIES"
- Private Const NUM_VAR As Integer = 10
+ Friend Const NUM_VAR As Integer = 10
Private Const LUA_CMP_VARS As String = "CMP"
Private Const LUA_CMP_DRAW As String = "CMP_Draw"
Private Const INFO_VAR As String = "Var"
- Private Const INFO_CMP As String = "CMP"
+ Friend Const INFO_CMP As String = "CMP"
Private Const INFO_ID As String = "ID"
Friend Const LUA_CMP_INDEX As String = LUA_CMP_VARS & ".Ind"
Friend Const LUA_CMP_INTERNAL As String = LUA_CMP_VARS & ".Int"
Friend Const LUA_REMOVEHOLE As String = "RemoveHole"
-
- Private m_sCompoDir As String = String.Empty
- Private m_bDrawOk As Boolean = False
+ Friend Const LUA_CMP_WITHINT As String = LUA_CMP_VARS & ".WithInt"
Private m_CompoParamList As New ObservableCollection(Of CompoParamItem)
Public ReadOnly Property CompoParamList As ObservableCollection(Of CompoParamItem)
@@ -27,65 +25,36 @@ Public Class CompoParamPageVM
End Get
End Property
- Private m_TopIsChecked As Boolean
- Public Property TopIsChecked As Boolean
+ Private m_Internal_Visibility As Visibility
+ Public Property Internal_Visibility As Visibility
Get
- Return m_TopIsChecked
- End Get
- Set(value As Boolean)
- m_TopIsChecked = value
- End Set
- End Property
-
- Private m_TopVisibility As Visibility
- Public Property TopVisibility As Visibility
- Get
- Return m_TopVisibility
+ Return m_Internal_Visibility
End Get
Set(value As Visibility)
- m_TopVisibility = value
+ m_Internal_Visibility = value
+ NotifyPropertyChanged("Internal_Visibility")
End Set
End Property
- Private m_PartName As String
- Public Property PartName As String
+ Private m_AddRemove_Visibility As Visibility
+ Public Property AddRemove_Visibility As Visibility
Get
- Return m_PartName
- End Get
- Set(value As String)
- m_PartName = value
- NotifyPropertyChanged("PartName")
- End Set
- End Property
-
- Private m_PartNameVisibility As Visibility
- Public Property PartNameVisibility As Visibility
- Get
- Return m_PartNameVisibility
+ Return m_AddRemove_Visibility
End Get
Set(value As Visibility)
- m_PartNameVisibility = value
+ m_AddRemove_Visibility = value
+ NotifyPropertyChanged("AddRemove_Visibility")
End Set
End Property
- Private m_PartNum As String
- Public Property PartNum As String
+ Private m_CompoManagerControl As CompoManagerV
+ Public Property CompoManagerControl As CompoManagerV
Get
- Return m_PartNum
+ Return m_CompoManagerControl
End Get
- Set(value As String)
- m_PartNum = value
- NotifyPropertyChanged("PartNum")
- End Set
- End Property
-
- Private m_PartNumVisibility As Visibility
- Public Property PartNumVisibility As Visibility
- Get
- Return m_PartNumVisibility
- End Get
- Set(value As Visibility)
- m_PartNumVisibility = value
+ Set(value As CompoManagerV)
+ m_CompoManagerControl = value
+ NotifyPropertyChanged("CompoManagerControl")
End Set
End Property
@@ -100,17 +69,6 @@ Public Class CompoParamPageVM
End Set
End Property
- Private m_OkIsEnabled As Boolean
- Public Property OkIsEnabled As Boolean
- Get
- Return m_OkIsEnabled
- End Get
- Set(value As Boolean)
- m_OkIsEnabled = value
- NotifyPropertyChanged("OkIsEnabled")
- End Set
- End Property
-
Private m_MsgColor As SolidColorBrush = Brushes.Black
Public Property MsgColor As SolidColorBrush
Get
@@ -122,38 +80,71 @@ Public Class CompoParamPageVM
End Set
End Property
+ Private m_Back_Visibility As Visibility
+ Public Property Back_Visibility As Visibility
+ Get
+ Return m_Back_Visibility
+ End Get
+ Set(value As Visibility)
+ m_Back_Visibility = value
+ NotifyPropertyChanged("Back_Visibility")
+ End Set
+ End Property
+
#Region "Messages"
- Public ReadOnly Property TopMsg As String
+ Public ReadOnly Property InternalMsg As String
Get
- Return EgtMsg(MSG_DRAWPAGEUC + 4)
+ Return EgtMsg(MSG_COMPONENTPAGEUC + 47)
End Get
End Property
- Public ReadOnly Property PartNameMsg As String
+ Private m_AddMsg As String
+ Public Property AddMsg As String
Get
- Return "Nome"
- End Get
- End Property
- Public ReadOnly Property PartNumMsg As String
- Get
- Return EgtMsg(MSG_DRAWPAGEUC + 1)
- End Get
- End Property
- Public ReadOnly Property OkMsg As String
- Get
- Return "Ok"
- End Get
- End Property
- Public ReadOnly Property ExitMsg As String
- Get
- Return "Exit"
+ Return m_AddMsg
+ End Get
+ Set(value As String)
+ m_AddMsg = value
+ NotifyPropertyChanged("AddMsg")
+ End Set
+ End Property
+ Public ReadOnly Property CancelMsg As String
+ Get
+ Return EgtMsg(MSG_COMPONENTPAGEUC + 49)
End Get
End Property
+ 'Public ReadOnly Property TopMsg As String
+ ' Get
+ ' Return EgtMsg(MSG_DRAWPAGEUC + 4)
+ ' End Get
+ 'End Property
+ 'Public ReadOnly Property PartNameMsg As String
+ ' Get
+ ' Return "Nome"
+ ' End Get
+ 'End Property
+ 'Public ReadOnly Property PartNumMsg As String
+ ' Get
+ ' Return EgtMsg(MSG_DRAWPAGEUC + 1)
+ ' End Get
+ 'End Property
+ 'Public ReadOnly Property OkMsg As String
+ ' Get
+ ' Return "Ok"
+ ' End Get
+ 'End Property
+ 'Public ReadOnly Property ExitMsg As String
+ ' Get
+ ' Return "Exit"
+ ' End Get
+ 'End Property
#End Region ' Messages
' definizione comandi
- Private m_cmdOk As ICommand
+ Private m_cmdInternal As ICommand
+ Private m_cmdAdd As ICommand
+ Private m_cmdCancel As ICommand
Private m_cmdBack As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -163,37 +154,63 @@ Public Class CompoParamPageVM
Sub New()
' Creo riferimento a questa classe in CompoWindowMap
CompoWindowMap.SetRefCompoParamPageVM(Me)
- ' Recupero path cartella che contiene i componenti
- GetMainPrivateProfileString("Compo", "CompoDir", "", m_sCompoDir)
+ '' Recupero path cartella che contiene i componenti
+ 'GetMainPrivateProfileString("Compo", "CompoDir", "", m_sCompoDir)
' Passo funzione UpdateView ad oggetti della lista parametri
- CompoParamItem.m_refUpdateView = AddressOf UpdateView
+ CompoParamItem.m_refUpdateView = AddressOf CompoWindowMap.refCompoWindowVM.UpdateView
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
- Friend Sub InitCompoListPage()
+ Friend Sub InitCompoParamPage()
' Pulisco l'ambiente lua
ResetLuaVariables()
' Carico il file ed eseguo in modalità anteprima
- Dim bOk As Boolean = ExecCompoFile()
+ Dim bOk As Boolean = CompoWindowMap.refCompoWindowVM.ExecCompoFile()
Dim sMsg As String = String.Empty
- ' Verifico se compo interno o esterno
- Dim InternalCompo As Integer = -1
- EgtLuaGetGlobIntVar(LUA_CMP_INTERNAL, InternalCompo)
- bOk = bOk AndAlso MakePreview(sMsg)
- If Not bOk And InternalCompo <> 1 Then
- EgtNewFile()
+ ' Verifico se ho selezionato un componente normale
+ If Not CompoWindowMap.refCompoSceneHostV.SelFromScene Then
+ ' lo eseguo e ne restituisco il messaggio
+ bOk = bOk AndAlso CompoWindowMap.refCompoWindowVM.MakePreview(sMsg)
+ If Not bOk And IsNothing(CompoWindowMap.refCompoWindowVM.m_SelInternalCompo) Then
+ EgtNewFile()
+ End If
+ ' scrivo messaggio
+ SetOutputMessage(sMsg, If(CompoWindowMap.refCompoWindowVM.m_bDrawOk, MSG_TYPE.INFO, MSG_TYPE.ERROR_))
+ CompoWindowMap.refCompoSceneHostV.CompoScene.ZoomAll()
+ ' Imposto messaggio aggiungi
+ AddMsg = EgtMsg(MSG_COMPONENTPAGEUC + 48)
+ ' altrimenti se è un compo interno
+ Else
+ If Not bOk Then
+ EgtOutLog("Error in Component " & CompoWindowMap.refCompoWindowVM.m_SelInternalCompo.LuaPath)
+ End If
+ ClearOutputMessage()
+ ' Imposto messaggio conferma
+ AddMsg = EgtMsg(MSG_COMPONENTPAGEUC + 50)
End If
- 'MessageTxBl.Text = sMsg
- 'MessageGrid.Background = If(m_bDrawOk, Brushes.Transparent, Application.Current.FindResource("OmagCut_Red"))
- CompoWindowMap.refCompoSceneHostV.CompoScene.ZoomAll()
' leggo variabili e aggiorno griglia
ReadAndShowVariables()
- ' assegno valori di default numero e nome pezzi
- PartNum = 1.ToString
- PartName = String.Empty
+ ' visualizzo/nascondo bottoni
+ If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelInternalCompo) Then
+ AddRemove_Visibility = Visibility.Collapsed
+ Back_Visibility = Visibility.Visible
+ ' Verifico se il compo selezionato ha i compo interni abilitati
+ Dim bHasInternalCompo As Boolean = False
+ EgtLuaGetGlobBoolVar(LUA_CMP_WITHINT, bHasInternalCompo)
+ Internal_Visibility = If(bHasInternalCompo, Visibility.Visible, Visibility.Collapsed)
+ Else
+ Internal_Visibility = Visibility.Collapsed
+ AddRemove_Visibility = Visibility.Visible
+ Back_Visibility = Visibility.Collapsed
+ End If
+ ' porto in CompoParam il CompoManager
+ CompoWindowMap.refCompoListPageVM.CompoManagerControl = Nothing
+ CompoManagerControl = CompoWindowMap.refCompoWindowVM.CompoManagerV
+ ' lancio inizializzazione CompoManager
+ CompoWindowMap.refCompoManagerVM.InitCompoManager()
End Sub
Private Function ResetLuaVariables() As Boolean
@@ -202,26 +219,6 @@ Public Class CompoParamPageVM
Return False
End Function
- Private Function MakePreview(ByRef sMsg As String) As Boolean
- If Not EgtLuaExecLine(LUA_CMP_DRAW & "(true)") Then
- sMsg = "Error in component execution"
- m_bDrawOk = False
- Else
- EgtLuaGetGlobStringVar(LUA_CMP_VARS & ".MSG", sMsg)
- Dim nErr As Integer = 0
- EgtLuaGetGlobIntVar(LUA_CMP_VARS & ".ERR", nErr)
- m_bDrawOk = (nErr = 0)
- End If
- Return m_bDrawOk
- End Function
-
- Private Function ExecCompoFile() As Boolean
- ' Costruisco path completa del componente
- Dim sPath = m_sCompoDir & "\" & CompoWindowMap.refCompoWindowVM.m_SelCompo.LuaPath
- ' Carico il file
- Return EgtLuaExecFile(sPath)
- End Function
-
Private Function ReadAndShowVariables() As Boolean
' Pulisco lista variabili
m_CompoParamList.Clear()
@@ -235,23 +232,38 @@ Public Class CompoParamPageVM
Return True
End Function
- Public Sub UpdateView()
- ' verifico ci sia un componente corrente
- If IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompo) Then
- Return
- End If
- ' aggiorno le variabili dalla griglia
- UpdateVariables()
- ' ricalcolo il disegno
- Dim sMsg As String = String.Empty
- MakePreview(sMsg)
- SetOutputMessage(sMsg, If(m_bDrawOk, MSG_TYPE.INFO, MSG_TYPE.ERROR_))
- ' aggiorno visualizzazione
- EgtSetView(VT.TOP, False)
- EgtZoom(ZM.ALL)
- End Sub
+ Friend Function ReadSelInternalVariables(nId As Integer) As Boolean
+ ' Imposto le variabili del componente
+ For i As Integer = 1 To m_CompoParamList.Count
+ ' leggo il valore della variabile
+ If Not IsNothing(CompoParamList(i - 1)) Then
+ Dim sVar As String = String.Empty
+ If EgtGetInfo(nId, "V" & i.ToString(), sVar) Then
+ If CompoParamList(i - 1).m_nType = CompoParamItem.ParamType.BOOL Then
+ Dim CurrParam As CheckParamItem = DirectCast(CompoParamList(i - 1), CheckParamItem)
+ CurrParam.FromString(sVar, False)
+ ' aggiorno la corrispondente variabile lua
+ If Not CurrParam.ToLua() Then
+ Dim sErr As String = String.Empty
+ EgtLuaGetLastError(sErr)
+ EgtOutLog(sErr)
+ End If
+ Else
+ Dim CurrParam As TextParamItem = DirectCast(CompoParamList(i - 1), TextParamItem)
+ CurrParam.FromString(sVar, False)
+ ' aggiorno la corrispondente variabile lua
+ If Not CurrParam.ToLua() Then
+ Dim sErr As String = String.Empty
+ EgtLuaGetLastError(sErr)
+ EgtOutLog(sErr)
+ End If
+ End If
+ End If
+ End If
+ Next
+ End Function
- Private Function UpdateVariables() As Boolean
+ Friend Function UpdateVariables() As Boolean
' aggiorno le variabili
For i As Integer = 0 To m_CompoParamList.Count - 1
If m_CompoParamList(i).m_nType <> CompoParamItem.ParamType.BOOL Then
@@ -273,104 +285,19 @@ Public Class CompoParamPageVM
Return True
End Function
- Private Function MakeInsert(nNbr As Integer, sName As String) As Boolean
- ' ricarico componente corrente
- ExecCompoFile()
- ' aggiorno variabili
- UpdateVariables()
- ' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
- Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
- ' elimino eventuali precedenti pezzi vuoti
- EgtEraseEmptyParts()
- ' eseguo inserimento
- For i As Integer = 1 To nNbr
- ' Inserisco il componente
- If Not EgtLuaExecLine(LUA_CMP_DRAW & "(false)") Then
- Dim sErr As String = String.Empty
- EgtLuaGetLastError(sErr)
- EgtOutLog(sErr)
- Exit For
- End If
- ' Ne recupero l'Id
- Dim nId2 As Integer = EgtGetLastPart()
- ' Ne recupero il layer OutLoop
- Dim nOutLoopLayer As Integer = EgtGetFirstNameInGroup(nId2, NAME_OUTLOOP)
- ' Calcolo dimensione ingombro OutLoop
- Dim ptMin, ptMax As Point3d
- EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, ptMin, ptMax)
- Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
- ' Ricavo nome layer con testi inclinazioni
- Dim TextLayer As Integer = EgtGetFirstNameInGroup(nId2, SIDE_ANGLE_LAYER)
- ' Se presente lo svuoto
- If TextLayer <> GDB_ID.NULL Then
- EgtEmptyGroup(TextLayer)
- ' altrimenti lo creo
- Else
- TextLayer = EgtCreateGroup(nId2)
- EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
- End If
- '' Modifico inclinazione lati
- 'For Each Entity In m_SideAngle.m_SideAngleEntityList
- ' Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
- ' If Math.Abs(Entity.dSideAngle) > EPS_ANG_SMALL Then
- ' ' Scrivo nuovo angolo nelle info
- ' EgtSetInfo(nCurrEntityName, INFO_SIDE_ANGLE, Entity.dSideAngle)
- ' ' Creo testo con angolo di inclinazione per nesting
- ' Dim sText As String = DoubleToString(Entity.dSideAngle, 1) & "°"
- ' SideAngleUC.AddTextToLine(sText, TextLayer, nCurrEntityName, 10, dBBoxRad, False)
- ' Else
- ' ' Cancello inclinazione nell'apposito campo info
- ' EgtRemoveInfo(nCurrEntityName, INFO_SIDE_ANGLE)
- ' End If
- 'Next
- '' Sistemo gocciolatoi
- 'm_SideAngle.CreateDripGeom(nId2)
- ' Muovo la regione in Z per evitare problemi in visualizzazione
- Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
- EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
- ' Se definito nome lo inserisco nel testo
- If Not String.IsNullOrWhiteSpace(sName) Then
- Dim nTextId = EgtGetFirstInGroup(nRegId)
- While nTextId <> GDB_ID.NULL
- If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
- Dim sText As String = String.Empty
- EgtTextGetContent(nTextId, sText)
- Dim sNewText = sName & " " & sText
- EgtModifyText(nTextId, sNewText)
- Exit While
- End If
- nTextId = EgtGetNext(nTextId)
- End While
- End If
- ' Eventuale testo per indicare il sopra (solo nel caso di rettangolo)
- If m_TopIsChecked Then
- Dim dDimX As Double = ptMax.x - ptMin.x
- Dim dDimY As Double = ptMax.y - ptMin.y
- Dim dH As Double = Math.Min(0.15 * dDimY, 30)
- Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC)
- EgtSetColor(nText, New Color3d())
- End If
- ' Aggiusto per lavorazioni
- AdjustFlatPart(nId2)
- ' Inserisco in parcheggio
- EstCalc.StoreOnePart(nId2, True)
- ' Se richiesto posizionamento diretto, lo eseguo
- If bDirect Then
- If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
- ' Eventuale notifica al VeinMatching
- VeinMatching.OnInsertPartInRaw(nId2)
- End If
- End If
- Next
- Return True
- End Function
-
Friend Overloads Sub SetOutputMessage(sMessage As String, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
SetMsgColor(nMsgType)
m_OutputMessage = sMessage
NotifyPropertyChanged("OutputMessage")
End Sub
+ Friend Sub ClearOutputMessage()
+ m_MsgColor = Brushes.Black
+ NotifyPropertyChanged("MsgColor")
+ m_OutputMessage = String.Empty
+ NotifyPropertyChanged("OutputMessage")
+ End Sub
+
Private Sub SetMsgColor(nMsgType As MSG_TYPE)
Select Case nMsgType
Case MSG_TYPE.INFO
@@ -387,42 +314,111 @@ Public Class CompoParamPageVM
#Region "COMMANDS"
-#Region "OkCommand"
+#Region "InternalCommand"
' Returns a command that manage the MainWindow_Unloaded command
- Public ReadOnly Property OkCommand() As ICommand
+ Public ReadOnly Property InternalCommand() As ICommand
Get
- If m_cmdOk Is Nothing Then
- m_cmdOk = New Command(AddressOf Ok)
+ If m_cmdInternal Is Nothing Then
+ m_cmdInternal = New Command(AddressOf Internal)
End If
- Return m_cmdOk
+ Return m_cmdInternal
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
- Public Sub Ok(ByVal param As Object)
- ' se errore esco
- If Not m_bDrawOk Then
- Return
- End If
- ' Leggo numero di pezzi da inserire
- Dim InsNbr As Integer
- StringToInt(m_PartNum, InsNbr)
- ' Passo al contesto principale
- EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
- ' Inserisco il componente nel DB geometrico principale
- MakeInsert(InsNbr, m_PartName)
- ' Aggiorno ambiente principale
- EgtZoom(ZM.ALL)
- ' Chiudo la finestra Compo
- For WndIndex = 0 To Application.Current.Windows.Count - 1
- If TypeOf Application.Current.Windows(WndIndex) Is CompoWindowV Then
- Application.Current.Windows(WndIndex).Close()
- End If
- Next
+ Public Sub Internal(ByVal param As Object)
+ CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = Nothing
+ CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.LIST
+ ' Nascondo layer etichette e quotature
+ Dim Pz As Integer = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
+ EgtSetStatus(EgtGetFirstNameInGroup(Pz, "LayAux"), GDB_ST.OFF)
+ EgtSetStatus(EgtGetFirstNameInGroup(Pz, "Etichette"), GDB_ST.OFF)
+ EgtSetStatus(EgtGetFirstNameInGroup(Pz, "Quotature"), GDB_ST.OFF)
+ EgtDraw()
End Sub
-#End Region ' OkCommand
+#End Region ' InternalCommand
+
+#Region "AddCommand"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property AddCommand() As ICommand
+ Get
+ If m_cmdAdd Is Nothing Then
+ m_cmdAdd = New Command(AddressOf Add)
+ End If
+ Return m_cmdAdd
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub Add(ByVal param As Object)
+ ' Se componente errato, non faccio alcunché
+ If Not CompoWindowMap.refCompoWindowVM.m_bDrawOk Then Return
+ ' Recupero indice componente corrente
+ Dim nCmp As Integer = 0
+ If EgtLuaGetGlobIntVar(LUA_CMP_INDEX, nCmp) And nCmp > 0 Then
+ ' Nascondo eventuali etichette del componente
+ Dim nId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "HoleLabels")
+ While nId <> GDB_ID.NULL
+ Dim nCmpInfo As Integer = 0
+ If EgtGetInfo(nId, "ID", nCmpInfo) AndAlso nCmp = nCmpInfo Then
+ EgtSetStatus(nId, GDB_ST.OFF)
+ Exit While
+ End If
+ nId = EgtGetNextName(nId, "HoleLabels")
+ End While
+ End If
+ ' Esco dal componente interno
+ CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = Nothing
+ CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.LIST
+ ' Deseleziono oggetto corrente e aggiorno visualizzazione
+ EgtDeselectAll()
+ EgtDraw()
+ End Sub
+
+#End Region ' AddCommand
+
+#Region "CancelCommand"
+
+ ' Returns a command that manage the MainWindow_Unloaded command
+ Public ReadOnly Property CancelCommand() As ICommand
+ Get
+ If m_cmdCancel Is Nothing Then
+ m_cmdCancel = New Command(AddressOf Cancel)
+ End If
+ Return m_cmdCancel
+ End Get
+ End Property
+
+ ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
+ Public Sub Cancel(ByVal param As Object)
+ ' Cancello layer con contorno errato
+ Dim nId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "ErrorLay")
+ EgtErase(nId)
+ ' Se trovo componente corrente, lo cancello
+ Dim nCmp As Integer = 0
+ If EgtLuaGetGlobIntVar(LUA_CMP_INDEX, nCmp) And nCmp > 0 Then
+ Dim sCmp As String = nCmp.ToString()
+ ' Lancio cancellazione
+ If Not EgtLuaExecLine(LUA_REMOVEHOLE & "(" & nCmp & ")") Then
+ EgtOutLog("Error in RemoveHole execution")
+ Return
+ End If
+ ' altrimenti è errato ed è già stato cancellato, resetto errore di disegno
+ Else
+ CompoWindowMap.refCompoWindowVM.m_bDrawOk = True
+ End If
+ ' Esco dal componente interno
+ CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = Nothing
+ CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.LIST
+ ' Deseleziono oggetto corrente e aggiorno visualizzazione
+ EgtDeselectAll()
+ EgtDraw()
+ End Sub
+
+#End Region ' CancelCommand
#Region "BackCommand"
diff --git a/CompoWindow/CompoSceneHostV.xaml.vb b/CompoWindow/CompoSceneHostV.xaml.vb
index d2e3bfb..46fd301 100644
--- a/CompoWindow/CompoSceneHostV.xaml.vb
+++ b/CompoWindow/CompoSceneHostV.xaml.vb
@@ -3,6 +3,13 @@ Imports EgtWPFLib5
Public Class CompoSceneHostV
+ Private m_SelFromScene As Boolean = False
+ Friend ReadOnly Property SelFromScene As Boolean
+ Get
+ Return m_SelFromScene
+ End Get
+ End Property
+
Sub New()
' This call is required by the designer.
InitializeComponent()
@@ -84,4 +91,61 @@ Public Class CompoSceneHostV
EgtSetGridShow(bShowGrid, False)
End Sub
+#Region "EVENTS"
+
+ Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CompoScene.OnMouseDownScene
+ ' Si può selezionare solo con il tasto sinistro e se stato NULL
+ If e.Button <> Windows.Forms.MouseButtons.Left Or Not CompoScene.IsStatusNull() Then
+ Return
+ End If
+ ' Si può selezionare solo se non si sta già editando un componente
+ If CompoWindowMap.refCompoWindowVM.CompoPage <> CompoWindowVM.CompoPageOpt.LIST Or IsNothing(CompoWindowMap.refCompoWindowVM.m_SelCompoFamily) Then
+ Return
+ End If
+ ' Verifico se selezionato indicativo di componente (wall, door o window)
+ EgtSetObjFilterForSelWin(True, True, True, True, True)
+ Dim nSel As Integer
+ EgtSelect(e.Location, 2 * Scene.DIM_SEL, 2 * Scene.DIM_SEL, nSel)
+ Dim sCompo As String = String.Empty
+ Dim nId As Integer = EgtGetFirstObjInSelWin()
+ While nId <> GDB_ID.NULL
+ If EgtGetInfo(nId, CompoParamPageVM.INFO_CMP, sCompo) Then
+ Exit While
+ End If
+ nId = EgtGetNextObjInSelWin()
+ End While
+ If String.IsNullOrWhiteSpace(sCompo) Then Return
+ ' Attivo stato selezione da scena
+ m_SelFromScene = True
+ ' Salvo l'indice della superficie di selezione
+ Dim nSurfSelId As Integer = nId
+ ' Recupero l'indice del componente
+ Dim sName As String = String.Empty
+ If Not EgtGetName(nId, sName) Then Return
+ Dim nCmp As Integer = -1
+ If Not StringToInt(sName, nCmp) Then Return
+ CompoWindowMap.refCompoWindowVM.m_SelInternalCompo = CompoWindowMap.refCompoListPageVM.CompoList.First(Function(x) x.LuaPath = sCompo & ".lua")
+ CompoWindowMap.refCompoWindowVM.CompoPage = CompoWindowVM.CompoPageOpt.PARAM
+ CompoWindowMap.refCompoParamPageVM.ReadSelInternalVariables(nId)
+ ' Imposto l'indice del componente
+ If Not EgtLuaSetGlobIntVar(CompoParamPageVM.LUA_CMP_INDEX, nCmp) Then Return
+ ' Evidenzio la sua regione di selezione
+ EgtSelectObj(nSurfSelId)
+ ' Rendo visibili le eventuali etichette del componente
+ Dim nHLId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "HoleLabels")
+ While nHLId <> GDB_ID.NULL
+ Dim nCmpInfo As Integer = 0
+ If EgtGetInfo(nHLId, "ID", nCmpInfo) AndAlso nCmp = nCmpInfo Then
+ EgtSetStatus(nHLId, GDB_ST.ON_)
+ Exit While
+ End If
+ nHLId = EgtGetNextName(nHLId, "HoleLabels")
+ End While
+ CompoScene.ZoomAll()
+ ' Disattivo stato selezione da scena
+ m_SelFromScene = False
+ End Sub
+
+#End Region ' Events
+
End Class
diff --git a/CompoWindow/CompoWindowMap.vb b/CompoWindow/CompoWindowMap.vb
index 85c215f..015d7a3 100644
--- a/CompoWindow/CompoWindowMap.vb
+++ b/CompoWindow/CompoWindowMap.vb
@@ -4,6 +4,7 @@
Private m_refCompoSceneHostV As CompoSceneHostV
Private m_refCompoListPageVM As CompoListPageVM
Private m_refCompoParamPageVM As CompoParamPageVM
+ Private m_refCompoManagerVM As CompoManagerVM
#Region "Get"
@@ -31,6 +32,12 @@
End Get
End Property
+ Public ReadOnly Property refCompoManagerVM As CompoManagerVM
+ Get
+ Return m_refCompoManagerVM
+ End Get
+ End Property
+
#End Region ' Get
#Region "Set"
@@ -50,6 +57,11 @@
Return Not IsNothing(m_refCompoParamPageVM)
End Function
+ Friend Function SetRefCompoManagerVM(CompoManagerVM As CompoManagerVM) As Boolean
+ m_refCompoManagerVM = CompoManagerVM
+ Return Not IsNothing(m_refCompoManagerVM)
+ End Function
+
#End Region ' Set
#Region "Init"
@@ -58,10 +70,12 @@
m_refCompoWindowVM = CompoWindowVM
Return Not IsNothing(m_refCompoWindowVM)
End Function
+
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
Return Not IsNothing(m_refCompoWindowVM) AndAlso Not IsNothing(m_refCompoSceneHostV) AndAlso
- Not IsNothing(m_refCompoListPageVM) AndAlso Not IsNothing(m_refCompoParamPageVM)
+ Not IsNothing(m_refCompoListPageVM) AndAlso Not IsNothing(m_refCompoParamPageVM) AndAlso
+ Not IsNothing(m_refCompoManagerVM)
End Function
#End Region ' Init
diff --git a/CompoWindow/CompoWindowV.xaml.vb b/CompoWindow/CompoWindowV.xaml.vb
index 022203c..d6046a8 100644
--- a/CompoWindow/CompoWindowV.xaml.vb
+++ b/CompoWindow/CompoWindowV.xaml.vb
@@ -1,6 +1,6 @@
Public Class CompoWindowV
- Private m_CompoWindowVM As CompoWindowVM
+ Private WithEvents m_CompoWindowVM As CompoWindowVM
Sub New(Owner As Window, CompoWindowVM As CompoWindowVM)
MyBase.New(Owner)
@@ -11,13 +11,8 @@
m_CompoWindowVM = CompoWindowVM
End Sub
- 'Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
- ' 'm_CompoWindowVM.LoadFlatParts()
- ' DialogResult = True
- 'End Sub
-
- 'Private Sub Cancel_Click(sender As Object, e As RoutedEventArgs) Handles CancelBtn.Click
- ' DialogResult = False
- 'End Sub
+ Private Sub OkBtn_Click(bDialogResult As Boolean) Handles m_CompoWindowVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
End Class
diff --git a/CompoWindow/CompoWindowVM.vb b/CompoWindow/CompoWindowVM.vb
index 24cd05b..9ba288a 100644
--- a/CompoWindow/CompoWindowVM.vb
+++ b/CompoWindow/CompoWindowVM.vb
@@ -1,4 +1,5 @@
Imports EgtUILib
+Imports EgtWPFLib5
Public Class CompoWindowVM
Inherits VMBase
@@ -10,8 +11,24 @@ Public Class CompoWindowVM
PARAM
End Enum
+ Friend Const NUM_VAR As Integer = 10
+ Private Const LUA_CMP_VARS As String = "CMP"
+ Private Const LUA_CMP_DRAW As String = "CMP_Draw"
+ Private Const INFO_VAR As String = "Var"
+ Friend Const INFO_CMP As String = "CMP"
+ Private Const INFO_ID As String = "ID"
+ Friend Const LUA_CMP_INDEX As String = LUA_CMP_VARS & ".Ind"
+ Friend Const LUA_CMP_INTERNAL As String = LUA_CMP_VARS & ".Int"
+ Friend Const LUA_REMOVEHOLE As String = "RemoveHole"
+ Friend Const LUA_CMP_WITHINT As String = LUA_CMP_VARS & ".WithInt"
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
Friend m_SelCompoFamily As CompoItem = Nothing
Friend m_SelCompo As CompoItem = Nothing
+ Friend m_SelInternalCompo As CompoItem = Nothing
+
+ Private m_sCompoDir As String = String.Empty
+ Friend m_bDrawOk As Boolean = False
Private m_CompoPage As CompoPageOpt
Public Property CompoPage As CompoPageOpt
@@ -23,7 +40,7 @@ Public Class CompoWindowVM
If value = CompoPageOpt.LIST Then
CompoWindowMap.refCompoListPageVM.InitCompoListPage()
Else
- CompoWindowMap.refCompoParamPageVM.InitCompoListPage()
+ CompoWindowMap.refCompoParamPageVM.InitCompoParamPage()
End If
NotifyPropertyChanged("CompoPageControl")
End Set
@@ -41,12 +58,18 @@ Public Class CompoWindowVM
End Get
End Property
+ Private m_CompoManagerV As CompoManagerV
+ Public ReadOnly Property CompoManagerV As CompoManagerV
+ Get
+ Return m_CompoManagerV
+ End Get
+ End Property
#Region "Messages"
Public ReadOnly Property TitleMsg As String
Get
- Return EgtMsg(MSG_IMPORTPAGEUC + 13)
+ Return EgtMsg(MSG_DRAWPAGEUC + 5) ' Disegno Parametrico
End Get
End Property
@@ -65,15 +88,269 @@ Public Class CompoWindowVM
' Creo pagina CompoParam
m_CompoParamPageV = New CompoParamPageV
m_CompoParamPageV.DataContext = New CompoParamPageVM
+ ' creo pagina CompoManager
+ m_CompoManagerV = New CompoManagerV
+ m_CompoManagerV.DataContext = New CompoManagerVM
' Inizializzo e visualizzo per default la CompoListPage
CompoWindowMap.refCompoListPageVM.InitCompoListPage()
CompoPage = CompoPageOpt.LIST
+ ' Recupero path cartella che contiene i componenti
+ GetMainPrivateProfileString("Compo", "CompoDir", "", m_sCompoDir)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
+ Friend Function MakePreview(ByRef sMsg As String) As Boolean
+ If Not EgtLuaExecLine(LUA_CMP_DRAW & "(true)") Then
+ sMsg = "Error in component execution"
+ m_bDrawOk = False
+ Else
+ EgtLuaGetGlobStringVar(LUA_CMP_VARS & ".MSG", sMsg)
+ Dim nErr As Integer = 0
+ EgtLuaGetGlobIntVar(LUA_CMP_VARS & ".ERR", nErr)
+ m_bDrawOk = (nErr = 0)
+ End If
+ Return m_bDrawOk
+ End Function
+
+ Friend Function ExecCompoFile() As Boolean
+ Dim sPath As String = String.Empty
+ ' Verifico se componente interno o normale e costruisco path completa del componente
+ If IsNothing(m_SelInternalCompo) Then
+ sPath = m_sCompoDir & "\" & m_SelCompo.LuaPath
+ Else
+ sPath = m_sCompoDir & "\" & m_SelInternalCompo.LuaPath
+ End If
+ ' Carico il file
+ Return EgtLuaExecFile(sPath)
+ End Function
+
+ Friend Sub UpdateView()
+ ' verifico ci sia un componente corrente
+ If IsNothing(m_SelCompo) Then
+ Return
+ End If
+ ' aggiorno le variabili dalla griglia
+ CompoWindowMap.refCompoParamPageVM.UpdateVariables()
+ ' ricalcolo il disegno
+ Dim sMsg As String = String.Empty
+ MakePreview(sMsg)
+ CompoWindowMap.refCompoParamPageVM.SetOutputMessage(sMsg, If(m_bDrawOk, MSG_TYPE.INFO, MSG_TYPE.ERROR_))
+ ' aggiorno visualizzazione
+ EgtSetView(VT.TOP, False)
+ EgtZoom(ZM.ALL)
+ End Sub
+
+ Friend Function MakeInsert(nNbr As Integer, sName As String) As Boolean
+ ' ricarico componente corrente
+ ExecCompoFile()
+ ' aggiorno variabili
+ CompoWindowMap.refCompoParamPageVM.UpdateVariables()
+ ' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
+ Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
+ ' elimino eventuali precedenti pezzi vuoti
+ EgtEraseEmptyParts()
+ ' eseguo inserimento
+ For i As Integer = 1 To nNbr
+ ' Inserisco il componente
+ If Not EgtLuaExecLine(LUA_CMP_DRAW & "(false)") Then
+ Dim sErr As String = String.Empty
+ EgtLuaGetLastError(sErr)
+ EgtOutLog(sErr)
+ Exit For
+ End If
+ ' Ne recupero l'Id
+ Dim nId2 As Integer = EgtGetLastPart()
+ ' Ne recupero il layer OutLoop
+ Dim nOutLoopLayer As Integer = EgtGetFirstNameInGroup(nId2, NAME_OUTLOOP)
+ ' Calcolo dimensione ingombro OutLoop
+ Dim ptMin, ptMax As Point3d
+ EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, ptMin, ptMax)
+ Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
+ ' Ricavo nome layer con testi inclinazioni
+ Dim TextLayer As Integer = EgtGetFirstNameInGroup(nId2, SIDE_ANGLE_LAYER)
+ ' Se presente lo svuoto
+ If TextLayer <> GDB_ID.NULL Then
+ EgtEmptyGroup(TextLayer)
+ ' altrimenti lo creo
+ Else
+ TextLayer = EgtCreateGroup(nId2)
+ EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
+ End If
+ '' Modifico inclinazione lati
+ 'For Each Entity In m_SideAngle.m_SideAngleEntityList
+ ' Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
+ ' If Math.Abs(Entity.dSideAngle) > EPS_ANG_SMALL Then
+ ' ' Scrivo nuovo angolo nelle info
+ ' EgtSetInfo(nCurrEntityName, INFO_SIDE_ANGLE, Entity.dSideAngle)
+ ' ' Creo testo con angolo di inclinazione per nesting
+ ' Dim sText As String = DoubleToString(Entity.dSideAngle, 1) & "°"
+ ' SideAngleUC.AddTextToLine(sText, TextLayer, nCurrEntityName, 10, dBBoxRad, False)
+ ' Else
+ ' ' Cancello inclinazione nell'apposito campo info
+ ' EgtRemoveInfo(nCurrEntityName, INFO_SIDE_ANGLE)
+ ' End If
+ 'Next
+ '' Sistemo gocciolatoi
+ 'm_SideAngle.CreateDripGeom(nId2)
+ ' Muovo la regione in Z per evitare problemi in visualizzazione
+ Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
+ EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
+ ' Se definito nome lo inserisco nel testo
+ If Not String.IsNullOrWhiteSpace(sName) Then
+ Dim nTextId = EgtGetFirstInGroup(nRegId)
+ While nTextId <> GDB_ID.NULL
+ If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
+ Dim sText As String = String.Empty
+ EgtTextGetContent(nTextId, sText)
+ Dim sNewText = sName & " " & sText
+ EgtModifyText(nTextId, sNewText)
+ Exit While
+ End If
+ nTextId = EgtGetNext(nTextId)
+ End While
+ End If
+ ' Eventuale testo per indicare il sopra (solo nel caso di rettangolo)
+ If CompoWindowMap.refCompoManagerVM.TopIsChecked Then
+ Dim dDimX As Double = ptMax.x - ptMin.x
+ Dim dDimY As Double = ptMax.y - ptMin.y
+ Dim dH As Double = Math.Min(0.15 * dDimY, 30)
+ Dim nText As Integer = EgtCreateTextAdv(nRegId, New Point3d(dDimX / 2, dDimY - dH, 0), 0, "*TOP*", "", 500, False, dH, 1, 0, INS_POS.MC)
+ EgtSetColor(nText, New Color3d())
+ End If
+ ' Aggiusto per lavorazioni
+ AdjustFlatPart(nId2)
+ ' Inserisco in parcheggio
+ EstCalc.StoreOnePart(nId2, True)
+ ' Se richiesto posizionamento diretto, lo eseguo
+ If bDirect Then
+ If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
+ ' Eventuale notifica al VeinMatching
+ VeinMatching.OnInsertPartInRaw(nId2)
+ End If
+ End If
+ Next
+ Return True
+ End Function
+
+ Friend Function MakeCompoInsert(ByVal nNbr As Integer, sName As String) As Boolean
+ ' Passo al contesto corrente
+ EgtSetCurrentContext(CompoWindowMap.refCompoSceneHostV.CompoScene.GetCtx())
+ ' Cancello layer regioni per selezione buchi
+ Dim Pz As Integer = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
+ Dim SelectRegion As Integer = EgtGetFirstNameInGroup(Pz, "SelectRegion")
+ EgtErase(SelectRegion)
+ ' Cancello layer etichette, quotatura,ausiliario e box
+ EgtErase(EgtGetFirstNameInGroup(Pz, "LayAux"))
+ EgtErase(EgtGetFirstNameInGroup(Pz, "Etichette"))
+ EgtErase(EgtGetFirstNameInGroup(Pz, "Quotature"))
+ EgtErase(EgtGetFirstNameInGroup(Pz, "Box"))
+ ' Cancello layer etichette dei componenti interni (buchi)
+ Dim nHLId As Integer = EgtGetFirstNameInGroup(Pz, "HoleLabels")
+ While nHLId <> GDB_ID.NULL
+ EgtErase(nHLId)
+ nHLId = EgtGetFirstNameInGroup(Pz, "HoleLabels")
+ End While
+ ' Attivo visualizzazione misura
+ Dim nRegLayId As Integer = EgtGetFirstNameInGroup(Pz, NAME_REGION)
+ Dim nId As Integer = EgtGetFirstInGroup(nRegLayId)
+ While nId <> GDB_ID.NULL
+ If EgtGetType(nId) = GDB_TY.EXT_TEXT Then
+ EgtSetStatus(nId, GDB_ST.ON_)
+ End If
+ nId = EgtGetNext(nId)
+ End While
+ ' Layer OutLoop
+ Dim nOutLoopLayer = EgtGetFirstNameInGroup(Pz, NAME_OUTLOOP)
+ ' Calcolo dimensione ingombro OutLoop
+ Dim ptMin, ptMax As Point3d
+ EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, ptMin, ptMax)
+ Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
+ ' Ricavo nome layer con testi inclinazioni
+ Dim TextLayer As Integer = EgtGetFirstNameInGroup(Pz, SIDE_ANGLE_LAYER)
+ ' Se presente lo svuoto
+ If TextLayer <> GDB_ID.NULL Then
+ EgtEmptyGroup(TextLayer)
+ ' altrimenti lo creo
+ Else
+ TextLayer = EgtCreateGroup(Pz)
+ EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
+ End If
+ '' Modifico inclinazione lati
+ 'For Each Entity In m_SideAngle.m_SideAngleEntityList
+ ' Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
+ ' If Math.Abs(Entity.dSideAngle) > EPS_ANG_SMALL Then
+ ' ' Scrivo nuovo angolo nelle info
+ ' EgtSetInfo(nCurrEntityName, INFO_SIDE_ANGLE, Entity.dSideAngle)
+ ' ' Creo testo con angolo di inclinazione per nesting
+ ' Dim sText As String = DoubleToString(Entity.dSideAngle, 1) & "°"
+ ' SideAngleUC.AddTextToLine(sText, TextLayer, nCurrEntityName, 10, dBBoxRad, False)
+ ' Else
+ ' ' Cancello inclinazione nell'apposito campo info
+ ' EgtRemoveInfo(nCurrEntityName, INFO_SIDE_ANGLE)
+ ' End If
+ 'Next
+ ' Esporto il pezzo in un file temporaneo
+ Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPartCompo.Nge"
+ If Not EgtSaveObjToFile(1, sTmpFile, NGE.BIN) Then
+ Return False
+ End If
+ ' Passo al contesto principale
+ EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
+ ' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
+ Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
+ ' Elimino eventuali precedenti pezzi vuoti
+ EgtEraseEmptyParts()
+ If My.Computer.FileSystem.FileExists(sTmpFile) Then
+ ' eseguo inserimento
+ For i As Integer = 1 To nNbr
+ ' Inserisco il pezzo
+ EgtInsertFile(sTmpFile)
+ ' Ne recupero l'Id
+ Dim nId2 As Integer = EgtGetLastPart()
+ ' Muovo la regione in Z per evitare problemi in visualizzazione
+ Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
+ EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
+ ' Se definito nome lo inserisco nel testo
+ If Not String.IsNullOrWhiteSpace(sName) Then
+ Dim nTextId = EgtGetFirstInGroup(nRegId)
+ While nTextId <> GDB_ID.NULL
+ If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
+ Dim sText As String = String.Empty
+ EgtTextGetContent(nTextId, sText)
+ Dim sNewText = sName & " " & sText
+ EgtModifyText(nTextId, sNewText)
+ Exit While
+ End If
+ nTextId = EgtGetNext(nTextId)
+ End While
+ End If
+ ' Aggiusto per lavorazioni
+ AdjustFlatPart(nId2)
+ ' Inserisco in parcheggio
+ EstCalc.StoreOnePart(nId2, True)
+ ' Se richiesto posizionamento diretto, lo eseguo
+ If bDirect Then
+ If EstCalc.InsertOnePart(nId2, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
+ ' Eventuale notifica al VeinMatching
+ VeinMatching.OnInsertPartInRaw(nId2)
+ End If
+ End If
+ Next
+ ' Cancello il file
+ My.Computer.FileSystem.DeleteFile(sTmpFile)
+ End If
+ ' Aggiorno ambiente principale
+ EgtZoom(ZM.ALL)
+ Return True
+ End Function
+
+ Friend Sub Close(bDialogResult As Boolean)
+ RaiseEvent m_CloseWindow(bDialogResult)
+ End Sub
+
#End Region ' METHODS
End Class
diff --git a/CsvWindow/CsvWindowV.xaml b/CsvWindow/CsvWindowV.xaml
new file mode 100644
index 0000000..e477eb8
--- /dev/null
+++ b/CsvWindow/CsvWindowV.xaml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/CsvWindow/CsvWindowV.xaml.vb b/CsvWindow/CsvWindowV.xaml.vb
new file mode 100644
index 0000000..76b0561
--- /dev/null
+++ b/CsvWindow/CsvWindowV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class CsvWindowV
+
+End Class
diff --git a/CsvWindow/CsvWindowVM.vb b/CsvWindow/CsvWindowVM.vb
new file mode 100644
index 0000000..6a9abb5
--- /dev/null
+++ b/CsvWindow/CsvWindowVM.vb
@@ -0,0 +1,3 @@
+Public Class CsvWindowVM
+
+End Class
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index e8288b8..d0382fd 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -69,5 +69,5 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/OmagOFFICE.vbproj b/OmagOFFICE.vbproj
index 6296ecd..7f0e802 100644
--- a/OmagOFFICE.vbproj
+++ b/OmagOFFICE.vbproj
@@ -135,6 +135,10 @@
CompoListPageV.xaml
+
+ CompoManagerV.xaml
+
+ CompoParamPageV.xaml
@@ -150,6 +154,10 @@
+
+ CsvWindowV.xaml
+
+ DxfImportWindowV.xaml
@@ -247,6 +255,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
@@ -259,6 +271,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb
index d29be7f..4448763 100644
--- a/OptionPanel/NestingTab/NestingTabVM.vb
+++ b/OptionPanel/NestingTab/NestingTabVM.vb
@@ -237,7 +237,6 @@ Public Class NestingTabVM
Public Sub Draw(ByVal param As Object)
Dim CompoWindow As New CompoWindowV(Application.Current.MainWindow, New CompoWindowVM)
CompoWindow.ShowDialog()
-
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())
End Sub