SarmaxWall 1.6i9 :

- prima gestione del ponte posa tavole
- modifiche varie per gestione colla
- aggiunto oggetto distanziale.
This commit is contained in:
Dario Sassi
2015-09-28 16:16:59 +00:00
parent d07fa7216e
commit b342705e9b
10 changed files with 226 additions and 66 deletions
+5
View File
@@ -75,9 +75,14 @@ Module ConstIni
Public Const K_PROCESSOR As String = "Processor"
Public Const K_OFFSETX As String = "OffsetX"
Public Const K_OFFSETY As String = "OffsetY"
Public Const K_PLANKX As String = "PlankX"
Public Const K_PLANKNUMINLAYER As String = "PlankNumInLayer"
Public Const K_OFFSETGLUE As String = "OffsetGlue"
Public Const K_MINDIST As String = "MinDist"
Public Const K_STEP As String = "Step"
Public Const K_LAYERTHICK As String = "LayerThickness"
Public Const K_PLANKNUMONTOP As String = "PlankNumOnTop"
Public Const K_TRANSMITTER As String = "Transmitter"
Public Const S_MRUFILES As String = "MruFiles"
Public Const S_MRUSCRIPTS As String = "MruScripts"
+14 -12
View File
@@ -33,7 +33,8 @@
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
@@ -47,31 +48,32 @@
<ToggleButton Name="WallBtn" Grid.Row="0" Grid.ColumnSpan="2" FontSize="15" />
<ToggleButton Name="DoorBtn" Grid.Row="1" Grid.ColumnSpan="2" FontSize="15" />
<ToggleButton Name="WindowBtn" Grid.Row="2" Grid.ColumnSpan="2" FontSize="15" />
<ToggleButton Name="SpacerBtn" Grid.Row="3" Grid.ColumnSpan="2" FontSize="15" />
<Label Name="Label1" Grid.Row="5" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
<Label Name="Label1" Grid.Row="6" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20"/>
<TextBox Name="TextBox1" Grid.Column="1" Grid.Row="5" Style="{StaticResource NumericKeyboard}"
<TextBox Name="TextBox1" Grid.Column="1" Grid.Row="6" Style="{StaticResource NumericKeyboard}"
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
TextAlignment="Right"/>
<Label Name="Label2" Grid.Row="6" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
<Label Name="Label2" Grid.Row="7" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20"/>
<TextBox Name="TextBox2" Grid.Column="1" Grid.Row="6" Style="{StaticResource NumericKeyboard}"
<TextBox Name="TextBox2" Grid.Column="1" Grid.Row="7" Style="{StaticResource NumericKeyboard}"
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
TextAlignment="Right" />
<Label Name="Label3" Grid.Row="7" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
<Label Name="Label3" Grid.Row="8" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20"/>
<TextBox Name="TextBox3" Grid.Column="1" Grid.Row="7" Style="{StaticResource NumericKeyboard}"
<TextBox Name="TextBox3" Grid.Column="1" Grid.Row="8" Style="{StaticResource NumericKeyboard}"
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
TextAlignment="Right"/>
<Label Name="Label4" Grid.Row="8" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
<Label Name="Label4" Grid.Row="9" Content="Label" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20"/>
<TextBox Name="TextBox4" Grid.Column="1" Grid.Row="8" Style="{StaticResource NumericKeyboard}"
<TextBox Name="TextBox4" Grid.Column="1" Grid.Row="9" Style="{StaticResource NumericKeyboard}"
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
TextAlignment="Right"/>
<Label Name="MessageLabel" Grid.Row="9" Grid.ColumnSpan="2" Content="Label" FontSize="15" />
<Label Name="MessageLabel" Grid.Row="10" Grid.ColumnSpan="2" Content="Label" FontSize="15" />
<Button Name="AddBtn" Grid.Row="10" FontSize="15" />
<Button Name="CancelBtn" Grid.Column="1" Grid.Row="10" FontSize="15" />
<Button Name="AddBtn" Grid.Row="11" FontSize="15" />
<Button Name="CancelBtn" Grid.Column="1" Grid.Row="11" FontSize="15" />
</Grid>
+84 -9
View File
@@ -14,6 +14,7 @@ Public Class DrawPageUC
Private Const LUA_CMP_WALL As String = "Wall"
Private Const LUA_CMP_DOOR As String = "Door"
Private Const LUA_CMP_WINDOW As String = "Window"
Private Const LUA_CMP_SPACER As String = "Spacer"
Private Const LUA_CMP_INDEX As String = LUA_CMP_VARS & ".Ind"
' Riferimento alla MainWindow
@@ -30,7 +31,8 @@ Public Class DrawPageUC
Private m_bFirst As Boolean = True
' Riferimento alla pagina correntemente attiva
Friend m_ActiveComponent As Components = Components.Null
Private m_ActiveComponent As Components = Components.Null
Private m_nStatus As Stat = Stat.Null
' Indica se il componente viene modificato o è nuovo
Private m_bEdit As Boolean = False
@@ -42,9 +44,16 @@ Public Class DrawPageUC
Wall
Door
Window
Spacer
Null
End Enum
Enum Stat
Null
Wall
Spacer
End Enum
' Dichiarazione Scene
Friend WithEvents DrawScene As New Scene
Dim DrawSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
@@ -74,6 +83,7 @@ Public Class DrawPageUC
WallBtn.Content = EgtMsg(MSG_DRAWPAGEUC + 1) 'Wall - Parete
DoorBtn.Content = EgtMsg(MSG_DRAWPAGEUC + 2) 'Door - Porta
WindowBtn.Content = EgtMsg(MSG_DRAWPAGEUC + 3) 'Window - Finestra
SpacerBtn.Content = EgtMsg(MSG_DRAWPAGEUC + 8) 'Spacer - Distanziale
End Sub
@@ -128,11 +138,13 @@ Public Class DrawPageUC
DrawScene.SetStatusNull()
' Apro e seleziono per default il componente Parete
m_ActiveComponent = Components.Wall
m_ActiveComponent = Components.Null
m_nStatus = Stat.Null
' Carico componente
EgtNewFile()
LoadCurrentCompo(LUA_CMP_WALL)
WallBtn.IsChecked = True
HideComponentParameters()
'LoadCurrentCompo(LUA_CMP_WALL)
'WallBtn.IsChecked = True
End Sub
@@ -163,10 +175,16 @@ Public Class DrawPageUC
WallBtn.IsChecked = False
WindowBtn.IsChecked = True
Case Components.Null
If m_nStatus <> Stat.Null Then
WallBtn.IsChecked = False
Return
End If
m_ActiveComponent = Components.Wall
' Carico componente
EgtNewFile()
m_bEdit = False
LoadCurrentCompo(LUA_CMP_WALL)
m_nStatus = Stat.Wall
WallBtn.IsChecked = True
End Select
End Sub
@@ -182,6 +200,10 @@ Public Class DrawPageUC
DoorBtn.IsChecked = False
WindowBtn.IsChecked = True
Case Components.Null
If m_nStatus <> Stat.Wall Then
DoorBtn.IsChecked = False
Return
End If
m_ActiveComponent = Components.Door
' Carico componente
m_bEdit = False
@@ -191,6 +213,7 @@ Public Class DrawPageUC
End Sub
Private Sub WindowBtn_Click(sender As Object, e As RoutedEventArgs) Handles WindowBtn.Click
Select Case m_ActiveComponent
Case Components.Wall
WallBtn.IsChecked = True
@@ -201,6 +224,10 @@ Public Class DrawPageUC
Case Components.Window
WindowBtn.IsChecked = True
Case Components.Null
If m_nStatus <> Stat.Wall Then
WindowBtn.IsChecked = False
Return
End If
m_ActiveComponent = Components.Window
' Carico componente
m_bEdit = False
@@ -209,6 +236,31 @@ Public Class DrawPageUC
End Select
End Sub
Private Sub SpacerBtn_Checked(sender As Object, e As RoutedEventArgs) Handles SpacerBtn.Checked
Select Case m_ActiveComponent
Case Components.Wall
WallBtn.IsChecked = True
Case Components.Door
WallBtn.IsChecked = False
DoorBtn.IsChecked = True
Case Components.Window
WallBtn.IsChecked = False
WindowBtn.IsChecked = True
Case Components.Null
If m_nStatus <> Stat.Null Then
SpacerBtn.IsChecked = False
Return
End If
m_ActiveComponent = Components.Spacer
' Carico componente
EgtNewFile()
m_bEdit = False
LoadCurrentCompo(LUA_CMP_SPACER)
m_nStatus = Stat.Spacer
SpacerBtn.IsChecked = True
End Select
End Sub
Private Sub AddBtn_Click(sender As Object, e As RoutedEventArgs) Handles AddBtn.Click
ResetBtns()
m_ActiveComponent = Components.Null
@@ -241,6 +293,7 @@ Public Class DrawPageUC
WallBtn.IsChecked = False
DoorBtn.IsChecked = False
WindowBtn.IsChecked = False
SpacerBtn.IsChecked = False
HideComponentParameters()
End Sub
@@ -290,6 +343,9 @@ Public Class DrawPageUC
ElseIf sCompo = LUA_CMP_WINDOW And nCmp > 0 Then
m_ActiveComponent = Components.Window
WindowBtn.IsChecked = True
ElseIf sCompo = LUA_CMP_SPACER And nCmp = 0 Then
m_ActiveComponent = Components.Spacer
SpacerBtn.IsChecked = True
Else
Return
End If
@@ -437,7 +493,7 @@ Public Class DrawPageUC
CancelBtn.Content = EgtMsg(MSG_DRAWPAGEUC + 5) 'Cancel - Annulla
End If
AddBtn.Visibility = Windows.Visibility.Visible
If m_ActiveComponent = Components.Wall Then
If m_ActiveComponent = Components.Wall Or m_ActiveComponent = Components.Spacer Then
CancelBtn.Visibility = Windows.Visibility.Hidden
Else
CancelBtn.Visibility = Windows.Visibility.Visible
@@ -507,12 +563,15 @@ Public Class DrawPageUC
' Passo al contesto principale
EgtSetCurrentContext(m_MainWindow.m_PlacePageUC.PlaceScene.GetCtx())
' Parametri di caricamento
Dim dMinX As Double = m_MainWindow.m_PlacePageUC.m_dOffsetX
Dim dMinY As Double = m_MainWindow.m_PlacePageUC.m_dOffsetY
Dim dMinX As Double = 0
Dim dMinY As Double = -m_MainWindow.m_PlacePageUC.m_dWidth
Dim dMaxX As Double = m_MainWindow.m_PlacePageUC.m_dLength
Dim dMaxY As Double = m_MainWindow.m_PlacePageUC.m_dWidth
Dim dMaxY As Double = 0
Dim dOffset As Double = m_MainWindow.m_PlacePageUC.m_dMinDist
Dim dParkMaxY As Double = m_MainWindow.m_PlacePageUC.m_dParkMaxY
Dim dOffsetX As Double = m_MainWindow.m_PlacePageUC.m_dOffsetX
Dim dOffsetY As Double = m_MainWindow.m_PlacePageUC.m_dOffsetY
Dim dPlankX As Double = m_MainWindow.m_PlacePageUC.m_dPlankX
' Ciclo di caricamento dei pezzi
For Each sTmpfile As String In sTmpFiles
If My.Computer.FileSystem.FileExists(sTmpfile) Then
@@ -520,10 +579,26 @@ Public Class DrawPageUC
EgtInsertFile(sTmpfile)
' Ne recupero l'Id
Dim nId2 As Integer = EgtGetLastPart()
' Se non è un distanziale, aggiungo il grezzo
If Not EgtExistsInfo(nId2, "Spacer") Then
Dim nIdRaw As Integer = EgtCreateGroup(nId2, New Frame3d())
EgtSetName(nIdRaw, "Raw")
EgtSetAlpha(nIdRaw, 40)
Dim ptMin, ptMax As Point3d
EgtGetBBoxGlob(nId2, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, ptMin, ptMax)
ptMin.x -= dOffsetX
ptMin.y -= dOffsetY
' Per avere un numero intero di assi in X
Dim dLen As Double = ptMax.x - ptMin.x + 2 * dOffsetX
Dim nPlank As Integer = Math.Ceiling(dLen / dPlankX)
ptMax.x = ptMin.x + nPlank * dPlankX
ptMax.y += dOffsetY
EgtCreateSurfTmBBox(nIdRaw, ptMin, ptMax, GDB_RT.GLOB)
End If
' Lo posiziono nel parcheggio
EgtPackPart(nId2, dMinX, -INFINITO, dMaxX, dParkMaxY, dOffset, False)
' Cerco di spostarlo nella tavola
EgtPackPart(nId2, dMinX, dMinY, dMaxX, dMaxY, dOffset, True)
EgtPackPart(nId2, dMinX, dMinY, dMaxX, dMaxY, dOffset, False)
' Cancello il file
My.Computer.FileSystem.DeleteFile(sTmpfile)
End If
+21 -4
View File
@@ -284,12 +284,15 @@ Public Class ImportPageUC
' Passo al contesto principale
EgtSetCurrentContext(m_MainWindow.m_PlacePageUC.PlaceScene.GetCtx())
' Parametri di caricamento
Dim dMinX As Double = m_MainWindow.m_PlacePageUC.m_dOffsetX
Dim dMinY As Double = m_MainWindow.m_PlacePageUC.m_dOffsetY
Dim dMinX As Double = 0
Dim dMinY As Double = -m_MainWindow.m_PlacePageUC.m_dWidth
Dim dMaxX As Double = m_MainWindow.m_PlacePageUC.m_dLength
Dim dMaxY As Double = m_MainWindow.m_PlacePageUC.m_dWidth
Dim dMaxY As Double = 0
Dim dOffset As Double = m_MainWindow.m_PlacePageUC.m_dMinDist
Dim dParkMaxY As Double = m_MainWindow.m_PlacePageUC.m_dParkMaxY
Dim dOffsetX As Double = m_MainWindow.m_PlacePageUC.m_dOffsetX
Dim dOffsetY As Double = m_MainWindow.m_PlacePageUC.m_dOffsetY
Dim dPlankX As Double = m_MainWindow.m_PlacePageUC.m_dPlankX
' Ciclo di caricamento dei pezzi
For Each sTmpfile As String In sTmpFiles
If My.Computer.FileSystem.FileExists(sTmpfile) Then
@@ -297,10 +300,24 @@ Public Class ImportPageUC
EgtInsertFile(sTmpfile)
' Ne recupero l'Id
Dim nId2 As Integer = EgtGetLastPart()
' Aggiungo il grezzo
Dim nIdRaw As Integer = EgtCreateGroup(nId2, New Frame3d())
EgtSetName(nIdRaw, "Raw")
EgtSetAlpha(nIdRaw, 40)
Dim ptMin, ptMax As Point3d
EgtGetBBoxGlob(nId2, GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, ptMin, ptMax)
ptMin.x -= dOffsetX
ptMin.y -= dOffsetY
' Per avere un numero intero di assi in X
Dim dLen As Double = ptMax.x - ptMin.x + 2 * dOffsetX
Dim nPlank As Integer = Math.Ceiling(dLen / dPlankX)
ptMax.x = ptMin.x + nPlank * dPlankX
ptMax.y += dOffsetY
EgtCreateSurfTmBBox(nIdRaw, ptMin, ptMax, GDB_RT.GLOB)
' Lo posiziono nel parcheggio
EgtPackPart(nId2, dMinX, -INFINITO, dMaxX, dParkMaxY, dOffset, False)
' Cerco di spostarlo nella tavola
EgtPackPart(nId2, dMinX, dMinY, dMaxX, dMaxY, dOffset, True)
EgtPackPart(nId2, dMinX, dMinY, dMaxX, dMaxY, dOffset, False)
' Cancello il file
My.Computer.FileSystem.DeleteFile(sTmpfile)
End If
+1 -1
View File
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="768" Width="1024" ResizeMode="NoResize"
Initialized="MainWindow_Initialized" Loaded="MainWindow_Loaded" WindowStyle="None" PreviewMouseDown="MainWindow_PreviewMouseDown" >
Initialized="MainWindow_Initialized" Loaded="MainWindow_Loaded" WindowStyle="None" PreviewMouseDown="MainWindow_PreviewMouseDown" Unloaded="MainWindow_Unloaded" >
<!-- Chiamata al Dictionary -->
<Window.Resources>
+1
View File
@@ -340,6 +340,7 @@ Class MainWindow
EgtOutLog(sOut)
End If
' Chiudo tutto
MainWindow_Unloaded(sender, e)
Me.Close()
End Sub
+2 -2
View File
@@ -60,5 +60,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.9.7")>
<Assembly: AssemblyFileVersion("1.6.9.7")>
<Assembly: AssemblyVersion("1.6.9.9")>
<Assembly: AssemblyFileVersion("1.6.9.9")>
+1 -1
View File
@@ -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="OptionsPage_Initialized" >
d:DesignHeight="704" d:DesignWidth="1024" Initialized="OptionsPage_Initialized" Loaded="OptionsPage_Loaded" >
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
+31 -2
View File
@@ -6,7 +6,7 @@ Public Class OptionsPageUC
Private Sub OptionsPage_Initialized(sender As Object, e As EventArgs)
'Imposto i messaggi letti dal file dei messaggi
' Imposto i messaggi letti dal file dei messaggi
ExtraRawPartXLbl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 1) 'Generate - Extra grezzo in X
ExtraRawPartYLbl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 2) 'Send - Trasmetti
ExtraGlueLbl.Text = EgtMsg(MSG_OPTIONSPAGEUC + 3) 'Send - Trasmetti
@@ -32,8 +32,37 @@ Public Class OptionsPageUC
End Sub
Private Sub OptionsPage_Loaded(sender As Object, e As RoutedEventArgs)
Dim dExtraRawX As Double = GetPrivateProfileDouble(S_MACHINE, K_OFFSETX, 0, m_MainWindow.GetIniFile())
ExtraRawPartXTxBx.Text = dExtraRawX
Dim dExtraRawY As Double = GetPrivateProfileDouble(S_MACHINE, K_OFFSETY, 0, m_MainWindow.GetIniFile())
ExtraRawPartYTxBx.Text = dExtraRawY
Dim dExtraGlue As Double = GetPrivateProfileDouble(S_MACHINE, K_OFFSETGLUE, 0, m_MainWindow.GetIniFile())
ExtraGlueTxBx.Text = dExtraGlue
Dim dPlankWidth As Double = GetPrivateProfileDouble(S_MACHINE, K_PLANKX, 0, m_MainWindow.GetIniFile())
PlankWidthTxBx.Text = dPlankWidth
Dim nPlankNumForLayer As Integer = GetPrivateProfileInt(S_MACHINE, K_PLANKNUMINLAYER, 0, m_MainWindow.GetIniFile())
PlankNumForLayerTxBx.Text = nPlankNumForLayer
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
'Istruzioni per chiudere OptionsPageUC e aprire PlacePage UC
' Istruzioni per chiudere OptionsPageUC e aprire PlacePage UC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OptionsPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PlacePageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.Place
m_MainWindow.OptionsBtn.IsChecked = False
m_MainWindow.PlaceBtn.IsChecked = True
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
' Salvo i dati introdotti
WritePrivateProfileString(S_MACHINE, K_OFFSETX, ExtraRawPartXTxBx.Text, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_MACHINE, K_OFFSETY, ExtraRawPartYTxBx.Text, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_MACHINE, K_OFFSETGLUE, ExtraGlueTxBx.Text, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_MACHINE, K_PLANKX, PlankWidthTxBx.Text, m_MainWindow.GetIniFile())
WritePrivateProfileString(S_MACHINE, K_PLANKNUMINLAYER, PlankNumForLayerTxBx.Text, m_MainWindow.GetIniFile())
' Istruzioni per chiudere OptionsPageUC e aprire PlacePage UC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OptionsPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PlacePageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.Place
+66 -35
View File
@@ -32,8 +32,9 @@ Public Class PlacePageUC
Friend m_dWidth As Double = 0
Friend m_dOffsetX As Double = 0
Friend m_dOffsetY As Double = 0
Friend m_dPlankX As Double = 0
Friend m_dMinDist As Double = 0
Friend m_dParkMaxY As Double = -1000
Friend m_dParkMaxY As Double = 0
' Dati movimento
Friend m_dStep As Double = 0
@@ -42,6 +43,8 @@ Public Class PlacePageUC
' Spessore layer (strato)
Private m_dLayerThick As Double = 0
' Numero tavole rimaste in cima alla catasta
Private m_nPlankNumOnTop As Integer = 0
Private Sub PlacePage_Initialized(sender As Object, e As EventArgs)
@@ -138,6 +141,7 @@ Public Class PlacePageUC
' 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_dPlankX = GetPrivateProfileDouble(S_MACHINE, K_PLANKX, 200, 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())
@@ -145,6 +149,9 @@ Public Class PlacePageUC
' carico lo spessore dei layer e lo visualizzo
m_dLayerThick = GetPrivateProfileDouble(S_MACHINE, K_LAYERTHICK, 0, m_MainWindow.GetIniFile())
LayerThicknessTxBx.Text = m_dLayerThick
' carico il numero di tavole rimaste sulla cima della catasta
m_nPlankNumOnTop = GetPrivateProfileInt(S_MACHINE, K_PLANKNUMONTOP, 0, m_MainWindow.GetIniFile())
PlankNumFirstLayerTxBx.Text = m_nPlankNumOnTop
' carico la griglia
LoadGridData()
m_bFirst = False
@@ -217,6 +224,7 @@ Public Class PlacePageUC
' Recupero dimensioni tavola
EgtGetInfo(nTableId, KEY_TABLENGTH, m_dLength)
EgtGetInfo(nTableId, KEY_TABWIDTH, m_dWidth)
m_dParkMaxY = -m_dWidth - 1000
' Inserisco contrassegno di progetto SarmaxWall valido
Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetName(nMarkId, NAME_PROJMARK)
@@ -236,7 +244,7 @@ Public Class PlacePageUC
EgtSetGridFrame(Frame3d.GLOB)
EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep)
EgtSetGridColor(MinLnColor, MajLnColor)
Dim frGrid As New Frame3d(New Point3d(m_dOffsetX, m_dOffsetY, 0))
Dim frGrid As New Frame3d(New Point3d(0, 0, 0))
EgtSetGridFrame(frGrid)
Dim bShowGrid As Boolean = (GetPrivateProfileInt(S_GRID, K_SHOWGRID, 1, m_MainWindow.GetIniFile()) <> 0)
EgtSetGridShow(bShowGrid, False)
@@ -301,7 +309,7 @@ Public Class PlacePageUC
' 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)
EgtMoveSelectedCluster(vtMove, 0, -m_dWidth, m_dLength, 0, m_dMinDist)
MyDraw()
' Aggiorno il punto precedente
'm_ptPrev += vtMove
@@ -322,8 +330,8 @@ Public Class PlacePageUC
If Not EgtGetBBoxGlob(nPartId, BBF_FLAG, ptMin, ptMax) Then
Return False
End If
If ptMax.x < m_dOffsetX - EPS_SMALL Or ptMin.x > m_dLength + EPS_SMALL Or
ptMax.y < m_dOffsetY - EPS_SMALL Or ptMin.y > m_dWidth + EPS_SMALL Then
If ptMax.x < 0 - EPS_SMALL Or ptMin.x > m_dLength + EPS_SMALL Or
ptMax.y < -m_dWidth - EPS_SMALL Or ptMin.y > 0 + EPS_SMALL Then
Return False
End If
Return True
@@ -331,25 +339,25 @@ 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)
EgtMoveSelectedCluster(New Vector3d(0, dStep, 0), 0, -m_dWidth, m_dLength, 0, m_dMinDist)
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)
EgtMoveSelectedCluster(New Vector3d(0, -dStep, 0), 0, -m_dWidth, m_dLength, 0, m_dMinDist)
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)
EgtMoveSelectedCluster(New Vector3d(dStep, 0, 0), 0, -m_dWidth, m_dLength, 0, m_dMinDist)
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)
EgtMoveSelectedCluster(New Vector3d(-dStep, 0, 0), 0, -m_dWidth, m_dLength, 0, m_dMinDist)
MyDraw()
End Sub
@@ -415,8 +423,8 @@ Public Class PlacePageUC
' Recupero nuovo box
EgtGetSelectedClusterBBoxGlob(ptMin, ptMax)
' Se non esce dalla tavola, provo un pack sul posto
If ptMin.x > m_dOffsetX - EPS_SMALL And ptMin.y > m_dOffsetY - EPS_SMALL And
ptMax.x < m_dLength + EPS_SMALL And ptMax.y < m_dWidth + EPS_SMALL Then
If ptMin.x > 0 - EPS_SMALL And ptMin.y > -m_dWidth - EPS_SMALL And
ptMax.x < m_dLength + EPS_SMALL And ptMax.y < 0 + EPS_SMALL Then
If EgtPackSelectedCluster(ptMin.x, ptMin.y, ptMax.x + 1, ptMax.y + 1, m_dMinDist, True) Then
Return True
End If
@@ -427,31 +435,31 @@ Public Class PlacePageUC
ptMin.y = ptCen.y - 0.5 * dDim
ptMax.x = ptCen.x + 0.5 * dDim
ptMax.y = ptCen.y + 0.5 * dDim
If (ptMin.x < m_dOffsetX) Then
ptMax.x += m_dOffsetX - ptMin.x
If (ptMin.x < 0) Then
ptMax.x += 0 - ptMin.x
ptMax.x = Math.Min(ptMax.x, m_dLength)
ptMin.x = m_dOffsetX
ptMin.x = 0
End If
If (ptMin.y < m_dOffsetY) Then
ptMax.y += m_dOffsetY - ptMin.y
ptMax.y = Math.Min(ptMax.y, m_dWidth)
ptMin.y = m_dOffsetY
If (ptMin.y < -m_dWidth) Then
ptMax.y += -m_dWidth - ptMin.y
ptMax.y = Math.Min(ptMax.y, 0)
ptMin.y = -m_dWidth
End If
If (ptMax.x > m_dLength) Then
ptMin.x += m_dLength - ptMax.x
ptMin.x = Math.Max(ptMin.x, m_dOffsetX)
ptMax.x = m_dLength
End If
If (ptMax.y > m_dWidth) Then
ptMin.y += m_dWidth - ptMax.y
ptMin.y = Math.Max(ptMin.y, m_dOffsetY)
ptMax.y = m_dWidth
If (ptMax.y > 0) Then
ptMin.y += 0 - ptMax.y
ptMin.y = Math.Max(ptMin.y, -m_dWidth)
ptMax.y = 0
End If
If EgtPackSelectedCluster(ptMin.x, ptMin.y, ptMax.x + 1, ptMax.y + 1, m_dMinDist, True) Then
Return True
End If
' Provo un pack sull'intera tavola
If EgtPackSelectedCluster(m_dOffsetX, m_dOffsetY, m_dLength, m_dWidth, m_dMinDist, True) Then
If EgtPackSelectedCluster(0, -m_dWidth, m_dLength, 0, m_dMinDist, True) Then
Return True
End If
' Non è possibile ruotare rimanendo in tavola, annullo l'azione
@@ -461,11 +469,6 @@ Public Class PlacePageUC
Private Sub InsertWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles InsertWallBtn.Click
' Parametri di caricamento
Dim dMinX As Double = m_dOffsetX
Dim dMinY As Double = m_dOffsetY
Dim dMaxX As Double = m_dLength
Dim dMaxY As Double = m_dWidth
Dim dOffset As Double = m_dMinDist
' Ciclo di inserimento in tavola dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
@@ -473,7 +476,7 @@ Public Class PlacePageUC
Dim nNextId = EgtGetNextSelectedObj()
' Se pezzo in parcheggio, metto nella tavola
If EgtIsPart(nId) And Not IsPartInTable(nId) Then
If Not EgtPackPart(nId, dMinX, dMinY, dMaxX, dMaxY, dOffset, True) Then
If Not EgtPackPart(nId, 0, -m_dWidth, m_dLength, 0, m_dMinDist, False) Then
EgtDeselectObj(nId)
End If
End If
@@ -488,11 +491,11 @@ Public Class PlacePageUC
Private Sub StoreWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles StoreWallBtn.Click
' Parametri di caricamento
Dim dMinX As Double = m_dOffsetX
Dim dMinY As Double = m_dOffsetY
Dim dMinX As Double = 0
Dim dMinY As Double = -m_dWidth
Dim dMaxX As Double = m_dLength
Dim dMaxY As Double = m_dWidth
Dim dOffset As Double = m_dMinDist
Dim dMaxY As Double = 0
Dim dOffset As Double = 100
Dim dParkMaxY As Double = m_dParkMaxY
' Ciclo di parcheggio dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
@@ -568,10 +571,22 @@ Public Class PlacePageUC
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.TABLEN", m_dLength)
EgtLuaSetGlobNumVar("PROC.TABWIDTH", m_dWidth)
EgtLuaSetGlobNumVar("PROC.OFFSETX", m_dOffsetX)
EgtLuaSetGlobNumVar("PROC.OFFSETY", m_dOffsetY)
EgtLuaEvalNumExpr(LayerThicknessTxBx.Text, m_dLayerThick)
WritePrivateProfileString(S_MACHINE, K_LAYERTHICK, m_dLayerThick, m_MainWindow.GetIniFile())
EgtLuaSetGlobNumVar("PROC.LAYTH", m_dLayerThick)
Dim dPlankWidth As Double = GetPrivateProfileDouble(S_MACHINE, K_PLANKX, 0, m_MainWindow.GetIniFile())
EgtLuaSetGlobNumVar("PROC.PLANKWIDTH", dPlankWidth)
Dim nPlankNumOnLay = GetPrivateProfileInt(S_MACHINE, K_PLANKNUMINLAYER, 0, m_MainWindow.GetIniFile())
EgtLuaSetGlobNumVar("PROC.LAYPLANKNBR", nPlankNumOnLay)
Dim dTemp As Double
EgtLuaEvalNumExpr(PlankNumFirstLayerTxBx.Text, dTemp)
m_nPlankNumOnTop = CInt(dTemp + 0.1)
WritePrivateProfileString(S_MACHINE, K_PLANKNUMONTOP, m_nPlankNumOnTop, m_MainWindow.GetIniFile())
EgtLuaSetGlobNumVar("PROC.TOPPLANKNBR", m_nPlankNumOnTop)
' eseguo
Dim sLuaPath As String = String.Empty
GetPrivateProfileString(S_MACHINE, K_PROCESSOR, "", sLuaPath, m_MainWindow.GetIniFile())
@@ -596,6 +611,22 @@ Public Class PlacePageUC
End Sub
Private Sub SendBtn_Click(sender As Object, e As RoutedEventArgs) Handles SendBtn.Click
' path dell'eseguibile di trasmissione
Dim sExeFile As String = String.Empty
GetPrivateProfileString(S_MACHINE, K_TRANSMITTER, "", sExeFile, m_MainWindow.GetIniFile())
' Path del file da trasmettere
Dim nLastProj As Integer = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 1, m_MainWindow.GetIniFile())
Dim sDataFile As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".dat"
' Lancio la trasmissione
Try
Process.Start(sExeFile, sDataFile)
MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 12) ' Lancio trasmissione riuscito
MessageBrd.Background = Brushes.Green
Catch ex As Exception
MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 13) ' Errore in lancio trasmissione
MessageBrd.Background = Brushes.Tomato
End Try
End Sub