Files
EgtCAM5/Project/ProjectVM.vb
T
Renzo Lanza fe58578e65 EgtCAM5 :
- eliminati tutti gli Application.Msn.Register/NotifyColleagues e la classe Messenger. Ora tutto ciò che eseguivano è in funzioni/sub Friend chiamate tramite i riferimenti in Map.
2020-10-28 14:09:17 +00:00

1553 lines
68 KiB
VB.net

Imports System.Windows.Forms.Integration
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtWPFLib5.EgtFloating
Public Class ProjectVM
Inherits TabViewModel
#Region "FIELDS"
' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining
Private m_bSelZeroDim As Boolean = True
Private m_bSelCurve As Boolean = True
Private m_bSelSurf As Boolean = True
Private m_bSelVolume As Boolean = True
Private m_bSelExtra As Boolean = True
Private m_bLoaded As Boolean = False
' Variabile che contiene il Frame di disegno per poterlo ripristinare dopo essere passato dalla lavorazioneù
Private m_GridDrawFrame3d As Frame3d = New Frame3d(New Point3d(0, 0, 0))
'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES
' Reference to the ProjectScene
Private WithEvents m_ProjectScene As New Scene
' Reference to the ProjectSceneHost
Private SceneHost As WindowsFormsHost
' Property used to bind the scene to the WindowsFormsHost in XAML
Private m_bfirst As Boolean = True
Public ReadOnly Property ProjectSceneHost As WindowsFormsHost
Get
If m_bfirst Then
SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene}
m_bfirst = False
End If
Return SceneHost
End Get
End Property
' Scene controller
Private WithEvents m_Controller As New Controller
' Definizione comandi
Private m_cmdLoaded As ICommand
' Flag per non salvare Script appena eseguito in elenco MruScript
Private m_bScriptInMru As Boolean = True
#End Region
#Region "EGTUILIB FIELDS"
Private m_bCPlaneTypePos As Boolean
'Private m_bStopExec As Boolean = False
'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
' Variabile per implementazione eventi
Private m_InputText As String
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefProjectVM(Me)
' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni
TMDbParamVisibility.bFirst = True
' Inizializza i parametri della scena
'InitializeEgtProject()
End Sub
#End Region
#Region "Get & Set"
Friend Function GetScene() As Scene
Return m_ProjectScene
End Function
Friend Function GetController() As Controller
Return m_Controller
End Function
#End Region ' Get & Set
#Region "COMMANDS"
#Region "LoadedCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property LoadedCommand As ICommand
Get
If m_cmdLoaded Is Nothing Then
m_cmdLoaded = New RelayCommand(AddressOf Loaded)
End If
Return m_cmdLoaded
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Loaded(ByVal param As Object)
' Verifico sia la prima volta
If m_bLoaded Then Return
m_bLoaded = True
' Creazione scena
PreInitializeScene()
' Se tutto bene
If m_ProjectScene.Init() And (IniFile.m_nKeyOptions And KEY_OPT.BASE) <> 0 Then
IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx
PostInitializeScene()
' Recupero e imposto handle finestra principale
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
EgtSetMainWindowHandle(hMainWnd)
' Inizializzo gestore lavorazioni
if Not EgtInitMachMgr(IniFile.m_sMachinesRoot, IniFile.m_sToolMakersDir) Then
' non riuscita -> imposto modalità solo disegno
IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW
Map.refProjectV.SetDbPanelVisibility()
End If
' Apro progetto vuoto
Map.refTopCommandBarVM.NewCmd()
' Seleziono la macchina impostata nel file ini
Map.refMachinePanelVM.LoadCurrentMachine()
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Return
End If
' Problemi
SceneHost.Child = Nothing
' Se manca la chiave
If IniFile.m_nKeyLevel = -1 Or IniFile.m_nKeyLevel = -2 Then
EgtOutLog("Missing Dongle")
' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
' Altrimenti manca la licenza
Else
EgtOutLog("Problems with Licence")
' Box di avviso licenza con problemi : sKeyInfo \n "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
Dim sKeyInfo As String = "" : EgtGetKeyInfo( sKeyInfo)
Dim sText As String = sKeyInfo & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
If MessageBox.Show( sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
' Apro dialogo per richiesta file licenza
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
.DefaultExt = ".lic",
.Filter = "Licences (.lic)|*.lic",
.CheckFileExists = True,
.ValidateNames = True
}
If LicDlg.ShowDialog() = True Then
' Recupero il direttorio del file
Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
' Se il file non è già nel direttorio di configurazione lo copio
If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(IniFile.m_sConfigDir), StringComparison.OrdinalIgnoreCase) Then
Try
File.Copy(LicDlg.FileName, Path.Combine(IniFile.m_sConfigDir, LicDlg.SafeFileName), True)
Catch ex As Exception
End Try
End If
' Imposto il nuovo file di licenza nell'Ini
WritePrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
End If
End If
End If
' Chiudo il programma
IniFile.m_bFailedRun = True
Map.refMainWindowVM.CloseApplicationCmd()
End Sub
#End Region ' LoadedCommand
#End Region
#Region "METHODS"
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
m_ProjectScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
m_ProjectScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto spessore linee
Dim nLineWidth As Integer = 1
nLineWidth = GetPrivateProfileInt(S_SCENE, K_LINEWIDTH, nLineWidth)
m_ProjectScene.SetLineWidth( nLineWidth)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
m_ProjectScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
m_ProjectScene.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_ProjectScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
m_ProjectScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
m_ProjectScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
m_Controller.SetScene(m_ProjectScene)
Dim bLuaReg As Boolean = (GetPrivateProfileInt(S_GENERAL, K_COMMANDLOG, 0) <> 0)
Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString())
If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then
EgtOutLog("Command log not started")
If Environment.GetCommandLineArgs.Count() <= 1 Then
MessageBox.Show("Command log not started", "EgtCAM5 Warning",
MessageBoxButton.OK, MessageBoxImage.Warning)
End If
End If
m_Controller.SetSurfTmTolerance(OptionModule.m_dGeometryTolerance)
m_Controller.SetUseCustomColors(True, S_SCENE, K_CUSTOMCOLORS)
' imposto unità di misura per interfaccia utente
IniFile.m_bMmUnits = (GetPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0)
Map.refStatusBarVM.UpdateStatusUnits(IniFile.m_bMmUnits)
' imposto visualizzazione riferimento globale
Dim bShowGlobFrame As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWGFRAME, 1) <> 0)
EgtSetGlobFrameShow(bShowGlobFrame)
' imposto i dati della griglia
LoadGridData()
' imposto stato di visualizzazione della griglia
IniFile.m_bDrawShowGrid = (GetPrivateProfileInt(S_GRID, K_DRAWSHOWGRID, 1) <> 0)
IniFile.m_bMachiningShowGrid = (GetPrivateProfileInt(S_GRID, K_MACHININGSHOWGRID, 1) <> 0)
IniFile.m_bShowGridFrame = (GetPrivateProfileInt(S_GRID, K_SHOWFRAME, 1) <> 0)
Map.refStatusBarVM.UpdateStatusGrid(New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame))
' imposto tipo coordinate
m_bCPlaneTypePos = True
Map.refStatusBarVM.StatusCurrPosTypeText("GRID")
m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos)
' modo di visualizzazione
Dim nShowMode As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
Map.refShowPanelVM.ShowModeState(nShowMode)
' visualizzazione direzione curve
Dim nShowCurveDir As Integer = GetPrivateProfileInt(S_SCENE, K_CURVEDIR, 0)
Map.refShowPanelVM.ShowCurveDir(nShowCurveDir)
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(nShowZmap, False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' stile corrente delle quotature
OptionModule.m_dExtLineLen = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_EXTLINELEN, 5)
OptionModule.m_dArrowLen = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_ARROWLEN, 5)
OptionModule.m_dTextDist = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTDIST, 2)
OptionModule.m_nLenIsMM = GetPrivateProfileInt(S_DIMENSIONSTYLE, K_LENISMM, 2)
OptionModule.m_nDecDigit = GetPrivateProfileInt(S_DIMENSIONSTYLE, K_DECDIGIT, -2)
OptionModule.m_sFont = "" : GetPrivateProfileStringUtf8(S_DIMENSIONSTYLE, K_DIMFONT, "ModernPropS.Nfe", m_sFont)
OptionModule.m_dTextHeight = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTHEIGHT, 2)
EgtSetCurrDimensionStyle(m_dExtLineLen, m_dArrowLen, m_dTextDist, m_nLenIsMM, m_nDecDigit, m_sFont, m_dTextHeight)
' lettura da ini della variabile che abilita i gruppi di lavorazione
IniFile.m_bMachiningGroup = (GetPrivateProfileInt(S_MACH, K_MACHININGGROUP, 0) <> 0)
Map.refTopCommandBarVM.DrawMode_IsChecked()
' lettura flag visualizzazione solo tavola in definizione lavorazioni
IniFile.m_bShowOnlyTable = (GetPrivateProfileInt(S_MACH, K_SHOWONLYTABLE, 1) <> 0)
' ObjTree non selezionato
Map.refManageLayerExpanderVM.UpdateObjTreeOldId(GDB_ID.NULL)
' nascondo input box
Map.refInputExpanderVM.ResetInputBox()
' Imposto stato filtro selezione
m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra)
m_Controller.MouseSetObjFilterForSelect(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra)
' Imposto default per import
m_Controller.SetScaleForDxfImport(OptionModule.m_dDxfScaleFactor)
m_Controller.SetScaleForStlImport(OptionModule.m_dStlScaleFactor)
m_Controller.SetScaleForImageImport(OptionModule.m_dImgScaleFactor)
' Imposto default per export
m_Controller.SetDefaultForDxfExport( OptionModule.m_nExportDxfFlag)
m_Controller.SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight)
End Sub
Friend Function GetAppToShow() As Boolean
' Se non ci sono veri parametri su linea di comando, visualizzazione standard
If Environment.GetCommandLineArgs.Count() <= 1 Then Return True
' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file
Dim sFile As String = Environment.GetCommandLineArgs(1)
Dim sExt As String = Path.GetExtension(sFile).ToLower()
' Analizzo i parametri
If sExt = ".btl" And Environment.GetCommandLineArgs.Count() > 2 Then
' Flag
Dim nFlag As Integer = 1
If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag)
' Modalità cieco con valori 0, 3 e 4
Return ( nFlag <> 0 And nFlag <> 3 And nFlag <> 4)
End If
Return True
End Function
Friend Sub ProcessCommandLine()
' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma)
If Environment.GetCommandLineArgs.Count() <= 1 Then Return
' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file
Dim sFile As String = Environment.GetCommandLineArgs(1)
Dim sExt As String = Path.GetExtension(sFile).ToLower()
If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return
' Se file btl con opzioni, gestione lavorazione travi
If sExt = ".btl" And Environment.GetCommandLineArgs.Count() > 2 Then
' Nome macchina
Dim sMachine As String = ""
If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2)
' Flag
Dim nFlag As Integer = 1
If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag)
Dim bOk As Boolean = False
' Verifico se travi o pareti (per ora dal nome della macchina)
Dim bBeam As Boolean = (sMachine = "FAST" OrElse sMachine = "ONE")
If bBeam Then
' Verifica abilitazione elaborazione travi
If Not VerifyBeam(sFile, sMachine, nFlag) Then
Map.refMainWindowVM.CloseApplicationCmd()
Return
End If
' Esecuzione
bOk = ExecBeam(sFile, sMachine, nFlag)
' altrimenti pareti
Else
' Verifica abilitazione elaborazione pareti
If Not VerifyWall(sFile, sMachine, nFlag) Then
Map.refMainWindowVM.CloseApplicationCmd()
Return
End If
' Esecuzione
bOk = ExecWall(sFile, sMachine, nFlag)
End If
' Se richiesta uscita immediata
If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then
Map.refMachinePanelVM.SaveCurrentMachine()
Map.refMainWindowVM.CloseApplicationCmd()
' Altrimenti se richiesta visualizzazione DB utensili
ElseIf nFlag = 11 And bOk Then
MyMachinePanelVM.ToolDb()
Map.refMachinePanelVM.SaveCurrentMachine()
Map.refMainWindowVM.CloseApplicationCmd()
' Altrimenti se richiesta visualizzazione DB lavorazioni
ElseIf nFlag = 12 And bOk Then
MyMachinePanelVM.MachDb()
If bBeam Then
Beam.BeamMachDb()
Else
Wall.WallMachDb()
End If
Map.refMachinePanelVM.SaveCurrentMachine()
Map.refMainWindowVM.CloseApplicationCmd()
' Altrimenti se errore
ElseIf Not bOk Then
EgtZoom(ZM.ALL)
End If
' Altrimenti si prosegue nel programma
Return
End If
' Se file ddf, gestione creazione porta con Doors
If sExt = ".ddf" Then
' Se manca direttorio uso quello di default
If String.IsNullOrWhiteSpace(Path.GetDirectoryName(sFile)) Then
Dim sDefDir As String = String.Empty
GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir)
sFile = sDefDir & "\" & sFile
End If
' Ricoscimento flag
Dim nFlag As Integer = 0
If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nFlag)
Dim bNcGen As Boolean = (nFlag >= 1)
Dim bExit As Boolean = (nFlag >= 2)
Dim nProbing As Integer = If(nFlag > 2, nFlag - 2, 0)
' Esecuzione
OpenDoorFile(sFile, bNcGen, bExit, nProbing)
' Se richiesta uscita immediata
If bExit Then Map.refMainWindowVM.CloseApplicationCmd()
Return
End If
' Se file tol, gestione aggiornamento dei dati degli utensili
If sExt = ".tol" Then
' Recupero nome macchina
Dim sMachine As String = String.Empty
If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2)
' Recupero flag
Dim nFlag As Integer = 0
If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag)
Dim bTest As Boolean = (nFlag = 0)
' Esecuzione
UpdateTools(sFile, sMachine, bTest)
' Uscita immediata
Map.refMainWindowVM.CloseApplicationCmd()
Return
End If
' Altrimenti gestione file standard
OpenStdFile(sFile)
End Sub
Friend Function OpenStdFile(sFile As String) As Boolean
Dim nFileType As Integer = EgtGetFileType(sFile)
Select Case nFileType
Case FT.NGE, FT.NFE
Return m_Controller.OpenProject(sFile, False)
Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML
Return m_Controller.ImportProject(sFile, False)
Case FT.TSC, FT.LUA
Return m_Controller.Exec(sFile, False)
End Select
Return False
End Function
Friend Function OpenDoorFile(sFile As String, Optional bNcGen As Boolean = False, Optional bBatch As Boolean = False, Optional nProbing As Integer = 0) As Boolean
' Formato descrizione porte
If Path.GetExtension(sFile).ToLower() = ".ddf" Then
CreateDoors(sFile, bNcGen, bBatch, nProbing)
EgtZoom(ZM.ALL)
Map.refProjectVM.EmitTitle()
Return True
End If
Return False
End Function
Friend Sub EmitTitle()
' nome file
Dim sTitle As String = m_Controller.GetCurrFile()
If String.IsNullOrEmpty(sTitle) Then
sTitle = EgtMsg(MSG_TOPCOMMANDBAR + 1) & IniFile.m_nInstance.ToString()
End If
' indicazione di modificato
If m_Controller.GetModified() Then
sTitle += "*"
End If
' dati del prodotto
sTitle += " - EgtCAM5"
' emissione del titolo
Map.refMainWindowVM.UpdateMainWindowTitle(sTitle)
End Sub
Friend Sub LoadGridData()
IniFile.dSnapStepMm = GetPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10)
IniFile.dSnapStepInch = GetPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 10)
IniFile.nMinLineSStep = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1)
IniFile.nMajLineSStep = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10)
IniFile.nExtSStep = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50)
IniFile.MinLnColor = New Color3d(160, 160, 160)
GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, IniFile.MinLnColor)
IniFile.MajLnColor = New Color3d(160, 160, 160)
GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, IniFile.MajLnColor)
EgtSetGridFrame(Frame3d.GLOB)
UpdateGridData()
End Sub
Private Sub UpdateGridData()
If IniFile.m_bMmUnits Then
EgtSetGridGeo(IniFile.dSnapStepMm, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep)
Else
EgtSetGridGeo(IniFile.dSnapStepInch, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep)
End If
EgtSetGridColor(IniFile.MinLnColor, IniFile.MajLnColor)
End Sub
Friend Sub UpdateProjectUI(bReloadUI As Boolean)
OnUpdateUI(Nothing, bReloadUI)
End Sub
Friend Sub SetMoveInDisposition(bMoveInDisposition As Boolean)
Me.bMoveInDisposition = bMoveInDisposition
End Sub
Friend Sub DrawMode_IsChecked()
' Ripristino il riferimento della griglia di disegno
EgtSetGridFrame(m_GridDrawFrame3d)
m_ProjectScene.SetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra)
Map.refStatusBarVM.UpdateStatusGrid(New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame))
End Sub
Friend Sub MachiningMode_IsChecked()
' Salvo il Frame3d di disegno
m_GridDrawFrame3d = EgtGetGridFrame()
' sposto la griglia sulla tavola di lavorazione
Dim TableRef As Point3d
EgtGetTableRef(1, TableRef)
EgtSetGridFrame(New Frame3d(TableRef))
m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra)
Map.refStatusBarVM.UpdateStatusGrid(New UpdateStatusGridParam(IniFile.m_bMachiningShowGrid, IniFile.m_bShowGridFrame))
End Sub
#Region "Manage TopCommandBar"
' NON USATO!!!!
Friend Sub OpenProject(sFilePath As String)
If String.IsNullOrEmpty(sFilePath) Then
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir)
m_Controller.OpenProject(sDir)
Else
m_Controller.OpenProject(sFilePath, False)
End If
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
End Sub
Friend Sub SaveProject()
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
If Not String.IsNullOrWhiteSpace(m_Controller.GetCurrFile()) Then
m_Controller.SaveProject(nType)
Else
Dim sFile As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile)
sFile.TrimEnd("\"c)
sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge"
m_Controller.SaveAsProject(sFile, nType)
End If
End Sub
Friend Sub SaveAsProject()
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Dim sFile As String = m_Controller.GetCurrFile()
If String.IsNullOrWhiteSpace(sFile) Then
GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile)
sFile.TrimEnd("\"c)
sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge"
End If
m_Controller.SaveAsProject(sFile, nType)
End Sub
Friend Sub InsertProject()
' eseguo
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir)
m_Controller.InsertProject(sDir)
End Sub
Friend Sub ImportProject()
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir)
m_Controller.ImportProject(sDir)
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
End Sub
Friend Sub ExportProject()
m_Controller.ExportProject(Path.ChangeExtension(m_Controller.GetCurrFile(), "dxf"))
End Sub
Friend Sub PreExecScript(bScriptInMru As Boolean)
m_bScriptInMru = bScriptInMru
End Sub
Friend Sub ExecScript(sFilePath As String)
If String.IsNullOrEmpty(sFilePath) Then
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir)
m_Controller.Exec(sDir)
Else
m_Controller.Exec(sFilePath, False)
End If
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Map.refTopCommandBarVM.SetMachiningMode()
End If
End Sub
Friend Sub DoorsScript(sFilePath As String)
Dim nErr As Integer
If String.IsNullOrEmpty(sFilePath) Then
nErr = ExecDoors(m_ProjectScene, String.Empty)
Else
nErr = ExecDoors(m_ProjectScene, sFilePath)
End If
EgtResetCurrPartLayer()
OnUpdateUI(Nothing, True)
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
IniFile.m_MruDoors.Add(IniFile.m_DDFFilePath)
Dim sFile As String = String.Empty
If EgtGetCurrFilePath(sFile) Then IniFile.m_MruFiles.Add(sFile)
' Segnalazione eventuali Warnings/Errors
If nErr = 999 Then
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 17), EgtMsg(MSG_DOORSERRORS + 1).ToUpper)
ElseIf nErr <> 0 Then
Try
Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_DDFFilePath, ".txt")
Dim Lines() As String = File.ReadAllLines(sErrFilePath)
Dim sErrMsg As String = String.Empty
For Index = 1 To Lines.Count - 1
If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf
Next
If nErr > 0 Then
MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 1).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error)
Else
MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 3).ToUpper, MessageBoxButton.OK, MessageBoxImage.Warning)
End If
Catch ex As Exception
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7), EgtMsg(MSG_DOORSERRORS + 1).ToUpper)
End Try
End If
End Sub
Friend Sub DMachScript()
Dim bOk As Boolean = ExecDoorsMachining(m_ProjectScene)
OnUpdateUI(Nothing, True)
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Map.refTopCommandBarVM.SetMachiningMode()
End If
If Not bOk Then Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(MSG_DOORSERRORS + 2))
End Sub
Friend Sub GunStockNew(sFilePath As String)
Dim bOk As Boolean
If String.IsNullOrEmpty(sFilePath) Then
bOk = ExecGunStockMod(m_ProjectScene, String.Empty)
Else
bOk = ExecGunStockMod(m_ProjectScene, sFilePath)
End If
EgtResetCurrPartLayer()
OnUpdateUI(Nothing, True)
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Map.refTopCommandBarVM.SetMachiningMode()
End If
If bOk Then
IniFile.m_MruNewGunStock.Add(IniFile.m_MODFilePath)
IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath)
Dim sFile As String = String.Empty
If EgtGetCurrFilePath(sFile) Then
IniFile.m_MruFiles.Add(sFile)
End If
Else
IniFile.m_MruNewGunStock.Remove(IniFile.m_MODFilePath)
If Not String.IsNullOrEmpty(IniFile.m_PEZFilePath) Then
Try
Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt")
Dim Lines() As String = File.ReadAllLines(sErrFilePath)
Dim values() As String = Lines(0).Split("="c).ToArray
Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1))
Dim sErrMsg As String = String.Empty
For Index = 1 To Lines.Count - 1
If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf
Next
MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error)
Catch ex As Exception
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7))
End Try
End If
End If
End Sub
Friend Sub GunStockModif(sFilePath As String)
Dim bOk As Boolean
If String.IsNullOrEmpty(sFilePath) Then
bOk = ExecGunStockPez(m_ProjectScene, String.Empty)
Else
bOk = ExecGunStockPez(m_ProjectScene, sFilePath)
End If
EgtResetCurrPartLayer()
OnUpdateUI(Nothing, True)
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Map.refTopCommandBarVM.SetMachiningMode()
End If
If bOk Then
IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath)
Dim sFile As String = String.Empty
If EgtGetCurrFilePath(sFile) Then
IniFile.m_MruFiles.Add(sFile)
End If
Else
IniFile.m_MruModifyGunStock.Remove(IniFile.m_PEZFilePath)
Try
Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt")
Dim Lines() As String = File.ReadAllLines(sErrFilePath)
Dim values() As String = Lines(0).Split("="c)
Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1))
Dim sErrMsg As String = String.Empty
For Index = 1 To Lines.Count - 1
If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf
Next
MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error)
Catch ex As Exception
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7))
End Try
End If
End Sub
#End Region
#Region "DrawOptionPanel Commands"
Friend Sub NotifyInputText(sInputText As String)
m_InputText = sInputText
End Sub
Friend Sub SetLastBoolean(bBoolean As Boolean)
m_Controller.SetLastBoolean(bBoolean)
End Sub
Friend Sub SetLastInteger(nInteger As Integer)
m_Controller.SetLastInteger(nInteger)
End Sub
Friend Sub Show(sString As String)
m_Controller.Show(sString)
End Sub
Friend Sub Done(sString As String)
m_Controller.Done(sString)
End Sub
Friend Sub SaveObject(SaveObjectParam As SaveObjectParam)
m_Controller.SaveObject(SaveObjectParam.nId, SaveObjectParam.sDir, SaveObjectParam.nType)
End Sub
#End Region
#Region "StatusBar Commands"
Friend Sub StatusCurrPosTypeCommand()
m_bCPlaneTypePos = Not m_bCPlaneTypePos
If m_bCPlaneTypePos Then
Map.refStatusBarVM.StatusCurrPosTypeText("GRID")
Else
Map.refStatusBarVM.StatusCurrPosTypeText("WORLD")
End If
m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos)
End Sub
Friend Sub StatusUnitsCommand()
IniFile.m_bMmUnits = Not IniFile.m_bMmUnits
Map.refStatusBarVM.UpdateStatusUnits(IniFile.m_bMmUnits)
UpdateGridData()
EgtDraw()
End Sub
#End Region
#Region "Controller Commands"
Friend Sub ExecuteCommand(nCmd As Controller.CMD)
m_Controller.ExecuteCommand(nCmd)
End Sub
Friend Sub ManageModified()
Dim AllowClose = m_Controller.ManageModified()
Map.refMainWindowVM.AllowWindowToClose(AllowClose)
End Sub
#End Region
#Region "MainWindow Commands"
Friend Sub ResetStatus()
m_Controller.ResetStatus()
End Sub
#End Region
#End Region
#Region "SCENE EVENTS"
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ProjectScene.OnCursorPos
Map.refStatusBarVM.NotifyCurrPos(sCursorPos)
End Sub
Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean,
bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) Handles m_ProjectScene.OnMouseSetObjFilterForSelect
m_Controller.MouseSetObjFilterForSelect(bZeroDim, bCurve, bSurf, bVolume, bExtra)
End Sub
Private Sub OnMouseSelectedAll(ByVal sender As Object, bOnlyVisble As Boolean) Handles m_ProjectScene.OnMouseSelectedAll
' Se in modalità Draw seleziono tutto
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
m_Controller.MouseSelectedAll(bOnlyVisble)
Return
End If
' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco
If m_SceneSelMode = SceneSelModeOpt.NULL Then Return
Select Case m_SceneSelType
Case SceneSelTypeOpt.MACHINING
' Cerco i pezzi all'interno dei grezzi
Dim nRawPart As Integer = EgtGetFirstRawPart()
While nRawPart <> GDB_ID.NULL
Dim nPart As Integer = EgtGetFirstPartInRawPart(nRawPart)
While nPart <> GDB_ID.NULL
Dim nLayer As Integer = EgtGetFirstGroupInGroup(nPart)
While nLayer <> GDB_ID.NULL
Dim nObj As Integer = EgtGetFirstInGroup(nLayer)
While nObj <> GDB_ID.NULL
EgtSelectObj(nObj)
nObj = EgtGetNext(nObj)
End While
nLayer = EgtGetNextGroup(nLayer)
End While
nPart = EgtGetNextPartInRawPart(nPart)
End While
nRawPart = EgtGetNextRawPart(nRawPart)
End While
Case SceneSelTypeOpt.FIXTURE
Dim nFixtureId As Integer = EgtGetFirstFixture()
While nFixtureId <> GDB_ID.NULL
EgtSelectObj(nFixtureId)
nFixtureId = EgtGetNextFixture(nFixtureId)
End While
Dim SelCount As Integer = EgtGetSelectedObjCount()
If SelCount > 1 Then
EgtSetMark(EgtGetFirstSelectedObj)
End If
Case SceneSelTypeOpt.RAWPART
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
EgtSelectObj(nRawPartId)
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
Dim SelCount As Integer = EgtGetSelectedObjCount()
If SelCount > 1 Then
EgtSetMark(EgtGetFirstSelectedObj)
End If
Case SceneSelTypeOpt.RAWPARTWITHFIXTURE
Dim nRawPartCount As Integer = 0
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
nRawPartCount += 1
EgtSelectObj(nRawPartId)
DispositionUtility.SelectRawPartFixture(nRawPartId)
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
If nRawPartCount > 1 Then
EgtSetMark(EgtGetFirstSelectedObj)
End If
End Select
EgtDraw()
End Sub
Private Sub OnMouseDeselectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseDeselectedAll
' Se in modalità Draw seleziono tutto
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
m_Controller.MouseDeselectedAll()
Return
End If
' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco
If m_SceneSelMode = SceneSelModeOpt.NULL Then Return
' Se sono in lavorazione
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then
If (m_SceneSelType = SceneSelTypeOpt.RAWPART OrElse m_SceneSelType = SceneSelTypeOpt.FIXTURE OrElse m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE) Then
EgtResetMark(EgtGetFirstSelectedObj())
ElseIf m_SceneSelType = SceneSelTypeOpt.MACHINING Then
SelData.ClearIdSub()
ElseIf m_SceneSelType = SceneSelTypeOpt.NULL Then
Return
End If
End If
' deseleziono tutto
m_Controller.MouseDeselectedAll()
End Sub
' Identificativi per elemento da selezionare/deselezionare
Private m_nIdToSel As Integer = GDB_ID.NULL
Private m_SelType As DispositionUtility.SelType = DispositionUtility.SelType.NULL
Private m_nIdToDesel As Integer = GDB_ID.NULL
'Private m_nFirstRawPartId As Integer = GDB_ID.NULL
' Dati per Drag
Private m_nRestRadius As Integer = 3
Private m_bDrag As Boolean = False
Private m_bDragToStart As Boolean = False
Private m_bDragging As Boolean = False
Private m_locPrev As System.Drawing.Point
Private m_ptPrev As Point3d
Private Sub OnMouseDown(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseDownScene
' Se in modalità Draw accetto tutto
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then Return
' Sono in modalità Machining
' se non posso selezionare nulla o in lavorazione esco
If m_SceneSelType = SceneSelTypeOpt.NULL OrElse m_SceneSelType = SceneSelTypeOpt.MACHINING Then Return
' Si può selezionare solo con il tasto sinistro
If e.Button <> Forms.MouseButtons.Left Then Return
' Dati per drag
Dim TableRef As Point3d
EgtGetTableRef(1, TableRef)
' Per default no drag
m_bDrag = False
Dim nSel As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
Select Case m_SceneSelType
Case SceneSelTypeOpt.FIXTURE
Dim nFixtureId As Integer = EgtGetParent(EgtGetParent(nId))
Dim sName As String = ""
EgtGetName(EgtGetParent(nId), sName)
If EgtVerifyFixture(nFixtureId) Then
m_SelType = DispositionUtility.SelType.FIXTURE
' Se già selezionato
If EgtIsSelectedObj(nFixtureId) Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nFixtureId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nFixtureId
End If
' Drag possibile
m_bDrag = True
' salvo vettore click rispetto a punto hook della ventosa
Dim ptCurr As Point3d
EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, ptCurr)
DispositionUtility.VtHookFinder(nFixtureId, ptCurr)
Exit While
ElseIf sName.Contains(DispositionUtility.MOBILE) Then
m_SelType = DispositionUtility.SelType.BARS
m_nIdToSel = EgtGetParent(nId)
' Drag possibile
m_bDrag = True
End If
Case SceneSelTypeOpt.RAWPART, SceneSelTypeOpt.RAWPARTWITHFIXTURE
Dim nRawPartId As Integer = EgtGetParent(nId)
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
m_SelType = DispositionUtility.SelType.RAWPART
' Se già selezionato
If EgtIsSelectedObj(nRawPartId) Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nRawPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nRawPartId
End If
' Drag possibile
m_bDrag = True
Exit While
End If
End Select
nId = EgtGetNextObjInSelWin()
End While
' Dati per drag
m_locPrev = e.Location
EgtGetTableRef(1, TableRef)
m_bDrag = m_bDrag AndAlso EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, m_ptPrev)
m_bDragToStart = m_bDrag
End Sub
Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseMoveScene
' Se in modalità Draw esco
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Return
End If
' Sono in modalità Machining
' Si può selezionare solo con il tasto sinistro se la selezione non è impostata a NULL
If e.Button <> Forms.MouseButtons.Left OrElse m_SceneSelType = SceneSelTypeOpt.NULL Then Return
' se non sono in modalità muovi esco
If Not m_bMoveInDisposition 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 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
Return
End If
m_bDragToStart = False
End If
' Determino cosa muovere
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
' Inizio esecuzione di drag
m_bDragging = True
' Ricavo il punto corrente in coordinate mondo
Dim ptCurr As Point3d
Dim TableRef As Point3d
EgtGetTableRef(1, TableRef)
EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, ptCurr)
' Ricavo il vettore di movimento (tengo solo XY)
Dim vtMove As Vector3d = ptCurr - m_ptPrev
vtMove.z = 0
' Muovo gli oggetti selezionati se consentito
DispositionUtility.MoveRawPartPartAndFixture(nMoveId, vtMove, m_SelType, ptCurr)
EgtDraw()
' Aggiorno il punto precedente
m_ptPrev = ptCurr
' Terminata esecuzione di drag
m_bDragging = False
End Sub
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseUpScene
' Se in modalità Draw esco
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Return
End If
' Sono in modalità Machining
' Se eseguito drag
If Not m_bDragToStart Then
' Basta reset alla fine
' se sono in modalità movimento barre
ElseIf m_SelType = DispositionUtility.SelType.BARS Then
' Basta reset alla fine
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' se sono in modalità sottopezzi
If m_SceneSelType = SceneSelTypeOpt.FIXTURE Then
' se il sottopezzo da selezionare è un riferimento e ci sono altri oggetti selezionati resetto lo stato di selezione ed esco
If DispositionUtility.FixtureType(m_nIdToSel) = DispositionUtility.FIX_TYPE.REFERENCE AndAlso
EgtGetSelectedObjCount() > 0 Then
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
Return
' altrimenti verifico il tipo del primo oggetto selezionato
Else
Dim nFirstSelId As Integer = EgtGetFirstSelectedObj()
' se è un riferimento resetto lo stato di selezione ed esco
If DispositionUtility.FixtureType(nFirstSelId) = DispositionUtility.FIX_TYPE.REFERENCE Then
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
Return
End If
End If
End If
' marco il primo elemento se questo è il secondo
If EgtGetSelectedObjCount() = 1 Then
' marco il primo tra i selezionati
Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj()
EgtSetMark(nFirstSelObj)
End If
' se sono in modalità grezzo con relativi sottopezzi
If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then
' seleziono tutti i sottopezzi sotto il grezzo da selezionare
DispositionUtility.SelectRawPartFixture(m_nIdToSel)
End If
' Eseguo la selezione
EgtSelectObj(m_nIdToSel)
' Se deselezione da eseguire
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
' se l'elemento da deselezionare è marcato
Dim bMarked As Boolean = False
EgtGetMark(m_nIdToDesel, bMarked)
If bMarked Then
' smarco l'oggetto deselezionato
EgtResetMark(m_nIdToDesel)
End If
' se sono in modalità ventose o grezzi
If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then
' deseleziono tutti i sottopezzi sotto il grezzo da deselezionare
DispositionUtility.DeselectRawPartFixture(m_nIdToDesel)
End If
' Eseguo la deselezione
EgtDeselectObj(m_nIdToDesel)
If EgtGetSelectedObjCount() > 1 Then
' marco il primo
Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj()
EgtSetMark(nFirstSelObj)
Else
' smarco il primo ed unico oggetto selezionato
Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj()
EgtResetMark(nFirstSelObj)
End If
End If
' Reset
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
End Sub
Private Sub OnMouseSelectingObj(ByVal sender As Object, ByVal nId As Integer, ByRef bOk As Boolean) Handles m_ProjectScene.OnMouseSelectingObj
' Se oggetto già rifiutato non faccio le verifiche
If Not bOk Then Return
' Se in modalità Draw accetto tutto
If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then Return
' Sono in modalità Machining
Select Case m_SceneSelType
Case SceneSelTypeOpt.NULL
bOk = False
Case SceneSelTypeOpt.MACHINING
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
If Not IsPartInRaw(nPartId) Then
bOk = False
End If
Case SceneSelTypeOpt.MACHPATH
bOk = Map.refOperationsListExpanderVM.IsInOperationList(nId)
Case Else
bOk = False
End Select
End Sub
Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING And m_SceneSelType = SceneSelTypeOpt.MACHPATH Then
Map.refOperationsListExpanderVM.SelOperationItemFromId(nId)
Else
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING And m_SceneSelType = SceneSelTypeOpt.MACHINING And
(EgtGetType(nId) = GDB_TY.SRF_MESH Or EgtGetType(nId) = GDB_TY.SRF_FRGN) Then
If Not EgtIsSelectedObj(nId) Then m_Controller.MouseSelectedObj(nId, bLast)
Else
m_Controller.MouseSelectedObj(nId, bLast)
End If
End If
End Sub
Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPart
m_Controller.MouseSelectedPart(nId)
End Sub
Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedLayer
m_Controller.MouseSelectedLayer(nId)
End Sub
Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) Handles m_ProjectScene.OnMouseSelectedPath
m_Controller.MouseSelectedPath(nId, bHaltOnFork)
End Sub
Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection
m_Controller.SetPointFromSelection(nId, PtP, nAux)
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING And m_SceneSelType = SceneSelTypeOpt.MACHINING And
( EgtGetType( nId) = GDB_TY.SRF_MESH Or EgtGetType( nId) = GDB_TY.SRF_FRGN) Then
If EgtIsSelectedObj( nId) Then
Dim nFac As Integer = If( EgtGetType( nId) = GDB_TY.SRF_MESH, Math.Max( EgtSurfTmFacetFromTria( nId, nAux), 0), nAux)
If Not SelData.FindIdSub( nId, nFac) Then
SelData.AddIdSub(nId, nFac)
Else
SelData.RemoveIdSub(nId, nFac)
If Not SelData.FindId( nId) Then
EgtDeselectObj( nId)
End If
End If
Else
SelData.RemoveId(nId)
End If
EgtDraw()
End If
End Sub
Private Sub OnMouseDone(ByVal sender As Object) Handles m_ProjectScene.OnMouseDone
m_Controller.Done(m_InputText)
End Sub
Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPoint
Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control
m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone)
End Sub
Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Handles m_ProjectScene.OnMouseSelectedDir
m_Controller.SetLastVector3d(VtDir)
End Sub
Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles m_ProjectScene.OnMouseMoveSelPoint
m_Controller.MouseMoveInSelectionPoint(PtP)
End Sub
Private Sub OnMouseAnalyzedEx(sender As Object, nId As Integer, nSub As Integer, ptSel As Point3d) Handles m_ProjectScene.OnMouseAnalyzedEx
Map.refManageLayerExpanderVM.UpdateObjInObjTree(nId)
Map.refManageLayerExpanderVM.SelectIdInObjTree(nId)
' Cancello geometria e info di eventuale precedente analisi
Analyze.ClearAnalyzeGroup()
Map.refStatusBarVM.NotifyStatusOutput("")
' Se curva composita, visualizzo numerazione curve semplici
If EgtGetType( nId) = GDB_TY.CRV_COMPO Then
' Visualizzo numerazione
Analyze.CreateAnalyzeGroup()
Analyze.CreateCurveCompoPntNbrs( nId)
' Se superficie trimesh, visualizzo dati faccetta toccata
ElseIf EgtGetType( nId) = GDB_TY.SRF_MESH Then
Dim nFac As Integer = EgtSurfTmFacetFromTria( nId, nSub)
If nFac <> -1 Then
' Visualizzo la normale e il contorno della faccia
Analyze.CreateAnalyzeGroup()
Analyze.CreateNormal( nId, nFac)
Analyze.CreateFacetLoops( nId, nFac)
' Recupero i dati (in globale o griglia a seconda della impostazione)
Dim ptC As Point3d
Dim vtN As Vector3d
EgtSurfTmFacetCenter( nId, nFac, If( m_bCPlaneTypePos, GDB_ID.GRID, GDB_ID.ROOT), ptC, vtN)
Dim dLen, dPhi, dTheta As Double
vtN.ToSpherical( dLen, dTheta, dPhi)
' Emetto info sulla barra di stato
Dim sOut As String = "Facet " + nFac.ToString() +
" : C(" + LenToString( ptC.x, 3) + "," + LenToString( ptC.y, 3) + "," + LenToString( ptC.z, 3) + ")" +
" N(" + DoubleToString( vtN.x, 4) + "," + DoubleToString( vtN.y, 4) + "," + DoubleToString( vtN.z, 4) + ")" +
" / φ=" + DoubleToString( dPhi, 2) + " θ=" + DoubleToString( dTheta, 2)
Map.refStatusBarVM.NotifyStatusOutput(sOut)
End If
End If
' Aggiorno la visualizzazione
EgtDraw()
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles m_ProjectScene.OnShowDistance
Map.refStatusBarVM.NotifyStatusOutput(sDistance)
End Sub
Private Sub OnSceneKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles m_ProjectScene.KeyDown
' Con DEL eseguo cancellazione delle entità selezionate
If e.KeyData = System.Windows.Forms.Keys.Delete AndAlso Map.refTopCommandBarVM.DrawIsChecked Then
m_Controller.SetLastInteger(GDB_ID.SEL)
m_Controller.ExecuteCommand(Controller.CMD.DELETE)
' Con SPAZIO ripeto l'ultimo comando
ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then
m_Controller.RepeatLastCommand()
' Con 'A' e in modalità continuazione, forzo il passaggio ad arco
ElseIf e.KeyData = System.Windows.Forms.Keys.A And m_Controller.GetContinue() Then
m_Controller.ContinueArcPDP()
' Con 'L' e in modalità continuazione, forzo il passaggio a retta
ElseIf e.KeyData = System.Windows.Forms.Keys.L And m_Controller.GetContinue() Then
m_Controller.ContinueLine2P()
' Con 'V' cambio lo stato del check
ElseIf e.KeyData = System.Windows.Forms.Keys.V Then
Map.refInputExpanderVM.ChangeInputBoxCheck()
End If
End Sub
Private Sub OnSceneCloseAnalyze(sender As System.Object) Handles m_ProjectScene.OnCloseAnalyze
Map.refInstrumentPanelVM.Analyze_IsChecked(False)
End Sub
Private Sub OnSceneCloseGetDist(sender As System.Object) Handles m_ProjectScene.OnCloseGetDist
Map.refInstrumentPanelVM.GetDistance_IsChecked(False)
End Sub
#End Region
#Region "CONTROLLER EVENTS"
Private Sub OnNewProject(ByVal sender As Object, ByVal bOk As Boolean) Handles m_Controller.OnNewProject
EgtZoom(ZM.ALL)
If Not bOk Then
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error
End If
End Sub
Private Sub OnOpeningProject(ByVal sender As Object) Handles m_Controller.OnOpeningProject
Map.refManageLayerExpanderVM.ClearObjTree()
End Sub
Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnOpenProject
EgtZoom(ZM.ALL)
WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile))
If bOk Then
IniFile.m_MruFiles.Add(sFile)
Else
IniFile.m_MruFiles.Remove(sFile)
Dim sMsg As String
If My.Computer.FileSystem.FileExists( sFile) Then
sMsg = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
Else
sMsg = EgtMsg(10009) & " '" & sFile & "'" 'Missing file
End If
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
End Sub
Private Sub OnInsertedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnInsertedProject
EgtZoom(ZM.ALL)
End Sub
Private Sub OnSavingProject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingProject
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject
WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile))
If bOk Then
IniFile.m_MruFiles.Add(sFile)
Else
IniFile.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End Sub
Private Sub OnSavingObject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingObject
End Sub
Private Sub OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedObject
WritePrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, Path.GetDirectoryName(sFile))
If bOk Then
IniFile.m_MruFiles.Add(sFile)
Else
IniFile.m_MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End Sub
Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) Handles m_Controller.OnImportingProject
If nType <> FT.NULL Then
Map.refManageLayerExpanderVM.ClearObjTree()
If nType = FT.CNC Then
nFlag = GetPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE)
ElseIf nType = FT.BTL Then
nFlag = GetPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIC_FL.NONE)
Else
nFlag = 0
End If
' Abilito progress e bottone stop
Map.refStatusBarVM.NotifyStatusProgress(0)
Map.refStatusBarVM.NotifyStatusStop(True)
Else
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error
End If
End Sub
Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnImportedProject
EgtZoom(ZM.ALL)
' Disabilito progress e bottone stop
Map.refStatusBarVM.NotifyStatusProgress(0)
Map.refStatusBarVM.NotifyStatusStop(False)
' Salvo path
WritePrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile))
' Segnalo eventuale errore
If Not bOk Then
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End Sub
Private Sub OnExportingProject(ByVal sender As Object) Handles m_Controller.OnExportingProject
End Sub
Private Sub OnExportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnExportedProject
WritePrivateProfileString(S_GENERAL, K_LASTEXPDIR, Path.GetDirectoryName(sFile))
If Not bOk Then
Dim sMsg As String = EgtMsg(10007) & " '" & sFile & "'" 'Error exporting file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End Sub
Private Sub OnExecutingScript(ByVal sender As Object) Handles m_Controller.OnExecutingScript
Map.refManageLayerExpanderVM.ClearObjTree()
' Abilito progress e bottone stop
Map.refStatusBarVM.NotifyStatusProgress(0)
Map.refStatusBarVM.NotifyStatusStop(True)
' Dichiaro script in esecuzione
m_bScriptRunning = True
End Sub
Private Sub OnExecutedScript(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean, ByVal sError As String) Handles m_Controller.OnExecutedScript
' Salvo path dello script in lista recenti
If bOk Then
If m_bScriptInMru Then
IniFile.m_MruScripts.Add(sFile)
WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile))
End If
Else
If m_bScriptInMru Then IniFile.m_MruScripts.Remove(sFile)
MessageBox.Show(Application.Current.MainWindow, sError, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
' Disabilito progress e bottone stop
Map.refStatusBarVM.NotifyStatusProgress(0)
Map.refStatusBarVM.NotifyStatusStop(False)
' Dichiaro terminata esecuzione script
m_bScriptRunning = False
End Sub
Private Sub OnPrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String,
ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) Handles m_Controller.PrepareInputBox
Map.refInputExpanderVM.PrepareInputBox(New PrepareInputBoxParam(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn))
End Sub
Private Sub OnSetInputBoxText(ByVal sText As String) Handles m_Controller.SetInputBoxText
Map.refInputExpanderVM.SetInputBoxText(sText)
End Sub
Private Sub OnSetInputBoxCheck(ByVal bCheck As Boolean) Handles m_Controller.SetInputBoxCheck
Map.refInputExpanderVM.SetInputBoxCheck(bCheck)
End Sub
Private Sub OnAddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) Handles m_Controller.AddInputBoxCombo
Map.refInputExpanderVM.AddInputBoxCombo(New AddInputBoxComboParam(sText, bSelected))
End Sub
Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI
' pulisco input e relativi messaggi
Map.refInputExpanderVM.ResetInputBox()
If m_Controller.GetContinue() Then
Map.refStatusBarVM.NotifyStatusOutput((EgtMsg(399))) ' Continue : 'L' with line, 'A' with arc
Else
Map.refStatusBarVM.NotifyStatusOutput((""))
End If
' aggiorno dati correnti
EmitTitle()
EmitCurrPartLayer()
If bReloadUI Then
Map.refManageLayerExpanderVM.LoadObjTree()
Else
Map.refManageLayerExpanderVM.UpdateObjTree()
End If
' aggiorno macchina corrente
Map.refMachinePanelVM.UpdateCurrentMachine()
End Sub
Private Sub OutputInfo(ByVal sender As Object, ByVal sText As String) Handles m_Controller.OutputInfo
Map.refStatusBarVM.NotifyStatusOutput(sText)
End Sub
#End Region
#Region "STATUSBAR EVENTS"
Private Sub ProjectScene_OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) Handles m_ProjectScene.OnChangedSnapPointType
If bUser Then
Map.refStatusBarVM.StatusSnapPointTypeBackground(New SolidColorBrush(SystemColors.ControlColor))
Else
Map.refStatusBarVM.StatusSnapPointTypeBackground(Brushes.Bisque)
End If
Select Case nSpType
Case SP.PT_SKETCH
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1102)) 'Sketch Point
Case SP.PT_GRID
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1104)) 'Grid Point
Case SP.PT_END
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1106)) 'End Point
Case SP.PT_MID
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1108)) 'Mid Point
Case SP.CENTER
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1110)) 'Center
Case SP.CENTROID
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1112)) 'Centroid
Case SP.PT_NEAR
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1114)) 'Near Point
Case SP.PT_INTERS
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1116)) 'Inters Point
Case SP.PT_TANGENT
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1118)) 'Tang Point
Case SP.PT_PERPENDICULAR
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1120)) 'Perp Point
Case SP.PT_MINDIST
Map.refStatusBarVM.StatusSnapPointTypeText(EgtMsg(1122)) 'MinDist Point
Case Else
Map.refStatusBarVM.StatusSnapPointTypeText("---")
End Select
End Sub
#End Region ' StatusBar events
#Region "DrawOptionPanel"
Private Sub EmitCurrPartLayer()
Dim sText As String = " "
Dim sName As String = String.Empty
Dim colObj As Color3d
EgtGetColor(GDB_ID.ROOT, colObj)
Dim nCurrPart As Integer = m_Controller.GetCurrPart()
If nCurrPart <> GDB_ID.NULL Then
If EgtGetName(nCurrPart, sName) Then
sText = sName
Else
sText = "Part " + nCurrPart.ToString()
End If
EgtGetCalcColor(nCurrPart, colObj)
Dim nCurrLayer As Integer = m_Controller.GetCurrLayer()
If nCurrLayer <> GDB_ID.NULL And EgtExistsObj(nCurrLayer) Then
If EgtGetName(nCurrLayer, sName) Then
sText += " --> " + sName
Else
sText += " --> Layer " + nCurrLayer.ToString()
End If
EgtGetCalcColor(nCurrLayer, colObj)
End If
End If
Map.refManageLayerExpanderVM.UpdateHeaderName(sText)
colObj.A = 100
Map.refManageLayerExpanderVM.UpdateHeaderColor(colObj)
End Sub
#End Region 'DrawOptionPanel
#Region "Scene selection"
Private m_SceneSelMode As SceneSelModeOpt
Friend Property SceneSelMode As SceneSelModeOpt
Get
Return m_SceneSelMode
End Get
Set(value As SceneSelModeOpt)
If value <> m_SceneSelMode Then
m_SceneSelMode = value
Select Case m_SceneSelMode
Case SceneSelModeOpt.NULL
m_ProjectScene.SetObjFilterForSel(False, False, False, False, False)
EgtSetObjFilterForSelect(True, True, True, True, True)
Case SceneSelModeOpt.PARTCURVES
m_ProjectScene.SetObjFilterForSel(False, True, False, False, True)
Case SceneSelModeOpt.PARTSURFACES
m_ProjectScene.SetObjFilterForSel(False, False, True, False, False)
Case SceneSelModeOpt.PARTCURVESANDSURFACES
m_ProjectScene.SetObjFilterForSel(False, True, True, False, True)
Case SceneSelModeOpt.ALL
m_ProjectScene.SetObjFilterForSel(True, True, True, True, True)
Case Else
m_ProjectScene.SetObjFilterForSel(False, False, False, False, False)
End Select
End If
End Set
End Property
Private m_SceneSelType As SceneSelTypeOpt
Friend Property SceneSelType As SceneSelTypeOpt
Get
Return m_SceneSelType
End Get
Set(value As SceneSelTypeOpt)
If value <> m_SceneSelType Then
m_SceneSelType = value
End If
End Set
End Property
Private m_bMoveInDisposition As Boolean
Public Property bMoveInDisposition As Boolean
Get
Return m_bMoveInDisposition
End Get
Set(value As Boolean)
m_bMoveInDisposition = value
End Set
End Property
Friend Function IsPartInRaw(nSearchedPartId As Integer) As Boolean
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
While nPartId <> GDB_ID.NULL
If nPartId = nSearchedPartId Then
Return True
End If
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
nRawId = EgtGetNextRawPart(nRawId)
End While
Return False
End Function
#End Region ' Scene selection
End Class