OmagCUT 1.6i8 :
- modifiche varie per foto, grezzo, simulazione, ...
This commit is contained in:
+8
-5
@@ -60,15 +60,18 @@
|
||||
<!-- Definizione della Grid inferiore -->
|
||||
<Grid Name="LowerButtonGrid" Grid.Column="1" Grid.Row="2" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="SaveBtn" Grid.Column="1" Content="Save" />
|
||||
<Button Name="SimulateBtn" Grid.Column="2" FontSize="22" />
|
||||
<Button Name="WorkBtn" Grid.Column="3" FontSize="22" />
|
||||
<Button Name="NewBtn" Grid.Column="0" Content="New" FontSize="22" />
|
||||
<Button Name="LoadBtn" Grid.Column="1" Content="Load" FontSize="22" />
|
||||
<Button Name="SaveBtn" Grid.Column="2" Content="Save" FontSize="22" />
|
||||
<Button Name="SimulateBtn" Grid.Column="4" FontSize="22" />
|
||||
<Button Name="WorkBtn" Grid.Column="5" FontSize="22" />
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
+17
-26
@@ -44,25 +44,8 @@ Public Class CadCutPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub PhotoBtn_Click(sender As Object, e As RoutedEventArgs) Handles PhotoBtn.Click
|
||||
EgtLoadTexture("Raw", "C:\EgtData\OmagCut\Images\Img1.jpg", 3500, 2700, False)
|
||||
' !!! PROVVISORIO per video !!!
|
||||
' Se non esiste già il grezzo lo inserisco
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
If nRawId = GDB_ID.NULL Then
|
||||
' recupero il colore
|
||||
Dim Col As New Color3d(64, 192, 255, 50)
|
||||
GetPrivateProfileColor(S_NEST, K_RAWCOLOR, Col, m_MainWindow.GetIniFile())
|
||||
nRawId = EgtAddRawPart(Point3d.ORIG(), 3500, 1990, 1, Col)
|
||||
' imposto info di grezzo con texture
|
||||
Dim nSolidId = EgtGetFirstNameInGroup(nRawId, "RawSolid")
|
||||
EgtSetInfo(nSolidId, "!TXT", "Raw")
|
||||
' Altrimenti lo modifico
|
||||
Else
|
||||
EgtModifyRawPartSize(nRawId, 3500, 1990, 1)
|
||||
End If
|
||||
EgtSetInfo(nRawId, "Kerf", 50.ToString("F4", CultureInfo.InvariantCulture))
|
||||
' Sistemo la posizione
|
||||
EgtMoveToCornerRawPart(nRawId, New Point3d(0, 0, 0), MCH_CR.BL)
|
||||
' Carico la foto
|
||||
m_MainWindow.m_CurrentProjectPageUC.LoadPhoto("C:\EgtData\OmagCut\Images\Img1.jpg")
|
||||
' Aggiorno visualizzazione
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
@@ -110,15 +93,23 @@ Public Class CadCutPageUC
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
|
||||
m_MainWindow.m_CurrentProjectPageUC.NewProject()
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
Private Sub LoadBtn_Click(sender As Object, e As RoutedEventArgs) Handles LoadBtn.Click
|
||||
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "CurrProj.nge"
|
||||
If Not m_MainWindow.m_CurrentProjectPageUC.LoadProject(sPath) Then
|
||||
m_MainWindow.m_CurrentProjectPageUC.NewProject()
|
||||
End If
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
|
||||
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "CurrProj.nge"
|
||||
EgtSaveFile(sPath, NGE.CMPTEXT)
|
||||
' Ripristino visualizzazione di eventuali pezzi in parcheggio (save li nasconde)
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
EgtSetStatus(nPartId, GDB_ST.ON_)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
m_MainWindow.m_CurrentProjectPageUC.SaveProject(sPath)
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub SimulateBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulateBtn.Click
|
||||
|
||||
+10
-1
@@ -83,10 +83,19 @@ Module ConstIni
|
||||
Public Const K_FLPCURRDIR As String = "CurrDir"
|
||||
|
||||
Public Const S_NEST As String = "Nest"
|
||||
Public Const K_RAWCOLOR As String = "RawColor"
|
||||
Public Const K_DIRECT As String = "Direct"
|
||||
Public Const K_STEP As String = "Step"
|
||||
|
||||
Public Const S_RAWPART As String = "RawPart"
|
||||
Public Const K_RAWCOLOR As String = "RawColor"
|
||||
Public Const K_KERFCOLOR As String = "KerfColor"
|
||||
Public Const K_RAWLENGTH As String = "Length"
|
||||
Public Const K_RAWWIDTH As String = "Width"
|
||||
Public Const K_RAWHEIGHT As String = "Height"
|
||||
Public Const K_RAWOFFSX As String = "OffsX"
|
||||
Public Const K_RAWOFFSY As String = "OffsY"
|
||||
Public Const K_RAWKERF As String = "Kerf"
|
||||
|
||||
Public Const S_MACH As String = "Mach"
|
||||
Public Const K_MACHINESDIR As String = "MachinesDir"
|
||||
Public Const K_CURRMACH As String = "CurrMach"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports EgtUILib
|
||||
Imports System.IO
|
||||
|
||||
Public Class CurrentProjectPageUC
|
||||
|
||||
@@ -20,12 +21,18 @@ Public Class CurrentProjectPageUC
|
||||
Friend WithEvents CurrentProjectScene As New Scene
|
||||
Private CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
|
||||
'Dichiarazione variabile per altezza grezzo
|
||||
' Dichiarazione altezza grezzo
|
||||
Friend m_dRawHeight As Double
|
||||
|
||||
' Identificativo del grezzo
|
||||
Friend m_nRawId As Integer = GDB_ID.NULL
|
||||
|
||||
' Costanti
|
||||
Friend Const MACH_GROUP As String = "Mach01"
|
||||
Friend Const MAIN_TAB As String = "MainTab"
|
||||
Friend Const PHOTO_GRP As String = "Photos"
|
||||
Friend Const PHOTO_NAME As String = "Raw"
|
||||
|
||||
Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Creazione delle Page UserControl
|
||||
@@ -141,4 +148,188 @@ Public Class CurrentProjectPageUC
|
||||
RaiseEvent OnMouseUpScene(sender, e)
|
||||
End Sub
|
||||
|
||||
Friend Function NewProject() As Boolean
|
||||
EgtNewFile()
|
||||
' carico la macchina corrente
|
||||
Dim sCurrMach As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH, K_CURRMACH, "", sCurrMach, m_MainWindow.GetIniFile())
|
||||
If EgtAddMachGroup(MACH_GROUP, sCurrMach) = GDB_ID.NULL Then
|
||||
Return False
|
||||
End If
|
||||
' imposto la tavola corrente
|
||||
If Not EgtSetTable(MAIN_TAB) Then
|
||||
Return False
|
||||
End If
|
||||
EgtShowOnlyTable(True)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function LoadProject(ByVal sPath As String) As Boolean
|
||||
If Not EgtOpenFile(sPath) Then
|
||||
Return False
|
||||
End If
|
||||
' attivo il gruppo di lavoro corrente
|
||||
Dim nMachGrpId As Integer = EgtGetFirstMachGroup()
|
||||
If Not EgtSetCurrMachGroup(nMachGrpId) Then
|
||||
Return False
|
||||
End If
|
||||
EgtShowOnlyTable(True)
|
||||
' aggiorno eventuale identificativo grezzo
|
||||
m_nRawId = EgtGetFirstRawPart()
|
||||
' aggiorno spessore grezzo
|
||||
m_dRawHeight = m_MainWindow.m_RawPartPage.GetRawHeight()
|
||||
HeightTxBx.Text = DoubleToString(m_dRawHeight, 2)
|
||||
' se presente la foto, ne carico la texture
|
||||
ReloadPhoto()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function SaveProject(ByVal sPath As String) As Boolean
|
||||
Dim bOk As Boolean = EgtSaveFile(sPath, NGE.CMPTEXT)
|
||||
' Ripristino visualizzazione di eventuali pezzi in parcheggio (save li nasconde)
|
||||
ShowParkedParts()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Friend Function LoadPhoto(ByVal sPath As String) As Boolean
|
||||
' Verifico esistenza file immagine
|
||||
If Not File.Exists(sPath) Then
|
||||
Return False
|
||||
End If
|
||||
' Leggo file dati aggiuntivi se esiste
|
||||
Dim ptOri As New Point3d(0, 0, 0)
|
||||
Dim ptCen As New Point3d(0, 0, 1)
|
||||
Dim dMMxPixel As Double = 1
|
||||
Dim sAuxPath As String = Path.ChangeExtension(sPath, ".txt")
|
||||
Try
|
||||
Dim sLine As String = String.Empty
|
||||
Dim sr As StreamReader = New StreamReader(sAuxPath)
|
||||
Do While sr.Peek() > -1
|
||||
sLine = sr.ReadLine()
|
||||
sLine = sLine.Replace(" ", "")
|
||||
If sLine.StartsWith("X=") Then
|
||||
StringToDouble(sLine.Substring(2), ptOri.x)
|
||||
ElseIf sLine.StartsWith("Y=") Then
|
||||
StringToDouble(sLine.Substring(2), ptOri.y)
|
||||
ElseIf sLine.StartsWith("Z_Lastra=") Then
|
||||
StringToDouble(sLine.Substring(9), ptOri.z)
|
||||
ElseIf sLine.StartsWith("X_ScaleCenter=") Then
|
||||
StringToDouble(sLine.Substring(14), ptCen.x)
|
||||
ElseIf sLine.StartsWith("Y_ScaleCenter=") Then
|
||||
StringToDouble(sLine.Substring(14), ptCen.y)
|
||||
ElseIf sLine.StartsWith("Z_ScaleCenter=") Then
|
||||
StringToDouble(sLine.Substring(14), ptCen.z)
|
||||
ElseIf sLine.StartsWith("Pixelxmm=") Then
|
||||
Dim dTmp As Double
|
||||
StringToDouble(sLine.Substring(9), dTmp)
|
||||
If dTmp > EPS_SMALL Then
|
||||
dMMxPixel = 1 / dTmp
|
||||
End If
|
||||
End If
|
||||
Loop
|
||||
sr.Close()
|
||||
Catch ex As Exception
|
||||
EgtOutLog("LoadPhoto Error on auxfile : " & sAuxPath)
|
||||
End Try
|
||||
' Recupero origine della tavola e porto i punti in globale
|
||||
Dim ptTab As Point3d
|
||||
EgtGetTableRef1(ptTab)
|
||||
ptOri.ToGlob(New Frame3d(ptTab))
|
||||
ptCen.ToGlob(New Frame3d(ptTab))
|
||||
' Recupero le dimensioni della tavola
|
||||
Dim nAreaId As Integer
|
||||
Dim ptMin, ptMax As Point3d
|
||||
If Not EgtGetTableArea1(nAreaId) Or
|
||||
Not EgtGetBBoxGlob(nAreaId, GDB_BB.STANDARD, ptMin, ptMax) Then
|
||||
Return False
|
||||
End If
|
||||
' Carico la fotografia
|
||||
Return AddPhoto(PHOTO_NAME, sPath, ptOri, ptCen, dMMxPixel, ptMin, ptMax)
|
||||
End Function
|
||||
|
||||
Friend Function ReloadPhoto() As Boolean
|
||||
Dim nPhotoId As Integer = GetPhoto()
|
||||
If nPhotoId = GDB_ID.NULL Then
|
||||
Return True
|
||||
End If
|
||||
' recupero i dati
|
||||
Dim sPath As String = String.Empty
|
||||
EgtGetInfo(nPhotoId, "!TPA", sPath)
|
||||
Dim dDimX As Double
|
||||
EgtGetInfo(nPhotoId, "!TDX", dDimX)
|
||||
Dim dDimY As Double
|
||||
EgtGetInfo(nPhotoId, "!TDY", dDimY)
|
||||
' Carico la texture
|
||||
If Not EgtLoadTexture(PHOTO_NAME, sPath, 0, dDimX, dDimY, False) Then
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function AddPhoto(ByVal sName As String, ByVal sPath As String,
|
||||
ByVal ptOri As Point3d, ByVal ptCen As Point3d, ByVal dMMxPixel As Double,
|
||||
ByVal ptMin As Point3d, ByVal ptMax As Point3d) As Boolean
|
||||
' Se non esiste il gruppo per le foto, lo creo
|
||||
Dim nPhGrpId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)
|
||||
If nPhGrpId = GDB_ID.NULL Then
|
||||
nPhGrpId = EgtCreateGroup(GDB_ID.ROOT)
|
||||
If nPhGrpId = GDB_ID.NULL Then
|
||||
Return False
|
||||
End If
|
||||
EgtSetName(nPhGrpId, PHOTO_GRP)
|
||||
End If
|
||||
EgtSetLevel(nPhGrpId, GDB_LV.SYSTEM)
|
||||
' Carico la texture
|
||||
If Not EgtLoadTexture(sName, sPath, dMMxPixel, 0, 0, False) Then
|
||||
Return False
|
||||
End If
|
||||
' Recupero le dimensioni fisiche
|
||||
Dim dDimX, dDimY As Double
|
||||
EgtGetTextureDimensions(sName, dDimX, dDimY)
|
||||
' Inserisco il rettangolo della foto
|
||||
Dim ptCross As Point3d = ptOri + New Vector3d(dDimX, dDimY, 0)
|
||||
ptOri.x = Math.Max(ptOri.x, ptMin.x)
|
||||
ptOri.y = Math.Max(ptOri.y, ptMin.y)
|
||||
ptCross.x = Math.Min(ptCross.x, ptMax.x)
|
||||
ptCross.y = Math.Min(ptCross.y, ptMax.y)
|
||||
Dim nId As Integer = EgtCreateSurfFrRectangle(nPhGrpId, ptOri, ptCross, GDB_RT.GLOB)
|
||||
If nId = GDB_ID.NULL Then
|
||||
EgtUnloadTexture(sName)
|
||||
Return False
|
||||
End If
|
||||
EgtSetColor(nId, New Color3d(255, 255, 255, 100))
|
||||
EgtSetName(nId, sName)
|
||||
EgtSetInfo(nId, "!TNA", sName)
|
||||
EgtSetInfo(nId, "!TPA", sPath)
|
||||
EgtSetInfo(nId, "!TDX", dDimX)
|
||||
EgtSetInfo(nId, "!TDY", dDimY)
|
||||
EgtSetInfo(nId, "!TFR", New Frame3d(ptOri))
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function ShowPhoto(ByVal bShow As Boolean) As Boolean
|
||||
' Recupero la foto
|
||||
Dim nId As Integer = GetPhoto()
|
||||
If nId = GDB_ID.NULL Then
|
||||
Return False
|
||||
End If
|
||||
' Ne cambio lo stato
|
||||
Return EgtSetStatus(nId, If(bShow, GDB_ST.ON_, GDB_ST.OFF))
|
||||
End Function
|
||||
|
||||
Friend Function GetPhoto() As Integer
|
||||
Dim nPhGrpId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)
|
||||
Return EgtGetFirstNameInGroup(nPhGrpId, PHOTO_NAME)
|
||||
End Function
|
||||
|
||||
Friend Function GetPhotoTextureRef(ByRef refTxt As Frame3d) As Boolean
|
||||
' Recupero la foto
|
||||
Dim nId As Integer = GetPhoto()
|
||||
If nId = GDB_ID.NULL Then
|
||||
Return False
|
||||
End If
|
||||
' Recupero il riferimento
|
||||
Return EgtGetInfo(nId, "!TFR", refTxt)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -55,5 +55,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.8")>
|
||||
<Assembly: AssemblyFileVersion("1.6.9.8")>
|
||||
|
||||
+31
-36
@@ -1,14 +1,11 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class NestPageUC
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
Private WithEvents m_CurrProjPage As CurrentProjectPageUC
|
||||
|
||||
' Flag di pagina attiva
|
||||
Private m_bActive As Boolean = False
|
||||
|
||||
' Flag per pezzi selezionati in tavola o fuori
|
||||
Private m_nPartPos As Integer = PART_POS.NONE_TABLE
|
||||
Enum PART_POS As Integer
|
||||
@@ -16,23 +13,19 @@ Public Class NestPageUC
|
||||
NONE_TABLE = 0
|
||||
OUT_TABLE = 1
|
||||
End Enum
|
||||
|
||||
' Dati del grezzo
|
||||
Private m_nRawId As Integer = GDB_ID.NULL
|
||||
Private m_ptRawMin As Point3d
|
||||
Private m_ptRawMax As Point3d
|
||||
Private m_dKerf As Double
|
||||
Private m_dMinDist As Double = 4
|
||||
|
||||
' Dati movimento
|
||||
Friend m_dStep As Double = 0
|
||||
Friend m_dMaxStep As Double = 0
|
||||
Private m_bMaximizeMove As Boolean = False
|
||||
|
||||
' Dati per Drag
|
||||
Private m_bDrag As Boolean = False
|
||||
Private m_ptPrev As Point3d
|
||||
|
||||
' Costante per flag di BBox
|
||||
Dim BBFLAG As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM
|
||||
|
||||
@@ -74,31 +67,31 @@ Public Class NestPageUC
|
||||
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
|
||||
Dim nId As Integer = EgtGetFirstObjInSelWin()
|
||||
While nId <> GDB_ID.NULL
|
||||
' Recupero l'identificativo del pezzo cui appartiene
|
||||
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
|
||||
Dim bPartInTable As Boolean = EgtGetParent(nPartId) = m_CurrProjPage.m_nRawId
|
||||
If EgtIsPart(nPartId) Or bPartInTable Then
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nPartId, nStat)
|
||||
' Se selezionato o posizione oggetto incompatibile con flag posizione selezionati
|
||||
If nStat = GDB_ST.SEL Or
|
||||
(bPartInTable And m_nPartPos = PART_POS.OUT_TABLE) Or
|
||||
(Not bPartInTable And m_nPartPos = PART_POS.IN_TABLE) Then
|
||||
' Deseleziono
|
||||
EgtDeselectObj(nPartId)
|
||||
' Se nessun pezzo selezionato, reset flag posizione selezionati
|
||||
If EgtGetSelectedObjCount() = 0 Then
|
||||
m_nPartPos = PART_POS.NONE_TABLE
|
||||
End If
|
||||
Else
|
||||
EgtSelectObj(nPartId)
|
||||
' Set flag posizione selezionati
|
||||
m_nPartPos = IIf(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
||||
End If
|
||||
EgtDraw()
|
||||
Exit While
|
||||
End If
|
||||
nId = EgtGetNextObjInSelWin()
|
||||
' Recupero l'identificativo del pezzo cui appartiene
|
||||
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
|
||||
Dim bPartInTable As Boolean = EgtGetParent(nPartId) = m_CurrProjPage.m_nRawId
|
||||
If EgtIsPart(nPartId) Or bPartInTable Then
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nPartId, nStat)
|
||||
' Se selezionato o posizione oggetto incompatibile con flag posizione selezionati
|
||||
If nStat = GDB_ST.SEL Or
|
||||
(bPartInTable And m_nPartPos = PART_POS.OUT_TABLE) Or
|
||||
(Not bPartInTable And m_nPartPos = PART_POS.IN_TABLE) Then
|
||||
' Deseleziono
|
||||
EgtDeselectObj(nPartId)
|
||||
' Se nessun pezzo selezionato, reset flag posizione selezionati
|
||||
If EgtGetSelectedObjCount() = 0 Then
|
||||
m_nPartPos = PART_POS.NONE_TABLE
|
||||
End If
|
||||
Else
|
||||
EgtSelectObj(nPartId)
|
||||
' Set flag posizione selezionati
|
||||
m_nPartPos = IIf(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
|
||||
End If
|
||||
EgtDraw()
|
||||
Exit While
|
||||
End If
|
||||
nId = EgtGetNextObjInSelWin()
|
||||
End While
|
||||
' Dati per drag
|
||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev)
|
||||
@@ -118,7 +111,8 @@ Public Class NestPageUC
|
||||
' Ricavo il vettore di movimento
|
||||
Dim vtMove As Vector3d = ptCurr - m_ptPrev
|
||||
' Muovo i pezzi selezionati di quanto possibile
|
||||
EgtMoveSelectedCluster(vtMove, m_ptRawMin.x, m_ptRawMin.y, m_ptRawMax.x, m_ptRawMax.y, m_dMinDist)
|
||||
EgtMoveSelectedCluster(vtMove, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, m_dMinDist)
|
||||
EgtDraw()
|
||||
' Aggiorno il punto precedente
|
||||
'm_ptPrev += vtMove
|
||||
@@ -335,9 +329,10 @@ Public Class NestPageUC
|
||||
If EgtIsPart(nId) Then
|
||||
EgtErase(nId)
|
||||
' Altrimenti pezzo nel grezzo
|
||||
Else
|
||||
EgtRemovePartFromRawPart(nId)
|
||||
EgtErase(nId)
|
||||
ElseIf EgtGetParent(nId) = m_nRawId Then
|
||||
If EgtRemovePartFromRawPart(nId) Then
|
||||
EgtErase(nId)
|
||||
End If
|
||||
End If
|
||||
' Passo al successivo selezionato
|
||||
nId = nNextId
|
||||
|
||||
@@ -183,9 +183,6 @@
|
||||
<Compile Include="SplitPageUC.xaml.vb">
|
||||
<DependentUpon>SplitPageUC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TagliCadUC.xaml.vb">
|
||||
<DependentUpon>TagliCadUC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility.vb" />
|
||||
<Compile Include="WorkInProgressPageUC.xaml.vb">
|
||||
<DependentUpon>WorkInProgressPageUC.xaml</DependentUpon>
|
||||
@@ -288,10 +285,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="TagliCadUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WorkInProgressPageUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
+1
-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="853.3" d:DesignWidth="1280" Loaded="RawPartPage_Loaded" Initialized="RawPartPage_Initialized">
|
||||
d:DesignHeight="853.3" d:DesignWidth="1280" Loaded="RawPartPage_Loaded" Initialized="RawPartPage_Initialized" Unloaded="RawPartPage_Unloaded">
|
||||
|
||||
<!-- Chiamata al Dictionary -->
|
||||
<UserControl.Resources>
|
||||
|
||||
+203
-36
@@ -2,12 +2,23 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class RawPartPageUC
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Dim m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
Dim m_CurrProjPage As CurrentProjectPageUC
|
||||
|
||||
Dim WithEvents m_CurrProjPage As CurrentProjectPageUC
|
||||
' Flag di pagina attiva
|
||||
Private m_bActive As Boolean = False
|
||||
' Dati per Drag
|
||||
Private m_bDrag As Boolean = False
|
||||
Private m_ptPrev As Point3d
|
||||
' Modalità aggiornamento variabili
|
||||
Friend m_bShowVar As Boolean = False
|
||||
' Dimensioni grezzo rettangolare
|
||||
Private m_RawLength As Double
|
||||
Private m_RawWidth As Double
|
||||
Private m_RawHeight As Double
|
||||
Private m_RawOffsX As Double
|
||||
Private m_RawOffsY As Double
|
||||
Private m_RawKerf As Double
|
||||
|
||||
Private Sub RawPartPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -43,10 +54,12 @@ Public Class RawPartPageUC
|
||||
|
||||
Private Sub RawPartPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
m_bActive = True
|
||||
' Nascondo eventuali pezzi in parcheggio
|
||||
HideParkedParts()
|
||||
' Aggiorno dimensioni grezzo
|
||||
' Se non esiste già il grezzo lo inserisco
|
||||
' Visualizzo eventuale foto
|
||||
m_MainWindow.m_CurrentProjectPageUC.ShowPhoto(True)
|
||||
' Se esiste già il grezzo...
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
If nRawId <> GDB_ID.NULL Then
|
||||
' origine tavola
|
||||
@@ -57,35 +70,103 @@ Public Class RawPartPageUC
|
||||
Dim nFlag As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM
|
||||
EgtGetBBoxGlob(nRawId, nFlag, ptMin, ptMax)
|
||||
' kerf
|
||||
Dim dKerf As Double
|
||||
EgtGetInfo(nRawId, "Kerf", dKerf)
|
||||
m_bShowVar = True
|
||||
' assegno valori ai textbox
|
||||
LengthTxBx.Text = DoubleToString((ptMax.x - ptMin.x - 2 * dKerf), 4)
|
||||
WidthTxBx.Text = DoubleToString((ptMax.y - ptMin.y - 2 * dKerf), 4)
|
||||
HeightTxBx.Text = DoubleToString((ptMax.z - ptMin.z), 4)
|
||||
OffsetXTxBx.Text = DoubleToString((ptMin.x - ptOri.x), 4)
|
||||
OffsetYTxBx.Text = DoubleToString((ptMin.y - ptOri.y), 4)
|
||||
KerfTxBx.Text = DoubleToString(dKerf, 4)
|
||||
m_bShowVar = False
|
||||
EgtGetInfo(nRawId, "Kerf", m_RawKerf)
|
||||
' aggiorno dati grezzo
|
||||
m_RawLength = ptMax.x - ptMin.x - 2 * m_RawKerf
|
||||
m_RawWidth = ptMax.y - ptMin.y - 2 * m_RawKerf
|
||||
m_RawHeight = ptMax.z - ptMin.z
|
||||
m_RawOffsX = ptMin.x - ptOri.x + m_RawKerf
|
||||
m_RawOffsY = ptMin.y - ptOri.y + m_RawKerf
|
||||
' aggiorno l'apparenza del grezzo
|
||||
AdjustRawPartOnStart()
|
||||
' Altrimenti lo definisco
|
||||
Else
|
||||
m_bShowVar = True
|
||||
LengthTxBx.Text = "2500"
|
||||
WidthTxBx.Text = "1500"
|
||||
HeightTxBx.Text = "30"
|
||||
OffsetXTxBx.Text = "300"
|
||||
OffsetYTxBx.Text = "200"
|
||||
KerfTxBx.Text = "50"
|
||||
m_bShowVar = False
|
||||
' Leggo da Ini gli ultimi valori
|
||||
m_RawLength = GetPrivateProfileDouble(S_RAWPART, K_RAWLENGTH, 2500, m_MainWindow.GetIniFile())
|
||||
m_RawWidth = GetPrivateProfileDouble(S_RAWPART, K_RAWWIDTH, 1500, m_MainWindow.GetIniFile())
|
||||
m_RawHeight = GetPrivateProfileDouble(S_RAWPART, K_RAWHEIGHT, 30, m_MainWindow.GetIniFile())
|
||||
m_RawOffsX = GetPrivateProfileDouble(S_RAWPART, K_RAWOFFSX, 100, m_MainWindow.GetIniFile())
|
||||
m_RawOffsY = GetPrivateProfileDouble(S_RAWPART, K_RAWOFFSY, 100, m_MainWindow.GetIniFile())
|
||||
m_RawKerf = GetPrivateProfileDouble(S_RAWPART, K_RAWKERF, 50, m_MainWindow.GetIniFile())
|
||||
End If
|
||||
' Deseleziono pezzi
|
||||
EgtDeselectAll()
|
||||
' Seleziono modalità rettangolo
|
||||
RectangleBtn.IsChecked = True
|
||||
' Assegno dati grezzo rettangolare ai textbox
|
||||
m_bShowVar = True
|
||||
LengthTxBx.Text = DoubleToString(m_RawLength, 2)
|
||||
WidthTxBx.Text = DoubleToString(m_RawWidth, 2)
|
||||
HeightTxBx.Text = DoubleToString(m_RawHeight, 2)
|
||||
OffsetXTxBx.Text = DoubleToString(m_RawOffsX, 2)
|
||||
OffsetYTxBx.Text = DoubleToString(m_RawOffsY, 2)
|
||||
KerfTxBx.Text = DoubleToString(m_RawKerf, 2)
|
||||
m_bShowVar = False
|
||||
' Aggiorno grezzo
|
||||
UpdateRawPart()
|
||||
' Imposto il materiale corrente nella combobox
|
||||
MaterialsCmbx.SelectedIndex = m_MainWindow.m_nCurrentMaterial
|
||||
End Sub
|
||||
|
||||
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene
|
||||
' Verifico di essere il gestore attivo
|
||||
If Not m_bActive Then
|
||||
Return
|
||||
End If
|
||||
' Si può selezionare solo con il tasto sinistro e se stato NULL
|
||||
If e.Button <> Windows.Forms.MouseButtons.Left Or
|
||||
Not m_CurrProjPage.CurrentProjectScene.IsStatusNull() Then
|
||||
Return
|
||||
End If
|
||||
' Verifico se selezionato indicativo di grezzo
|
||||
Dim nSolidId = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, "RawSolid")
|
||||
EgtSetObjFilterForSelect(True, True, True, True, True)
|
||||
Dim nSel As Integer
|
||||
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
|
||||
Dim nId As Integer = EgtGetFirstObjInSelWin()
|
||||
While nId <> GDB_ID.NULL
|
||||
If nSolidId <> GDB_ID.NULL And nId = nSolidId Then
|
||||
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev)
|
||||
Exit While
|
||||
End If
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseMoveScene
|
||||
' Verifico di essere il gestore attivo
|
||||
If Not m_bActive Then
|
||||
Return
|
||||
End If
|
||||
' Verifico di essere in modalità drag
|
||||
If Not m_bDrag 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 il grezzo
|
||||
EgtMoveRawPart(m_CurrProjPage.m_nRawId, vtMove)
|
||||
EgtDraw()
|
||||
' Aggiorno gli offset
|
||||
m_RawOffsX += vtMove.x
|
||||
m_RawOffsY += vtMove.y
|
||||
m_bShowVar = True
|
||||
OffsetXTxBx.Text = DoubleToString(m_RawOffsX, 2)
|
||||
OffsetYTxBx.Text = DoubleToString(m_RawOffsY, 2)
|
||||
m_bShowVar = False
|
||||
' Aggiorno il punto precedente
|
||||
m_ptPrev = ptCurr
|
||||
End Sub
|
||||
|
||||
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseUpScene
|
||||
' Verifico di essere il gestore attivo
|
||||
If Not m_bActive Then
|
||||
Return
|
||||
End If
|
||||
' Disabilito modalità drag
|
||||
m_bDrag = False
|
||||
End Sub
|
||||
|
||||
Private Sub MaterialsCmbx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles MaterialsCmbx.SelectionChanged
|
||||
@@ -94,11 +175,20 @@ Public Class RawPartPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub ExitBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
' Sistemo il grezzo
|
||||
AdjustRawPartOnExit()
|
||||
' Ripristino visualizzazione di eventuali pezzi in parcheggio
|
||||
ShowParkedParts()
|
||||
' Imposto spessore del grezzo
|
||||
m_CurrProjPage.m_dRawHeight = GetRawHeight()
|
||||
m_CurrProjPage.HeightTxBx.Text = GetRawHeight()
|
||||
m_CurrProjPage.HeightTxBx.Text = m_CurrProjPage.m_dRawHeight
|
||||
' Salvo nel file Ini le dimensioni del grezzo
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWLENGTH, DoubleToString(m_RawLength, 2), m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWWIDTH, DoubleToString(m_RawWidth, 2), m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWHEIGHT, DoubleToString(m_RawHeight, 2), m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWOFFSX, DoubleToString(m_RawOffsX, 2), m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWOFFSY, DoubleToString(m_RawOffsY, 2), m_MainWindow.GetIniFile())
|
||||
WritePrivateProfileString(S_RAWPART, K_RAWKERF, DoubleToString(m_RawKerf, 2), m_MainWindow.GetIniFile())
|
||||
' Esco dalla pagina
|
||||
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(Me)
|
||||
m_CurrProjPage.CurrProjGrid.Visibility = Windows.Visibility.Visible
|
||||
@@ -115,13 +205,14 @@ Public Class RawPartPageUC
|
||||
|
||||
Public Function GetRawHeight() As Double
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
If nRawId = GDB_ID.NULL Then
|
||||
Dim nSolidRawId As Integer = EgtGetFirstNameInGroup(nRawId, "RawSolid")
|
||||
If nSolidRawId = GDB_ID.NULL Then
|
||||
Return 0
|
||||
End If
|
||||
' box grezzo
|
||||
Dim ptMin, ptMax As Point3d
|
||||
Dim nFlag As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM
|
||||
EgtGetBBoxGlob(nRawId, nFlag, ptMin, ptMax)
|
||||
EgtGetBBoxGlob(nSolidRawId, nFlag, ptMin, ptMax)
|
||||
Return ptMax.z - ptMin.z
|
||||
End Function
|
||||
|
||||
@@ -131,22 +222,27 @@ Public Class RawPartPageUC
|
||||
If Not StringToDouble(LengthTxBx.Text, dLength) Or dLength < EPS_SMALL Then
|
||||
Return
|
||||
End If
|
||||
m_RawLength = dLength
|
||||
Dim dWidth As Double
|
||||
If Not StringToDouble(WidthTxBx.Text, dWidth) Or dWidth < EPS_SMALL Then
|
||||
Return
|
||||
End If
|
||||
m_RawWidth = dWidth
|
||||
Dim dHeight As Double
|
||||
If Not StringToDouble(HeightTxBx.Text, dHeight) Or dHeight < EPS_SMALL Then
|
||||
Return
|
||||
End If
|
||||
m_RawHeight = dHeight
|
||||
Dim dOffsetX As Double
|
||||
If Not StringToDouble(OffsetXTxBx.Text, dOffsetX) Then
|
||||
Return
|
||||
End If
|
||||
m_RawOffsX = dOffsetX
|
||||
Dim dOffsetY As Double
|
||||
If Not StringToDouble(OffsetYTxBx.Text, dOffsetY) Then
|
||||
Return
|
||||
End If
|
||||
m_RawOffsY = dOffsetY
|
||||
Dim dKerf As Double
|
||||
If Not StringToDouble(KerfTxBx.Text, dKerf) Then
|
||||
Return
|
||||
@@ -154,26 +250,97 @@ Public Class RawPartPageUC
|
||||
If dKerf < EPS_SMALL Then
|
||||
dKerf = 0
|
||||
End If
|
||||
m_RawKerf = dKerf
|
||||
' Se non esiste già il grezzo lo inserisco
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
If nRawId = GDB_ID.NULL Then
|
||||
' recupero il colore
|
||||
Dim Col As New Color3d(64, 192, 255, 50)
|
||||
GetPrivateProfileColor(S_NEST, K_RAWCOLOR, Col, m_MainWindow.GetIniFile())
|
||||
m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), dLength + 2 * dKerf, dWidth + 2 * dKerf, dHeight, Col)
|
||||
' imposto info di grezzo con texture
|
||||
Dim nSolidId = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, "RawSolid")
|
||||
EgtSetInfo(nSolidId, "!TXT", "Raw")
|
||||
Dim Col As New Color3d(64, 192, 255, 40)
|
||||
GetPrivateProfileColor(S_RAWPART, K_RAWCOLOR, Col, m_MainWindow.GetIniFile())
|
||||
' in presenza di foto rendo molto più trasparente
|
||||
If m_CurrProjPage.GetPhoto() <> GDB_ID.NULL Then
|
||||
Col.A = 20
|
||||
End If
|
||||
m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, m_RawWidth + 2 * m_RawKerf, m_RawHeight, Col)
|
||||
' Altrimenti lo modifico
|
||||
Else
|
||||
m_CurrProjPage.m_nRawId = nRawId
|
||||
EgtModifyRawPartSize(nRawId, dLength + 2 * dKerf, dWidth + 2 * dKerf, dHeight)
|
||||
EgtModifyRawPartSize(nRawId, m_RawLength + 2 * m_RawKerf, m_RawWidth + 2 * m_RawKerf, m_RawHeight)
|
||||
End If
|
||||
EgtSetInfo(m_CurrProjPage.m_nRawId, "Kerf", dKerf.ToString("F4", CultureInfo.InvariantCulture))
|
||||
UpdateRawPartKerf()
|
||||
' Sistemo la posizione
|
||||
EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, New Point3d(dOffsetX, dOffsetY, 0), MCH_CR.BL)
|
||||
EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, 0), MCH_CR.BL)
|
||||
' Aggiorno visualizzazione
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
Private Function UpdateRawPartKerf() As Boolean
|
||||
' Recupero il vecchio valore del kerf
|
||||
Dim dOldKerf As Double
|
||||
If Not EgtGetInfo(m_CurrProjPage.m_nRawId, "Kerf", dOldKerf) Then
|
||||
dOldKerf = GetPrivateProfileDouble(S_RAWPART, K_RAWKERF, 30, m_MainWindow.GetIniFile())
|
||||
End If
|
||||
' Cancello eventuale vecchio contorno di kerf
|
||||
Dim nKerfId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, "Kerf")
|
||||
EgtErase(nKerfId)
|
||||
' box grezzo
|
||||
Dim ptMin, ptMax As Point3d
|
||||
Dim nFlag As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM
|
||||
EgtGetBBoxGlob(m_CurrProjPage.m_nRawId, nFlag, ptMin, ptMax)
|
||||
ptMin.x += m_RawKerf
|
||||
ptMin.y += m_RawKerf
|
||||
ptMin.z = ptMax.z
|
||||
ptMax.x -= m_RawKerf
|
||||
ptMax.y -= m_RawKerf
|
||||
' Creo il nuovo contorno del kerf
|
||||
nKerfId = EgtCreateRectangle2P(m_CurrProjPage.m_nRawId, ptMin, ptMax, GDB_RT.GLOB)
|
||||
EgtSetName(nKerfId, "Kerf")
|
||||
Dim Col As New Color3d(255, 0, 0, 100)
|
||||
GetPrivateProfileColor(S_RAWPART, K_KERFCOLOR, Col, m_MainWindow.GetIniFile())
|
||||
EgtSetColor(nKerfId, Col)
|
||||
' Salvo il nuovo valore
|
||||
EgtSetInfo(m_CurrProjPage.m_nRawId, "Kerf", DoubleToString(m_RawKerf, 4))
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub AdjustRawPartOnStart()
|
||||
' Se non c'è la foto va già bene così
|
||||
If m_CurrProjPage.GetPhoto() = GDB_ID.NULL Then
|
||||
Return
|
||||
End If
|
||||
' Disabilito la texture della foto
|
||||
Dim nSolidId = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, "RawSolid")
|
||||
EgtRemoveInfo(nSolidId, "!TNA")
|
||||
' Sistemo il colore
|
||||
Dim Col As New Color3d(64, 192, 255, 40)
|
||||
GetPrivateProfileColor(S_RAWPART, K_RAWCOLOR, Col, m_MainWindow.GetIniFile())
|
||||
Col.A = 20
|
||||
EgtSetColor(nSolidId, Col, True)
|
||||
End Sub
|
||||
|
||||
Private Sub AdjustRawPartOnExit()
|
||||
' Se non c'è la foto va già bene così
|
||||
If m_CurrProjPage.GetPhoto() = GDB_ID.NULL Then
|
||||
Return
|
||||
End If
|
||||
' Carico la texture della foto
|
||||
Dim nSolidId = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, "RawSolid")
|
||||
EgtSetInfo(nSolidId, "!TNA", "Raw")
|
||||
' Sistemo il riferimento della texture
|
||||
Dim refGlob As New Frame3d
|
||||
EgtGetGroupGlobFrame(m_CurrProjPage.m_nRawId, refGlob)
|
||||
Dim refTxt As New Frame3d
|
||||
m_CurrProjPage.GetPhotoTextureRef(refTxt)
|
||||
refTxt.ToLoc(refGlob)
|
||||
EgtSetInfo(nSolidId, "!TFR", refTxt)
|
||||
' Sistemo il colore
|
||||
EgtSetColor(nSolidId, New Color3d(255, 255, 255, 100), True)
|
||||
End Sub
|
||||
|
||||
Private Sub RawPartPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
' Nascondo eventuale foto
|
||||
m_MainWindow.m_CurrentProjectPageUC.ShowPhoto(False)
|
||||
m_bActive = False
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -5,12 +5,15 @@ Public Class SimulationPageUC
|
||||
Dim m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
Dim m_CurrProjPage As CurrentProjectPageUC
|
||||
|
||||
'Dichiarazione delle Page UserControl
|
||||
' Dichiarazione delle Page UserControl
|
||||
Friend m_SceneButtons As SceneButtonsUC
|
||||
|
||||
'Dichiarazione flag PlayPauseBtn
|
||||
' Dichiarazione flag PlayPauseBtn
|
||||
Private m_bPlay As Boolean = False
|
||||
|
||||
' Flag di progetto da caricare prima di simulare
|
||||
Private m_bToReload As Boolean = False
|
||||
|
||||
Private Sub SimulationPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Creazione del UserCOntrol SceneButtons
|
||||
@@ -26,32 +29,49 @@ Public Class SimulationPageUC
|
||||
|
||||
Private Sub SimulationPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
' Salvo il progetto corrente
|
||||
SaveProject()
|
||||
' Nascondo eventuali pezzi in parcheggio
|
||||
HideParkedParts()
|
||||
' Visualizzo tutta la macchina
|
||||
EgtShowOnlyTable(False)
|
||||
' Imposto vista 3d isometrica di tutto
|
||||
EgtSetView(VT.ISO_SE, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
Private Sub PlayPauseBtn_Click(sender As Object, e As RoutedEventArgs) Handles PlayPauseBtn.Click
|
||||
If m_bPlay Then
|
||||
'Metto in pausa
|
||||
' Metto in pausa
|
||||
m_bPlay = False
|
||||
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
||||
Else
|
||||
'Metto in play
|
||||
' Ricarico il progetto, se necessario
|
||||
If ReloadProject() Then
|
||||
HideParkedParts()
|
||||
EgtShowOnlyTable(False)
|
||||
EgtDraw()
|
||||
End If
|
||||
' Metto in play
|
||||
m_bPlay = True
|
||||
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Pause.png", UriKind.Relative))
|
||||
' Eseguo
|
||||
m_bToReload = True
|
||||
EgtLuaExecFile("C:\EgtData\OmagCut\Config\Simulate.lua")
|
||||
' Metto in pausa
|
||||
m_bPlay = False
|
||||
PlayPauseImage.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/Play.png", UriKind.Relative))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ExitBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
' Ricarico il progetto corrente
|
||||
ReloadProject()
|
||||
' Ripristino visualizzazione di eventuali pezzi in parcheggio
|
||||
ShowParkedParts()
|
||||
' Ripristino visualizzazione della sola tavola
|
||||
EgtShowOnlyTable(True)
|
||||
' Imposto vista 2D
|
||||
EgtSetView(VT.TOP, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
' Esco dalla pagina
|
||||
@@ -61,4 +81,21 @@ Public Class SimulationPageUC
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
|
||||
Private Sub SaveProject()
|
||||
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "SimuProj.nge"
|
||||
m_CurrProjPage.SaveProject(sPath)
|
||||
m_bToReload = False
|
||||
End Sub
|
||||
|
||||
Private Function ReloadProject() As Boolean
|
||||
If Not m_bToReload Then
|
||||
Return False
|
||||
End If
|
||||
' Ricarico
|
||||
Dim sPath As String = m_MainWindow.GetTempDir() & "\" & "SimuProj.nge"
|
||||
m_CurrProjPage.LoadProject(sPath)
|
||||
m_bToReload = False
|
||||
Return True
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<UserControl x:Class="TagliCadUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="853.3" d:DesignWidth="1024" Loaded="TagliCadUC_Loaded" Initialized="TagliCadUC_Initialized">
|
||||
|
||||
<!-- Chiamata al dizionario -->
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary Source="OmagCUTDictionary.xaml"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Definizione della PAGINA TAGLI CAD -->
|
||||
<Grid Name="BackGroundGridLavorazioniPiane">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource TabPageColumn0Width}"/>
|
||||
<ColumnDefinition Width="{StaticResource TabPageColumn1Width}"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="{StaticResource TabPageRow0Width}"/>
|
||||
<RowDefinition Height="{StaticResource TabPageRow1Width}"/>
|
||||
<RowDefinition Height="{StaticResource TabPageRow2Width}"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione barra dei tasti sopra -->
|
||||
<UniformGrid Grid.ColumnSpan="2" Rows="1" Columns="12">
|
||||
|
||||
<!-- Definizione del Button Components -->
|
||||
<Button Click="ComponentsBtnUC_Click" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Style="{StaticResource ButtonImage}" Source="c:\Users\Emmanuele\Documents\Visual Studio 2013\Projects\ProvaTab2\ProvaTab2\Images\Import.png"/>
|
||||
<TextBlock Style="{StaticResource ButtonTextBlock}" Text="Componenti" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Definizione del Button Zoom All -->
|
||||
<Button Click="ZoomAllBtnUC_Click" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Style="{StaticResource ButtonImage}" Source="c:\Users\Emmanuele\Documents\Visual Studio 2013\Projects\ProvaTab2\ProvaTab2\Images\Import.png"/>
|
||||
<TextBlock Style="{StaticResource ButtonTextBlock}" Text="Zoom All" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Definizione del Button Lavora -->
|
||||
<Button Click="LavoraBtnUC_Click" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Style="{StaticResource ButtonImage}" Source="c:\Users\Emmanuele\Documents\Visual Studio 2013\Projects\ProvaTab2\ProvaTab2\Images\Import.png"/>
|
||||
<TextBlock Style="{StaticResource ButtonTextBlock}" Text="Lavora" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Definizione del Button Grezzo -->
|
||||
<Button Click="GrezzoBtnUC_Click" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Style="{StaticResource ButtonImage}" Source="c:\Users\Emmanuele\Documents\Visual Studio 2013\Projects\ProvaTab2\ProvaTab2\Images\Import.png"/>
|
||||
<TextBlock Style="{StaticResource ButtonTextBlock}" Text="Grezzo" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Definizione del Button Import -->
|
||||
<Button Click="ImportBtnUC_Click" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Style="{StaticResource ButtonImage}" Source="c:\Users\Emmanuele\Documents\Visual Studio 2013\Projects\ProvaTab2\ProvaTab2\Images\Import.png"/>
|
||||
<TextBlock Style="{StaticResource ButtonTextBlock}" Text="Import" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
</UniformGrid>
|
||||
|
||||
<!-- Riferimento al User Control della barra dei tasti a destra -->
|
||||
<ContentPresenter Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Name="RightBtnBarContent" />
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -1,42 +0,0 @@
|
||||
Public Class TagliCadUC
|
||||
|
||||
Dim MainWindowUC As MainWindow = Application.Current.MainWindow
|
||||
'Dim m_BarLavoraUC As BarLavoraUC
|
||||
'Dim m_BarNestingUC As BarNestingUC
|
||||
|
||||
Private Sub TagliCadUC_Initialized(sender As Object, e As EventArgs)
|
||||
'm_BarLavoraUC = New BarLavoraUC
|
||||
'm_BarNestingUC = New BarNestingUC
|
||||
End Sub
|
||||
|
||||
Private Sub TagliCadUC_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
'RightBtnBarContent.Content = m_BarNestingUC
|
||||
End Sub
|
||||
|
||||
Private Sub ComponentsBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
'MainWindowUC.TagliCadContent.Content = MainWindowUC.m_ComponentiUC
|
||||
End Sub
|
||||
|
||||
Private Sub ZoomAllBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
'MainWindowUC.MachiningScene.ZoomAll()
|
||||
End Sub
|
||||
|
||||
Private Sub LavoraBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
'If (RightBtnBarContent.Content = m_BarNestingUC) Then
|
||||
' RightBtnBarContent.Content = m_BarLavoraUC
|
||||
'Else
|
||||
' RightBtnBarContent.Content = m_BarLavoraUC
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub GrezzoBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
'MainWindowUC.m_GrezzoUC.SetValue(Grid.RowProperty, 1)
|
||||
'MainWindowUC.m_GrezzoUC.SetValue(Grid.RowSpanProperty, 2)
|
||||
'MainWindowUC.MainGrid.Children.Add(MainWindowUC.m_GrezzoUC)
|
||||
End Sub
|
||||
|
||||
Private Sub ImportBtnUC_Click(sender As Object, e As RoutedEventArgs)
|
||||
'MainWindowUC.TagliCadContent.Content = MainWindowUC.m_FlatPartsImportUC
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+14
-13
@@ -2,19 +2,6 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Module Utility
|
||||
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As UInteger) As String
|
||||
Dim sFormat As String = "F" + nNumDec.ToString()
|
||||
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
|
||||
If nNumDec > 0 Then
|
||||
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
|
||||
Else
|
||||
Return sVal
|
||||
End If
|
||||
End Function
|
||||
|
||||
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
||||
Return EgtLuaEvalNumExpr(sVal, dVal)
|
||||
End Function
|
||||
|
||||
Friend Sub HideParkedParts()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
@@ -32,4 +19,18 @@ Module Utility
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As UInteger) As String
|
||||
Dim sFormat As String = "F" + nNumDec.ToString()
|
||||
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
|
||||
If nNumDec > 0 Then
|
||||
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
|
||||
Else
|
||||
Return sVal
|
||||
End If
|
||||
End Function
|
||||
|
||||
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
||||
Return EgtLuaEvalNumExpr(sVal, dVal)
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
Reference in New Issue
Block a user