7a25e8d634
- aggiunta toolbar per ReversePost - gestione protezione da licenza di Trimming e ReversePost - aggiunte info su Window, Trimming e ReversePost in AboutBox.
258 lines
12 KiB
VB.net
258 lines
12 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
|
|
' Qualità di visualizzazione delle superfici
|
|
Friend m_ShowSurfQuality As SceneSurfQualityOpt
|
|
' Tipo di visualizzazione delle Zmap
|
|
Friend m_nShowZmapType As Integer
|
|
|
|
' 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_dOffScaleFactor As Double
|
|
Friend m_dPlyScaleFactor As Double
|
|
Friend m_dImgScaleFactor As Double
|
|
Friend m_dAdvImpTolerance 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_SelGeomProbing As SceneSelModeOpt
|
|
' Qualità di calcolo del virtual milling
|
|
Friend m_VMillQuality 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_bWindowOn As Boolean
|
|
Friend m_bTrimmingOn As Boolean
|
|
Friend m_bReversePostOn 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
|
|
Dim nSSQ As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWSURFQUALITY, 0)
|
|
m_ShowSurfQuality = DirectCast( Math.Min( Math.Max( nSSQ, -2), 2), SceneSurfQualityOpt)
|
|
' Inizializzo tipo di visualizzazione Zmap
|
|
m_nShowZmapType = GetPrivateProfileInt(S_SCENE, K_SHOWZMAP, 9)
|
|
' 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 stile corrente delle quotature
|
|
m_dExtLineLen = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_EXTLINELEN, 5)
|
|
m_dArrowLen = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_ARROWLEN, 5)
|
|
m_dTextDist = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTDIST, 2)
|
|
m_nLenIsMM = GetPrivateProfileInt(S_DIMENSIONSTYLE, K_LENISMM, 2)
|
|
m_nDecDigit = GetPrivateProfileInt(S_DIMENSIONSTYLE, K_DECDIGIT, -2)
|
|
m_sFont = "" : GetPrivateProfileStringUtf8(S_DIMENSIONSTYLE, K_DIMFONT, "ModernPropS.Nfe", m_sFont)
|
|
m_dTextHeight = GetPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTHEIGHT, 2)
|
|
' Inizializzo variabili per import
|
|
m_dDxfScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_DXFSCALE, 1)
|
|
m_dStlScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_STLSCALE, 1)
|
|
m_dOffScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_OFFSCALE, 1)
|
|
m_dPlyScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_PLYSCALE, 1)
|
|
m_dImgScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_IMGSCALE, 1)
|
|
m_dAdvImpTolerance = GetPrivateProfileDouble(S_IMPORT, K_ADVTOLER, 0.05)
|
|
' 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_SELGEOMPROBING, -1)
|
|
m_SelGeomProbing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
|
|
m_SelGeomWaterJetting = SceneSelModeOpt.PARTCURVES
|
|
' Inizializzo qualità di virtual milling
|
|
Temp = GetPrivateProfileInt(S_MACH, K_VMILLQUALITY, 0)
|
|
m_VMillQuality = DirectCast(Math.Min( Math.Max( Temp, -2), 2), VMillSelTypeOpt)
|
|
' 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_bWindowOn = (GetPrivateProfileInt(S_WINDOW, K_WINDOWENABLE, 0) <> 0)
|
|
m_bTrimmingOn = (GetPrivateProfileInt(S_TRIMMING, K_TRIMMINGENABLE, 0) <> 0)
|
|
m_bReversePostOn = (GetPrivateProfileInt(S_REVERSEPOST, K_REVERSEPOSTENABLE, 0) <> 0)
|
|
m_bGunstockOn = (GetPrivateProfileInt(S_GUNSTOCK, K_GUNSTOCKENABLE, 0) <> 0)
|
|
End Sub
|
|
|
|
' restituisco spessore linee
|
|
Friend Function GetLineWidth() As Integer
|
|
Return If( m_bThickLine, 2, 1)
|
|
End Function
|
|
|
|
' imposto stato visualizzazione superfici
|
|
Friend Sub SetShowSurfQuality( bRedraw As Boolean)
|
|
Dim bSmoothTriMesh As Boolean = True
|
|
Dim dSrfBezShowTol As Double = 0.2
|
|
Select m_ShowSurfQuality
|
|
Case SceneSurfQualityOpt.LOWER
|
|
bSmoothTriMesh = False
|
|
dSrfBezShowTol = 4
|
|
Case SceneSurfQualityOpt.LOW
|
|
bSmoothTriMesh = False
|
|
dSrfBezShowTol = 1
|
|
Case SceneSurfQualityOpt.STANDARD
|
|
bSmoothTriMesh = True
|
|
dSrfBezShowTol = 0.2
|
|
Case SceneSurfQualityOpt.HIGH
|
|
bSmoothTriMesh = True
|
|
dSrfBezShowTol = 0.05
|
|
Case SceneSurfQualityOpt.HIGHER
|
|
bSmoothTriMesh = True
|
|
dSrfBezShowTol = 0.01
|
|
End Select
|
|
EgtSetShowTriaAdv(bSmoothTriMesh, false)
|
|
EgtSetShowSurfBezierTol(dSrfBezShowTol, bRedraw)
|
|
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
|