Files
EgtCAM5/OptionsWindow/OptionModule.vb
Dario Sassi 5e53f20fec EgtCAM5 :
- aggiunta gestione messaggi lavorazioni avanzate non abilitate in simulazione, stima e generazione
- piccola miglioria in default VMillQuality se non trovata in Ini file.
2024-10-01 13:10:43 +02:00

198 lines
9.5 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Friend Module OptionModule
' Parametri che contengono lista delle lingue disponibili e lingua selezionata
Friend m_LanguageList As New ObservableCollection(Of Language)
Friend m_SelectedLanguage As Language
' Colori di sfondo della vista e della griglia
Friend m_TopSceneBackground As Color3d
Friend m_BotSceneBackground As Color3d
Friend m_GridColor As Color3d
' Flag per visualizzazione spessa delle linee
Friend m_bThickLine As Boolean
' Flag per visualizzazione smussata delle superfici
Friend m_bSmoothTriMesh As Boolean
' Colore di default in disegno
Friend m_DefMaterialColor As Color3d
' Tolleranza geometrica
Friend m_dGeometryTolerance As Double
' Parametri per import
Friend m_dDxfScaleFactor As Double
Friend m_dStlScaleFactor As Double
Friend m_dImgScaleFactor As Double
' Parametri per export
Friend m_nExportDxfFlag As Integer
Friend m_nImgWidth As Integer
Friend m_nImgHeight As Integer
' Font di testo
Friend m_sFontText As String
' Parametri per le quotature
Friend m_dExtLineLen As Double
Friend m_dArrowLen As Double
Friend m_dTextDist As Double
Friend m_nLenIsMM As Integer
Friend m_nDecDigit As Integer
Friend m_sFont As String
Friend m_dTextHeight As Double
' Variabili che indicano per ogni tipo di lavorazione quale geometria è selezionabile
Friend m_SelGeomSawing As SceneSelModeOpt
Friend m_SelGeomDrilling As SceneSelModeOpt
Friend m_SelGeomMilling As SceneSelModeOpt
Friend m_SelGeomPocketing As SceneSelModeOpt
Friend m_SelGeomMortising As SceneSelModeOpt
Friend m_SelGeomSawRoughing As SceneSelModeOpt
Friend m_SelGeomSawFinishing As SceneSelModeOpt
Friend m_SelGeomGenMachining As SceneSelModeOpt
Friend m_SelGeomChiseling As SceneSelModeOpt
Friend m_SelGeomSurfFinishing As SceneSelModeOpt
Friend m_SelGeomSurfRoughing As SceneSelModeOpt
Friend m_SelGeomWaterJetting As SceneSelModeOpt
Friend m_SelGeomFiveAxMilling As SceneSelModeOpt
Friend m_SelVMillQuality As VMillSelTypeOpt
' Flag per aggiungere una nuova lavorazione alla fine della fase o subito dopo la lavorazione selezionata
Friend m_bNewMachiningIsLastOne As Boolean
' Variabile che indica se usare lo script per calcolare automaticamente la disposizione quando si passa in lavorazione
Friend m_bUseDispositionScript As Boolean
' Variabili per gli Extra
Friend m_bSpecialOn As Boolean
Friend m_bBeamOn As Boolean
Friend m_bWallOn As Boolean
Friend m_bDoorsOn As Boolean
Friend m_bGunstockOn As Boolean
' inizializzazione lettura variabili ad inizio programma
Friend Sub InitOptionModule()
' Leggo elenco lingue disponibili da file ini
Dim nIndex As Integer = 1
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
While Not IsNothing(ReadLanguage)
OptionModule.m_LanguageList.Add(ReadLanguage)
nIndex += 1
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
End While
If nIndex = 1 Then
EgtOutLog("Error missing languages section in Config.ini")
MessageBox.Show("Error : missing languages informations", "EgtCAM5", MessageBoxButton.OK, MessageBoxImage.Error)
End
End If
' Inizializzo la lingua corrente
OptionModule.m_SelectedLanguage = OptionModule.m_LanguageList(0)
Dim sMsgName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName)
For Each Language In OptionModule.m_LanguageList
If Language.Name = sMsgName Then
OptionModule.m_SelectedLanguage = Language
Exit For
End If
Next
' Inizializzo variabili colori di sfondo scena, griglia
Dim BackTopColor As New Color3d(192, 192, 192)
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
m_TopSceneBackground = BackTopColor
Dim BackBotColor As New Color3d(BackTopColor)
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
m_BotSceneBackground = BackBotColor
Dim GridColor As New Color3d(0, 0, 0)
GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, GridColor)
m_GridColor = GridColor
' Inizializzo flag linee ingrossate
m_bThickLine = (GetPrivateProfileInt(S_SCENE, K_LINEWIDTH, 1) <> 1)
' Inizializzo flag visualizzazione smussata delle superfici
m_bSmoothTriMesh = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
' Inizio colore di default in disegno
Dim DefColor As New Color3d(0, 0, 0)
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
m_DefMaterialColor = DefColor
' Inizializzo tolleranza geometrica
m_dGeometryTolerance = GetPrivateProfileDouble(S_GEOMDB, K_SURFTMTOLER, 0.05)
' Inizializzo variabili per import
m_dDxfScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_DXFSCALE, 1)
m_dStlScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_STLSCALE, 1)
m_dImgScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_IMGSCALE, 1)
' Inizializzo variabili per export
m_nExportDxfFlag = GetPrivateProfileInt(S_EXPORT, K_DXFFLAG, EEX_FL.COMP_LAYER)
m_nImgWidth = GetPrivateProfileInt(S_EXPORT, K_IMGWIDTH, 400)
m_nImgHeight = GetPrivateProfileInt(S_EXPORT, K_IMGHEIGHT, 300)
' Inizializzo variabili che indicano per ogni tipo di lavorazione quale geometria è selezionabile
Dim Temp As Integer = 0
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWING, -1)
m_SelGeomSawing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMDRILLING, -1)
m_SelGeomDrilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMILLING, -1)
m_SelGeomMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMPOCKETING, -1)
m_SelGeomPocketing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMORTISING, -1)
m_SelGeomMortising = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWROUGHING, -1)
m_SelGeomSawRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWFINISHING, -1)
m_SelGeomSawFinishing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMGENMACHINING, -1)
m_SelGeomGenMachining = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMCHISELING, -1)
m_SelGeomChiseling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSURFFINISHING, -1)
m_SelGeomSurfFinishing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSURFROUGHING, -1)
m_SelGeomSurfRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMFIVEAXMILLING, -1)
m_SelGeomFiveAxMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELVMILLQUALITY, 0)
m_SelVMillQuality = If(Temp < -2 Or Temp > 2, VMillSelTypeOpt.HIGHER, DirectCast(Temp, VMillSelTypeOpt))
m_SelGeomWaterJetting = SceneSelModeOpt.PARTCURVES
' Inizializzo variabile che indica posizione nuova operazione di lavorazione
m_bNewMachiningIsLastOne = (GetPrivateProfileInt(S_OPTIONS, K_NEWMACHININGISLASTONE, 0) <> 0)
' Inizializzo variabile che indica se usare script di disposizione
m_bUseDispositionScript = (GetPrivateProfileInt(S_OPTIONS, K_USEDISPOSITIONSCRIPT, 0) <> 0)
' Inizializzo variabili per Extra
m_bSpecialOn = (GetPrivateProfileInt(S_SPECIAL, K_SPECIALENABLE, 0) <> 0)
m_bBeamOn = (GetPrivateProfileInt(S_BEAM, K_BEAMENABLE, 0) <> 0)
m_bWallOn = (GetPrivateProfileInt(S_WALL, K_WALLENABLE, 0) <> 0)
m_bDoorsOn = (GetPrivateProfileInt(S_DOORS, K_DDFENABLE, 0) <> 0)
m_bGunstockOn = (GetPrivateProfileInt(S_GUNSTOCK, K_GUNSTOCKENABLE, 0) <> 0)
End Sub
End Module
' Classe che identifica una lingua del programma con nome e path del file dei messaggi
Public Class Language
Private m_sName As String
Private m_sFilePath As String
Public Property Name As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Public Property FilePath As String
Get
Return m_sFilePath
End Get
Set(value As String)
m_sFilePath = value
End Set
End Property
Sub New(sName As String, sFilePath As String)
Me.Name = sName
Me.FilePath = sFilePath
End Sub
End Class