OmagCUT :
- aggiunta prima versione di Vein Matching - si eliminano spazi iniziali e finali da nomi utensili e lavorazioni - nuovo utensile come copia di esistente ora crea nuovo disegno - nuovo utensile ora assegna valori di default alla geometria.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
<Application x:Class="Application"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml" >
|
||||
StartupUri="MainWindow.xaml" ShutdownMode="OnMainWindowClose" >
|
||||
|
||||
<Application.Resources>
|
||||
<ResourceDictionary Source="OmagCUTDictionary.xaml"/>
|
||||
|
||||
+8
-4
@@ -61,10 +61,12 @@ Public Class CNCommunication
|
||||
End If
|
||||
EgtOutLog("NcLink=" & m_MainWindow.m_bNCLink.ToString & " type=" & m_nNCType)
|
||||
|
||||
' Se CNSiemens leggo path programmino di comunicazione
|
||||
' Se CNSiemens leggo dati programma intermedio di comunicazione
|
||||
If m_nNCType = 3 Then
|
||||
GetPrivateProfileString("CNSiemensExe", "Path", "", m_sCNSiemensPath, m_MainWindow.m_CurrentMachine.sMachIniFile)
|
||||
GetPrivateProfileString("CNSiemensExe", "PathHMI", "", m_sCNSiemensHMIPath, m_MainWindow.m_CurrentMachine.sMachIniFile)
|
||||
Dim sExeName As String = String.Empty
|
||||
GetPrivateProfileString(S_NCSIEMENS, K_COMM_NAME, "", sExeName, m_MainWindow.m_CurrentMachine.sMachIniFile)
|
||||
m_sCNSiemensPath = m_MainWindow.GetExeRootDir() & "\" & sExeName
|
||||
GetPrivateProfileString(S_NCSIEMENS, K_PATH_HMI, "", m_sCNSiemensHMIPath, m_MainWindow.m_CurrentMachine.sMachIniFile)
|
||||
End If
|
||||
|
||||
' Inizializzo la connessione
|
||||
@@ -214,7 +216,9 @@ Public Class CNCommunication
|
||||
' Avvio programmino di comunicazione
|
||||
Try
|
||||
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray")
|
||||
Process.Start(m_sCNSiemensHMIPath, "-start """ & m_sCNSiemensPath & """")
|
||||
Dim sArg As String = "-start """ & m_sCNSiemensPath & """"
|
||||
EgtOutLog("ProcessStart : " & m_sCNSiemensHMIPath & " " & sArg)
|
||||
Process.Start(m_sCNSiemensHMIPath, sArg)
|
||||
Catch ex As Exception
|
||||
' Per evitare crash con azioni verso il controllo, avvio quello di debug
|
||||
Me.m_CN.Stop_Connection()
|
||||
|
||||
+9
-2
@@ -35,7 +35,9 @@ Public Class CSVPage
|
||||
' Leggo lista pezzi corrente
|
||||
Dim sCsvFile As String = String.Empty
|
||||
GetPrivateProfileString(S_CSV, K_CSVLASTFILE, "", sCsvFile, m_MainWindow.GetIniFile())
|
||||
LoadCsvPartList(sCsvFile)
|
||||
If Not String.IsNullOrEmpty(sCsvFile) Then
|
||||
LoadCsvPartList(sCsvFile)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CSVPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
@@ -463,6 +465,11 @@ Public Class CSVPage
|
||||
End Function
|
||||
|
||||
Friend Sub SaveCsvPartList()
|
||||
' Se non c'è nulla di attivo, non faccio alcunché
|
||||
If String.IsNullOrEmpty(m_sCsvPath) Then
|
||||
EgtOutLog("CSV List missing")
|
||||
Return
|
||||
End If
|
||||
' Path del file
|
||||
Dim sFile As String = Path.ChangeExtension(m_sCsvPath, ".epl")
|
||||
' Gestione file
|
||||
@@ -496,7 +503,7 @@ Public Class CSVPage
|
||||
WritePrivateProfileString(S_CSV, K_CSVLASTFILE, sFile, m_MainWindow.GetIniFile())
|
||||
' Errore
|
||||
Catch ex As Exception
|
||||
EgtOutLog("Error writing " & sFile)
|
||||
EgtOutLog("CSV List error writing " & sFile)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -62,6 +62,12 @@ Public Class CadCutPageUC
|
||||
Else
|
||||
m_ProjectMgr.CSVBtn.Visibility = Windows.Visibility.Hidden
|
||||
End If
|
||||
' Se abilitato, visualizzo bottone VeinMatching
|
||||
If GetPrivateProfileInt(S_VEINMATCHING, K_VEINMA_ENABLE, 0, m_MainWindow.GetIniFile()) <> 0 Then
|
||||
m_ProjectMgr.VeinMatchingBtn.Visibility = Windows.Visibility.Visible
|
||||
Else
|
||||
m_ProjectMgr.VeinMatchingBtn.Visibility = Windows.Visibility.Hidden
|
||||
End If
|
||||
' Seleziono UserControl di apertura
|
||||
CadCutPageGrid.Children.Add(m_NestPage)
|
||||
m_CadCutMode = CadCutModes.Nest
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Module CamAuto
|
||||
Friend Module CamAuto
|
||||
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
|
||||
|
||||
@@ -151,6 +151,8 @@ Module ConstGen
|
||||
Public Const INFO_CSV_PATH As String = "CsvPath"
|
||||
' Info in pezzo con suo nome in Csv
|
||||
Public Const INFO_CSV_PART As String = "CsvPart"
|
||||
' Nome layer per valori angoli di inclinazione dei lati
|
||||
Public Const SIDE_ANGLE_LAYER As String = "SideAngle"
|
||||
|
||||
' Nome di pezzo che è una cornice
|
||||
Public Const NAME_FRAME As String = "Frame"
|
||||
|
||||
@@ -138,4 +138,8 @@ Module ConstIni
|
||||
Public Const S_COPYTEMPLATE As String = "CopyTemplate"
|
||||
Public Const K_CPTCURRDIR As String = "CurrDir"
|
||||
|
||||
Public Const S_VEINMATCHING As String = "VeinMatching"
|
||||
Public Const K_VEINMA_ENABLE As String = "Enable"
|
||||
Public Const K_VEINMA_PLACE As String = "WinPlace"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
Public Const K_DELTA_C As String = "DeltaC"
|
||||
Public Const K_ININCHES As String = "InInches"
|
||||
|
||||
Public Const S_NCSIEMENS As String = "NcSiemens"
|
||||
Public Const K_COMM_NAME As String = "CommName"
|
||||
Public Const K_PATH_HMI As String = "PathHmi"
|
||||
|
||||
Public Const S_NCDATA As String = "NcData"
|
||||
Public Const K_MODE As String = "Mode"
|
||||
Public Const K_JOGINCR As String = "JogIncr"
|
||||
|
||||
+4
-4
@@ -474,14 +474,14 @@ Public Class DrawPageUC
|
||||
EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
|
||||
' Ricavo nome layer con testi inclinazioni
|
||||
Dim TextLayer As Integer = EgtGetFirstNameInGroup(nId2, SideAngleUC.SIDE_ANGLE_LAYER)
|
||||
Dim TextLayer As Integer = EgtGetFirstNameInGroup(nId2, SIDE_ANGLE_LAYER)
|
||||
' Se presente lo svuoto
|
||||
If TextLayer <> GDB_ID.NULL Then
|
||||
EgtEmptyGroup(TextLayer)
|
||||
' altrimenti lo creo
|
||||
Else
|
||||
TextLayer = EgtCreateGroup(nId2)
|
||||
EgtSetName(TextLayer, SideAngleUC.SIDE_ANGLE_LAYER)
|
||||
EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
|
||||
End If
|
||||
' Modifico inclinazione lati
|
||||
For Each Entity In m_SideAngle.m_SideAngleEntityList
|
||||
@@ -546,14 +546,14 @@ Public Class DrawPageUC
|
||||
EgtGetBBoxGlob(nOutLoopLayer, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
|
||||
' Ricavo nome layer con testi inclinazioni
|
||||
Dim TextLayer As Integer = EgtGetFirstNameInGroup(Pz, SideAngleUC.SIDE_ANGLE_LAYER)
|
||||
Dim TextLayer As Integer = EgtGetFirstNameInGroup(Pz, SIDE_ANGLE_LAYER)
|
||||
' Se presente lo svuoto
|
||||
If TextLayer <> GDB_ID.NULL Then
|
||||
EgtEmptyGroup(TextLayer)
|
||||
' altrimenti lo creo
|
||||
Else
|
||||
TextLayer = EgtCreateGroup(Pz)
|
||||
EgtSetName(TextLayer, SideAngleUC.SIDE_ANGLE_LAYER)
|
||||
EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
|
||||
End If
|
||||
' Modifico inclinazione lati
|
||||
For Each Entity In m_SideAngle.m_SideAngleEntityList
|
||||
|
||||
@@ -72,8 +72,9 @@ Public Class FrameCutPageUC
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
m_CurrMachine = m_MainWindow.m_CurrentMachine
|
||||
m_bActive = True
|
||||
' Nascondo bottone CSV
|
||||
' Nascondo bottoni CSV e VeinMatching
|
||||
m_ProjectMgr.CSVBtn.Visibility = Windows.Visibility.Hidden
|
||||
m_ProjectMgr.VeinMatchingBtn.Visibility = Windows.Visibility.Hidden
|
||||
' Recupero dimensioni e kerf del grezzo
|
||||
m_nRawId = EgtGetFirstRawPart()
|
||||
GetRawBox(m_RawBox)
|
||||
|
||||
+15
-6
@@ -486,6 +486,10 @@ Public Class ImportPageUC
|
||||
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
' Se import per pezzi piatti
|
||||
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
|
||||
' Ricavo nome pezzo selezionato per cancellarne i testi
|
||||
Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_nSelectedPart
|
||||
EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
|
||||
' Eseguo importazione pezzi piatti
|
||||
LoadFlatParts()
|
||||
' altrimenti import per cornici
|
||||
Else
|
||||
@@ -498,11 +502,12 @@ Public Class ImportPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub LoadFlatParts()
|
||||
' Ricavo nome pezzo selezionato per cancellarne i testi
|
||||
Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_nSelectedPart
|
||||
EgtErase(EgtGetFirstNameInGroup(Part1, SideAngleUC.SIDE_ANGLE_LAYER))
|
||||
' Scrivo testi per nesting
|
||||
m_SideAngleUC.WriteSideAngleForNest()
|
||||
m_SideAngleUC.WriteSideAngleForNest(ImportScene.GetCtx())
|
||||
' Imposto riferimento sul centro geometrico di ogni pezzo
|
||||
VeinMatching.SetRefOnAllParts(ImportScene.GetCtx())
|
||||
' Eventuale pulizia VeinMatching
|
||||
VeinMatching.Clear()
|
||||
' Vettore nomi file temporanei
|
||||
Dim sTmpFiles As New ArrayList()
|
||||
' Ciclo di salvataggio dei pezzi
|
||||
@@ -526,7 +531,7 @@ Public Class ImportPageUC
|
||||
' Ciclo di caricamento dei pezzi
|
||||
For Each sTmpfile As String In sTmpFiles
|
||||
If My.Computer.FileSystem.FileExists(sTmpfile) Then
|
||||
' Inserisco il pezzo
|
||||
' Inserisco il pezzo nell'ambiente principale
|
||||
EgtInsertFile(sTmpfile)
|
||||
' Ne recupero l'Id
|
||||
Dim nId2 As Integer = EgtGetLastPart()
|
||||
@@ -535,6 +540,8 @@ Public Class ImportPageUC
|
||||
EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
|
||||
' Inserisco in parcheggio
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.StoreOnePart(nId2, True)
|
||||
' Eventuale inserimento pezzo in VeinMatching
|
||||
VeinMatching.AddPart(sTmpfile, nId2)
|
||||
' Se richiesto posizionamento diretto, lo eseguo
|
||||
If bDirect Then
|
||||
m_MainWindow.m_CadCutPageUC.m_NestPage.InsertOnePart(nId2)
|
||||
@@ -543,6 +550,8 @@ Public Class ImportPageUC
|
||||
My.Computer.FileSystem.DeleteFile(sTmpfile)
|
||||
End If
|
||||
Next
|
||||
' Eventuale aggiornamento VeinMatching
|
||||
VeinMatching.ZoomAll()
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
@@ -601,7 +610,7 @@ Public Class ImportPageUC
|
||||
LeftGrid.Children.Remove(m_SideAngleUC)
|
||||
' Ricavo nome pezzo selezionato
|
||||
Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_nSelectedPart
|
||||
EgtErase(EgtGetFirstNameInGroup(Part1, SideAngleUC.SIDE_ANGLE_LAYER))
|
||||
EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER))
|
||||
' Riabilito bottone reset
|
||||
ResetBtn.IsEnabled = True
|
||||
End If
|
||||
|
||||
@@ -221,6 +221,7 @@ Public Class MachiningDbPageUC
|
||||
NewMachiningItem.IsSelected = True
|
||||
MachiningFamily.IsExpanded = True
|
||||
m_OldItem = MachiningTreeView.SelectedItem
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
GetMachiningParams()
|
||||
@@ -240,6 +241,7 @@ Public Class MachiningDbPageUC
|
||||
NewMachiningItem.IsSelected = True
|
||||
GetMachiningParams()
|
||||
m_OldItem = MachiningTreeView.SelectedItem
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -251,9 +253,10 @@ Public Class MachiningDbPageUC
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
SetMachiningParams()
|
||||
EgtMdbSaveCurrMachining()
|
||||
Dim CurrTool As CustomItem = TryCast(m_OldItem, CustomItem)
|
||||
If CurrTool IsNot Nothing Then
|
||||
CurrTool.Name = NameTxBx.Text
|
||||
m_sMachiningName = NameTxBx.Text
|
||||
Dim Machining As CustomItem = TryCast(m_OldItem, CustomItem)
|
||||
If Machining IsNot Nothing Then
|
||||
Machining.Name = m_sMachiningName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -1019,22 +1022,22 @@ Public Class MachiningDbPageUC
|
||||
End Function
|
||||
|
||||
Private Sub NameTxBx_EgtClosed(sender As Object, e As EventArgs) Handles NameTxBx.EgtClosed
|
||||
' Elimino spazi iniziali e finali
|
||||
NameTxBx.Text = NameTxBx.Text.Trim()
|
||||
' Se cambiato nome
|
||||
If NameTxBx.Text <> m_sMachiningName Then
|
||||
' Imposto contesto macchina
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Se nome nuovo,lo assegno
|
||||
' Verifico se nome già esistente
|
||||
Dim TempName As String = NameTxBx.Text
|
||||
EgtMdbGetMachiningNewName(TempName)
|
||||
If TempName = NameTxBx.Text Then
|
||||
NameTxBx.Text = NameTxBx.Text
|
||||
Else
|
||||
' se già esistente, avviso e rifiuto
|
||||
If TempName <> NameTxBx.Text Then
|
||||
' Nome già utilizzato
|
||||
Dim InfoBox As New EgtMsgBox(m_MainWindow, "", EgtMsg(91104), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
|
||||
' Ripristino il precedente
|
||||
NameTxBx.Text = m_sMachiningName
|
||||
End If
|
||||
Else
|
||||
NameTxBx.Text = m_sMachiningName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
+11
-9
@@ -37,6 +37,7 @@ Class MainWindow
|
||||
Friend m_OptionsPageUC As OptionsPageUC
|
||||
|
||||
' Dichiarazione variabili direttori
|
||||
Private m_sExeRoot As String = String.Empty
|
||||
Private m_sDataRoot As String = String.Empty
|
||||
Private m_sConfigDir As String = String.Empty
|
||||
Private m_sResourcesDir As String = String.Empty
|
||||
@@ -105,6 +106,10 @@ Class MainWindow
|
||||
Options
|
||||
End Enum
|
||||
|
||||
Public Function GetExeRootDir() As String
|
||||
Return m_sExeRoot
|
||||
End Function
|
||||
|
||||
Public Function GetIniFile() As String
|
||||
Return m_sIniFile
|
||||
End Function
|
||||
@@ -157,17 +162,18 @@ Class MainWindow
|
||||
Return ((m_nKeyOptions And nKeyOpt) <> 0)
|
||||
End Function
|
||||
|
||||
Friend Function GetKeyOptions() As UInteger
|
||||
Friend Function GetKeyOptions() As UInteger
|
||||
Return m_nKeyOptions
|
||||
End Function
|
||||
|
||||
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Verifico sia l'unica istanza
|
||||
ManageSingleIstance()
|
||||
' Imposto path di esecuzione
|
||||
m_sExeRoot = System.AppDomain.CurrentDomain.BaseDirectory.TrimEnd("\".ToCharArray())
|
||||
' Impostazione path radice per i dati
|
||||
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
|
||||
If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
|
||||
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
|
||||
If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sExeRoot & "\" & DAT_FILE_NAME) = 0 Then
|
||||
m_sDataRoot = m_sExeRoot
|
||||
End If
|
||||
' Impostazione direttorio di configurazione
|
||||
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
|
||||
@@ -261,11 +267,7 @@ Class MainWindow
|
||||
Dim bMM As Boolean = (GetPrivateProfileInt(S_GENERAL, K_MMUNITS, 1, m_sIniFile) <> 0)
|
||||
EgtSetUiUnits(bMM)
|
||||
' Imposto posizione e dimensioni della MainWindow
|
||||
Dim nFlag As Integer
|
||||
Dim nLeft As Integer
|
||||
Dim nTop As Integer
|
||||
Dim nWidth As Integer
|
||||
Dim nHeight As Integer
|
||||
Dim nFlag, nLeft, nTop, nWidth, nHeight As Integer
|
||||
GetPrivateProfileWinPos(S_GENERAL, K_WINPLACE, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile)
|
||||
Me.WindowStartupLocation = Windows.WindowStartupLocation.Manual
|
||||
Me.Top = nTop
|
||||
|
||||
+65
-1
@@ -133,7 +133,7 @@ Public Class NestPageUC
|
||||
If Not m_bActive Then Return
|
||||
' Se drag non abilitato o già in esecuzione, esco
|
||||
If Not m_bDrag Or m_bDragging Then Return
|
||||
' Se primo movimento di drag, verifico si aver superato la soglia di movimento in pixel
|
||||
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
|
||||
If m_bDragToStart Then
|
||||
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
|
||||
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
|
||||
@@ -180,6 +180,16 @@ Public Class NestPageUC
|
||||
End If
|
||||
EgtDraw()
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
' Eventuale notifica al VeinMatching
|
||||
If nMoveId = GDB_ID.SEL Then
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Else
|
||||
VeinMatching.OnMovePartInRaw(nMoveId)
|
||||
End If
|
||||
End If
|
||||
' Aggiorno il punto precedente
|
||||
'm_ptPrev += vtMove
|
||||
@@ -233,6 +243,7 @@ Public Class NestPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub UpBtn_Click(sender As Object, e As RoutedEventArgs) Handles UpBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Aggiorno regioni per nesting
|
||||
UpdateNestRegions()
|
||||
' eseguo movimento
|
||||
@@ -251,9 +262,16 @@ Public Class NestPageUC
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub DownBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Aggiorno regioni per nesting
|
||||
UpdateNestRegions()
|
||||
' eseguo movimento
|
||||
@@ -272,9 +290,16 @@ Public Class NestPageUC
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub RightBtn_Click(sender As Object, e As RoutedEventArgs) Handles RightBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Aggiorno regioni per nesting
|
||||
UpdateNestRegions()
|
||||
' eseguo movimento
|
||||
@@ -293,9 +318,16 @@ Public Class NestPageUC
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub LeftBtn_Click(sender As Object, e As RoutedEventArgs) Handles LeftBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Aggiorno regioni per nesting
|
||||
UpdateNestRegions()
|
||||
' eseguo movimento
|
||||
@@ -314,18 +346,38 @@ Public Class NestPageUC
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub RotateCounterClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateCounterClockwiseBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
RotateCluster(m_dAngStep)
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub RotateClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateClockwiseBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
RotateCluster(-m_dAngStep)
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
EgtDraw()
|
||||
' Eventuale notifica al VeinMatching
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
VeinMatching.OnMovePartInRaw(nId)
|
||||
nId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Function RotateCluster(ByVal dAngRotDeg As Double) As Boolean
|
||||
@@ -357,6 +409,7 @@ Public Class NestPageUC
|
||||
End Function
|
||||
|
||||
Private Sub InsertPartBtn_Click(sender As Object, e As RoutedEventArgs) Handles InsertPartBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Ciclo di inserimento in tavola dei pezzi selezionati
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
@@ -408,6 +461,8 @@ Public Class NestPageUC
|
||||
End If
|
||||
' Gestione risultato nesting
|
||||
If bFit Then
|
||||
' Eventuale notifica al VeinMatching
|
||||
VeinMatching.OnInsertPartInRaw(nId)
|
||||
Return True
|
||||
Else
|
||||
EraseMachinings(nId)
|
||||
@@ -431,6 +486,7 @@ Public Class NestPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub StorePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles StorePartBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Ciclo di parcheggio dei pezzi selezionati
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
While nId <> GDB_ID.NULL
|
||||
@@ -438,6 +494,8 @@ Public Class NestPageUC
|
||||
Dim nNextId = EgtGetNextSelectedObj()
|
||||
' Metto in parcheggio, se in grezzo
|
||||
StoreOnePart(nId)
|
||||
' Eventuale notifica al VeinMatching
|
||||
VeinMatching.OnRemovePartFromRaw(nId)
|
||||
' Passo al successivo selezionato
|
||||
nId = nNextId
|
||||
End While
|
||||
@@ -485,6 +543,7 @@ Public Class NestPageUC
|
||||
End Function
|
||||
|
||||
Private Sub RemovePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemovePartBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Verifico se ci sono pezzi provenienti da liste Csv
|
||||
Dim bCsvParts As Boolean = False
|
||||
Dim nId As Integer = EgtGetFirstSelectedObj()
|
||||
@@ -526,6 +585,8 @@ Public Class NestPageUC
|
||||
' Altrimenti pezzo nel grezzo
|
||||
ElseIf EgtGetParent(nId) = m_nRawId Then
|
||||
If EgtRemovePartFromRawPart(nId) Then
|
||||
' Eventuale notifica al VeinMatching
|
||||
VeinMatching.OnRemovePartFromRaw(nId)
|
||||
' Rimuovo le lavorazioni
|
||||
EraseMachinings(nId)
|
||||
'Cancello
|
||||
@@ -543,6 +604,7 @@ Public Class NestPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub SelectAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles SelectAllBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Se già selezionati in tavola o non ci sono selezionati
|
||||
If m_nPartPos = PART_POS.IN_TABLE Or m_nPartPos = PART_POS.NONE_TABLE Then
|
||||
' Seleziono tutti i pezzi in tavola
|
||||
@@ -567,6 +629,7 @@ Public Class NestPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub DeselectAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles DeselectAllBtn.Click
|
||||
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
|
||||
' Eseguo
|
||||
EgtDeselectAll()
|
||||
' Imposto flag posizione pezzi
|
||||
@@ -591,6 +654,7 @@ Public Class NestPageUC
|
||||
|
||||
Private Sub NestPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
m_bActive = False
|
||||
m_MainWindow.m_CadCutPageUC.m_ProjectMgr.VeinMatchingHide()
|
||||
End Sub
|
||||
|
||||
Private Sub MagneticPiecesBtn_Click(sender As Object, e As RoutedEventArgs) Handles MagneticPiecesBtn.Click
|
||||
|
||||
@@ -275,6 +275,10 @@
|
||||
</Compile>
|
||||
<Compile Include="Utility.vb" />
|
||||
<Compile Include="VacuumCups.vb" />
|
||||
<Compile Include="VeinMatchingWindow.xaml.vb">
|
||||
<DependentUpon>VeinMatchingWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WorkInProgressPageUC.xaml.vb">
|
||||
<DependentUpon>WorkInProgressPageUC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -468,6 +472,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="VeinMatchingWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WorkInProgressPageUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
+7
-4
@@ -12,7 +12,8 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
@@ -31,11 +32,13 @@
|
||||
|
||||
<Button Name="CSVBtn" Grid.Column="4"
|
||||
Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
<Button Name="ResetCutBtn" Grid.Column="5"
|
||||
<ToggleButton Name="VeinMatchingBtn" Grid.Column="5"
|
||||
Style="{StaticResource OmagCut_YellowToggleButton}"/>
|
||||
<Button Name="ResetCutBtn" Grid.Column="7"
|
||||
Style="{StaticResource OmagCut_YellowTextButton}"/>
|
||||
|
||||
<Button Name="SimulateBtn" Grid.Column="7" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
|
||||
<Button Name="WorkBtn" Grid.Column="8" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
|
||||
<Button Name="SimulateBtn" Grid.Column="8" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
|
||||
<Button Name="WorkBtn" Grid.Column="9" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Public Class ProjectMgrUC
|
||||
Private m_CurrProjPage As CurrentProjectPageUC
|
||||
Private m_CurrMachine As CurrentMachine
|
||||
Private m_CurrNcComm As CNCommunication
|
||||
Private m_VeinMatchingWnd As VeinMatchingWindow = Nothing
|
||||
|
||||
' Riferimento alla finestra di salvataggio con nome
|
||||
Friend m_SaveNameWD As SaveNameWD
|
||||
@@ -20,15 +21,27 @@ Public Class ProjectMgrUC
|
||||
SaveBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 5)
|
||||
SaveNameBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 6)
|
||||
CSVBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 8)
|
||||
VeinMatchingBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 9)
|
||||
ResetCutBtn.Content = EgtMsg(MSG_NESTPAGEUC + 6)
|
||||
SimulateBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 1) 'Simulate - Simula
|
||||
WorkBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 2) 'Work - Lavora
|
||||
End Sub
|
||||
|
||||
Private Sub ProjectMgrUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
' Impostazioni
|
||||
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
||||
m_CurrMachine = m_MainWindow.m_CurrentMachine
|
||||
m_CurrNcComm = m_MainWindow.m_CNCommunication
|
||||
' Se richiesto carico finestra per VeinMatching
|
||||
If GetPrivateProfileInt(S_VEINMATCHING, K_VEINMA_ENABLE, 0, m_MainWindow.GetIniFile()) <> 0 And
|
||||
IsNothing(m_VeinMatchingWnd) Then
|
||||
m_VeinMatchingWnd = New VeinMatchingWindow
|
||||
m_VeinMatchingWnd.Owner = m_MainWindow
|
||||
m_VeinMatchingWnd.Show()
|
||||
m_VeinMatchingWnd.Hide()
|
||||
VeinMatching.m_nVeinCtx = GetVeinMatchingContext()
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
|
||||
@@ -199,6 +212,7 @@ Public Class ProjectMgrUC
|
||||
|
||||
Private Sub WorkBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkBtn.Click
|
||||
Dim bOk As Boolean = True
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Verifico l'attrezzaggio degli utensili utilizzati
|
||||
Dim sMissingTools As String = String.Empty
|
||||
If Not VerifySetup(sMissingTools) Then
|
||||
@@ -341,4 +355,36 @@ Public Class ProjectMgrUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub VeinMatchingBtn_Click(sender As Object, e As RoutedEventArgs) Handles VeinMatchingBtn.Click
|
||||
If VeinMatchingBtn.IsChecked Then
|
||||
VeinMatchingShow()
|
||||
Else
|
||||
VeinMatchingHide()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function GetVeinMatchingContext() As Integer
|
||||
If IsNothing(m_VeinMatchingWnd) Then Return 0
|
||||
Return m_VeinMatchingWnd.VeinMatchingScene.GetCtx()
|
||||
End Function
|
||||
|
||||
Friend Sub VeinMatchingShow()
|
||||
' Se non già creata, non devo fare alcunchè
|
||||
If IsNothing(m_VeinMatchingWnd) Then Return
|
||||
' Esecuzione
|
||||
m_VeinMatchingWnd.AdjustPosition()
|
||||
m_VeinMatchingWnd.Show()
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
VeinMatchingBtn.IsChecked = True
|
||||
End Sub
|
||||
|
||||
Friend Sub VeinMatchingHide()
|
||||
' Se non già creata, non devo fare alcunchè
|
||||
If IsNothing(m_VeinMatchingWnd) Then Return
|
||||
' Esecuzione
|
||||
m_VeinMatchingWnd.Hide()
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
VeinMatchingBtn.IsChecked = False
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
+3
-6
@@ -6,8 +6,6 @@ Public Class SideAngleUC
|
||||
Friend Const COMPO_LAYER_AUX As String = "LayAux"
|
||||
Friend Const COMPO_LAYER_QUOTATURE As String = "Quotature"
|
||||
Friend Const COMPO_LAYER_ETICHETTE As String = "Etichette"
|
||||
' Costanti testi angoli inclinati
|
||||
Friend Const SIDE_ANGLE_LAYER As String = "SideAngle"
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
@@ -520,9 +518,9 @@ Public Class SideAngleUC
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Sub WriteSideAngleForNest()
|
||||
Friend Sub WriteSideAngleForNest(nCtx As Integer)
|
||||
' Imposto contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_ImportPageUC.ImportScene.GetCtx())
|
||||
EgtSetCurrentContext(nCtx)
|
||||
Dim CurrPart As Integer
|
||||
CurrPart = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
While CurrPart <> GDB_ID.NULL
|
||||
@@ -535,9 +533,8 @@ Public Class SideAngleUC
|
||||
' Creo layer per testi nesting
|
||||
Dim TextLayer As Integer = EgtCreateGroup(CurrPart)
|
||||
EgtSetName(TextLayer, SIDE_ANGLE_LAYER)
|
||||
|
||||
Dim CurrLine As Integer = EgtGetFirstInGroup(OutLoop)
|
||||
' Ciclo che verifica se possibile inclinare la linea corrente fino alla penultima
|
||||
Dim CurrLine As Integer = EgtGetFirstInGroup(OutLoop)
|
||||
While CurrLine <> GDB_ID.NULL
|
||||
Dim dSideAngle As Double = 0
|
||||
EgtGetInfo(CurrLine, INFO_SIDE_ANGLE, dSideAngle)
|
||||
|
||||
+47
-13
@@ -228,13 +228,14 @@ Public Class ToolsDbPageUC
|
||||
NewToolItem.IsSelected = True
|
||||
ToolFamily.IsExpanded = True
|
||||
m_OldItem = ToolTreeView.SelectedItem
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
' Determino il tipo di utensile
|
||||
Dim nType As Integer
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nType)
|
||||
Dim bSaw As Boolean = ((nType And MCH_TF.SAWBLADE) <> 0)
|
||||
' Imposto testa e uscita
|
||||
' determino il tipo di utensile
|
||||
Dim nTemp As Integer
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nTemp)
|
||||
Dim bSaw As Boolean = ((nTemp And MCH_TF.SAWBLADE) <> 0)
|
||||
' Per macchine con ToolChanger lame su H1.1 e altri utensili su H2.1
|
||||
If m_CurrMachine.bShowToolChanger Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.HEAD, If(bSaw, "H1", "H2"))
|
||||
@@ -248,6 +249,28 @@ Public Class ToolsDbPageUC
|
||||
If Not m_CurrMachine.bShowToolChanger Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TCPOS, "")
|
||||
End If
|
||||
' Imposto dimensioni standard
|
||||
If (nType And MCH_TF.DRILLBIT) <> 0 Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.LEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DIAM, 20.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, 20.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, 40.0)
|
||||
ElseIf (nType And MCH_TF.SAWBLADE) <> 0 Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.LEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DIAM, 600.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, 600.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.THICK, 5.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, 40.0)
|
||||
ElseIf (nType And MCH_TF.MILL) <> 0 Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.LEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, 80.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DIAM, 20.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, 20.0)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, 40.0)
|
||||
End If
|
||||
' Salvo e aggiorno interfaccia utente
|
||||
EgtTdbSaveCurrTool()
|
||||
GetToolParams()
|
||||
ViewToolParams()
|
||||
@@ -258,6 +281,12 @@ Public Class ToolsDbPageUC
|
||||
Dim NewName As String = SelectedCathegory.Name
|
||||
EgtTdbGetToolNewName(NewName)
|
||||
If EgtTdbCopyTool(SelectedCathegory.Name, NewName) Then
|
||||
' Annullo disegno
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DRAW, "")
|
||||
EgtTdbSaveCurrTool()
|
||||
' Ricalcolo disegno (creo file con nuovo nome)
|
||||
SaveToolDraw()
|
||||
' Aggiorno lista utensili
|
||||
Dim CurrType As Integer
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType)
|
||||
For Each ToolFamily In ToolsList
|
||||
@@ -267,6 +296,7 @@ Public Class ToolsDbPageUC
|
||||
NewToolItem.IsSelected = True
|
||||
GetToolParams()
|
||||
m_OldItem = ToolTreeView.SelectedItem
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -279,9 +309,10 @@ Public Class ToolsDbPageUC
|
||||
SetToolParams()
|
||||
EgtTdbSaveCurrTool()
|
||||
SaveToolDraw()
|
||||
m_sToolName = NameTxBx.Text
|
||||
Dim CurrTool As CustomItem = TryCast(m_OldItem, CustomItem)
|
||||
If CurrTool IsNot Nothing Then
|
||||
CurrTool.Name = NameTxBx.Text
|
||||
CurrTool.Name = m_sToolName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -831,7 +862,9 @@ Public Class ToolsDbPageUC
|
||||
End Function
|
||||
|
||||
Private Function SaveToolDraw() As Boolean
|
||||
If m_nToolType = MCH_TY.DRILL_STD Or m_nToolType = MCH_TY.SAW_STD Or m_nToolType = MCH_TY.MILL_STD Then
|
||||
If m_nToolType = MCH_TY.DRILL_STD Or
|
||||
m_nToolType = MCH_TY.SAW_STD Or
|
||||
m_nToolType = MCH_TY.MILL_STD Then
|
||||
' nome e direttorio del file da salvare
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
Dim sDrawName As String = String.Empty
|
||||
@@ -896,9 +929,10 @@ Public Class ToolsDbPageUC
|
||||
Case 1 ' Si
|
||||
EgtTdbSaveCurrTool()
|
||||
SaveToolDraw()
|
||||
m_sToolName = NameTxBx.Text
|
||||
Dim CurrTool As CustomItem = TryCast(m_OldItem, CustomItem)
|
||||
If CurrTool IsNot Nothing Then
|
||||
CurrTool.Name = NameTxBx.Text
|
||||
CurrTool.Name = m_sToolName
|
||||
End If
|
||||
Case 2 ' No
|
||||
EgtTdbSetCurrTool(m_sToolName)
|
||||
@@ -909,22 +943,22 @@ Public Class ToolsDbPageUC
|
||||
End Function
|
||||
|
||||
Private Sub NameTxBx_EgtClosed(sender As Object, e As EventArgs) Handles NameTxBx.EgtClosed
|
||||
' Elimino spazi iniziali e finali
|
||||
NameTxBx.Text = NameTxBx.Text.Trim()
|
||||
' Se cambiato nome
|
||||
If NameTxBx.Text <> m_sToolName Then
|
||||
' Imposto contesto macchina
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Se nome nuovo,lo assegno
|
||||
' Verifico se nome già esistente
|
||||
Dim TempName As String = NameTxBx.Text
|
||||
EgtTdbGetToolNewName(TempName)
|
||||
If TempName = NameTxBx.Text Then
|
||||
NameTxBx.Text = NameTxBx.Text
|
||||
Else
|
||||
' se già esistente, avviso e rifiuto
|
||||
If TempName <> NameTxBx.Text Then
|
||||
' Nome già utilizzato
|
||||
Dim InfoBox As New EgtMsgBox(m_MainWindow, "", EgtMsg(91104), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
|
||||
' Ripristino il precedente
|
||||
NameTxBx.Text = m_sToolName
|
||||
End If
|
||||
Else
|
||||
NameTxBx.Text = m_sToolName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<Window x:Class="VeinMatchingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
TextBlock.FontFamily="./Resources/Fonts/#Century Gothic"
|
||||
Height="500" Width="500" ShowInTaskbar="False" Topmost="True" Initialized="Window_Initialized" MinWidth="300" MinHeight="300">
|
||||
|
||||
<Grid Name="VeinMatchingGrid" Background="{StaticResource OmagCut_Gray}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="91"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Name="NewBtn" Grid.Column="5" Height="64"
|
||||
Style="{StaticResource OmagCut_YellowTextButton}"
|
||||
Content="New"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,444 @@
|
||||
Imports System.Windows.Interop
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class VeinMatchingWindow
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
Private m_bFirst As Boolean = True
|
||||
Private m_bPositioned As Boolean = False
|
||||
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents VeinMatchingScene As New Scene
|
||||
Private VeinMatchingSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
|
||||
Private Sub Window_Initialized(sender As Object, e As EventArgs)
|
||||
' Assegnazione scena all'host e posizionamento nella PlacePageGrid
|
||||
VeinMatchingSceneHost.Child = VeinMatchingScene
|
||||
VeinMatchingSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
Me.VeinMatchingGrid.Children.Add(VeinMatchingSceneHost)
|
||||
' Per non farla visualizzare alla creazione
|
||||
Me.Left = 32000
|
||||
End Sub
|
||||
|
||||
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
If m_bFirst Then
|
||||
' Imposto finestra senza SystemMenu
|
||||
Dim hwnd As IntPtr = New WindowInteropHelper(Me).Handle
|
||||
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) And Not WS_SYSMENU)
|
||||
' imposto colore di default
|
||||
Dim DefColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetDefaultMaterial(DefColor)
|
||||
' imposto colori sfondo
|
||||
Dim BackTopColor As New Color3d(211, 211, 211)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
|
||||
Dim BackBotColor As New Color3d(211, 211, 211)
|
||||
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetViewBackground(BackTopColor, BackBotColor)
|
||||
' imposto colore di evidenziazione
|
||||
Dim MarkColor As New Color3d(255, 255, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetMarkMaterial(MarkColor)
|
||||
' imposto colore per superfici selezionate
|
||||
Dim SelSurfColor As New Color3d(255, 255, 192)
|
||||
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetSelSurfMaterial(SelSurfColor)
|
||||
' imposto tipo e colore del rettangolo di zoom
|
||||
Dim bOutline As Boolean = True
|
||||
Dim ZwColor As New Color3d(0, 0, 0)
|
||||
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetZoomWinAttribs(bOutline, ZwColor)
|
||||
' imposto colore della linea di distanza
|
||||
Dim DstLnColor As New Color3d(255, 0, 0)
|
||||
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetDistLineMaterial(DstLnColor)
|
||||
' imposto parametri OpenGL
|
||||
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
|
||||
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
|
||||
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
|
||||
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
|
||||
VeinMatchingScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
||||
' inizializzo la scena (DB geometrico + visualizzazione) e verifico presenza chiave
|
||||
If Not VeinMatchingScene.Init() Then
|
||||
m_MainWindow.m_CadCutPageUC.m_ProjectMgr.VeinMatchingBtn.IsChecked = False
|
||||
Me.Close()
|
||||
End If
|
||||
m_bFirst = False
|
||||
End If
|
||||
|
||||
' inibisco selezione diretta da Scene
|
||||
VeinMatchingScene.SetStatusNull()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Window_Closed(sender As Object, e As EventArgs) Handles Me.Closed
|
||||
' Salvo posizione Window (se posizionata e non minimizzata)
|
||||
If m_bPositioned And Me.WindowState <> WindowState.Minimized Then
|
||||
Dim nFlag As Integer = If(Me.WindowState = WindowState.Maximized, 1, 0)
|
||||
WritePrivateProfileWinPos(S_VEINMATCHING, K_VEINMA_PLACE, nFlag, CInt(Me.Left), CInt(Me.Top), CInt(Me.Width), CInt(Me.Height), m_MainWindow.GetIniFile())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub AdjustPosition()
|
||||
' Se già pozizionata, esco subito
|
||||
If m_bPositioned Then Return
|
||||
' Imposto posizione e dimensioni della MainWindow da INI
|
||||
Dim nFlag, nLeft, nTop, nWidth, nHeight As Integer
|
||||
If GetPrivateProfileWinPos(S_VEINMATCHING, K_VEINMA_PLACE, nFlag, nLeft, nTop, nWidth, nHeight, m_MainWindow.GetIniFile()) Then
|
||||
Dim PtTL = New System.Drawing.Point(nLeft, nTop)
|
||||
Dim s As System.Windows.Forms.Screen = System.Windows.Forms.Screen.FromPoint(PtTL)
|
||||
If s.Bounds.Contains(PtTL) Then
|
||||
Me.WindowStartupLocation = Windows.WindowStartupLocation.Manual
|
||||
Me.Top = nTop
|
||||
Me.Left = nLeft
|
||||
Me.Height = nHeight
|
||||
Me.Width = nWidth
|
||||
Me.WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal)
|
||||
m_bPositioned = True
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' Imposto in posizione standard
|
||||
Me.WindowStartupLocation = Windows.WindowStartupLocation.Manual
|
||||
Me.Top = m_MainWindow.Top
|
||||
Me.Left = m_MainWindow.Left
|
||||
Me.Height = nHeight
|
||||
Me.Width = nWidth
|
||||
Me.WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal)
|
||||
m_bPositioned = True
|
||||
End Sub
|
||||
|
||||
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
|
||||
VeinMatching.Clear()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Module VeinMatching
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
' Contesto del VeinMatching
|
||||
Friend m_nVeinCtx As Integer = 0
|
||||
|
||||
' Costanti
|
||||
Const REF_NAME As String = "Ref"
|
||||
Const ORI_REF_KEY As String = "OriRef"
|
||||
Const ORI_ID_KEY As String = "OriId"
|
||||
|
||||
Friend Function SetRefOnAllParts(nCtx As Integer) As Boolean
|
||||
' Si opera nel contesto indicato
|
||||
EgtSetCurrentContext(nCtx)
|
||||
Dim nId As Integer = EgtGetFirstPart()
|
||||
While nId <> GDB_ID.NULL
|
||||
' Gruppo regione
|
||||
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_REGION)
|
||||
' Entità superficie regione piatta
|
||||
Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId)
|
||||
While nRegId <> GDB_ID.NULL
|
||||
If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then
|
||||
Exit While
|
||||
End If
|
||||
nRegId = EgtGetNext(nRegId)
|
||||
End While
|
||||
' Ne recupero il centroide
|
||||
Dim ptCen As Point3d
|
||||
EgtCentroid(nRegId, GDB_ID.ROOT, ptCen)
|
||||
' Inserisco il riferimento
|
||||
Dim frRef As New Frame3d(ptCen)
|
||||
Dim nRefId As Integer = EgtCreateGeoFrame(nRegLayId, frRef, GDB_RT.GLOB)
|
||||
EgtSetName(nRefId, REF_NAME)
|
||||
' salvo nelle info il riferimento originale
|
||||
EgtSetInfo(nRefId, ORI_REF_KEY, frRef)
|
||||
' nascondo l'oggetto appena inserito
|
||||
EgtSetMode(nRefId, GDB_MD.HIDDEN)
|
||||
' Passo al pezzo successivo
|
||||
nId = EgtGetNextPart(nId)
|
||||
End While
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function Clear() As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return False
|
||||
' Pulisco il DB
|
||||
EgtNewFile()
|
||||
EgtDraw()
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function AddPart(sPartFile As String, nPartId As Integer) As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Imposto VeinMatching context
|
||||
Dim nMainCtx = SetVeinContext()
|
||||
If nMainCtx = 0 Then Return False
|
||||
' Inserisco il pezzo
|
||||
EgtInsertFile(sPartFile)
|
||||
' Ne recupero l'Id
|
||||
Dim nVeinId2 As Integer = EgtGetLastPart()
|
||||
' Assegno Id originale
|
||||
EgtSetInfo(nVeinId2, ORI_ID_KEY, nPartId)
|
||||
' Nascondo scritte, sono nel layer "Region"
|
||||
Dim nVeinRegId As Integer = EgtGetFirstNameInGroup(nVeinId2, NAME_REGION)
|
||||
Dim nCurrId As Integer = EgtGetFirstInGroup(nVeinRegId)
|
||||
While nCurrId <> GDB_ID.NULL
|
||||
If EgtGetType(nCurrId) = GDB_TY.EXT_TEXT Then EgtSetStatus(nCurrId, GDB_ST.OFF)
|
||||
nCurrId = EgtGetNext(nCurrId)
|
||||
End While
|
||||
' Nascondo layer con valori angoli dei lati
|
||||
nCurrId = EgtGetFirstNameInGroup(nVeinId2, SIDE_ANGLE_LAYER)
|
||||
EgtSetStatus(nCurrId, GDB_ST.OFF)
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nMainCtx > 0 Then EgtSetCurrentContext(nMainCtx)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function OnInsertPartInRaw(nPartId As Integer) As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Recupero il contesto corrente (principale)
|
||||
Dim nMainCtx = EgtGetCurrentContext()
|
||||
' Se non c'è la fotografia, esco
|
||||
Dim nPhotoId As Integer = m_MainWindow.m_CurrentProjectPageUC.GetPhoto()
|
||||
If nPhotoId = GDB_ID.NULL Then Return True
|
||||
|
||||
' Verifico se esiste già la foto del progetto corrente nel VeinMatching
|
||||
Dim sPhoto As String = String.Empty
|
||||
EgtGetPhotoPath(nPhotoId, sPhoto)
|
||||
Dim sVeinPhoto As String = String.Empty
|
||||
GetVeinPhotoPath(sVeinPhoto)
|
||||
' Se necessario, copio la foto
|
||||
If String.Compare(sPhoto, sVeinPhoto, True) <> 0 Then
|
||||
If Not CopyPhoto(nPhotoId) Then Return False
|
||||
End If
|
||||
|
||||
' Recupero il pezzo nel VeinMatching
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
Dim nId = GetVeinPartId(nPartId)
|
||||
If nId <> GDB_ID.NULL Then
|
||||
' Recupero la regione del pezzo
|
||||
Dim nRegId As Integer = GetVeinPartRegionId(nId)
|
||||
' Gli assegno la texture della foto
|
||||
EgtSetTextureName(nRegId, PHOTO_NAME)
|
||||
' Sistemo il riferimento della texture
|
||||
Dim refTxr As New Frame3d
|
||||
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
|
||||
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
|
||||
' Sistemo il colore
|
||||
Dim colWhite As New Color3d(255, 255, 255, 100)
|
||||
EgtSetColor(nRegId, colWhite)
|
||||
End If
|
||||
EgtDraw()
|
||||
EgtSetCurrentContext(nMainCtx)
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function OnMovePartInRaw(nPartId As Integer) As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Recupero il contesto corrente (principale)
|
||||
Dim nMainCtx = EgtGetCurrentContext()
|
||||
' Se non c'è la fotografia, esco
|
||||
Dim nPhotoId As Integer = m_MainWindow.m_CurrentProjectPageUC.GetPhoto()
|
||||
If nPhotoId = GDB_ID.NULL Then Return True
|
||||
|
||||
' Recupero il pezzo nel VeinMatching
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
Dim nId = GetVeinPartId(nPartId)
|
||||
If nId <> GDB_ID.NULL Then
|
||||
' Recupero la regione del pezzo
|
||||
Dim nRegId As Integer = GetVeinPartRegionId(nId)
|
||||
' Sistemo il riferimento della texture
|
||||
Dim refTxr As New Frame3d
|
||||
GetVeinRefPhoto(nMainCtx, nPartId, nId, refTxr)
|
||||
EgtSetTextureFrame(nRegId, refTxr, GDB_RT.GLOB)
|
||||
End If
|
||||
EgtDraw()
|
||||
EgtSetCurrentContext(nMainCtx)
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function OnRemovePartFromRaw(nPartId As Integer) As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Recupero il contesto corrente (principale)
|
||||
Dim nMainCtx = EgtGetCurrentContext()
|
||||
' Se non c'è la fotografia, esco
|
||||
Dim nPhotoId As Integer = m_MainWindow.m_CurrentProjectPageUC.GetPhoto()
|
||||
If nPhotoId = GDB_ID.NULL Then Return True
|
||||
|
||||
' Tolgo la texture dal pezzo
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
Dim nId As Integer = GetVeinPartId(nPartId)
|
||||
If nId <> GDB_ID.NULL Then
|
||||
' Recupero la regione del pezzo
|
||||
Dim nRegId As Integer = GetVeinPartRegionId(nId)
|
||||
' Gli tolgo la texture
|
||||
EgtRemoveTextureData(nRegId)
|
||||
' Sistemo il colore
|
||||
Dim colAqua As New Color3d(0, 255, 255, 25)
|
||||
EgtSetColor(nRegId, colAqua)
|
||||
End If
|
||||
EgtDraw()
|
||||
EgtSetCurrentContext(nMainCtx)
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function ZoomAll() As Boolean
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return True
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return False
|
||||
' Eseguo Zoom
|
||||
EgtZoom(ZM.ALL)
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function CopyPhoto(nPhotoId As Integer) As Boolean
|
||||
' Recupero il contesto corrente
|
||||
Dim nCurrCtx = EgtGetCurrentContext()
|
||||
' Recupero i dati della fotografia
|
||||
Dim sPath As String = String.Empty
|
||||
EgtGetPhotoPath(nPhotoId, sPath)
|
||||
Dim ptOri As Point3d
|
||||
EgtGetPhotoOrigin(nPhotoId, ptOri)
|
||||
Dim ptCen As Point3d
|
||||
EgtGetPhotoCenter(nPhotoId, ptCen)
|
||||
Dim dMMxPixel As Double
|
||||
EgtGetPhotoMMxPixel(nPhotoId, dMMxPixel)
|
||||
Dim ptMin, ptMax As Point3d
|
||||
EgtGetBBoxGlob(nPhotoId, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
' Passo al contesto del VeinMatching
|
||||
EgtSetCurrentContext(m_nVeinCtx)
|
||||
' 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
|
||||
EgtSetCurrentContext(nCurrCtx)
|
||||
Return False
|
||||
End If
|
||||
EgtSetName(nPhGrpId, PHOTO_GRP)
|
||||
End If
|
||||
EgtSetLevel(nPhGrpId, GDB_LV.SYSTEM)
|
||||
EgtSetStatus(nPhGrpId, GDB_ST.OFF)
|
||||
' Carico la fotografia
|
||||
Dim nNewId As Integer = EgtAddPhoto(PHOTO_NAME, sPath, ptOri, ptCen, dMMxPixel, nPhGrpId, ptMin, ptMax)
|
||||
' Ritorno al contesto corrente
|
||||
EgtSetCurrentContext(nCurrCtx)
|
||||
Return nNewId <> GDB_ID.NULL
|
||||
End Function
|
||||
|
||||
Private Function SetVeinContext() As Integer
|
||||
' Verifico esista il contesto del VeinMatching
|
||||
If m_nVeinCtx = 0 Then Return 0
|
||||
' Recupero il contesto corrente
|
||||
Dim nCurrCtx = EgtGetCurrentContext()
|
||||
' Se necessario, cambio contesto
|
||||
If m_nVeinCtx <> nCurrCtx Then
|
||||
If EgtSetCurrentContext(m_nVeinCtx) Then
|
||||
Return nCurrCtx
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
Else
|
||||
Return -1
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function GetVeinPhoto() As Integer
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return GDB_ID.NULL
|
||||
' Recupero Id foto
|
||||
Dim nId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME)
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return nId
|
||||
End Function
|
||||
|
||||
Private Function GetVeinPhotoPath(ByRef sPath As String) As Boolean
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return False
|
||||
' Recupero path dell'immagine della foto
|
||||
Dim nId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME)
|
||||
Dim bOk As Boolean = EgtGetPhotoPath(nId, sPath)
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Function GetVeinRefPhoto(nMainCtx As Integer, nPartId As Integer, nVePartId As Integer, ByRef refPhoto As Frame3d)
|
||||
' Riferimento della foto rispetto al riferimento del pezzo nel contesto principale
|
||||
If Not EgtSetCurrentContext(nMainCtx) Then Return False
|
||||
' riferimento della foto in globale
|
||||
If Not m_MainWindow.m_CurrentProjectPageUC.GetPhotoTextureRef(refPhoto) Then Return False
|
||||
' riferimento del pezzo in globale
|
||||
Dim nRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nPartId, NAME_REGION), REF_NAME)
|
||||
Dim refPart As New Frame3d
|
||||
If Not EgtFrame(nRefId, GDB_ID.ROOT, refPart) Then Return False
|
||||
' porto il riferimento della foto in quello del pezzo
|
||||
refPhoto.ToLoc(refPart)
|
||||
' Riferimento della foto rispetto al riferimento del pezzo in VeinMatching
|
||||
If Not EgtSetCurrentContext(m_nVeinCtx) Then Return False
|
||||
' riferimento del pezzo in globale
|
||||
Dim nVeRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nVePartId, NAME_REGION), REF_NAME)
|
||||
Dim refVePart As New Frame3d
|
||||
If Not EgtFrame(nVeRefId, GDB_ID.ROOT, refVePart) Then Return False
|
||||
refPhoto.ToGlob(refVePart)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function GetVeinPartId(nPartId As Integer) As Integer
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return GDB_ID.NULL
|
||||
' Cerco il pezzo in Vein che corrisponde al pezzo desiderato
|
||||
Dim nId As Integer = EgtGetFirstPart()
|
||||
While nId <> GDB_ID.NULL
|
||||
Dim nOriId As Integer
|
||||
If EgtGetInfo(nId, ORI_ID_KEY, nOriId) AndAlso nOriId = nPartId Then
|
||||
Exit While
|
||||
End If
|
||||
nId = EgtGetNextPart(nId)
|
||||
End While
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return nId
|
||||
End Function
|
||||
|
||||
Private Function GetVeinPartRegionId(nVeinPartId As Integer) As Integer
|
||||
' Imposto VeinMatching context
|
||||
Dim nCurrCtx = SetVeinContext()
|
||||
If nCurrCtx = 0 Then Return GDB_ID.NULL
|
||||
' Gruppo regione
|
||||
Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nVeinPartId, NAME_REGION)
|
||||
' Entità superficie regione piatta
|
||||
Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId)
|
||||
While nRegId <> GDB_ID.NULL
|
||||
If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then
|
||||
Exit While
|
||||
End If
|
||||
nRegId = EgtGetNext(nRegId)
|
||||
End While
|
||||
' Se necessario, ripristino il contesto originale
|
||||
If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx)
|
||||
Return nRegId
|
||||
End Function
|
||||
|
||||
End Module
|
||||
Reference in New Issue
Block a user