Compare commits

...

20 Commits

Author SHA1 Message Date
Emmanuele Sassi 1f0fd32470 Merge branch 'develop' into ImportExportMaterialDb 2023-03-01 13:16:49 +01:00
Emmanuele Sassi a257412294 - introdotta gestione ordine ribs anche in CurrMachining 2023-02-15 12:35:20 +01:00
Emmanuele Sassi daabc36730 - introduzione tipologie rib in ordinamento percorsi 2023-02-15 12:14:32 +01:00
Emmanuele Sassi 503616820b - modifica spostamento pezzo per stampa a 45 gradi 2023-02-10 16:23:33 +01:00
Emmanuele Sassi 84863dc5d5 - gestione colori in importazione
- gestione visibilita' entita' in importazione
- eliminazione marcatura pezzo selezionato
- correzione su cancellazione pezzo
2023-02-10 11:01:46 +01:00
Emmanuele Sassi 0e09b44db3 Merge remote-tracking branch 'ICARUS/main' into develop 2023-02-08 20:57:11 +01:00
Emmanuele Sassi ef883cb163 - gestione importazione materiali
- uso nuova gestione textbox per nome
2023-02-08 20:56:31 +01:00
DarioS 7934ad8fd5 Icarus 2.5b2 :
- correzione gestione assegnazione Ribs.
2023-02-08 16:33:28 +01:00
Emmanuele Sassi 2631c94c03 - Sviluppo importazione con materiali originali 2023-02-06 16:53:15 +01:00
DarioS 5db3c25d77 Icarus :
- piccole modifiche sugli spostamenti nella Disposizione.
2023-02-06 12:32:14 +01:00
DarioS ba92a9098d Merge branch 'develop' of https://gitlab.steamware.net/egalware/icarus 2023-02-06 10:22:33 +01:00
Emmanuele Sassi ee58cd36f0 Merge branch 'develop' into ImportExportMaterialDb 2023-02-03 17:32:22 +01:00
Emmanuele Sassi 1fae546b34 - correzione scorrimento parametri di lavorazione 2023-02-03 17:32:02 +01:00
Emmanuele Sassi 00dbe5f522 - inizio definizione tipo e modo di import ed export 2023-02-03 16:33:32 +01:00
Emmanuele Sassi e4b20c596a - aggiunto parametro RibInvertStrandOrder 2023-02-03 12:55:46 +01:00
Emmanuele Sassi b76ddfd303 - correzione riferimento da file importato 2023-02-03 08:59:47 +01:00
Emmanuele Sassi fa120a280c - creazione bottoni
- gestione abilitazione pagina
2023-02-03 08:58:40 +01:00
Emmanuele Sassi 99bcefcfe8 - correzione salvataggio parametri CurrMachining
- modifica gestione OrderedMachining Param
- gestione spostamento riferimento e pezzo su cambio tipo Ribs
2023-02-02 17:40:22 +01:00
DarioS 704a4becb4 Icarus :
- merge develop in main.
2023-02-02 11:50:57 +01:00
DarioS b3d50be2f9 Icarus 2.5b1 :
- migliorato report errori in generazione CN.
2023-02-02 11:44:46 +01:00
29 changed files with 1182 additions and 659 deletions
+9
View File
@@ -107,6 +107,7 @@
Public Const MAC_RIBSLINK = "RibsLink"
Public Const MAC_RIBSINVERTORDER = "RibsInvertOrder"
Public Const MAC_RIBSINVERTDIRECTION = "RibsInvertDirection"
Public Const MAC_RIBSINVERTSTRANDORDER = "RibsInvertStrandOrder"
Public Const MAC_RIBSLEADININVERT = "RibsLeadInInvert"
Public Const MAC_RIBSLEADINLEN = "RibsLeadInLen"
Public Const MAC_RIBSLEADOUTINVERT = "RibsLeadOutInvert"
@@ -153,11 +154,19 @@
' materiale in progetto
Public Const KEY_MATERIAL_GUID = "MaterialGuid"
Public Const KEY_MATERIAL_NAME = "MaterialName"
' nome file cn in progetto
Public Const KEY_ISOFILE_PATH = "IsoFilePath"
' info di spostamento pezzo per 45 gradi
Public Const KEY_MOVEDPART = "MovedPart"
Public Const KEY_MOVEDPART2 = "MovedPart2"
Public Const FILE_PATH = "FilePath"
Public Const PART_NAME = "PartName"
Public Const ENTITY_NAME = "EntityName"
' stringa che identifica il materiale come originale del costruttore
Public Const ORIG_MATERIAL As String = "***"
End Module
+37 -9
View File
@@ -163,6 +163,21 @@ Public Class CurrMachining
End Select
End Sub
Friend Overrides Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
' resetto stato di modificata
UpdateIsModified()
End If
End Sub
Protected Overrides Sub SaveParams()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub WriteCurrParamInPart(nPartId As Integer)
EgtSetInfo(nPartId, MAC_GUID, m_sCurrGUID.ToString())
For Each Cathegory As CurrMachiningCathegory In m_CathegoryList
@@ -226,6 +241,7 @@ Public Class CurrMachiningCathegory
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLINK, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTORDER, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nPartId, nIndex, bForceFromDb),
@@ -253,12 +269,6 @@ Public Class CurrMachiningCathegory
End Select
End Sub
Friend Sub SaveCurrParams()
For Each Param In m_MachiningParamList
Param.SaveParam()
Next
End Sub
Friend Sub ResetCurrParams()
For Each Param In m_MachiningParamList
Param.ResetParam()
@@ -906,6 +916,8 @@ Public Class CurrCheckMachiningParam
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTORDER, m_bValue)
Case Params.RIBSINVERTDIRECTION
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_bValue)
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_bValue)
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_bValue)
Case Params.RIBSLEADOUTINVERT
@@ -917,7 +929,7 @@ Public Class CurrCheckMachiningParam
Select Case Type
Case Params.SPIRALVASE
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
Case Params.RIBSLINK, Params.RIBSINVERTORDER, Params.RIBSINVERTDIRECTION, Params.RIBSLEADININVERT, Params.RIBSLEADOUTINVERT
Case Params.RIBSLINK, Params.RIBSINVERTORDER, Params.RIBSINVERTDIRECTION, Params.RIBSINVERTSTRANDORDER, Params.RIBSLEADININVERT, Params.RIBSLEADOUTINVERT
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.RIBS).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
End Select
If bForceFromDb OrElse Not bReadFromPart Then
@@ -937,6 +949,8 @@ Public Class CurrCheckMachiningParam
EgtSetInfo(nPartId, MAC_RIBSINVERTORDER, If(m_bValue, 1, 0))
Case Params.RIBSINVERTDIRECTION
EgtSetInfo(nPartId, MAC_RIBSINVERTDIRECTION, If(m_bValue, 1, 0))
Case Params.RIBSINVERTSTRANDORDER
EgtSetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0))
Case Params.RIBSLEADININVERT
EgtSetInfo(nPartId, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0))
Case Params.RIBSLEADOUTINVERT
@@ -1002,7 +1016,22 @@ Public Class CurrOrderedMachiningParam
Dim bReadFromPart As Boolean = False
Select Case Type
Case Params.PRINT_ORDER
m_ValueList = New ObservableCollection(Of IdNameStruct)
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
Dim sValue As String = ""
bReadFromPart = EgtGetInfo(nPartId, MAC_PRINTORDER, sValue)
Value = sValue
@@ -1056,7 +1085,6 @@ Public Class CurrOrderedMachiningParam
End Property
Public Sub ResetParamCmd()
m_SelValue = Nothing
Value = DbParam.OrigValue
NotifyPropertyChanged(NameOf(Value))
NotifyPropertyChanged(NameOf(SelValue))
@@ -120,39 +120,39 @@
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sName}"/>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<ListBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="2"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
<ListBox Grid.ColumnSpan="2"
Grid.Row="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -59,8 +59,23 @@ Public Class CurrMachiningPanelVM
End Property
Public Sub Ok()
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsCathegory As MachiningCathegory = CurrMachining.CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.RIBS)
If Not IsNothing(RibsCathegory) Then
Dim RibsTypeParam As MachiningParam = RibsCathegory.MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
End If
' scrivo i parametri modificati
m_CurrMachining.WriteCurrParamInPart(Map.refTopPanelVM.SelPart.nPartId)
m_CurrMachining.Save()
' se modificata tipologia Ribs, aggiorno posizione riferimento
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
@@ -28,12 +28,6 @@
Content="Move"
IsChecked="{Binding bMove_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Red"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"/>-->
<Border x:Name="PopupBrd"
Grid.Column="1"
@@ -97,77 +91,12 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=MoveBtn}"
PlacementTarget="{Binding ElementName=MoveBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border x:Name="PopupBrd" Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,0,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="X"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sXPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="1"
Margin="0,2.5,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Y"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sYPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Z"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sZPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="3"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragMove_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
<ToggleButton x:Name="RotateBtn"
Grid.Row="4"
Content="Rotate"
IsChecked="{Binding bRotate_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Blue"
Grid.Column="2"
Grid.Row="2"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"/>-->
<Border Grid.Column="1"
Grid.Row="2"
@@ -209,42 +138,4 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=RotateBtn}"
Grid.Column="1"
PlacementTarget="{Binding ElementName=RotateBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Columns="3">
<RadioButton Content="X"
GroupName="Axes"
IsChecked="{Binding RotAxes[0]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Y"
GroupName="Axes"
IsChecked="{Binding RotAxes[1]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Z"
GroupName="Axes"
IsChecked="{Binding RotAxes[2]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
</UniformGrid>
<EgtWPFLib5:EgtTextBox Grid.Row="1"
Text="{Binding sRotAngle, UpdateSourceTrigger=Explicit}"
Margin="0,5,0,0"/>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragRotate_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
</Grid>
+91 -60
View File
@@ -20,25 +20,7 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewXPos As Double = ptReference.x
StringToLen(value, dNewXPos)
Dim b3Print As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If b3Ribs.Min.x <> INFINITO Then
b3Print.Add(b3Ribs)
End If
End If
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimX
If b3Print.Max.x > ptReference.x Then
@@ -47,13 +29,18 @@ Public Class DispositionPanelVM
If b3Print.Min.x < ptReference.x Then
dMin += ptReference.x - b3Print.Min.x
End If
If dNewXPos >= dMin AndAlso dNewXPos <= dMax Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sXPos))
' riduco a spostamento massimo
If dNewXPos < dMin Then
dNewXPos = dMin
ElseIf dNewXPos > dMax Then
dNewXPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sXPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
@@ -72,25 +59,7 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewYPos As Double = ptReference.y
StringToLen(value, dNewYPos)
Dim b3Print As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If b3Ribs.Min.x <> INFINITO Then
b3Print.Add(b3Ribs)
End If
End If
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimY
If b3Print.Max.y > ptReference.y Then
@@ -99,13 +68,18 @@ Public Class DispositionPanelVM
If b3Print.Min.y < ptReference.y Then
dMin += ptReference.y - b3Print.Min.y
End If
If dNewYPos >= dMin AndAlso dNewYPos <= dMax Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sYPos))
' riduco a spostamento massimo
If dNewYPos < dMin Then
dNewYPos = dMin
ElseIf dNewyPos > dMax Then
dNewYPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sYPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
@@ -124,16 +98,67 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sZPos))
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
' riduco a spostamento massimo
If dNewZPos < dMin Then
dNewZPos = dMin
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sZPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
Friend Sub UpdateZPos()
Dim ptReference As New Point3d
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
If ptReference.z < dMin Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dMin) - ptReference, GDB_RT.GLOB)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End If
NotifyPropertyChanged(NameOf(sZPos))
End Sub
' funzione che calcola il box totale del solido da stampare piu' ribs esterne ed unbounded
Friend Function GetSolidForReferenceBBox(SelPart As Print3dPartVM) As BBox3d
Dim b3Print As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
If Not EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType) Then
EgtGetInfo(SelPart.nPartId, MAC_RIBSTYPE, nRibType)
End If
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If Not b3Ribs.IsEmpty() Then
b3Print.Add(b3Ribs)
End If
End If
Return b3Print
End Function
Private m_RotAxes As Boolean() = { False, False, False}
Public Property RotX As Boolean
Get
@@ -185,19 +210,25 @@ Public Class DispositionPanelVM
Return
End If
Dim vtMovedPart As Vector3d
if EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, "MovedPart", vtMovedPart) Then
Dim nEntId = EgtGetFirstInGroup( Map.refTopPanelVM.SelPart.nPrintSolidLayerId)
If EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART, vtMovedPart) Then
Dim nEntId = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nPrintSolidLayerId)
While nEntId <> GDB_ID.NULL
EgtMove(nEntId, -vtMovedPart, GDB_RT.GLOB)
nEntId = EgtGetNext( nEntId)
nEntId = EgtGetNext(nEntId)
End While
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, "MovedPart")
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART)
End If
If EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART2, vtMovedPart) Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, -vtMovedPart, GDB_RT.GLOB)
EgtMove(Map.refTopPanelVM.SelPart.nReferenceId, vtMovedPart, GDB_RT.GLOB)
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART2)
End If
Dim b3PrintSolid As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPartId, GDB_BB.STANDARD, b3PrintSolid)
If EgtRotate(Map.refTopPanelVM.SelPart.nPartId, b3PrintSolid.Center, vtSelRotAxes, dNewAngle, GDB_RT.GLOB) Then
m_sRotAngle = 0
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
RefreshPos()
EgtDraw()
NotifyPropertyChanged(NameOf(sRotAngle))
@@ -1,15 +1,45 @@
Imports System.Collections.ObjectModel
Imports System.Drawing
Imports System.IO
Imports System.Reflection
Imports EgtUILib
Imports EgtWPFLib5
Imports Icarus.ImportExportMachiningPanelVM
Public Class ImportExportMachiningPanelVM
Inherits VMBase
Private Const m_MaterialDataExtension As String = ".mtd"
Public Shared ReadOnly Property MaterialDataExtension As String
Get
Return m_MaterialDataExtension
End Get
End Property
Private Const m_OriginalMaterialDataExtension As String = ".omtd"
Public Shared ReadOnly Property OriginalMaterialDataExtension As String
Get
Return m_OriginalMaterialDataExtension
End Get
End Property
Private Const m_MachiningDataExtension As String = ".mcd"
Public Shared ReadOnly Property MachiningDataExtension As String
Get
Return m_MachiningDataExtension
End Get
End Property
' Modalita' di apertura della finestra
Public Enum WindowModeEnum As Integer
IMPORT
EXPORT
IMPORT = 1
EXPORT = 2
IMPORT_ORIG = 3
EXPORT_ORIG = 4
End Enum
' Tipo da importare/esportare
Public Enum WindowTypeEnum As Integer
MATERIAL = 1
MACHINING = 2
End Enum
Private m_WindowMode As WindowModeEnum
@@ -19,6 +49,13 @@ Public Class ImportExportMachiningPanelVM
End Get
End Property
Private m_WindowType As WindowTypeEnum
Public ReadOnly Property WindowType As WindowTypeEnum
Get
Return m_WindowType
End Get
End Property
' Lista delle lavorazioni
Private m_MachiningList As New ObservableCollection(Of ImpExpMachiningItem)
Public Property MachiningList As ObservableCollection(Of ImpExpMachiningItem)
@@ -85,22 +122,112 @@ Public Class ImportExportMachiningPanelVM
#Region "CONSTRUCTOR"
' export
Sub New()
m_WindowMode = WindowModeEnum.EXPORT
Sub New(Type As WindowTypeEnum, Mode As WindowModeEnum, Optional sImportFilePath As String = "")
m_WindowType = Type
ImpExpMachiningItem.SetWindowType(m_WindowType)
m_WindowMode = Mode
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
nIndex += 1
End While
Select Case Mode
Case WindowModeEnum.IMPORT
Select Case Type
Case WindowTypeEnum.MATERIAL
m_ImportFilePath = sImportFilePath
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
Dim bIsOriginal = False
Dim bIsCustom = False
While ReadMachiningParamString(nIndex, MAT_GUID, "", sGUID, sImportFilePath) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAT_NAME, "", sName, sImportFilePath)
Dim sOrigGUID As String = ""
ReadMachiningParamString(nIndex, MAT_ORIG, "", sOrigGUID, sImportFilePath)
If sOrigGUID = ORIG_MATERIAL Then
If Not bIsOriginal Then bIsOriginal = True
Else
If Not bIsCustom Then bIsCustom = True
End If
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, AlreadyExist(sName)))
nIndex += 1
End While
If bIsOriginal AndAlso bIsCustom Then
MessageBox.Show("Corrupted file! Impossible to import it!")
ElseIf bIsOriginal Then
LoadOriginalMaterial()
End If
Case WindowTypeEnum.MACHINING
m_ImportFilePath = sImportFilePath
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID, sImportFilePath) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName, sImportFilePath)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, AlreadyExist(sName)))
nIndex += 1
End While
End Select
Case WindowModeEnum.EXPORT
Select Case Type
Case WindowTypeEnum.MATERIAL
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID <> ORIG_MATERIAL Then
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMaterialParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
End If
nIndex += 1
End While
Case WindowTypeEnum.MACHINING
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
nIndex += 1
End While
End Select
Case WindowModeEnum.EXPORT_ORIG
If Type = WindowTypeEnum.MATERIAL Then
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID = ORIG_MATERIAL Then
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMaterialParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
End If
nIndex += 1
End While
End If
End Select
ImpExpMachiningItem.m_delEnableOkBtn = AddressOf EnableOkBtn
End Sub
@@ -134,9 +261,104 @@ Public Class ImportExportMachiningPanelVM
End Sub
Private Function AlreadyExist(MachiningName As String) As Boolean
Return Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = MachiningName)
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Return Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = MachiningName)
Case WindowTypeEnum.MACHINING
Return Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = MachiningName)
End Select
End Function
Enum MaterialState As Integer
NOTFOUND = 1
FOUND = 2
NOTORIGSAMENAME = 3
End Enum
Private Sub LoadOriginalMaterial()
m_WindowMode = WindowModeEnum.IMPORT_ORIG
' verifico se esistono materiali con lo stesso nome ma non originali
Dim ImportedMaterialList As New List(Of MaterialState)
For Each ImpExpMaterial In m_MachiningList
Dim IsNotOrigSameName As MaterialState = MaterialState.NOTFOUND
For Each DbMaterial In Map.refMaterialDbVM.MaterialList
If DbMaterial.sName = ImpExpMaterial.sName Then
Dim sOrigGUID As String = ""
ReadMaterialParamString(DbMaterial.nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID <> ORIG_MATERIAL Then
If Not IsNotOrigSameName Then IsNotOrigSameName = MaterialState.NOTORIGSAMENAME
End If
Else
IsNotOrigSameName = MaterialState.FOUND
End If
Next
ImportedMaterialList.Add(IsNotOrigSameName)
Next
If ImportedMaterialList.Contains(True) Then
Dim sDuplicatedMaterialList As String = ""
For Index = 0 To ImportedMaterialList.Count - 1
If ImportedMaterialList(Index) = MaterialState.NOTORIGSAMENAME Then
sDuplicatedMaterialList &= " - " & m_MachiningList(Index).sName & Environment.NewLine
End If
Next
MessageBox.Show("Impossible to import the package because materials named:" & Environment.NewLine &
sDuplicatedMaterialList & Environment.NewLine &
"Please modify the names of these machining and then retry to import the materials.")
Return
End If
' aggiorno/aggiungo materiali
Dim OrigFilePath As String = CurrentMachine.sMaterialFilePath
Dim NewMaterial As Material = Nothing
For Each Material In m_MachiningList
Dim nIndex As Integer = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
If Material.Active Then
CurrentMachine.SetMaterialFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMaterial = New Material(Material.nIndex)
' cambio guid, indice e verifico nome
NewMaterial.sGUID = Guid.NewGuid.ToString()
NewMaterial.SetIndex(nIndex)
If Material.AlreadyExist Then
If Material.ChangeName Then
NewMaterial.sName = Material.sName
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMaterial As Material = Map.refMaterialDbVM.MaterialList.FirstOrDefault(Function(x) x.sName = Material.sName)
NewMaterial.SetIndex(ToSubstituteMaterial.nIndex)
NewMaterial.sGUID = ToSubstituteMaterial.sGUID
Dim nToReplaceIndex As Integer = Map.refMaterialDbVM.MaterialList.IndexOf(ToSubstituteMaterial)
Map.refMaterialDbVM.MaterialList(nToReplaceIndex) = NewMaterial
End If
Else
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
End If
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' salvo la lavorazione
NewMaterial.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMaterial) Then
Map.refMaterialDbVM.SelMaterial = NewMaterial
Map.refMaterialDbVM.NotifyPropertyChanged(NameOf(Map.refMaterialDbVM.SelMaterial))
End If
' imposto Db modificato
Map.refMaterialDbVM.SetIsModified(True)
' messaggio con modifiche
Dim sMaterialList As String = ""
For Index = 0 To ImportedMaterialList.Count - 1
sMaterialList &= " - " & m_MachiningList(Index).sName & " (" & If(ImportedMaterialList(Index) = MaterialState.NOTFOUND, "New", "Updated") & ")" & Environment.NewLine
Next
MessageBox.Show("List of the materials:" & Environment.NewLine &
sMaterialList & Environment.NewLine &
"Import successfully completed.")
Return
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -159,52 +381,109 @@ Public Class ImportExportMachiningPanelVM
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub ConfirmImpExpMachinings(param As Object)
Select Case WindowMode
Select Case m_WindowMode
Case WindowModeEnum.IMPORT
Dim OrigFilePath As String = CurrentMachine.sMachiningFilePath
Dim NewMachining As Machining = Nothing
For Each Machining In m_MachiningList
Dim nIndex As Integer = Map.refMachiningDbVM.MachiningList.Max(Function(x) x.nIndex) + 1
If Machining.Active Then
CurrentMachine.SetMachiningFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMachining = New Machining(Machining.nIndex)
' cambio guid, indice e verifico nome
NewMachining.sGUID = Guid.NewGuid.ToString()
NewMachining.SetIndex(nIndex)
If Machining.AlreadyExist Then
If Machining.ChangeName Then
NewMachining.sName = Machining.sName
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Dim OrigFilePath As String = CurrentMachine.sMaterialFilePath
Dim NewMaterial As Material = Nothing
For Each Material In m_MachiningList
Dim nIndex As Integer = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
If Material.Active Then
CurrentMachine.SetMaterialFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMaterial = New Material(Material.nIndex)
' cambio guid, indice e verifico nome
NewMaterial.sGUID = Guid.NewGuid.ToString()
NewMaterial.SetIndex(nIndex)
If Material.AlreadyExist Then
If Material.ChangeName Then
NewMaterial.sName = Material.sName
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMaterial As Material = Map.refMaterialDbVM.MaterialList.FirstOrDefault(Function(x) x.sName = Material.sName)
NewMaterial.SetIndex(ToSubstituteMaterial.nIndex)
NewMaterial.sGUID = ToSubstituteMaterial.sGUID
Dim nToReplaceIndex As Integer = Map.refMaterialDbVM.MaterialList.IndexOf(ToSubstituteMaterial)
Map.refMaterialDbVM.MaterialList(nToReplaceIndex) = NewMaterial
End If
Else
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
End If
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' salvo la lavorazione
NewMaterial.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMaterial) Then
Map.refMaterialDbVM.SelMaterial = NewMaterial
Map.refMaterialDbVM.NotifyPropertyChanged(NameOf(Map.refMaterialDbVM.SelMaterial))
End If
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
' imposto Db modificato
Map.refMaterialDbVM.SetIsModified(True)
Case WindowTypeEnum.MACHINING
Dim OrigFilePath As String = CurrentMachine.sMachiningFilePath
Dim NewMachining As Machining = Nothing
For Each Machining In m_MachiningList
Dim nIndex As Integer = Map.refMachiningDbVM.MachiningList.Max(Function(x) x.nIndex) + 1
If Machining.Active Then
CurrentMachine.SetMachiningFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMachining = New Machining(Machining.nIndex)
' cambio guid, indice e verifico nome
NewMachining.sGUID = Guid.NewGuid.ToString()
NewMachining.SetIndex(nIndex)
If Machining.AlreadyExist Then
If Machining.ChangeName Then
NewMachining.sName = Machining.sName
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.sName = Machining.sName)
NewMachining.SetIndex(ToSubstituteMachining.nIndex)
NewMachining.sGUID = ToSubstituteMachining.sGUID
Dim nToReplaceIndex As Integer = Map.refMachiningDbVM.MachiningList.IndexOf(ToSubstituteMachining)
Map.refMachiningDbVM.MachiningList(nToReplaceIndex) = NewMachining
End If
Else
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
End If
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' salvo la lavorazione
NewMachining.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' salvo la lavorazione
NewMachining.Save()
' seleziono ultima importata
If Not IsNothing(NewMachining) Then
Map.refMachiningDbVM.SelMachining = NewMachining
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.SelMachining))
End If
' imposto Db modificato
Map.refMachiningDbVM.SetIsModified(True)
End Select
Case WindowModeEnum.EXPORT, WindowModeEnum.EXPORT_ORIG
' chiedo il nome con cui salvare il file
Dim sExtension As String =""
If m_WindowType = WindowTypeEnum.MATERIAL Then
If m_WindowMode = WindowModeEnum.EXPORT_ORIG Then
sExtension = OriginalMaterialDataExtension
Else
sExtension = MaterialDataExtension
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMachining) Then
Map.refMachiningDbVM.SelMachining = NewMachining
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.SelMachining))
Else
sExtension = MachiningDataExtension
End If
Case WindowModeEnum.EXPORT
' recupero le lavorazioni checkate
Dim FinalNameList As New List(Of String)
For Each Machining In MachiningList
If Machining.Active Then
FinalNameList.Add(Machining.sName)
End If
Next
If FinalNameList.Count() = 0 Then Return
Dim FinalNameArray = FinalNameList.ToArray()
' chiedo il nome con cui salvare il file .data
Dim SaveFileDlg As New System.Windows.Forms.SaveFileDialog() With {
.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*.data)|*.data|Tutti i file (*.*)|*.*",
.Filter = "File data (*" & sExtension & ")|*" & sExtension,
.FileName = String.Empty
}
If SaveFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
@@ -224,15 +503,25 @@ Public Class ImportExportMachiningPanelVM
Catch ex As Exception
End Try
End If
Dim ActiveMachiningList As List(Of Machining) = (From Machining In Map.refMachiningDbVM.MachiningList
Select Machining
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Machining.sGUID AndAlso x.Active)).ToList()
' salvo tutte le lavorazioni sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Dim ActiveMachiningList As List(Of Material) = (From Material In Map.refMaterialDbVM.MaterialList
Select Material
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Material.sGUID AndAlso x.Active)).ToList()
' salvo tutti i materiali sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
Case WindowTypeEnum.MACHINING
Dim ActiveMachiningList As List(Of Machining) = (From Machining In Map.refMachiningDbVM.MachiningList
Select Machining
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Machining.sGUID AndAlso x.Active)).ToList()
' salvo tutte le lavorazioni sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
End Select
End Select
' Chiusura finestra
RaiseEvent m_CloseWindow(True)
End Sub
@@ -246,13 +535,18 @@ End Class
Public Class ImpExpMachiningItem
Inherits VMBase
Public Const IMPEXTNAME As String = "_imp"
Public Const IMPEXPNAME As String = "_imp"
' Actions
Friend Shared m_delEnableOkBtn As Action
Private Shared m_Empty As New MachiningIndex(-1, Guid.Empty, "None")
Private Shared m_WindowType As WindowTypeEnum
Friend Shared Sub SetWindowType(value As WindowTypeEnum)
m_WindowType = value
End Sub
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
@@ -284,26 +578,51 @@ Public Class ImpExpMachiningItem
' se esiste gia' chiedo se sovrascriverla
If value Then
If m_AlreadyExist Then
Select Case System.Windows.MessageBox.Show(EgtMsg(31453), "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXTNAME) Then
nImpNameIndex += 1
While Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXTNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXTNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Machining will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Select Case System.Windows.MessageBox.Show("Material already existing in Db. Overwrite it?", "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME) Then
nImpNameIndex += 1
While Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXPNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Material will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
Case WindowTypeEnum.MACHINING
Select Case System.Windows.MessageBox.Show("Machining already existing in Db. Overwrite it?", "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME) Then
nImpNameIndex += 1
While Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXPNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Machining will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
End Select
NotifyPropertyChanged(NameOf(Active))
Else
@@ -360,82 +679,3 @@ Public Class ImpExpMachiningItem
End Function
End Class
Public Class MachiningItem
Inherits VMBase
' Actions
Friend Shared m_delEnableOkBtn As Action
Private m_Name As String
Public Property Name As String
Get
If m_ChangeName Then
Return m_Name & "_imp"
Else
Return m_Name
End If
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_Active As Boolean
Public Property Active As Boolean
Get
Return m_Active
End Get
Set(value As Boolean)
' se esiste gia' chiedo se sovrascriverla
If value Then
If m_AlreadyExist Then
Select Case System.Windows.MessageBox.Show(EgtMsg(31453), "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
System.Windows.MessageBox.Show(EgtMsg(31454), "", MessageBoxButton.OK)
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
NotifyPropertyChanged("Active")
Else
m_Active = True
End If
Else
m_ChangeName = False
m_Active = False
End If
If Not IsNothing(m_delEnableOkBtn) Then m_delEnableOkBtn()
End Set
End Property
' Parametro che indica se questo item da importare esiste gia'
Private m_AlreadyExist As Boolean
Friend ReadOnly Property AlreadyExist As Boolean
Get
Return m_AlreadyExist
End Get
End Property
' Parametro che indica se cambiare il nome di un item che esiste gia' o sovrascriverlo
Private m_ChangeName As Boolean
Friend Property ChangeName As Boolean
Get
Return m_ChangeName
End Get
Set(value As Boolean)
m_ChangeName = value
NotifyPropertyChanged("Name")
End Set
End Property
Sub New(Name As String, AlreadyExist As Boolean)
m_Name = Name
m_AlreadyExist = AlreadyExist
End Sub
End Class
+84 -42
View File
@@ -59,7 +59,10 @@ Public Class Machining
EXTRA_SHELL = 2
INFILL = 3
AUX_SOLID = 4
RIB = 5
RIB_UNBOUNDED = 5
RIB_EXTERNAL = 6
RIB_INTERNAL = 7
RIB_SUPPORT = 8
End Enum
Protected m_CathegoryList As New ObservableCollection(Of MachiningCathegory)
@@ -134,7 +137,7 @@ Public Class Machining
Else
nIndex = -1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "PrintingParam"
m_sName = "New Machining"
End If
m_sOrigName = m_sName
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.GENERAL, nIndex))
@@ -169,7 +172,7 @@ Public Class Machining
NotifyPropertyChanged(NameOf(ghName))
End Sub
Friend Sub Save()
Friend Overridable Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
@@ -180,7 +183,7 @@ Public Class Machining
End If
End Sub
Private Sub SaveParams()
Protected Overridable Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
@@ -353,6 +356,7 @@ Public Class MachiningCathegory
New CheckMachiningParam(MachiningParam.Params.RIBSLINK, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTORDER, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nIndex),
@@ -475,6 +479,7 @@ Public MustInherit Class MachiningParam
FLOWRATE_PC = 58
DYNAMIC_MODE = 59
PRINT_ORDER = 60
RIBSINVERTSTRANDORDER = 61
MATERIALS = 100
End Enum
@@ -561,6 +566,8 @@ Public MustInherit Class MachiningParam
m_sName = "Invert Order"
Case Params.RIBSINVERTDIRECTION
m_sName = "Invert Direction"
Case Params.RIBSINVERTSTRANDORDER
m_sName = "Invert Strand Order"
Case Params.RIBSLEADININVERT
m_sName = "Lead In Invert"
Case Params.RIBSLEADINLEN
@@ -1155,6 +1162,8 @@ Public Class CheckMachiningParam
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTORDER, 0)
Case Params.RIBSINVERTDIRECTION
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTDIRECTION, 0)
Case Params.RIBSINVERTSTRANDORDER
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTSTRANDORDER, 0)
Case Params.RIBSLEADININVERT
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSLEADININVERT, 0)
Case Params.RIBSLEADOUTINVERT
@@ -1174,6 +1183,8 @@ Public Class CheckMachiningParam
WriteMachiningParam(nIndex, MAC_RIBSINVERTORDER, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSINVERTDIRECTION
WriteMachiningParam(nIndex, MAC_RIBSINVERTDIRECTION, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSINVERTSTRANDORDER
WriteMachiningParam(nIndex, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSLEADININVERT
WriteMachiningParam(nIndex, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSLEADOUTINVERT
@@ -1269,6 +1280,8 @@ End Class
Public Class OrderedMachiningParam
Inherits MachiningParam
Protected m_StandardValueOrderList As List(Of Integer)
Protected m_ValueList As ObservableCollection(Of IdNameStruct)
Public ReadOnly Property ValueList As ObservableCollection(Of IdNameStruct)
Get
@@ -1304,48 +1317,44 @@ Public Class OrderedMachiningParam
Set(value As String)
Select Case Type
Case Params.PRINT_ORDER
Dim StandardValueList() As String = {Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB}
Dim StringValueList() As String = StandardValueList
If value.Length = 9 Then
Dim StringValueList() As String
Dim IntegerValueList As New List(Of Integer)
If value.Length = 15 Then
StringValueList = value.Split(","c)
For Each StringValue In StringValueList
Dim IntegerValue As Integer = 0
If Integer.TryParse(StringValue, IntegerValue) Then
IntegerValueList.Add(IntegerValue)
End If
Next
End If
If StringValueList.Count <> 5 Then
StringValueList = StandardValueList
If IntegerValueList.Count <> 8 Then
IntegerValueList = m_StandardValueOrderList
End If
If Not StringValueList.Contains(Machining.MPAR_PRINT_ORDER.SHELL) OrElse
Not StringValueList.Contains(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL) OrElse
Not StringValueList.Contains(Machining.MPAR_PRINT_ORDER.INFILL) OrElse
Not StringValueList.Contains(Machining.MPAR_PRINT_ORDER.AUX_SOLID) OrElse
Not StringValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB) Then
StringValueList = StandardValueList
If Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.SHELL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.INFILL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.AUX_SOLID) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT) Then
IntegerValueList = m_StandardValueOrderList
End If
m_ValueList.Clear()
For Each StringValue In StringValueList
Dim nValue As Integer = -1
Integer.TryParse(StringValue, nValue)
Dim ItemList As IdNameStruct
Select Case nValue
Case Machining.MPAR_PRINT_ORDER.SHELL
ItemList = New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell")
Case Machining.MPAR_PRINT_ORDER.EXTRA_SHELL
ItemList = New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shell")
Case Machining.MPAR_PRINT_ORDER.INFILL
ItemList = New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infill")
Case Machining.MPAR_PRINT_ORDER.AUX_SOLID
ItemList = New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids")
Case Machining.MPAR_PRINT_ORDER.RIB
ItemList = New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB, "Ribs")
End Select
m_ValueList.Add(ItemList)
Next
OrderByReference(m_ValueList, IntegerValueList)
End Select
End Set
End Property
Public Shared Sub OrderByReference(collection As ObservableCollection(Of IdNameStruct), comparison As List(Of Integer))
For i As Integer = 0 To comparison.Count - 1
Dim Index As Integer = i
If Not comparison.ElementAt(i).Equals(collection.ElementAt(i)) Then
collection.Move(collection.IndexOf(collection.FirstOrDefault(Function(x) x.Id = comparison(Index))), i)
End If
Next
End Sub
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return Value <> m_OrigValue
@@ -1364,12 +1373,45 @@ Public Class OrderedMachiningParam
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
If nIndex = 0 Then
m_ValueList = New ObservableCollection(Of IdNameStruct)
m_SelValue = Nothing
Select Case Type
Case Params.PRINT_ORDER
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
m_SelValue = Nothing
End Select
Else
Select Case Type
Case Params.PRINT_ORDER
m_ValueList = New ObservableCollection(Of IdNameStruct)
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
ReadMachiningParamString(nIndex, MAC_PRINTORDER, "", Value)
End Select
End If
@@ -1457,9 +1499,9 @@ Public Class OrderedMachiningParam
Public Sub ResetOrder()
Dim CurrValue As String = Value
OrderByReference(m_ValueList, m_StandardValueOrderList)
m_ValueList = New ObservableCollection(Of IdNameStruct)(m_ValueList.OrderBy(Function(x) x.Id))
If Value <> CurrValue Then
SelValue = Nothing
NotifyPropertyChanged(NameOf(ValueList))
NotifyPropertyChanged(NameOf(Value))
NotifyPropertyChanged(NameOf(SelValue))
+28 -26
View File
@@ -8,7 +8,6 @@
Style="{StaticResource RightPanel_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
@@ -63,6 +62,7 @@
Visibility="{Binding Combo_Visibility}"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelectedItem.sName, ElementName=MachiningCombo, UpdateSourceTrigger=Explicit}"
ExplicitUpdateSource="EnterKeyPressOrLostFocus"
IsExplicitFocused="{Binding UserShouldEditValueNow}"
Visibility="{Binding Name_Visibility}"
Style="{StaticResource OptionTextBox}"/>
@@ -72,7 +72,7 @@
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<ScrollViewer Grid.Row="3"
<ScrollViewer Grid.Row="2"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
@@ -188,31 +188,33 @@
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sName}"/>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
<ListBox Grid.ColumnSpan="2"
Grid.Row="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="1"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -222,7 +224,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<UniformGrid Grid.Row="3" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsEnabled="{Binding IsEnabled}"
+8 -7
View File
@@ -291,6 +291,9 @@ Public Class MachiningDbVM
Case MessageBoxResult.Yes
m_MachiningList.Remove(m_SelMachining)
SetIsModified(True)
If m_MachiningList.Count > 0 Then
SelMachining = m_MachiningList(0)
End If
Case MessageBoxResult.No
Return
End Select
@@ -330,13 +333,11 @@ Public Class MachiningDbVM
Public Sub Import()
' chiedo il nome del file .data da aprire
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {
.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*.data)|*.data|Tutti i file (*.*)|*.*",
.FileName = String.Empty
}
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*" & ImportExportMachiningPanelVM.MachiningDataExtension & ")|*" & ImportExportMachiningPanelVM.MachiningDataExtension,
.FileName = String.Empty}
If OpenFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
Dim ImportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(OpenFileDlg.FileName))
Dim ImportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MACHINING, ImportExportMachiningPanelVM.WindowModeEnum.IMPORT, OpenFileDlg.FileName))
ImportWindow.ShowDialog()
End Sub
@@ -354,7 +355,7 @@ Public Class MachiningDbVM
End Property
Public Sub Export()
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM)
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MACHINING, ImportExportMachiningPanelVM.WindowModeEnum.EXPORT))
ExportWindow.ShowDialog()
End Sub
+2 -2
View File
@@ -195,8 +195,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(5583, 2501, 1, m_nKeyLevel) And
EgtGetKeyOptions(5583, 2501, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(5583, 2502, 1, m_nKeyLevel) And
EgtGetKeyOptions(5583, 2502, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
+6 -10
View File
@@ -359,15 +359,17 @@ Public Class ManagePartPanelVM
nRibsLayerId = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
Dim nRibsIndex As Integer = 1
For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
EgtSetInfo(PartManager_GeomEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetInfo(PartManager_GeomEntity.nId, RIB_ID, RibPanelVM.GetNextRibIndex())
EgtSetInfo(PartManager_GeomEntity.nId, RIB_ID, nRibsIndex)
EgtRelocateGlob(PartManager_GeomEntity.nId, nRibsLayerId, GDB_POS.LAST_SON)
' elimino colore entita'
EgtResetColor(PartManager_GeomEntity.nId)
If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
End If
nRibsIndex += 1
Next
Case ManagePart_Layer.LayerType.SHELL_NUMBER
nShellNumberLayerId = EgtCreateGroup(nPartId)
@@ -433,17 +435,9 @@ Public Class ManagePartPanelVM
End If
End Select
Next
' aggiungo riferimento
' aggiungo layer riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Dim frPrintSolid As New Frame3d(ptOrig)
nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
If nFrameId Then
EgtSetName(nFrameId, FRAME_PART)
EgtSetMode(nFrameId, GDB_MD.LOCKED)
End If
EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -455,6 +449,8 @@ Public Class ManagePartPanelVM
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Next
End If
'EgtAddMachGroup("3dPrint")
+44 -26
View File
@@ -1,4 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports EgtUILib
Imports EgtWPFLib5
@@ -375,10 +376,11 @@ Public Class ManagePart_Layer
Public Enum LayerType As Integer
PRINT_SOLID = 1
MACH_START = 2
RIBS = 3
SHELL_NUMBER = 4
AUX_SOLIDS = 5
'REFERENCE = 2
MACH_START = 3
RIBS = 4
SHELL_NUMBER = 5
AUX_SOLIDS = 6
OTHERS = 7
CHANGENAME = 15
DELETE = 16
@@ -639,7 +641,7 @@ Public Class GeomEntity_MenuItem
End If
' se e' presente elimino flag di spostamento a 45 gradi
Dim nPartId As Integer = EgtGetParent(EgtGetParent(m_OrigEntity.nId))
EgtRemoveInfo(nPartId, "MovedPart")
EgtRemoveInfo(nPartId, KEY_MOVEDPART)
EgtDraw()
' aggiorno riferimenti nel context menu item
Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
@@ -666,6 +668,8 @@ Public Class GeomEntity_MenuItem
NewLayer.EntityList.Add(m_OrigEntity)
' aggiorno riferimenti nell'entita'
m_OrigEntity.UpdateOrigLayer(NewLayer)
' aggiorno colore
EgtSetColor(m_OrigEntity.nId, GetColor(LayerType.PRINTPART))
End If
End If
' aggiorno i contextmenu di tutti gli entity
@@ -684,44 +688,38 @@ Public Class GeomEntity_MenuItem
' creo layer solido di stampa
Dim nPrintPartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nPrintPartLayerId, PRINT_SOLID)
EgtSetColor(nPrintPartLayerId, GeomEntityColors.c3Print)
EgtRelocateGlob(m_OrigEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
' calcolo box superficie per creazione riferimento
EgtGetBBoxGlob(m_OrigEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
' coloro l'entita'
EgtSetColor(m_OrigEntity.nId, GeomEntityColors.c3Print)
' creo layer mach start
Dim nMachStartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nMachStartLayerId, LAY_MACH_START)
EgtSetColor(nMachStartLayerId, GeomEntityColors.c3MachStart)
Dim nMachStartId As Integer = GDB_ID.NULL
' creo punto di partenza
Dim ptStart As Point3d = b3PrintSolid.Center() - 0.6 * b3PrintSolid.DimY() * Vector3d.Y_AX() - 0.5 * b3PrintSolid.DimZ() * Vector3d.Z_AX()
nMachStartId = EgtCreateGeoPoint(nMachStartLayerId, ptStart, GDB_RT.GLOB)
EgtSetName(nMachStartId, START_GEOM)
' coloro l'entita' di rosso
EgtSetColor(nMachStartId, GeomEntityColors.c3MachStart)
' creo layer ribs
Dim nRibsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
' creo layer shell number
Dim nShellNumberLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
EgtSetColor(nShellNumberLayerId, GeomEntityColors.c3ShellNumber)
' creo layer aux
Dim nAuxSolidsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
EgtSetColor(nAuxSolidsLayerId, GeomEntityColors.c3AuxSolids)
' creo layer others
Dim nOthersLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nOthersLayerId, LAY_OTHERS)
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
' aggiungo riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Dim frPrintSolid As New Frame3d(ptOrig)
nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
If nFrameId Then
EgtSetName(nFrameId, FRAME_PART)
EgtSetMode(nFrameId, GDB_MD.LOCKED)
End If
EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -730,6 +728,8 @@ Public Class GeomEntity_MenuItem
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Dim ManagePart_Part As ManagePart_Part = New ManagePart_Part(NewPart)
' elimino da posizione originale
m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
@@ -741,9 +741,10 @@ Public Class GeomEntity_MenuItem
' Imposto flag di ricalcolo slice
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
End Select
'' aggiorno visibilita' da check di categoria
'Dim PrintLayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = ViewLayer.ViewLayerType.PRINT_SOLID)
'EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintLayer.bIsVisible) OrElse PrintLayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
' aggiorno visibilita' da check di categoria
Dim PrintViewlayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = ViewLayer.ViewLayerType.PRINT_SOLID)
EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintViewlayer.bIsVisible) OrElse PrintViewlayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
EgtDraw()
Return
End If
Select Case Map.refManagePartPanelVM.Type
@@ -763,11 +764,18 @@ Public Class GeomEntity_MenuItem
NewLayer.EntityList.Add(m_OrigEntity)
' aggiorno riferimenti nell'entita'
m_OrigEntity.UpdateOrigLayer(NewLayer)
' aggiorno colore
EgtSetColor(m_OrigEntity.nId, GetColor(m_Type))
' aggiorno visibilita' da check di categoria
Dim PrintViewlayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = m_Type)
EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintViewlayer.bIsVisible) OrElse PrintViewlayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
EgtDraw()
End If
End If
' aggiorno riferimenti nel context menu item
m_OrigEntity.UpdateContextMenu()
Case ManagePartPanelVM.ManagePartType.MODIFY
Dim bIsMovedRib As Boolean = False
' recupero layer da pezzo
Dim nLayerId As Integer = GDB_ID.NULL
Select Case m_Type
@@ -789,19 +797,20 @@ Public Class GeomEntity_MenuItem
' elimino info vecchio layer
Select Case m_OrigEntity.OrigLayer.Type
Case ManagePart_Layer.LayerType.PRINT_SOLID
EgtResetMark(m_OrigEntity.nId)
'EgtResetMark(m_OrigEntity.nId)
' se e' presente flag di spostamento a 45 gradi
Dim nPartId As Integer = EgtGetParent(EgtGetParent(m_OrigEntity.nId))
Dim vtMoved As Vector3d
If EgtGetInfo(nPartId, "MovedPart", vtMoved) Then
If EgtGetInfo(nPartId, KEY_MOVEDPART, vtMoved) Then
' lo sposto e rimuovo info
EgtMove(m_OrigEntity.nId, -vtMoved, GDB_RT.GLOB)
EgtRemoveInfo(nPartId, "MovedPart")
EgtRemoveInfo(nPartId, KEY_MOVEDPART)
End If
Case ManagePart_Layer.LayerType.MACH_START
Case ManagePart_Layer.LayerType.RIBS
EgtRemoveInfo(m_OrigEntity.nId, KEY_RIB_TYPE)
EgtRemoveInfo(m_OrigEntity.nId, RIB_ID)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtRemoveInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE)
Case ManagePart_Layer.LayerType.AUX_SOLIDS
@@ -827,7 +836,7 @@ Public Class GeomEntity_MenuItem
EgtSetName(m_OrigEntity.nId, PRINT_SOLID)
EgtSetColor(m_OrigEntity.nId, c3Print)
' rimuovo eventuale nota spostamento per 45 gradi
EgtRemoveInfo(m_OrigEntity.OrigLayer.OrigPart.nId, "MovedPart")
EgtRemoveInfo(m_OrigEntity.OrigLayer.OrigPart.nId, KEY_MOVEDPART)
Case ManagePart_Layer.LayerType.MACH_START
EgtSetName(m_OrigEntity.nId, LAY_MACH_START)
EgtSetColor(m_OrigEntity.nId, c3MachStart)
@@ -836,6 +845,7 @@ Public Class GeomEntity_MenuItem
EgtSetInfo(m_OrigEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetInfo(m_OrigEntity.nId, RIB_ID, RibPanelVM.GetNextRibIndex())
EgtSetColor(m_OrigEntity.nId, c3Rib)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtSetName(m_OrigEntity.nId, LAY_SHELL_NBR)
EgtSetInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
@@ -848,6 +858,11 @@ Public Class GeomEntity_MenuItem
EgtSetName(m_OrigEntity.nId, LAY_OTHERS)
EgtSetColor(m_OrigEntity.nId, c3Others)
End Select
' se spostato un Rib, aggiorno posizione riferimento e pezzo
If bIsMovedRib Then
Map.refReferencePanelVM.UpdateFramePosition(NewPart.PrintPart)
Map.refDispositionPanelVM.UpdateZPos()
End If
EgtDraw()
' aggiorno riferimenti nel context menu item
If bUpdateAllContextMenu Then
@@ -926,7 +941,8 @@ Public Class ManagerPart_MenuItem
Select Case Map.refManagePartPanelVM.Type
Case ManagePartPanelVM.ManagePartType.IMPORT
For Each Layer In m_OrigPart.LayerList
For Each Entity In Layer.EntityList
For EntityIndex = Layer.EntityList.Count - 1 To 0 Step -1
Dim Entity As PartManager_GeomEntity = Layer.EntityList(EntityIndex)
' le rimuovo da lista entita' pezzo
Layer.EntityList.Remove(Entity)
' la rimetto in lista importati
@@ -949,7 +965,9 @@ Public Class ManagerPart_MenuItem
' aggiorno riferimenti nel context menu item
Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
' Imposto flag di ricalcolo slice
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
If Not IsNothing(Map.refTopPanelVM.SelPart) Then ' in prima importazione non c'e' alcun pezzo selezionato
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
End If
End Select
End Sub
+70 -44
View File
@@ -21,7 +21,7 @@ Public Class Material
End Get
End Property
Friend Sub UpdateIsModified()
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified))
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified)) OrElse bIsModifiedName
NotifyPropertyChanged(NameOf(ghName))
End Sub
@@ -31,23 +31,32 @@ Public Class Material
Return m_nIndex
End Get
End Property
Friend Sub SetIndex(nValue As Integer)
m_nIndex = nValue
End Sub
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Public Property sGUID As String
Get
Return m_sGUID
End Get
Set(value As String)
m_sGUID = value
End Set
End Property
Private m_sOrigName As String = ""
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
Dim bIsModified As Boolean = m_sName <> value
m_sName = value
Map.refMaterialDbVM.SetNameVisibility(False)
NotifyPropertyChanged(NameOf(ghName))
If bIsModified Then UpdateIsModified()
Map.refMaterialDbVM.SetIsEnabled(True)
End Set
End Property
Public ReadOnly Property ghName As String
@@ -55,12 +64,18 @@ Public Class Material
Return m_sName & If(m_bIsModified, "*", "")
End Get
End Property
Public ReadOnly Property bIsModifiedName As Boolean
Get
Return m_sName <> m_sOrigName
End Get
End Property
' per lettura da file
Sub New(nIndex As Integer)
m_nIndex = nIndex
ReadMaterialParamString(nIndex, MAT_GUID, "", m_sGUID)
ReadMaterialParamString(nIndex, MAT_NAME, "", m_sName)
m_sOrigName = m_sName
'EgtGetStringUtf8FromIni(nIndex, MAT_NAME, "", m_sName, sMatIniFilePath)
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nIndex))
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.TEMPERATURES, nIndex))
@@ -76,7 +91,8 @@ Public Class Material
Sub New()
m_nIndex = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "New Material Param"
m_sName = "New Material"
m_sOrigName = m_sName
Dim nCopyIndex As Integer = Map.refMaterialDbVM.SelMaterial.m_nIndex
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nCopyIndex))
Dim Orig As StringMaterialParam = m_CathegoryList(0).MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
@@ -133,6 +149,16 @@ Public Class Material
'm_dRibsLeadOutWipeDir = ReadMaterialParamDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, CurrentMachine.sMachiningFilePath)
End Sub
Private Sub SaveName()
m_sOrigName = m_sName
End Sub
Private Sub ResetName()
m_sName = m_sOrigName
NotifyPropertyChanged(NameOf(ghName))
NotifyPropertyChanged(NameOf(sName))
End Sub
Friend Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
@@ -145,15 +171,17 @@ Public Class Material
End Sub
Private Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub ResetModification()
ResetName()
If bIsModified Then
' annullo le modifiche di tutti i parametri
SaveParams()
ResetParams()
' resetto stato di modificata
UpdateIsModified()
End If
@@ -165,12 +193,12 @@ Public Class Material
Next
End Sub
Friend Sub WriteParamsOnDb(nIndex As Integer)
WriteMaterialParam(nIndex, MAT_GUID, m_sGUID)
WriteMaterialParam(nIndex, MAT_NAME, m_sName)
Friend Sub WriteParamsOnDb(nIndex As Integer, Optional sFilePath As String = "")
WriteMaterialParam(nIndex, MAT_GUID, m_sGUID, sFilePath)
WriteMaterialParam(nIndex, MAT_NAME, m_sName, sFilePath)
' EgtWriteStringUtf8toIni(nIndex, MAT_NAME, m_sName)
For Each Cathegory In m_CathegoryList
Cathegory.WriteParamOnDb(nIndex)
Cathegory.WriteParamOnDb(nIndex, sFilePath)
Next
End Sub
@@ -358,9 +386,9 @@ Public Class MaterialCathegory
Next
End Sub
Friend Sub WriteParamOnDb(nIndex As Integer)
Friend Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
For Each Param In m_MaterialParamList
Param.WriteParamOnDb(nIndex)
Param.WriteParamOnDb(nIndex, sFilePath)
Next
End Sub
@@ -456,7 +484,7 @@ Public MustInherit Class MaterialParam
End Sub
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer)
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Friend MustOverride Sub SaveParam()
Friend MustOverride Sub ResetParam()
@@ -559,7 +587,7 @@ Public Class NumericMaterialParam
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Dim sWriteValue As String = ""
If m_bIsLen Then
sWriteValue = LenToString(m_dValue, 5)
@@ -568,43 +596,43 @@ Public Class NumericMaterialParam
End If
Select Case Type
Case Params.T1
WriteMaterialParam(nIndex, MAT_T1, sWriteValue)
WriteMaterialParam(nIndex, MAT_T1, sWriteValue, sFilePath)
Case Params.T2
WriteMaterialParam(nIndex, MAT_T2, sWriteValue)
WriteMaterialParam(nIndex, MAT_T2, sWriteValue, sFilePath)
Case Params.T3
WriteMaterialParam(nIndex, MAT_T3, sWriteValue)
WriteMaterialParam(nIndex, MAT_T3, sWriteValue, sFilePath)
Case Params.T4
WriteMaterialParam(nIndex, MAT_T4, sWriteValue)
WriteMaterialParam(nIndex, MAT_T4, sWriteValue, sFilePath)
Case Params.T5
WriteMaterialParam(nIndex, MAT_T5, sWriteValue)
WriteMaterialParam(nIndex, MAT_T5, sWriteValue, sFilePath)
Case Params.K_EXTRUSION
WriteMaterialParam(nIndex, MAT_KEXTRUSION, sWriteValue)
WriteMaterialParam(nIndex, MAT_KEXTRUSION, sWriteValue, sFilePath)
Case Params.K_LAY_TIME
WriteMaterialParam(nIndex, MAT_KLAYERTIME, sWriteValue)
WriteMaterialParam(nIndex, MAT_KLAYERTIME, sWriteValue, sFilePath)
Case Params.C1
WriteMaterialParam(nIndex, MAT_C1, sWriteValue)
WriteMaterialParam(nIndex, MAT_C1, sWriteValue, sFilePath)
Case Params.C2
WriteMaterialParam(nIndex, MAT_C2, sWriteValue)
WriteMaterialParam(nIndex, MAT_C2, sWriteValue, sFilePath)
Case Params.DENSITY
WriteMaterialParam(nIndex, MAT_DENSITY, sWriteValue)
WriteMaterialParam(nIndex, MAT_DENSITY, sWriteValue, sFilePath)
Case Params.AMAX
WriteMaterialParam(nIndex, MAT_AMAX, sWriteValue)
WriteMaterialParam(nIndex, MAT_AMAX, sWriteValue, sFilePath)
Case Params.ATRG
WriteMaterialParam(nIndex, MAT_ATRG, sWriteValue)
WriteMaterialParam(nIndex, MAT_ATRG, sWriteValue, sFilePath)
Case Params.AMIN
WriteMaterialParam(nIndex, MAT_AMIN, sWriteValue)
WriteMaterialParam(nIndex, MAT_AMIN, sWriteValue, sFilePath)
Case Params.BMAX
WriteMaterialParam(nIndex, MAT_BMAX, sWriteValue)
WriteMaterialParam(nIndex, MAT_BMAX, sWriteValue, sFilePath)
Case Params.BTRG
WriteMaterialParam(nIndex, MAT_BTRG, sWriteValue)
WriteMaterialParam(nIndex, MAT_BTRG, sWriteValue, sFilePath)
Case Params.BMIN
WriteMaterialParam(nIndex, MAT_BMIN, sWriteValue)
WriteMaterialParam(nIndex, MAT_BMIN, sWriteValue, sFilePath)
Case Params.KW
WriteMaterialParam(nIndex, MAT_KW, sWriteValue)
WriteMaterialParam(nIndex, MAT_KW, sWriteValue, sFilePath)
Case Params.KZ
WriteMaterialParam(nIndex, MAT_KZ, sWriteValue)
WriteMaterialParam(nIndex, MAT_KZ, sWriteValue, sFilePath)
Case Params.KN
WriteMaterialParam(nIndex, MAT_KN, sWriteValue)
WriteMaterialParam(nIndex, MAT_KN, sWriteValue, sFilePath)
End Select
End Sub
@@ -621,8 +649,6 @@ End Class
Public Class StringMaterialParam
Inherits MaterialParam
Public Const DEFAULT_MATERIAL As String = "***"
Private m_sGUID As String
Public Property sGUID As String
Get
@@ -687,9 +713,9 @@ Public Class StringMaterialParam
Case Params.ORIG
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID = DEFAULT_MATERIAL Then
m_sGUID = DEFAULT_MATERIAL
m_sValue = DEFAULT_MATERIAL
If sOrigGUID = ORIG_MATERIAL Then
m_sGUID = ORIG_MATERIAL
m_sValue = ORIG_MATERIAL
' se livello alto, lo visualizzo comunque
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
m_String_Visibility = Visibility.Visible
@@ -714,10 +740,10 @@ Public Class StringMaterialParam
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
Case Params.ORIG
WriteMaterialParam(nIndex, MAT_ORIG, m_sGUID)
WriteMaterialParam(nIndex, MAT_ORIG, m_sGUID, sFilePath)
End Select
End Sub
@@ -744,8 +770,8 @@ Public Class StringMaterialParam
Public Sub Original()
If MessageBox.Show("Are you sure you want to set this material as original?", "Original material confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
m_sGUID = DEFAULT_MATERIAL
m_sValue = DEFAULT_MATERIAL
m_sGUID = ORIG_MATERIAL
m_sValue = ORIG_MATERIAL
NotifyPropertyChanged(NameOf(sValue))
End If
End Sub
@@ -801,10 +827,10 @@ Public Class ComboMaterialParam
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
'Case Params.STRANDORDER
' WriteMaterialParam(nIndex, MAC_STRANDORDER, m_SelValue.Id)
' WriteMaterialParam(nIndex, MAC_STRANDORDER, m_SelValue.Id, sFilePath)
End Select
End Sub
@@ -852,7 +878,7 @@ Public Class CheckMaterialParam
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
End Select
End Sub
+50 -47
View File
@@ -13,39 +13,70 @@
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Rows="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="Copy"
Command="{Binding Copy_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Save"
<Button Grid.Column="1"
Content="Save"
Command="{Binding Save_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Delete"
<Button Grid.Column="2" Content="Delete"
Command="{Binding Delete_Command}"
IsEnabled="{Binding Delete_IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
<ComboBox Grid.Row="1"
Name="MaterialCombo"
ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelMaterial}"
DisplayMemberPath="ghName"/>
<Grid Grid.Row="2"
Visibility="{Binding Name_Visibility}">
<Button Grid.Column="3"
Command="{Binding Import_Command}"
ToolTip="{Binding ImportToolTip}"
IsEnabled="{Binding ImpExp_IsEnabled}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/MachiningDB/Import.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="4"
Command="{Binding Export_Command}"
ToolTip="{Binding ImportToolTip}"
IsEnabled="{Binding ImpExp_IsEnabled}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/MachiningDB/Export.png" Stretch="Uniform"/>
</Button>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name_Msg}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SelectedItem.sName, ElementName=MaterialCombo, UpdateSourceTrigger=Explicit}"/>
<ComboBox Grid.Row="1"
Name="MaterialCombo"
ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelMaterial}"
DisplayMemberPath="ghName"
Visibility="{Binding Combo_Visibility}"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelectedItem.sName, ElementName=MaterialCombo, UpdateSourceTrigger=Explicit}"
ExplicitUpdateSource="EnterKeyPressOrLostFocus"
IsExplicitFocused="{Binding UserShouldEditValueNow}"
Visibility="{Binding Name_Visibility}"/>
<Button Grid.Column="1"
Command="{Binding EditName_Command}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<ScrollViewer Grid.Row="3"
<ScrollViewer Grid.Row="2"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MaterialCombo}">
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MaterialCombo}"
IsEnabled="{Binding IsEnabled}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
@@ -80,15 +111,6 @@
<TextBlock Text="{Binding sName}"/>
<TextBox Grid.Column="1"
Text="{Binding dValue}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:StringMaterialParam}">
@@ -117,22 +139,12 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"
HorizontalAlignment="Stretch"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:CheckMaterialParam}">
@@ -140,22 +152,12 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<CheckBox Grid.Column="1"
IsChecked="{Binding bValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -165,9 +167,10 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<UniformGrid Grid.Row="3" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
+151 -15
View File
@@ -60,10 +60,13 @@ Public Class MaterialDbVM
Return m_Name_Visibility
End Get
End Property
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
End Sub
Private m_Combo_Visibility As Visibility = Visibility.Visible
Public ReadOnly Property Combo_Visibility As Visibility
Get
Return m_Combo_Visibility
End Get
End Property
' variabile che indica se una qualunque lavorazione e' stata modificata
Private m_bIsModified As Boolean
@@ -76,10 +79,22 @@ Public Class MaterialDbVM
m_bIsModified = value
End Sub
Private m_IsEnabled As Boolean = True
Public ReadOnly Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
End Property
Friend Sub SetIsEnabled(value As Boolean)
m_IsEnabled = value
NotifyPropertyChanged(NameOf(IsEnabled))
NotifyPropertyChanged(NameOf(Delete_IsEnabled))
End Sub
Private m_Delete_IsEnabled As Boolean = True
Public ReadOnly Property Delete_IsEnabled As Boolean
Get
Return m_Delete_IsEnabled
Return m_IsEnabled AndAlso m_Delete_IsEnabled
End Get
End Property
Friend Sub SetDeleteIsEnabled(value As Boolean)
@@ -91,11 +106,36 @@ Public Class MaterialDbVM
NotifyPropertyChanged(NameOf(Delete_IsEnabled))
End Sub
Private m_UserShouldEditValueNow As Boolean = False
Public Property UserShouldEditValueNow As Boolean
Get
Return m_UserShouldEditValueNow
End Get
Set(value As Boolean)
m_UserShouldEditValueNow = value
End Set
End Property
Friend Sub SetUserShouldEditValueNow()
m_UserShouldEditValueNow = True
NotifyPropertyChanged(NameOf(UserShouldEditValueNow))
m_UserShouldEditValueNow = False
NotifyPropertyChanged(NameOf(UserShouldEditValueNow))
End Sub
Public ReadOnly Property ImpExp_IsEnabled As Boolean
Get
Return m_IsEnabled AndAlso (IsNothing(m_SelMaterial) OrElse Not m_SelMaterial.bIsModified)
End Get
End Property
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCopy As ICommand
Private m_cmdSave As ICommand
Private m_cmdDelete As ICommand
Private m_cmdEditName As ICommand
Private m_cmdImport As ICommand
Private m_cmdExport As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -133,6 +173,14 @@ Public Class MaterialDbVM
End If
End Sub
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
m_Combo_Visibility = If(Not bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
NotifyPropertyChanged(NameOf(Combo_Visibility))
If bValue Then SetUserShouldEditValueNow()
End Sub
Private Function SelMaterialIsOriginal() As Boolean
If IsNothing(m_SelMaterial) Then Return False
' verifico abilitazione delete
@@ -140,7 +188,7 @@ Public Class MaterialDbVM
If Not IsNothing(General) Then
Dim Original As MaterialParam = General.MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
If Not IsNothing(Original) Then
If DirectCast(Original, StringMaterialParam).sValue = StringMaterialParam.DEFAULT_MATERIAL Then
If DirectCast(Original, StringMaterialParam).sValue = ORIG_MATERIAL Then
Return True
End If
End If
@@ -176,7 +224,7 @@ Public Class MaterialDbVM
End Select
End If
If m_bIsModified Then
Dim sBakMatIniFilePath As String = Path.ChangeExtension(CurrentMachine.sMaterialsFilePath, ".bak")
Dim sBakMatIniFilePath As String = Path.ChangeExtension(CurrentMachine.sMaterialFilePath, ".bak")
If File.Exists(sBakMatIniFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
@@ -184,24 +232,24 @@ Public Class MaterialDbVM
Catch ex As Exception
End Try
End If
If File.Exists(CurrentMachine.sMaterialsFilePath) Then
If File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
File.Move(CurrentMachine.sMaterialsFilePath, sBakMatIniFilePath)
File.Move(CurrentMachine.sMaterialFilePath, sBakMatIniFilePath)
Catch ex As Exception
End Try
End If
' se ancora esiste lo elimino
If File.Exists(CurrentMachine.sMaterialsFilePath) Then
If File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
File.Delete(CurrentMachine.sMaterialsFilePath)
File.Delete(CurrentMachine.sMaterialFilePath)
Catch ex As Exception
End Try
End If
' creo nuovo file
If Not File.Exists(CurrentMachine.sMaterialsFilePath) Then
If Not File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
File.WriteAllLines(CurrentMachine.sMaterialsFilePath, {"; Commento per evitare BOM con UTF-8"})
File.WriteAllLines(CurrentMachine.sMaterialFilePath, {"; Commento per evitare BOM con UTF-8"})
Catch ex As Exception
End Try
End If
@@ -291,12 +339,28 @@ Public Class MaterialDbVM
End Property
Public Sub Delete()
Dim sCheckMessage As String = "Are you sure you want to delete selected material?"
' se materiale originale, esco
If SelMaterialIsOriginal() Then Return
If SelMaterialIsOriginal() Then
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
If MessageBox.Show("Trying to delete an Original Material! Are you sure you want to delete it?", "", MessageBoxButton.YesNo, MessageBoxImage.Warning) <> MessageBoxResult.Yes Then
Return
End If
sCheckMessage = "Trying to delete an Original Material! Are you ABSOLUTELY sure you want to delete it?"
Else
MessageBox.Show("Original material impossible to delete!")
Return
End If
End If
' chiedo conferma
Select Case MessageBox.Show("Are you sure you want to delete selected material?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Select Case MessageBox.Show(sCheckMessage, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_MaterialList.Remove(m_SelMaterial)
SetIsModified(True)
If m_MaterialList.Count > 0 Then
SelMaterial = m_MaterialList(0)
NotifyPropertyChanged(NameOf(SelMaterial))
End If
' segno Db come modificato
Map.refMaterialDbVM.SetIsModified(True)
Case MessageBoxResult.No
@@ -306,6 +370,78 @@ Public Class MaterialDbVM
#End Region ' Delete
#Region "EditName"
Public ReadOnly Property EditName_Command As ICommand
Get
If m_cmdEditName Is Nothing Then
m_cmdEditName = New Command(AddressOf EditName)
End If
Return m_cmdEditName
End Get
End Property
Public Sub EditName()
If IsNothing(m_SelMaterial) Then Return
SetNameVisibility(True)
SetIsEnabled(False)
End Sub
#End Region ' EditName
#Region "Import"
Public ReadOnly Property Import_Command As ICommand
Get
If m_cmdImport Is Nothing Then
m_cmdImport = New Command(AddressOf Import)
End If
Return m_cmdImport
End Get
End Property
Public Sub Import()
' chiedo il nome del file .data da aprire
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "Material file data (*" & ImportExportMachiningPanelVM.MaterialDataExtension & ")|*" & ImportExportMachiningPanelVM.MaterialDataExtension &
"|Original Material file data (*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension & ")|*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension &
"|All Material file data (*" & ImportExportMachiningPanelVM.MaterialDataExtension & "," & ImportExportMachiningPanelVM.OriginalMaterialDataExtension & ")|*" &
ImportExportMachiningPanelVM.MaterialDataExtension & ";*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension,
.FilterIndex = 3,
.FileName = String.Empty}
If OpenFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
Dim ImportWindowVM As New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MATERIAL, ImportExportMachiningPanelVM.WindowModeEnum.IMPORT, OpenFileDlg.FileName)
If ImportWindowVM.WindowMode <> ImportExportMachiningPanelVM.WindowModeEnum.IMPORT_ORIG Then
Dim ImportWindowV As New ImportExportMachiningPanelV(Application.Current.MainWindow, ImportWindowVM)
ImportWindowV.ShowDialog()
End If
End Sub
#End Region ' Import
#Region "Export"
Public ReadOnly Property Export_Command As ICommand
Get
If m_cmdExport Is Nothing Then
m_cmdExport = New Command(AddressOf Export)
End If
Return m_cmdExport
End Get
End Property
Public Sub Export()
Dim ExportMode As ImportExportMachiningPanelVM.WindowModeEnum = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
ExportMode = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT_ORIG
End If
Dim ExportWindowVM As New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MATERIAL, ExportMode)
Dim ExportWindowV As New ImportExportMachiningPanelV(Application.Current.MainWindow, ExportWindowVM)
ExportWindowV.ShowDialog()
End Sub
#End Region ' Export
#End Region ' COMMANDS
End Class
+2 -2
View File
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.1.1")>
<Assembly: AssemblyFileVersion("2.5.1.1")>
<Assembly: AssemblyVersion("2.5.2.2")>
<Assembly: AssemblyFileVersion("2.5.2.2")>
+6 -5
View File
@@ -1162,11 +1162,12 @@ Public Class LayerColor
Public Enum LayerType As Integer
PRINTPART = 1
RIBS = 2
SHELLNUMBERS = 3
AUXSOLIDS = 4
MACHSTART = 5
OTHERS = 6
'REFERENCE = 2
MACHSTART = 3
RIBS = 4
SHELLNUMBERS = 5
AUXSOLIDS = 6
OTHERS = 7
End Enum
Private m_Type As LayerType
+26 -19
View File
@@ -30,6 +30,7 @@ Public Class ReferencePanelVM
End Get
Set(value As ReferenceBtn)
m_SelReference = value.Type
EgtSetInfo(Map.refTopPanelVM.SelPart.nReferenceLayerId, KEY_REFERENCE, value.Type)
UpdateFramePosition()
End Set
End Property
@@ -42,6 +43,7 @@ Public Class ReferencePanelVM
If value Then
m_SelReference = ReferenceBtn.References.FROM_IMPORT
NotifyPropertyChanged(NameOf(ghSelReference))
EgtSetInfo(Map.refTopPanelVM.SelPart.nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.FROM_IMPORT)
UpdateFramePosition()
End If
End Set
@@ -68,45 +70,51 @@ Public Class ReferencePanelVM
End Sub
Friend Sub UpdateFramePosition(Optional SelPart As Print3dPartVM = Nothing)
If IsNothing(SelPart) Then SelPart = Map.refTopPanelVM.SelPart
Dim SelReference As Integer = ReferenceBtn.References.BL
If IsNothing(SelPart) Then
SelPart = Map.refTopPanelVM.SelPart
End If
EgtGetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, SelReference)
' elimino precedente
EgtEmptyGroup(SelPart.nReferenceLayerId)
' Creo riferimento
Dim frPrintSolid As New Frame3d()
If m_SelReference = ReferenceBtn.References.FROM_IMPORT Then
If SelReference = ReferenceBtn.References.FROM_IMPORT Then
EgtGetGlobFrame(SelPart.nPrintSolidId, frPrintSolid)
frPrintSolid.Setup(New Point3d(frPrintSolid.Orig.x, frPrintSolid.Orig.y, 0))
Else
Dim b3PrintSolid As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.STANDARD, b3PrintSolid)
Dim b3ToBePrintSolid As BBox3d = Map.refDispositionPanelVM.GetSolidForReferenceBBox(SelPart)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Select Case m_SelReference
Dim ptOrig As New Point3d(b3ToBePrintSolid.Min())
Select Case SelReference
Case ReferenceBtn.References.TL
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX
Case ReferenceBtn.References.TR
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BL
Case ReferenceBtn.References.BR
ptOrig += b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.ML
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BC
ptOrig += b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MC
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
End Select
Dim vtMovedPart As Vector3d
EgtGetInfo(SelPart.nPartId, "MovedPart", vtMovedPart)
ptOrig = ptOrig - vtMovedPart
If EgtGetInfo(SelPart.nPartId, KEY_MOVEDPART, vtMovedPart) Then
ptOrig = ptOrig - vtMovedPart
ElseIf EgtGetInfo(SelPart.nPartId, KEY_MOVEDPART2, vtMovedPart) Then
ptOrig = ptOrig - vtMovedPart
End If
frPrintSolid = New Frame3d(ptOrig)
End If
Dim nFrameId As Integer = EgtCreateGeoFrame(SelPart.nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
@@ -115,7 +123,6 @@ Public Class ReferencePanelVM
EgtSetMode(nFrameId, GDB_MD.LOCKED)
SelPart.UpdateReferenceId(nFrameId)
End If
EgtSetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, m_SelReference)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End Sub
+1
View File
@@ -5,6 +5,7 @@
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Title="{Binding sTitle}" Icon="/Resources/Icarus.ico"
WindowStyle="None" ResizeMode="NoResize" IsClosable="False"
WindowStartupLocation="CenterOwner"
SizeToContent="WidthAndHeight">
<Grid Margin="5">
<Grid.RowDefinitions>
+5 -1
View File
@@ -60,6 +60,7 @@ Public Class CopyFromWndVM
MachiningParam.Params.RIBSSTRANDCOUNT,
MachiningParam.Params.RIBSLINK,
MachiningParam.Params.RIBSINVERTDIRECTION,
MachiningParam.Params.RIBSINVERTSTRANDORDER,
MachiningParam.Params.RIBSLEADININVERT,
MachiningParam.Params.RIBSLEADINLEN,
MachiningParam.Params.RIBSLEADOUTINVERT,
@@ -129,7 +130,7 @@ Public Class CopyFromWndVM
Else
RibTypeParam.SetValue(RibTypeParam.dPartValue)
End If
Case MachiningParam.Params.RIBSLINK, MachiningParam.Params.RIBSINVERTDIRECTION, MachiningParam.Params.RIBSLEADININVERT, MachiningParam.Params.RIBSLEADOUTINVERT
Case MachiningParam.Params.RIBSLINK, MachiningParam.Params.RIBSINVERTDIRECTION, MachiningParam.Params.RIBSINVERTSTRANDORDER, MachiningParam.Params.RIBSLEADININVERT, MachiningParam.Params.RIBSLEADOUTINVERT
Dim RibTypeParam As RibCheckMachiningParam = Nothing
Dim bRibParam As Boolean = False
Select Case Type
@@ -139,6 +140,9 @@ Public Class CopyFromWndVM
Case MachiningParam.Params.RIBSINVERTDIRECTION
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSINVERTDIRECTION)
bRead = EgtGetInfo(nFromId, MAC_RIBSINVERTDIRECTION, bRibParam)
Case MachiningParam.Params.RIBSINVERTSTRANDORDER
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSINVERTSTRANDORDER)
bRead = EgtGetInfo(nFromId, MAC_RIBSINVERTSTRANDORDER, bRibParam)
Case MachiningParam.Params.RIBSLEADININVERT
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADININVERT)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADININVERT, bRibParam)
+32
View File
@@ -47,6 +47,7 @@ Public Class RibParamPanelVM
New RibNumericMachiningParam(MachiningParam.Params.RIBSSTRANDCOUNT, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLINK, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nRibId, nPartId),
@@ -112,6 +113,12 @@ Public Class RibParamPanelVM
Public Sub Ok()
If Not IsNothing(Map.refRibPanelVM.SelRib) Then
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsTypeParam As MachiningParam = MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
' scrivo i parametri modificati
Select Case Map.refRibPanelVM.SelRib.Type
Case RibEntity.RibTypes.FROMDRAW
@@ -120,6 +127,12 @@ Public Class RibParamPanelVM
Case RibEntity.RibTypes.FROMIMPORT
WriteParamsInRib(Map.refRibPanelVM.SelRib.nExtrusionId)
End Select
SaveCurrParams()
' se modificata tipologia Ribs, aggiorno posizione riferimento e pezzo
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
End If
' ripristino modalita' standard
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL)
@@ -226,6 +239,10 @@ Public Class RibNumericMachiningParam
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTDIRECTION, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_dPartValue)
m_bIsLen = True
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_dPartValue)
m_bIsLen = True
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADININVERT, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_dPartValue)
@@ -288,6 +305,12 @@ Public Class RibNumericMachiningParam
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTDIRECTION)
End If
Case Params.RIBSINVERTSTRANDORDER
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, sWriteValue)
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTSTRANDORDER)
End If
Case Params.RIBSLEADININVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADININVERT, sWriteValue)
@@ -511,6 +534,9 @@ Public Class RibCheckMachiningParam
Case Params.RIBSINVERTDIRECTION
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTDIRECTION, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_bPartValue)
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_bPartValue)
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADININVERT, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_bPartValue)
@@ -539,6 +565,12 @@ Public Class RibCheckMachiningParam
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTDIRECTION)
End If
Case Params.RIBSINVERTSTRANDORDER
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0))
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTSTRANDORDER)
End If
Case Params.RIBSLEADININVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0))
+3 -2
View File
@@ -451,9 +451,10 @@ Public Class MySceneHostVM
' elimino colore entita'
EgtResetColor(nNewEntityId)
' aggiorno riferimento pezzo
Map.refReferencePanelVM.UpdateFramePosition(MenuItem.OrigLayer.OrigPart.PrintPart)
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
' elimino eventuale flag di spostamento a 45 gradi
EgtRemoveInfo(MenuItem.OrigLayer.OrigPart.PrintPart.nPartId, "MovedPart")
EgtRemoveInfo(MenuItem.OrigLayer.OrigPart.PrintPart.nPartId, KEY_MOVEDPART)
' elimino vecchio elemento ed aggiungo nuovo
MenuItem.OrigLayer.EntityList.Clear()
MenuItem.OrigLayer.EntityList.Add(New PartManager_GeomEntity(MenuItem.OrigLayer, nNewEntityId))
+9 -2
View File
@@ -376,7 +376,8 @@ Public Class SliceManagerVM
' verifico esistenza e correttezza machgroup
InitMachGroup(True)
' eseguo generazione CN
bOk = ExecGenerate()
Dim sMsg As String = ""
bOk = ExecGenerate(sMsg)
' leggo stima tempo e la riporto in layer di calcolo
EgtGetInfo(EgtGetFirstMachGroup(), "Ttot", m_dTime)
NotifyPropertyChanged(NameOf(ghTime))
@@ -391,7 +392,13 @@ Public Class SliceManagerVM
nCurrPartId = EgtGetNextPart(nCurrPartId)
End While
Else
MessageBox.Show("Error in NC code generation! See log file.", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Dim sOut As String = "Error in NC code generation : "
If String.IsNullOrWhiteSpace(sMsg) Then
sOut &= "See log file."
Else
sOut &= sMsg
End If
MessageBox.Show(sOut, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End If
' Aggiorno intestazione programma
+11 -11
View File
@@ -166,14 +166,14 @@ Public Class TopPanelVM
End Get
Set(value As Print3dPartVM)
If Not IsNothing(m_SelPart) Then
' deseleziono eventuale pezzo precedente
EgtResetMark(m_SelPart.nPrintSolidId)
'' deseleziono eventuale pezzo precedente
'EgtResetMark(m_SelPart.nPrintSolidId)
End If
m_SelPart = value
If Not IsNothing(value) Then
' Eseguo la selezione
EgtDeselectAll()
EgtSetMark(m_SelPart.nPrintSolidId)
' EgtSetMark(m_SelPart.nPrintSolidId)
EgtDraw()
' imposto lavorazione e materiale del pezzo selezionato
Map.refCurrMachiningPanelVM.ReadMachParamFromSelPart()
@@ -553,10 +553,10 @@ Public Class TopPanelVM
Map.refSliderManagerVM.SetLayerIndexIsEnabled(False)
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(False)
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(False)
' tolgo mark da pezzo selezionato
If Not IsNothing(SelPart) Then
EgtResetMark(SelPart.nPrintSolidId)
End If
'' tolgo mark da pezzo selezionato
'If Not IsNothing(SelPart) Then
' EgtResetMark(SelPart.nPrintSolidId)
'End If
' imposto pagina
Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.MODIFYPART)
End Sub
@@ -569,10 +569,10 @@ Public Class TopPanelVM
Map.refSliderManagerVM.SetLayerIndexIsEnabled(True)
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(True)
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(True)
' ripristino mark su pezzo selezionato
If Not IsNothing(SelPart) Then
EgtSetMark(SelPart.nPrintSolidId)
End If
'' ripristino mark su pezzo selezionato
'If Not IsNothing(SelPart) Then
' EgtSetMark(SelPart.nPrintSolidId)
'End If
Return True
End Function
+9 -6
View File
@@ -46,12 +46,15 @@ Public Module CurrentMachine
m_sMachiningFilePath = sValue
End Sub
' Cartella dei materiali
Private m_sMaterialsFilePath As String = String.Empty
Friend ReadOnly Property sMaterialsFilePath As String
Private m_sMaterialFilePath As String = String.Empty
Friend ReadOnly Property sMaterialFilePath As String
Get
Return m_sMaterialsFilePath
Return m_sMaterialFilePath
End Get
End Property
Friend Sub SetMaterialFilePath(sValue As String)
m_sMaterialFilePath = sValue
End Sub
' box della tavola macchina
Private m_b3Tab As New BBox3d
@@ -75,7 +78,7 @@ Public Module CurrentMachine
' impostazione cartella lavorazioni
m_sMachiningFilePath = sMachinesRootDir & "\" & sMachineName & "\Machinings\Machinings.ini"
' impostazione cartella materiali
m_sMaterialsFilePath = sMachinesRootDir & "\" & sMachineName & "\Materials\Materials.ini"
m_sMaterialFilePath = sMachinesRootDir & "\" & sMachineName & "\Materials\Materials.ini"
' Disabilito segnalazione modificato
Dim DisableMgr As New DisableModifiedMgr
' recupero box macchina
@@ -180,7 +183,7 @@ Public Module CurrentMachine
End Function
Friend Function ReadMaterialParamString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, Optional sFilePath As String = "") As Integer
Dim nResult As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialsFilePath))
Dim nResult As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialFilePath))
If Not String.IsNullOrWhiteSpace(lpString) Then
lpString = EgwCrypto.PowerDecryptString(lpString, m_Salt)
Else
@@ -198,7 +201,7 @@ Public Module CurrentMachine
End Function
Friend Function WriteMaterialParam(lpAppName As String, lpKeyName As String, lpString As String, Optional sFilePath As String = "") As Boolean
Return WritePrivateProfileString(lpAppName, lpKeyName, EgwCrypto.PowerEncryptString(lpString, m_Salt), If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialsFilePath))
Return WritePrivateProfileString(lpAppName, lpKeyName, EgwCrypto.PowerEncryptString(lpString, m_Salt), If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialFilePath))
End Function
#End Region 'Methods
+34 -7
View File
@@ -5,11 +5,12 @@ Module GeomEntityColors
Public Enum LayerType As Integer
PRINTPART = 1
RIBS = 2
SHELLNUMBERS = 3
AUXSOLIDS = 4
MACHSTART = 5
OTHERS = 6
'REFERENCE = 2
MACHSTART = 3
RIBS = 4
SHELLNUMBERS = 5
AUXSOLIDS = 6
OTHERS = 7
ALL = 10
End Enum
@@ -124,6 +125,23 @@ Module GeomEntityColors
WritePrivateProfileColor(S_COLORS, sIniKey, c3Temp)
UpdateColors(Type)
End Sub
Friend Function GetColor(Type As LayerType) As Color3d
Dim sIniKey As String = ""
Select Case Type
Case LayerType.PRINTPART
Return c3Print
Case LayerType.RIBS
Return c3Rib
Case LayerType.SHELLNUMBERS
Return c3ShellNumber
Case LayerType.AUXSOLIDS
Return c3AuxSolids
Case LayerType.MACHSTART
Return c3MachStart
Case LayerType.OTHERS
Return c3Others
End Select
End Function
Friend Sub SetAlpha(Type As LayerType, dAlpha As Double)
Dim c3Temp As Color3d = c3Print
Dim sIniKey As String = ""
@@ -222,12 +240,21 @@ Module GeomEntityColors
End While
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
End If
' Ripristino stato segnalazione modifica
DisableMgr.ReEnable()
nPartId = EgtGetNextPart(nPartId)
End While
' se in import, aggiorno anche i pezzi di import
If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
For Each ImportPart In Map.refManagePartPanelVM.ManagerPartList
Dim Layer As ManagePart_Layer = ImportPart.LayerList.FirstOrDefault(Function(x) x.Type = Type)
If Not IsNothing(Layer) Then
For Each Entity In Layer.EntityList
EgtSetColor(Entity.nId, GetColor(Type))
Next
End If
Next
End If
EgtDraw()
End Sub
+4 -2
View File
@@ -64,7 +64,8 @@ Module LuaExec
Return bOk
End Function
Friend Function ExecGenerate() As Boolean
Friend Function ExecGenerate(ByRef sMsg As String) As Boolean
sMsg = ""
EgtOutLog("-- Start ExecGenerate --")
' eseguo generazione
EgtLuaCreateGlobTable("PRINT")
@@ -74,7 +75,7 @@ Module LuaExec
Dim nTabPartId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, TABLE)
If nTabPartId <> GDB_ID.NULL Then
If Not EgtGetInfo(nTabPartId, KEY_ISOFILE_PATH, sIsoFilePath) OrElse
Not IO.Directory.Exists( IO.Path.GetDirectoryName(sIsoFilePath)) Then
Not IO.Directory.Exists(IO.Path.GetDirectoryName(sIsoFilePath)) Then
EgtGetCurrFilePath(sIsoFilePath)
Dim sExtension As String = ""
GetPrivateProfileString(S_PARTPROGRAM, K_EXTENSION, "", sExtension, CurrentMachine.sMachIniFile)
@@ -89,6 +90,7 @@ Module LuaExec
If bOk Then
Dim nErr As Integer = 999
EgtLuaGetGlobIntVar("PRINT.ERR", nErr)
EgtLuaGetGlobStringVar("PRINT.MSG", sMsg)
bOk = (nErr <= 0)
End If
' Cancello tavola globale
+20 -20
View File
@@ -95,9 +95,9 @@ Public Class ViewLayer
RIBS = 4
SHELL_NUMBER = 5
AUX_SOLIDS = 6
SOLID_SLICE = 7
SLICE_TOOLPATH = 8
OTHERS = 9
OTHERS = 7
SOLID_SLICE = 8
SLICE_TOOLPATH = 9
End Enum
Private m_Type As ViewLayerType
@@ -229,23 +229,23 @@ Public Class ViewLayer
EgtSetStatus(CurrPart.nOthersLayerId, Status)
End Select
Next
'' se sono in importazione, dis/attivo anche queste superfici
'If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
' For Each CurrPart In Map.refManagePartPanelVM.ManagerPartList
' For Each Layer In CurrPart.LayerList
' If (Layer.Type = ManagePart_Layer.LayerType.PRINT_SOLID AndAlso m_Type = ViewLayerType.PRINT_SOLID) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.MACH_START AndAlso m_Type = ViewLayerType.START_MACHINING) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.RIBS AndAlso m_Type = ViewLayerType.RIBS) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.SHELL_NUMBER AndAlso m_Type = ViewLayerType.SHELL_NUMBER) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.AUX_SOLIDS AndAlso m_Type = ViewLayerType.AUX_SOLIDS) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.OTHERS AndAlso m_Type = ViewLayerType.OTHERS) Then
' For Each Entity In Layer.EntityList
' EgtSetStatus(Entity.nId, Status)
' Next
' End If
' Next
' Next
'End If
' se sono in importazione, dis/attivo anche queste superfici
If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
For Each CurrPart In Map.refManagePartPanelVM.ManagerPartList
For Each Layer In CurrPart.LayerList
If (Layer.Type = ManagePart_Layer.LayerType.PRINT_SOLID AndAlso m_Type = ViewLayerType.PRINT_SOLID) OrElse
(Layer.Type = ManagePart_Layer.LayerType.MACH_START AndAlso m_Type = ViewLayerType.START_MACHINING) OrElse
(Layer.Type = ManagePart_Layer.LayerType.RIBS AndAlso m_Type = ViewLayerType.RIBS) OrElse
(Layer.Type = ManagePart_Layer.LayerType.SHELL_NUMBER AndAlso m_Type = ViewLayerType.SHELL_NUMBER) OrElse
(Layer.Type = ManagePart_Layer.LayerType.AUX_SOLIDS AndAlso m_Type = ViewLayerType.AUX_SOLIDS) OrElse
(Layer.Type = ManagePart_Layer.LayerType.OTHERS AndAlso m_Type = ViewLayerType.OTHERS) Then
For Each Entity In Layer.EntityList
EgtSetStatus(Entity.nId, Status)
Next
End If
Next
Next
End If
' Ripristino stato segnalazione modifica
DisableMgr.ReEnable()
End Sub