SarmaxWall 1.6i6 :
- prima versione con generazione completata.
This commit is contained in:
+26
-7
@@ -13,9 +13,9 @@
|
||||
|
||||
Module ConstGen
|
||||
|
||||
' File con direttorio radice dei dati
|
||||
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
|
||||
Public Const S_DATA As String = "Data"
|
||||
' File con direttorio radice dei dati
|
||||
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
|
||||
Public Const S_DATA As String = "Data"
|
||||
Public Const K_DATAROOT As String = "DataRoot"
|
||||
|
||||
' File con dati di licenza
|
||||
@@ -29,10 +29,29 @@ Public Const S_DATA As String = "Data"
|
||||
' File di log dei comandi
|
||||
Public Const CMDLOG_FILE_NAME As String = "SarmaxWallLog.tua"
|
||||
|
||||
' Sottodirettorio di configurazione
|
||||
Public Const CONF_DIR As String = "Config"
|
||||
' Sottodirettorio di configurazione
|
||||
Public Const CONF_DIR As String = "Config"
|
||||
|
||||
' Sottodirettorio temporaneo
|
||||
Public Const TEMP_DIR As String = "Temp"
|
||||
' Sottodirettorio temporaneo
|
||||
Public Const TEMP_DIR As String = "Temp"
|
||||
|
||||
' Sottodirettorio di salvataggio progetti
|
||||
Public Const DATA_DIR As String = "Data"
|
||||
|
||||
' Nome gruppo identificativo della macchina
|
||||
Public Const NAME_MACHINE As String = "Machine"
|
||||
|
||||
' Nome sottogruppo identificativo della tavola
|
||||
Public Const NAME_TABLE As String = "Table"
|
||||
|
||||
' Chiavi info per dimensioni tavola
|
||||
Public Const KEY_TABLENGTH As String = "L"
|
||||
Public Const KEY_TABWIDTH As String = "W"
|
||||
|
||||
' Nome gruppo identificativo di progetto SarmaxWall
|
||||
Public Const NAME_PROJMARK As String = "SarmaxWall"
|
||||
|
||||
' Nome info di modificato nel gruppo precedente quando salvo corrente in uscita
|
||||
Public Const INFO_MODIF As String = "Modif"
|
||||
|
||||
End Module
|
||||
|
||||
+9
-19
@@ -18,17 +18,12 @@ Module ConstIni
|
||||
Public Const S_GENERAL As String = "General"
|
||||
Public Const K_DEBUG As String = "Debug"
|
||||
Public Const K_LICENCE As String = "Licence"
|
||||
Public Const K_USERLEVEL As String = "UserLevel"
|
||||
Public Const K_MAXINST As String = "MaxInstances"
|
||||
Public Const K_INSTANCES As String = "Instances"
|
||||
Public Const K_COMMANDLOG As String = "CommandLog"
|
||||
Public Const K_MESSAGES As String = "Messages"
|
||||
Public Const K_WINPLACE As String = "WinPlace"
|
||||
Public Const K_LASTNGEDIR As String = "LastNgeDir"
|
||||
Public Const K_LASTNGEOBJDIR As String = "LastNgeObjDir"
|
||||
Public Const K_LASTLUADIR As String = "LastLuaDir"
|
||||
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
||||
Public Const K_LASTEXPDIR As String = "LastExpDir"
|
||||
Public Const K_MAXPROJ As String = "MaxProj"
|
||||
Public Const K_LASTPROJ As String = "LastProj"
|
||||
Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
||||
|
||||
Public Const S_LUA As String = "Lua"
|
||||
Public Const K_LIBSDIR As String = "LibsDir"
|
||||
@@ -38,7 +33,6 @@ Module ConstIni
|
||||
Public Const K_DEFAULTFONT As String = "DefaultFont"
|
||||
Public Const K_NFEFONTDIR As String = "NfeFontDir"
|
||||
Public Const K_DEFAULTCOLOR As String = "DefaultColor"
|
||||
Public Const K_SAVETYPE As String = "SaveType"
|
||||
|
||||
Public Const S_OPENGL As String = "OpenGL"
|
||||
Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
|
||||
@@ -49,15 +43,11 @@ Module ConstIni
|
||||
Public Const S_SCENE As String = "Scene"
|
||||
Public Const K_BACKTOP As String = "BackTop"
|
||||
Public Const K_BACKBOTTOM As String = "BackBottom"
|
||||
Public Const K_SHOWGFRAME As String = "ShowGFrame"
|
||||
Public Const K_MARK As String = "Mark"
|
||||
Public Const K_SELSURF As String = "SelSurf"
|
||||
Public Const K_SHOWMODE As String = "ShowMode"
|
||||
Public Const K_CURVEDIR As String = "CurveDir"
|
||||
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
|
||||
Public Const K_ZOOMWIN As String = "ZoomWin"
|
||||
Public Const K_DISTLINE As String = "DistLine"
|
||||
Public Const K_MMUNITS As String = "MmUnits"
|
||||
|
||||
Public Const S_GRID As String = "Grid"
|
||||
Public Const K_SHOWGRID As String = "ShowGrid"
|
||||
@@ -70,23 +60,23 @@ Module ConstIni
|
||||
Public Const K_MINLNCOLOR As String = "MinLnColor"
|
||||
Public Const K_MAJLNCOLOR As String = "MajLnColor"
|
||||
|
||||
Public Const S_TABSPECIAL As String = "TabSpecial"
|
||||
Public Const K_TSSHOW As String = "Show"
|
||||
|
||||
Public Const S_COMPO As String = "Compo"
|
||||
Public Const K_CMPWINPLACE As String = "WinPlace"
|
||||
Public Const K_COMPODIR As String = "CompoDir"
|
||||
|
||||
Public Const S_FLATPARTS As String = "FlatParts"
|
||||
Public Const K_FLPWINPLACE As String = "WinPlace"
|
||||
Public Const K_FLPCURRDIR As String = "CurrDir"
|
||||
|
||||
Public Const S_FILEOPEN As String = "FileOpen"
|
||||
Public Const K_LASTNGEDIR As String = "LastNgeDir"
|
||||
|
||||
Public Const S_MACHINE As String = "Machine"
|
||||
Public Const K_MACHFILE As String = "File"
|
||||
Public Const K_GEOMETRY As String = "Geometry"
|
||||
Public Const K_PROCESSOR As String = "Processor"
|
||||
Public Const K_OFFSETX As String = "OffsetX"
|
||||
Public Const K_OFFSETY As String = "OffsetY"
|
||||
Public Const K_MINDIST As String = "MinDist"
|
||||
Public Const K_STEP As String = "Step"
|
||||
Public Const K_LAYERTHICK As String = "LayerThickness"
|
||||
|
||||
Public Const S_MRUFILES As String = "MruFiles"
|
||||
Public Const S_MRUSCRIPTS As String = "MruScripts"
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@
|
||||
Public Const MSG_DRAWPAGEUC As Integer = 101200
|
||||
Public Const MSG_PLACEPAGEUC As Integer = 101300
|
||||
Public Const MSG_OPTIONSPAGEUC As Integer = 101400
|
||||
Public Const MSG_MISSINGKEYWD As Integer = 101500
|
||||
Public Const MSG_OPENPAGEUC As Integer = 101500
|
||||
Public Const MSG_MISSINGKEYWD As Integer = 101600
|
||||
|
||||
End Module
|
||||
|
||||
+2
-1
@@ -565,7 +565,8 @@ Public Class DrawPageUC
|
||||
Return
|
||||
End If
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
EgtZoom(ZM.ALL, False)
|
||||
m_MainWindow.m_PlacePageUC.MyDraw()
|
||||
' Istruzioni per chiudere DrawPageUC e aprire PlacePage UC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PlacePageUC)
|
||||
|
||||
@@ -306,7 +306,8 @@ Public Class ImportPageUC
|
||||
End If
|
||||
Next
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
EgtZoom(ZM.ALL, False)
|
||||
m_MainWindow.m_PlacePageUC.MyDraw()
|
||||
'Istruzioni per chiudere ImportPageUC e aprire PlacePage UC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_ImportPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PlacePageUC)
|
||||
|
||||
+58
-1
@@ -1,4 +1,5 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Threading
|
||||
Imports System.Windows.Threading
|
||||
Imports EgtUILib
|
||||
|
||||
@@ -13,10 +14,13 @@ Class MainWindow
|
||||
Friend m_NumericKeyboardWD As NumericKeyboardWD
|
||||
Friend m_AboutBoxWD As AboutBoxWD
|
||||
|
||||
Private m_objMutex As New Mutex
|
||||
|
||||
'Dichiarazione variabili direttori
|
||||
Private m_sDataRoot As String = String.Empty
|
||||
Private m_sConfigDir As String = String.Empty
|
||||
Private m_sTempDir As String = String.Empty
|
||||
Private m_sDataDir As String = String.Empty
|
||||
Private Shared m_sIniFile As String = String.Empty
|
||||
Private m_nDebug As Integer = 0
|
||||
|
||||
@@ -46,8 +50,13 @@ Class MainWindow
|
||||
Return m_sTempDir
|
||||
End Function
|
||||
|
||||
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs)
|
||||
Public Function GetDataDir() As String
|
||||
Return m_sDataDir
|
||||
End Function
|
||||
|
||||
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs)
|
||||
' Verifico sia l'unica istanza
|
||||
ManageSingleIstance()
|
||||
' Impostazione path radice per i dati
|
||||
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory.Substring(0, System.AppDomain.CurrentDomain.BaseDirectory.Length - 1)
|
||||
If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
|
||||
@@ -57,6 +66,8 @@ Class MainWindow
|
||||
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
|
||||
' Impostazione direttorio per file temporanei
|
||||
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
|
||||
' Impostazione direttorio per file di dati
|
||||
m_sDataDir = m_sDataRoot & "\" & DATA_DIR
|
||||
' Impostazione path Ini file
|
||||
m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
|
||||
' Leggo e imposto chiave di protezione
|
||||
@@ -146,6 +157,41 @@ Class MainWindow
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub ManageSingleIstance()
|
||||
Dim bCreated As Boolean
|
||||
Try
|
||||
m_objMutex = New Mutex(False, "Global\SarmaxWall", bCreated)
|
||||
Catch
|
||||
bCreated = False
|
||||
End Try
|
||||
If Not bCreated Then
|
||||
' porto in primo piano la prima istanza
|
||||
Dim bFound As Boolean = False
|
||||
' processi del programma a 32 bit
|
||||
Dim localProc As Process() = Process.GetProcessesByName("SarmaxWallR32")
|
||||
For Each p As Process In localProc
|
||||
If p.Id <> Process.GetCurrentProcess().Id Then
|
||||
bFound = True
|
||||
ShowWindow(p.MainWindowHandle, 1)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' se non trovati processi a 32 bit provo a 64 bit
|
||||
If Not bFound Then
|
||||
localProc = Process.GetProcessesByName("SarmaxWallR64")
|
||||
For Each p As Process In localProc
|
||||
If p.Id <> Process.GetCurrentProcess().Id Then
|
||||
bFound = True
|
||||
ShowWindow(p.MainWindowHandle, SW.RESTORE)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
' esco dal programma
|
||||
End
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
|
||||
'Assegno NumericKeyboardWD e AboutBoxWD come child della MainWindow
|
||||
@@ -290,6 +336,17 @@ Class MainWindow
|
||||
End Sub
|
||||
|
||||
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs)
|
||||
' Recupero flag di modificato, per salvarlo nel progetto
|
||||
Dim bModif As Boolean = EgtGetModified()
|
||||
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
|
||||
EgtSetInfo(nMarkId, INFO_MODIF, IIf(bModif, 1, 0))
|
||||
' Salvo il progetto corrente
|
||||
Dim sPath As String = GetDataDir() & "\0000.nge"
|
||||
If Not EgtSaveFile(sPath, NGE.CMPTEXT) Then
|
||||
Dim sOut As String = "Error saving file " & sPath
|
||||
EgtOutLog(sOut)
|
||||
End If
|
||||
' Chiudo tutto
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -60,5 +60,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.6.9.5")>
|
||||
<Assembly: AssemblyFileVersion("1.6.9.5")>
|
||||
<Assembly: AssemblyVersion("1.6.9.6")>
|
||||
<Assembly: AssemblyFileVersion("1.6.9.6")>
|
||||
|
||||
+6
-1
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="704" d:DesignWidth="1024" Initialized="OpenPage_Initialized" Loaded="OpenPage_Loaded">
|
||||
d:DesignHeight="704" d:DesignWidth="1024" Initialized="OpenPage_Initialized" Loaded="OpenPage_Loaded" Unloaded="OpenPage_Unloaded">
|
||||
|
||||
<!-- Chiamata al Dictionary -->
|
||||
<UserControl.Resources>
|
||||
@@ -27,6 +27,11 @@
|
||||
<ListBox Name="FileListBox" Grid.Row="1" ItemTemplate="{DynamicResource DataTemplateItem}"
|
||||
ItemsSource="{Binding ItemList}"/>
|
||||
|
||||
<Border Name="MessageBrd" Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||
<TextBlock Name="MessageTxBx" FontSize="15" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
<!-- Definizione della Grid Inferiore per i Button V e X -->
|
||||
<Grid Name="BottomButtonsGrid" Grid.Column="1" Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
+32
-9
@@ -12,8 +12,8 @@ Public Class OpenPageUC
|
||||
' Properties
|
||||
Private m_sCurrDir As String = String.Empty
|
||||
Private m_sCurrFile As String = String.Empty
|
||||
Private m_nFileType As Integer = FT.NULL
|
||||
Private m_bFirst As Boolean = True
|
||||
Private m_bFileOk As Boolean = False
|
||||
|
||||
'Dichiarazione Scene
|
||||
Friend WithEvents OpenScene As New Scene
|
||||
@@ -81,7 +81,7 @@ Public Class OpenPageUC
|
||||
' Imposto griglia
|
||||
LoadGridData()
|
||||
' leggo direttorio corrente
|
||||
GetPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, "", m_sCurrDir, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_FILEOPEN, K_LASTNGEDIR, "", m_sCurrDir, m_MainWindow.GetIniFile())
|
||||
' lo carico
|
||||
LoadCurrDir()
|
||||
m_bFirst = False
|
||||
@@ -213,6 +213,10 @@ Public Class OpenPageUC
|
||||
EgtNewFile()
|
||||
' Eseguo zoom
|
||||
OpenScene.ZoomAll()
|
||||
' Cancello messaggio
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.White
|
||||
OkBtn.IsEnabled = False
|
||||
Return True
|
||||
End Function
|
||||
|
||||
@@ -222,15 +226,26 @@ Public Class OpenPageUC
|
||||
' Costruisco path completa del componente
|
||||
Dim sPath = IO.Path.Combine(m_sCurrDir, m_sCurrFile)
|
||||
' Riconoscimento tipo
|
||||
m_nFileType = EgtGetFileType(sPath)
|
||||
If m_nFileType = FT.NGE Then
|
||||
' Carico Btl
|
||||
Dim nFileType As Integer = EgtGetFileType(sPath)
|
||||
If nFileType = FT.NGE Then
|
||||
' Carico Nge
|
||||
bOk = bOk AndAlso EgtOpenFile(sPath)
|
||||
Else
|
||||
' Formato sconosciuto
|
||||
EgtNewFile()
|
||||
bOk = False
|
||||
End If
|
||||
' Cerco contrassegno di progetto SarmaxWall
|
||||
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
|
||||
m_bFileOk = bOk And (nMarkId <> GDB_ID.NULL)
|
||||
If m_bFileOk Then
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.White
|
||||
OkBtn.IsEnabled = True
|
||||
Else
|
||||
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
|
||||
MessageBrd.Background = Brushes.Tomato
|
||||
OkBtn.IsEnabled = False
|
||||
End If
|
||||
' Eseguo zoom
|
||||
OpenScene.ZoomAll()
|
||||
Return bOk
|
||||
@@ -240,14 +255,21 @@ Public Class OpenPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub ConfirmBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
' Verifico che il file corrente sia valido
|
||||
If Not m_bFileOk Then
|
||||
Return
|
||||
End If
|
||||
' Passo al contesto principale
|
||||
EgtSetCurrentContext(m_MainWindow.m_PlacePageUC.PlaceScene.GetCtx())
|
||||
' Costruisco path completa del componente
|
||||
Dim sPath = IO.Path.Combine(m_sCurrDir, m_sCurrFile)
|
||||
' Apro il progetto
|
||||
EgtOpenFile(sPath)
|
||||
' Dichiaro progetto modificato
|
||||
EgtSetModified()
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
EgtZoom(ZM.ALL, False)
|
||||
m_MainWindow.m_PlacePageUC.MyDraw()
|
||||
'Istruzioni per chiudere ImportPageUC e aprire PlacePage UC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OpenPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PlacePageUC)
|
||||
@@ -265,9 +287,10 @@ Public Class OpenPageUC
|
||||
m_MainWindow.PlaceBtn.IsChecked = True
|
||||
End Sub
|
||||
|
||||
Private Sub ImportPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
Private Sub OpenPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
' Salvo direttorio corrente
|
||||
'WritePrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, m_sCurrDir, m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_FILEOPEN, K_LASTNGEDIR, m_sCurrDir, m_MainWindow.GetIniFile())
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
+16
-11
@@ -68,15 +68,15 @@
|
||||
<Image Source="Resources/CounterClockwiseRotate.png" Width="64" Height="65" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Button>
|
||||
<Button Name="RotateClockwiseBtn" Grid.Column="1" Grid.Row="4" >
|
||||
<Button Name="RotateHalfTurnBtn" Grid.Column="1" Grid.Row="4" >
|
||||
<Image Source="Resources/HalfTurnRotate.png" Width="65" Height="65" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Button>
|
||||
<Button Name="RotateClockwiseBtn" Grid.Column="2" Grid.Row="4" >
|
||||
<Image Source="Resources/ClockwiseRotate.png" Width="65" Height="65" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Button>
|
||||
<Button Name="RotateHalfTurnBtn" Grid.Column="2" Grid.Row="4" >
|
||||
<Image Source="Resources/HalfTurnRotate.png" Width="65" Height="65" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Button>
|
||||
|
||||
|
||||
<UniformGrid Grid.Column="0" Grid.Row="6" Grid.ColumnSpan="3" Columns="2" >
|
||||
<Button Name="InsertWallBtn" FontSize="15" >
|
||||
<TextBlock Name="InsertWallTxt" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
@@ -99,7 +99,13 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Definizione della Grid Inferiore per i Button Genera e Trasmetti -->
|
||||
<Border Name="MessageBrd" Grid.Row="1" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||
<TextBlock Name="MessageTxBx" FontSize="15" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
|
||||
<!-- Definizione della Grid Inferiore per i Button Genera e Trasmetti -->
|
||||
<Grid Name="BottomButtonsGrid" Grid.Column="2" Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
@@ -107,12 +113,11 @@
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="SaveBtn" Grid.Column="1" Content="Salva" FontSize="15" />
|
||||
<Button Name="GenerateBtn" Grid.Column="2" FontSize="15" />
|
||||
<Button Name="GenerateBtn" Grid.Column="2" FontSize="15" />
|
||||
<Button Name="SendBtn" Grid.Column="3" FontSize="15" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
+169
-30
@@ -10,7 +10,6 @@ Public Class PlacePageUC
|
||||
|
||||
' Properties
|
||||
Private m_bFirst As Boolean = True
|
||||
Private m_bMaximizeMove As Boolean = False
|
||||
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents PlaceScene As New Scene
|
||||
@@ -24,6 +23,10 @@ Public Class PlacePageUC
|
||||
OUT_TABLE = 1
|
||||
End Enum
|
||||
|
||||
' Dati per Drag
|
||||
Private m_bDrag As Boolean = False
|
||||
Private m_ptPrev As Point3d
|
||||
|
||||
' Dati macchina
|
||||
Friend m_dLength As Double = 0
|
||||
Friend m_dWidth As Double = 0
|
||||
@@ -35,7 +38,10 @@ Public Class PlacePageUC
|
||||
' Dati movimento
|
||||
Friend m_dStep As Double = 0
|
||||
Friend m_dMaxStep As Double = 0
|
||||
Private m_bMaximizeMove As Boolean = False
|
||||
|
||||
' Spessore layer (strato)
|
||||
Private m_dLayerThick As Double = 0
|
||||
|
||||
Private Sub PlacePage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -112,17 +118,29 @@ Public Class PlacePageUC
|
||||
m_MainWindow.Close()
|
||||
m_MissingKeyWindow.Show()
|
||||
End If
|
||||
' carico la macchina
|
||||
If Not LoadMachine() Then
|
||||
EgtOutLog("Error loading machine")
|
||||
' Se richiesto, carico l'ultimo progetto
|
||||
Dim nAutoLoad As Integer = GetPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0, m_MainWindow.GetIniFile())
|
||||
If nAutoLoad <> 0 Then
|
||||
If Not LoadLastProject() Then
|
||||
EgtOutLog("Error loading last project")
|
||||
End If
|
||||
End If
|
||||
' Carico la macchina
|
||||
EgtDisableModified()
|
||||
If Not LoadMachine() Then
|
||||
EgtOutLog("Error loading machine")
|
||||
End If
|
||||
EgtEnableModified()
|
||||
' carico i parametri di posizionamento
|
||||
m_dOffsetX = GetPrivateProfileDouble(S_MACHINE, K_OFFSETX, 0, m_MainWindow.GetIniFile())
|
||||
m_dOffsetY = GetPrivateProfileDouble(S_MACHINE, K_OFFSETY, 0, m_MainWindow.GetIniFile())
|
||||
m_dMinDist = GetPrivateProfileDouble(S_MACHINE, K_MINDIST, 0, m_MainWindow.GetIniFile())
|
||||
' carico e calcolo i parametri di movimento
|
||||
m_dStep = GetPrivateProfileDouble(S_MACHINE, K_STEP, 0, m_MainWindow.GetIniFile())
|
||||
' determino lo step massimo
|
||||
m_dMaxStep = Math.Max(m_dLength - m_dOffsetX, m_dWidth - m_dOffsetY)
|
||||
' carico lo spessore dei layer e lo visualizzo
|
||||
m_dLayerThick = GetPrivateProfileDouble(S_MACHINE, K_LAYERTHICK, 0, m_MainWindow.GetIniFile())
|
||||
LayerThicknessTxBx.Text = m_dLayerThick
|
||||
' carico la griglia
|
||||
LoadGridData()
|
||||
m_bFirst = False
|
||||
@@ -142,16 +160,45 @@ Public Class PlacePageUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function LoadLastProject() As Boolean
|
||||
' Carico l'ultimo progetto
|
||||
Dim sPath As String = m_MainWindow.GetDataDir() & "\0000.nge"
|
||||
If Not EgtOpenFile(sPath) Then
|
||||
Return False
|
||||
End If
|
||||
' Recupero il contrassegno
|
||||
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
|
||||
If nMarkId = GDB_ID.NULL Then
|
||||
EgtNewFile()
|
||||
EgtResetModified()
|
||||
Return False
|
||||
End If
|
||||
' Leggo lo stato di modificato
|
||||
Dim nModif As Integer = 1
|
||||
EgtGetInfo(nMarkId, INFO_MODIF, nModif)
|
||||
' Cancello macchina e contrassegno
|
||||
Dim nMachineId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_MACHINE)
|
||||
EgtErase(nMachineId)
|
||||
EgtErase(nMarkId)
|
||||
' Imposto lo stato originale di modificato
|
||||
If nModif <> 0 Then
|
||||
EgtSetModified()
|
||||
Else
|
||||
EgtResetModified()
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function LoadMachine() As Boolean
|
||||
' Recupero path del file macchina
|
||||
Dim sMachFile As String = String.Empty
|
||||
GetPrivateProfileString(S_MACHINE, K_MACHFILE, "", sMachFile, m_MainWindow.GetIniFile())
|
||||
GetPrivateProfileString(S_MACHINE, K_GEOMETRY, "", sMachFile, m_MainWindow.GetIniFile())
|
||||
' Carico la macchina
|
||||
If Not EgtOpenFile(sMachFile) Then
|
||||
If Not EgtInsertFile(sMachFile) Then
|
||||
Return False
|
||||
End If
|
||||
' Recupero la macchina e la imposto a livello System
|
||||
Dim nMachineId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, "Machine")
|
||||
Dim nMachineId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_MACHINE)
|
||||
If nMachineId = GDB_ID.NULL Or EgtGetType(nMachineId) <> GDB_TY.GROUP Then
|
||||
Return False
|
||||
End If
|
||||
@@ -159,14 +206,17 @@ Public Class PlacePageUC
|
||||
' Eseguo zoom all
|
||||
EgtZoom(ZM.ALL)
|
||||
' Recupero la tavola
|
||||
Dim nTableId As Integer = EgtGetFirstNameInGroup(nMachineId, "Table")
|
||||
Dim nTableId As Integer = EgtGetFirstNameInGroup(nMachineId, NAME_TABLE)
|
||||
If nTableId = GDB_ID.NULL Or EgtGetType(nMachineId) <> GDB_TY.GROUP Then
|
||||
Return False
|
||||
End If
|
||||
' Recupero dimensioni tavola
|
||||
EgtGetInfo(nTableId, "L", m_dLength)
|
||||
EgtGetInfo(nTableId, "W", m_dWidth)
|
||||
|
||||
EgtGetInfo(nTableId, KEY_TABLENGTH, m_dLength)
|
||||
EgtGetInfo(nTableId, KEY_TABWIDTH, m_dWidth)
|
||||
' Inserisco contrassegno di progetto SarmaxWall valido
|
||||
Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT)
|
||||
EgtSetName(nMarkId, NAME_PROJMARK)
|
||||
EgtSetLevel(nMarkId, GDB_LV.SYSTEM)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
@@ -188,6 +238,14 @@ Public Class PlacePageUC
|
||||
EgtSetGridShow(bShowGrid, False)
|
||||
End Sub
|
||||
|
||||
Friend Sub MyDraw()
|
||||
EgtDraw()
|
||||
If EgtGetModified() Then
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.White
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PlaceScene.OnMouseDownScene
|
||||
' Si può selezionare solo con il tasto sinistro e se stato NULL
|
||||
If e.Button <> Windows.Forms.MouseButtons.Left Or Not PlaceScene.IsStatusNull() Then
|
||||
@@ -220,11 +278,35 @@ Public Class PlacePageUC
|
||||
' Set flag posizione selezionati
|
||||
m_nPartPos = IIf(bInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
||||
End If
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
Exit While
|
||||
End If
|
||||
nId = EgtGetNextObjInSelWin()
|
||||
End While
|
||||
' Dati per drag
|
||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev)
|
||||
End Sub
|
||||
|
||||
Private Sub OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PlaceScene.OnMouseMoveScene
|
||||
If Not m_bDrag Or m_nPartPos <> PART_POS.IN_TABLE Then
|
||||
Return
|
||||
End If
|
||||
' Ricavo il punto corrente in coordinate mondo
|
||||
Dim ptCurr As Point3d
|
||||
EgtUnProjectPoint(e.Location, ptCurr)
|
||||
' Ricavo il vettore di movimento
|
||||
Dim vtMove As Vector3d = ptCurr - m_ptPrev
|
||||
' Muovo i pezzi selezionati di quanto possibile
|
||||
EgtMoveSelectedCluster(vtMove, m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist)
|
||||
MyDraw()
|
||||
' Aggiorno il punto precedente
|
||||
'm_ptPrev += vtMove
|
||||
m_ptPrev = ptCurr
|
||||
End Sub
|
||||
|
||||
Private Sub OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PlaceScene.OnMouseUpScene
|
||||
' Disabilito modalità drag
|
||||
m_bDrag = False
|
||||
End Sub
|
||||
|
||||
Private Function IsPartInTable(ByVal nPartId As Integer) As Boolean
|
||||
@@ -246,35 +328,35 @@ Public Class PlacePageUC
|
||||
Private Sub UpBtn_Click(sender As Object, e As RoutedEventArgs) Handles UpBtn.Click
|
||||
Dim dStep As Double = IIf(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedCluster(New Vector3d(0, dStep, 0), m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub DownBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownBtn.Click
|
||||
Dim dStep As Double = IIf(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedCluster(New Vector3d(0, -dStep, 0), m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub RightBtn_Click(sender As Object, e As RoutedEventArgs) Handles RightBtn.Click
|
||||
Dim dStep As Double = IIf(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedCluster(New Vector3d(dStep, 0, 0), m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub LeftBtn_Click(sender As Object, e As RoutedEventArgs) Handles LeftBtn.Click
|
||||
Dim dStep As Double = IIf(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedCluster(New Vector3d(-dStep, 0, 0), m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub RotateCounterClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateCounterClockwiseBtn.Click
|
||||
RotateCluster(90)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub RotateClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateClockwiseBtn.Click
|
||||
RotateCluster(-90)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub RotateHalfTurnBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateHalfTurnBtn.Click
|
||||
@@ -295,12 +377,12 @@ Public Class PlacePageUC
|
||||
EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), 180, GDB_RT.GLOB)
|
||||
' Se un solo pezzo, non sono necessarie verifiche
|
||||
If nCount = 1 Then
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
Return
|
||||
End If
|
||||
' Caso generale
|
||||
RotateCluster(180)
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Function RotateCluster(ByVal dAngRotDeg As Double) As Boolean
|
||||
@@ -393,7 +475,7 @@ Public Class PlacePageUC
|
||||
' Aggiorno flag selezionati
|
||||
m_nPartPos = IIf(EgtGetSelectedObjCount() > 0, PART_POS.IN_TABLE, PART_POS.NONE_TABLE)
|
||||
' Aggiorno vista
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub StoreWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles StoreWallBtn.Click
|
||||
@@ -417,7 +499,7 @@ Public Class PlacePageUC
|
||||
' Imposto flag posizione pezzi su parcheggio
|
||||
m_nPartPos = PART_POS.OUT_TABLE
|
||||
' Aggiorno vista
|
||||
EgtDraw()
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub RemoveWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemoveWallBtn.Click
|
||||
@@ -436,16 +518,73 @@ Public Class PlacePageUC
|
||||
' Imposto flag posizione pezzi
|
||||
m_nPartPos = PART_POS.NONE_TABLE
|
||||
' Aggiorno vista
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
|
||||
Dim sPath As String = m_MainWindow.GetTempDir() & "\Place.nge"
|
||||
EgtSaveFile(sPath, NGE.CMPTEXT)
|
||||
MyDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub GenerateBtn_Click(sender As Object, e As RoutedEventArgs) Handles GenerateBtn.Click
|
||||
|
||||
' Recupero numero progressivo valido come nome ultimo progetto
|
||||
Dim nLastProj As Integer = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 1, m_MainWindow.GetIniFile())
|
||||
' Se modificato, lo incremento e lo salvo
|
||||
If EgtGetModified() Then
|
||||
' Recupero massimo numero di progetti
|
||||
Dim nMaxProj As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXPROJ, 100, m_MainWindow.GetIniFile())
|
||||
' Sistemo nuovo nome numerico
|
||||
nLastProj += 1
|
||||
If nLastProj > nMaxProj Then
|
||||
nLastProj = 1
|
||||
End If
|
||||
WritePrivateProfileString(S_GENERAL, K_LASTPROJ, nLastProj.ToString(), m_MainWindow.GetIniFile())
|
||||
' Salvo il progetto corrente
|
||||
Dim sPath As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".nge"
|
||||
If Not EgtSaveFile(sPath, NGE.CMPTEXT) Then
|
||||
Dim sOut As String = "Error saving file " & sPath
|
||||
EgtOutLog(sOut)
|
||||
Else
|
||||
EgtResetModified()
|
||||
End If
|
||||
' Cancello eventuali vecchi file di dati e report
|
||||
Dim sDPath As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".dat"
|
||||
If My.Computer.FileSystem.FileExists(sDPath) Then
|
||||
My.Computer.FileSystem.DeleteFile(sDPath)
|
||||
End If
|
||||
Dim sRPath As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".txt"
|
||||
If My.Computer.FileSystem.FileExists(sRPath) Then
|
||||
My.Computer.FileSystem.DeleteFile(sRPath)
|
||||
End If
|
||||
End If
|
||||
' Lancio la generazione con Lua
|
||||
' assegno variabili
|
||||
EgtLuaCreateGlobTable("PROC")
|
||||
Dim sDataFile As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".dat"
|
||||
EgtLuaSetGlobStringVar("PROC.DATAFILE", sDataFile)
|
||||
Dim sReportFile As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".txt"
|
||||
EgtLuaSetGlobStringVar("PROC.REPORTFILE", sReportFile)
|
||||
EgtLuaSetGlobStringVar("PROC.TEMPDIR", m_MainWindow.GetTempDir())
|
||||
EgtLuaEvalNumExpr(LayerThicknessTxBx.Text, m_dLayerThick)
|
||||
EgtLuaSetGlobNumVar("PROC.LAYTH", m_dLayerThick)
|
||||
EgtLuaSetGlobNumVar("PROC.OFFSETX", m_dOffsetX)
|
||||
EgtLuaSetGlobNumVar("PROC.OFFSETY", m_dOffsetY)
|
||||
' eseguo
|
||||
Dim sLuaPath As String = String.Empty
|
||||
GetPrivateProfileString(S_MACHINE, K_PROCESSOR, "", sLuaPath, m_MainWindow.GetIniFile())
|
||||
EgtDisableModified()
|
||||
If Not EgtLuaExecFile(sLuaPath) Then
|
||||
Dim sOut As String = "Error running processor " & sLuaPath
|
||||
EgtOutLog(sOut)
|
||||
End If
|
||||
EgtEnableModified()
|
||||
' recupero stato di esecuzione
|
||||
Dim nErr As Integer = 1000
|
||||
EgtLuaGetGlobIntVar("PROC.ERR", nErr)
|
||||
If nErr = 0 Then
|
||||
MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 10) ' Generazione riuscita
|
||||
MessageBrd.Background = Brushes.Green
|
||||
Else
|
||||
MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 11) ' Errore in generazione
|
||||
MessageBrd.Background = Brushes.Tomato
|
||||
End If
|
||||
' cancello variabili
|
||||
EgtLuaResetGlobVar("PROC")
|
||||
End Sub
|
||||
|
||||
Private Sub SendBtn_Click(sender As Object, e As RoutedEventArgs) Handles SendBtn.Click
|
||||
|
||||
Reference in New Issue
Block a user