EgtCAM5 :

- modifiche per impostazione qualità di visualizzazione superfici (con eliminazione SmoothTriMesh/ShowTriaAdv).
This commit is contained in:
Dario Sassi
2025-08-24 19:18:58 +02:00
parent cfaf513a91
commit bba92a4980
7 changed files with 146 additions and 74 deletions
+2 -2
View File
@@ -73,7 +73,7 @@ Module ConstIni
Public Const K_SELSURF As String = "SelSurf"
Public Const K_SHOWMODE As String = "ShowMode"
Public Const K_CURVEDIR As String = "CurveDir"
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
Public Const K_SHOWSURFQUALITY As String = "ShowSurfQuality"
Public Const K_SHOWZMAP As String = "ShowZmap"
Public Const K_TEXMAXLINPIX As String = "TextureMaxLinPixels"
Public Const K_ZOOMWIN As String = "ZoomWin"
@@ -190,7 +190,7 @@ Module ConstIni
Public Const K_SELGEOMSURFROUGHING As String = "SelGeomSurfRoughing"
Public Const K_SELGEOMFIVEAXMILLING As String = "SelGeomFiveAxMilling"
Public Const K_SELGEOMPROBING As String = "SelGeomProbing"
Public Const K_SELVMILLQUALITY As String = "VMillQuality"
Public Const K_VMILLQUALITY As String = "VMillQuality"
Public Const K_MACHININGGROUP As String = "MachiningGroup"
Public Const K_SHOWONLYTABLE As String = "ShowOnlyTable"
Public Const K_MOVETHROUGHDISPS As String = "MoveThroughDisps"
+47 -6
View File
@@ -12,8 +12,8 @@ Friend Module OptionModule
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
' Qualità di visualizzazione delle superfici
Friend m_ShowSurfQuality As SceneSurfQualityOpt
' Colore di default in disegno
Friend m_DefMaterialColor As Color3d
@@ -60,7 +60,8 @@ Friend Module OptionModule
Friend m_SelGeomWaterJetting As SceneSelModeOpt
Friend m_SelGeomFiveAxMilling As SceneSelModeOpt
Friend m_SelGeomProbing As SceneSelModeOpt
Friend m_SelVMillQuality As VMillSelTypeOpt
' 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
@@ -111,13 +112,22 @@ Friend Module OptionModule
' 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)
Dim nSSQ As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWSURFQUALITY, 0)
m_ShowSurfQuality = DirectCast( Math.Min( Math.Max( nSSQ, -2), 2), SceneSurfQualityOpt)
' 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)
@@ -157,9 +167,10 @@ Friend Module OptionModule
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))
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 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
@@ -172,6 +183,36 @@ Friend Module OptionModule
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
+12 -4
View File
@@ -14,6 +14,7 @@
<EgtWPFLib5:EgtCustomWindow.Resources>
<local:GeomTypeConverter x:Key="GeomTypeConverter"/>
<local:SceneSurfQualityOptConverter x:Key="SceneSurfQualityOptConverter"/>
<local:VMillTypeConverter x:Key="VMillTypeConverter"/>
</EgtWPFLib5:EgtCustomWindow.Resources>
@@ -65,10 +66,17 @@
Grid.Row="0" Margin="0,5,0,5"/>
<CheckBox IsChecked="{Binding ThickLine}"
Grid.Column="1" Grid.Row="0" Margin="22,5,0,5" VerticalAlignment="Center"/>
<TextBlock Text="{Binding SmoothTriMeshMsg}" VerticalAlignment="Center"
<TextBlock Text="{Binding SceneSurfQualityMsg}" VerticalAlignment="Center"
Grid.Row="1" Margin="0,5,0,5"/>
<CheckBox IsChecked="{Binding SmoothTriMesh}"
Grid.Column="1" Grid.Row="1" Margin="22,5,0,5" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding SceneSurfQualityOptList, Mode=OneWay}"
SelectedItem="{Binding SelectedSceneSurfQualityOpt}"
Grid.Column="1" Grid.Row="1" Height="25" Margin="0,5,0,5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource SceneSurfQualityOptConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<UniformGrid Columns="2"
Margin="0,0,0,5">
@@ -374,7 +382,7 @@
<UniformGrid Columns="2" Grid.ColumnSpan="2" Margin="0,5,0,0">
<TextBlock Text="{Binding VMillQualityMsg}" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding VMillTypeList, Mode=OneWay}"
SelectedItem="{Binding SelectedVMillTypeType}" Height="25">
SelectedItem="{Binding SelectedVMillQualityType}" Height="25">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource VMillTypeConverter}}"/>
+68 -38
View File
@@ -34,6 +34,13 @@ Public Class OptionWindowVM
End Get
End Property
Private m_SceneSurfQualityOptList As ObservableCollection(Of SceneSurfQualityOpt) = New ObservableCollection(Of SceneSurfQualityOpt)({SceneSurfQualityOpt.LOWER, SceneSurfQualityOpt.LOW, SceneSurfQualityOpt.STANDARD, SceneSurfQualityOpt.HIGH, SceneSurfQualityOpt.HIGHER})
Public ReadOnly Property SceneSurfQualityOptList As ObservableCollection(Of SceneSurfQualityOpt)
Get
Return m_SceneSurfQualityOptList
End Get
End Property
Private m_FontList As New ObservableCollection(Of String)
Public ReadOnly Property FontList As ObservableCollection(Of String)
Get
@@ -98,6 +105,18 @@ Public Class OptionWindowVM
End Set
End Property
Public Property SelectedSceneSurfQualityOpt As SceneSurfQualityOpt
Get
Return OptionModule.m_ShowSurfQuality
End Get
Set(value As SceneSurfQualityOpt)
If WritePrivateProfileString(S_SCENE, K_SHOWSURFQUALITY, CInt(value).ToString()) Then
OptionModule.m_ShowSurfQuality = value
OptionModule.SetShowSurfQuality( true)
End If
End Set
End Property
Public Property SelectedMillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomMilling
@@ -158,8 +177,7 @@ Public Class OptionWindowVM
End If
End Set
End Property
Public Property SelectedGenGeomType As SceneSelModeOpt
Public Property SelectedGenGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomGenMachining
End Get
@@ -169,8 +187,7 @@ Public Class OptionWindowVM
End If
End Set
End Property
Public Property SelectedSurfRoughGeomType As SceneSelModeOpt
Public Property SelectedSurfRoughGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomSurfRoughing
End Get
@@ -180,7 +197,6 @@ Public Class OptionWindowVM
End If
End Set
End Property
Public Property SelectedSurfFinishGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomSurfFinishing
@@ -202,7 +218,6 @@ Public Class OptionWindowVM
' End If
' End Set
'End Property
Public Property SelectedFiveAxGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomFiveAxMilling
@@ -213,7 +228,6 @@ Public Class OptionWindowVM
End If
End Set
End Property
Public Property SelectedProbingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomProbing
@@ -225,13 +239,13 @@ Public Class OptionWindowVM
End Set
End Property
Public Property SelectedVMillTypeType As VMillSelTypeOpt
Public Property SelectedVMillQualityType As VMillSelTypeOpt
Get
Return OptionModule.m_SelVMillQuality
Return OptionModule.m_VMillQuality
End Get
Set(value As VMillSelTypeOpt)
If WritePrivateProfileString(S_MACH, K_SELVMILLQUALITY, CInt(value).ToString()) Then
OptionModule.m_SelVMillQuality = value
If WritePrivateProfileString(S_MACH, K_VMILLQUALITY, CInt(value).ToString()) Then
OptionModule.m_VMillQuality = value
End If
End Set
End Property
@@ -312,19 +326,10 @@ Public Class OptionWindowVM
End Get
Set(value As Boolean)
OptionModule.m_bThickLine = value
WritePrivateProfileString(S_SCENE, K_LINEWIDTH, If(value, "2", "1"))
EgtSetLineAttribs(If(value, 2, 1))
End Set
End Property
Public Property SmoothTriMesh As Boolean
Get
Return OptionModule.m_bSmoothTriMesh
End Get
Set(value As Boolean)
OptionModule.m_bSmoothTriMesh = value
WritePrivateProfileString(S_SCENE, K_SHOWTRIAADV, If(value, "1", "0"))
EgtSetShowTriaAdv(value)
Dim nThickLine As Integer = OptionModule.GetLineWidth()
WritePrivateProfileString(S_SCENE, K_LINEWIDTH, nThickLine.ToString())
EgtSetLineAttribs(nThickLine)
EgtDraw()
End Set
End Property
@@ -886,9 +891,9 @@ Public Class OptionWindowVM
Return EgtMsg(6536) ' Linee spesse
End Get
End Property
Public ReadOnly Property SmoothTriMeshMsg As String
Public ReadOnly Property SceneSurfQualityMsg As String
Get
Return EgtMsg(6518) ' Superfici smussate
Return EgtMsg(6518) ' Qualità visualizzazione superfici
End Get
End Property
Public ReadOnly Property UpdateLicenceMsg As String
@@ -1978,21 +1983,21 @@ Public Class GeomTypeConverter
End Class
Public Class VMillTypeConverter
Public Class SceneSurfQualityOptConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Select Case CInt(value)
Case VMillSelTypeOpt.LOWER
Return EgtMsg(31215)
Case VMillSelTypeOpt.LOW
Return EgtMsg(31216)
Case VMillSelTypeOpt.STANDARD
Return EgtMsg(31217)
Case VMillSelTypeOpt.HIGH
Return EgtMsg(31218)
Case VMillSelTypeOpt.HIGHER
Return EgtMsg(31219)
Case SceneSurfQualityOpt.LOWER
Return EgtMsg(31215) ' Inferiore
Case SceneSurfQualityOpt.LOW
Return EgtMsg(31216) ' Bassa
Case SceneSurfQualityOpt.STANDARD
Return EgtMsg(31217) ' Media
Case SceneSurfQualityOpt.HIGH
Return EgtMsg(31218) ' Alta
Case SceneSurfQualityOpt.HIGHER
Return EgtMsg(31219) ' Superiore
Case Else
Return ""
End Select
@@ -2001,4 +2006,29 @@ Public Class VMillTypeConverter
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
End Class
Public Class VMillTypeConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Select Case CInt(value)
Case VMillSelTypeOpt.LOWER
Return EgtMsg(31215) ' Inferiore
Case VMillSelTypeOpt.LOW
Return EgtMsg(31216) ' Bassa
Case VMillSelTypeOpt.STANDARD
Return EgtMsg(31217) ' Media
Case VMillSelTypeOpt.HIGH
Return EgtMsg(31218) ' Alta
Case VMillSelTypeOpt.HIGHER
Return EgtMsg(31219) ' Superiore
Case Else
Return ""
End Select
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
+8 -23
View File
@@ -294,19 +294,9 @@ Public Class ProjectVM
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)
m_ProjectScene.SetDefaultMaterial(OptionModule.m_DefMaterialColor)
' 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)
m_ProjectScene.SetViewBackground(OptionModule.m_TopSceneBackground, OptionModule.m_BotSceneBackground)
' imposto colori di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
@@ -370,12 +360,13 @@ Public Class ProjectVM
' modo di visualizzazione
Dim nShowMode As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
Map.refShowPanelVM.ShowModeState(nShowMode)
' imposto spessore curve
m_ProjectScene.SetLineWidth(OptionModule.GetLineWidth())
' 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)
' qualità di visualizzazione delle superfici
OptionModule.SetShowSurfQuality( False)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(nShowZmap, False)
@@ -383,14 +374,8 @@ Public Class ProjectVM
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)
EgtSetCurrDimensionStyle(OptionModule.m_dExtLineLen, OptionModule.m_dArrowLen, OptionModule.m_dTextDist,
OptionModule.m_nLenIsMM, OptionModule.m_nDecDigit, OptionModule.m_sFont, OptionModule.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()
+1 -1
View File
@@ -175,7 +175,7 @@ Public Class MTableDbV
Public Sub DataGrid_PreviewMouseMove(sender As Object, e As MouseEventArgs)
Dim Element As Object = e.OriginalSource
While Not IsNothing(Element) AndAlso Not TypeOf Element Is ScrollBar
Element = VisualTreeHelper.GetParent(Element)
Element = VisualTreeHelper.GetParent(CType(Element, DependencyObject))
End While
' verifico che non sia ScrollBar, di modo che questa continui a funzionare, ma non possa selezionare piu' righe trascinando
If IsNothing(Element) OrElse Not TypeOf Element Is ScrollBar Then
+8
View File
@@ -17,6 +17,14 @@ Public Module IniFile
ONLYDRAW = 3
End Enum
Public Enum SceneSurfQualityOpt As Integer
LOWER = -2
LOW = -1
STANDARD = 0
HIGH = 1
HIGHER = 2
End Enum
Public Enum SceneSelModeOpt As Integer
NULL = 0
PARTCURVES = 1