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