Compare commits

..

26 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
Emmanuele Sassi 629d16b4f1 - introdotto "copia da" su parametri ribs
- introdotto indice fisso ribs
- introdotto ordine di stampa dei layer (shell, rib, ecc...)
- corretta estensione in esportazione
2023-01-24 20:31:23 +01:00
Emmanuele Sassi ea551e25e5 - aggiunta gestione spostamenti limitati nella tavola o meno a seconda del tipo di entita' 2023-01-23 09:53:22 +01:00
Emmanuele Sassi ff180ec2a4 Merge branch 'MinorFix' into develop 2023-01-12 10:51:16 +01:00
Emmanuele Sassi 3b6accaa20 Merge remote-tracking branch 'ICARUS/main' into develop 2023-01-12 10:50:43 +01:00
DarioS 80bcd2f225 Merge branch 'main' of https://gitlab.steamware.net/egalware/icarus 2023-01-12 09:38:58 +01:00
DarioS 40970b417a Icarus :
- assegnazione default nuovi  parametri di materiali
- sistemazione esportazione 3mf/stl
- assegnazione direttorio base dei file lua in esecuzione degli stessi.
2023-01-12 09:38:33 +01:00
35 changed files with 1836 additions and 566 deletions
+11
View File
@@ -14,6 +14,7 @@
Public Const START_GEOM = "Start"
Public Const RIB_EXTRUSION = "RibExtrusion"
Public Const RIB_CURVE = "RibCurve"
Public Const RIB_ID = "RibId"
Public Const VIEWPARAMS = "ViewParams"
Public Const IMPORTED_SOLID = "ImportedSolid"
Public Const RESULT_READ_PROG = "ResultReadProg"
@@ -106,6 +107,7 @@
Public Const MAC_RIBSLINK = "RibsLink"
Public Const MAC_RIBSINVERTORDER = "RibsInvertOrder"
Public Const MAC_RIBSINVERTDIRECTION = "RibsInvertDirection"
Public Const MAC_RIBSINVERTSTRANDORDER = "RibsInvertStrandOrder"
Public Const MAC_RIBSLEADININVERT = "RibsLeadInInvert"
Public Const MAC_RIBSLEADINLEN = "RibsLeadInLen"
Public Const MAC_RIBSLEADOUTINVERT = "RibsLeadOutInvert"
@@ -127,6 +129,7 @@
Public Const MAC_AUXSOLIDSWIPELEN = "AuxSolidsWipeLen"
Public Const MAC_AUXSOLIDSWIPEDIR = "AuxSolidsWipeDir"
Public Const MAC_DYNAMICMODE = "DynamicMode"
Public Const MAC_PRINTORDER = "PrintOrder"
Public Const MAC_CONSTANT = "Constant"
Public Const MAC_MATERIALS = "Materials"
@@ -151,11 +154,19 @@
' materiale in progetto
Public Const KEY_MATERIAL_GUID = "MaterialGuid"
Public Const KEY_MATERIAL_NAME = "MaterialName"
' nome file cn in progetto
Public Const KEY_ISOFILE_PATH = "IsoFilePath"
' info di spostamento pezzo per 45 gradi
Public Const KEY_MOVEDPART = "MovedPart"
Public Const KEY_MOVEDPART2 = "MovedPart2"
Public Const FILE_PATH = "FilePath"
Public Const PART_NAME = "PartName"
Public Const ENTITY_NAME = "EntityName"
' stringa che identifica il materiale come originale del costruttore
Public Const ORIG_MATERIAL As String = "***"
End Module
+130 -9
View File
@@ -1,4 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports EgtUILib
Imports EgtWPFLib5
@@ -150,7 +151,7 @@ Public Class CurrMachining
Friend Overrides Sub OnMachiningParamPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue)
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue), NameOf(sender.Value)
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
NotifyPropertyChanged(NameOf(sCurrSlicingType))
@@ -158,9 +159,25 @@ Public Class CurrMachining
NotifyPropertyChanged(NameOf(sCurrStrandW))
NotifyPropertyChanged(NameOf(sCurrStrandCount))
NotifyPropertyChanged(NameOf(sCurrOffset))
sender.NotifyPropertyChanged(NameOf(sender.bIsModifiedFromDb))
End Select
End Sub
Friend Overrides Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
' resetto stato di modificata
UpdateIsModified()
End If
End Sub
Protected Overrides Sub SaveParams()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub WriteCurrParamInPart(nPartId As Integer)
EgtSetInfo(nPartId, MAC_GUID, m_sCurrGUID.ToString())
For Each Cathegory As CurrMachiningCathegory In m_CathegoryList
@@ -197,7 +214,8 @@ Public Class CurrMachiningCathegory
New CurrNumericMachiningParam(MachiningParam.Params.G0FEEDZ, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.TOOLDIAM, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nPartId, nIndex, bForceFromDb),
New CurrComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nPartId, nIndex, bForceFromDb)})
New CurrComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nPartId, nIndex, bForceFromDb),
New CurrOrderedMachiningParam(MachiningParam.Params.PRINT_ORDER, nPartId, nIndex, bForceFromDb)})
Case Cathegories.LINK
m_sName = "Shell"
m_MachiningParamList = New List(Of MachiningParam)({New CurrComboMachiningParam(MachiningParam.Params.LINKTYPE, nPartId, nIndex, bForceFromDb),
@@ -223,6 +241,7 @@ Public Class CurrMachiningCathegory
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLINK, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTORDER, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nPartId, nIndex, bForceFromDb),
New CurrCheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nPartId, nIndex, bForceFromDb),
@@ -250,12 +269,6 @@ Public Class CurrMachiningCathegory
End Select
End Sub
Friend Sub SaveCurrParams()
For Each Param In m_MachiningParamList
Param.SaveParam()
Next
End Sub
Friend Sub ResetCurrParams()
For Each Param In m_MachiningParamList
Param.ResetParam()
@@ -903,6 +916,8 @@ Public Class CurrCheckMachiningParam
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTORDER, m_bValue)
Case Params.RIBSINVERTDIRECTION
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_bValue)
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_bValue)
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_bValue)
Case Params.RIBSLEADOUTINVERT
@@ -914,7 +929,7 @@ Public Class CurrCheckMachiningParam
Select Case Type
Case Params.SPIRALVASE
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
Case Params.RIBSLINK, Params.RIBSINVERTORDER, Params.RIBSINVERTDIRECTION, Params.RIBSLEADININVERT, Params.RIBSLEADOUTINVERT
Case Params.RIBSLINK, Params.RIBSINVERTORDER, Params.RIBSINVERTDIRECTION, Params.RIBSINVERTSTRANDORDER, Params.RIBSLEADININVERT, Params.RIBSLEADOUTINVERT
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.RIBS).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
End Select
If bForceFromDb OrElse Not bReadFromPart Then
@@ -934,6 +949,8 @@ Public Class CurrCheckMachiningParam
EgtSetInfo(nPartId, MAC_RIBSINVERTORDER, If(m_bValue, 1, 0))
Case Params.RIBSINVERTDIRECTION
EgtSetInfo(nPartId, MAC_RIBSINVERTDIRECTION, If(m_bValue, 1, 0))
Case Params.RIBSINVERTSTRANDORDER
EgtSetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0))
Case Params.RIBSLEADININVERT
EgtSetInfo(nPartId, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0))
Case Params.RIBSLEADOUTINVERT
@@ -975,3 +992,107 @@ Public Class CurrCheckMachiningParam
End Class
Public Class CurrOrderedMachiningParam
Inherits OrderedMachiningParam
Private m_DbParam As OrderedMachiningParam
Public ReadOnly Property DbParam As OrderedMachiningParam
Get
Return m_DbParam
End Get
End Property
Public ReadOnly Property bIsModifiedFromDb As Boolean
Get
Return If(Map.refTopPanelVM.SelMachining.sGUID <> Guid.Empty, Value <> m_DbParam.Value, False)
End Get
End Property
' Definizione comandi
Private m_cmdResetParam As ICommand
Sub New(Type As Params, nPartId As Integer, nIndex As Integer, bForceFromDb As Boolean)
MyBase.New(Type, nIndex)
Dim bReadFromPart As Boolean = False
Select Case Type
Case Params.PRINT_ORDER
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
Dim sValue As String = ""
bReadFromPart = EgtGetInfo(nPartId, MAC_PRINTORDER, sValue)
Value = sValue
End Select
m_OrigValue = Value
If nIndex > 0 Then
Dim DbMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.nIndex = nIndex)
Select Case Type
Case Params.PRINT_ORDER
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
End Select
If bForceFromDb OrElse Not bReadFromPart Then
Value = m_DbParam.OrigValue
m_OrigValue = m_DbParam.OrigValue
End If
ElseIf Type = Params.PRINT_ORDER AndAlso Not bReadFromPart Then
Value = ""
m_OrigValue = Value
End If
End Sub
Friend Overrides Sub WriteParamInPart(nPartId As Integer)
Select Case Type
Case Params.PRINT_ORDER
EgtSetInfo(nPartId, MAC_PRINTORDER, Value)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_OrigValue = Value
End Sub
Friend Overrides Sub ResetParam()
Value = m_OrigValue
m_SelValue = Nothing
NotifyPropertyChanged(NameOf(ValueList))
NotifyPropertyChanged(NameOf(SelValue))
End Sub
#Region "COMMANDS"
#Region "ResetParam"
Public ReadOnly Property ResetParam_Command As ICommand
Get
If m_cmdResetParam Is Nothing Then
m_cmdResetParam = New Command(AddressOf ResetParamCmd)
End If
Return m_cmdResetParam
End Get
End Property
Public Sub ResetParamCmd()
Value = DbParam.OrigValue
NotifyPropertyChanged(NameOf(Value))
NotifyPropertyChanged(NameOf(SelValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromDb))
End Sub
#End Region ' ResetParam
#End Region ' COMMANDS
End Class
@@ -27,8 +27,7 @@
<ItemsControl ItemsSource="{Binding MachiningParamList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"
HorizontalAlignment="Stretch"/>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Resources>
@@ -118,6 +117,44 @@
Style="{StaticResource ToolBar_SmallButton}"/>
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<ListBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="2"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</Expander>
@@ -59,8 +59,23 @@ Public Class CurrMachiningPanelVM
End Property
Public Sub Ok()
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsCathegory As MachiningCathegory = CurrMachining.CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.RIBS)
If Not IsNothing(RibsCathegory) Then
Dim RibsTypeParam As MachiningParam = RibsCathegory.MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
End If
' scrivo i parametri modificati
m_CurrMachining.WriteCurrParamInPart(Map.refTopPanelVM.SelPart.nPartId)
m_CurrMachining.Save()
' se modificata tipologia Ribs, aggiorno posizione riferimento
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
@@ -28,12 +28,6 @@
Content="Move"
IsChecked="{Binding bMove_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Red"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"/>-->
<Border x:Name="PopupBrd"
Grid.Column="1"
@@ -97,77 +91,12 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=MoveBtn}"
PlacementTarget="{Binding ElementName=MoveBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border x:Name="PopupBrd" Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,0,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="X"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sXPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="1"
Margin="0,2.5,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Y"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sYPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Z"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sZPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="3"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragMove_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
<ToggleButton x:Name="RotateBtn"
Grid.Row="4"
Content="Rotate"
IsChecked="{Binding bRotate_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Blue"
Grid.Column="2"
Grid.Row="2"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"/>-->
<Border Grid.Column="1"
Grid.Row="2"
@@ -209,42 +138,4 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=RotateBtn}"
Grid.Column="1"
PlacementTarget="{Binding ElementName=RotateBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Columns="3">
<RadioButton Content="X"
GroupName="Axes"
IsChecked="{Binding RotAxes[0]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Y"
GroupName="Axes"
IsChecked="{Binding RotAxes[1]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Z"
GroupName="Axes"
IsChecked="{Binding RotAxes[2]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
</UniformGrid>
<EgtWPFLib5:EgtTextBox Grid.Row="1"
Text="{Binding sRotAngle, UpdateSourceTrigger=Explicit}"
Margin="0,5,0,0"/>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragRotate_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
</Grid>
+112 -24
View File
@@ -20,13 +20,27 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewXPos As Double = ptReference.x
StringToLen(value, dNewXPos)
If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sXPos))
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimX
If b3Print.Max.x > ptReference.x Then
dMax -= b3Print.Max.x - ptReference.x
End If
If b3Print.Min.x < ptReference.x Then
dMin += ptReference.x - b3Print.Min.x
End If
' riduco a spostamento massimo
If dNewXPos < dMin Then
dNewXPos = dMin
ElseIf dNewXPos > dMax Then
dNewXPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sXPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
@@ -45,13 +59,27 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewYPos As Double = ptReference.y
StringToLen(value, dNewYPos)
If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sYPos))
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimY
If b3Print.Max.y > ptReference.y Then
dMax -= b3Print.Max.y - ptReference.y
End If
If b3Print.Min.y < ptReference.y Then
dMin += ptReference.y - b3Print.Min.y
End If
' riduco a spostamento massimo
If dNewYPos < dMin Then
dNewYPos = dMin
ElseIf dNewyPos > dMax Then
dNewYPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sYPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
@@ -70,16 +98,67 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sZPos))
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
' riduco a spostamento massimo
If dNewZPos < dMin Then
dNewZPos = dMin
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sZPos))
' Imposto flag di ricalcolo part-program
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_GENERATE, True)
End Set
End Property
Friend Sub UpdateZPos()
Dim ptReference As New Point3d
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
If ptReference.z < dMin Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dMin) - ptReference, GDB_RT.GLOB)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End If
NotifyPropertyChanged(NameOf(sZPos))
End Sub
' funzione che calcola il box totale del solido da stampare piu' ribs esterne ed unbounded
Friend Function GetSolidForReferenceBBox(SelPart As Print3dPartVM) As BBox3d
Dim b3Print As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
If Not EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType) Then
EgtGetInfo(SelPart.nPartId, MAC_RIBSTYPE, nRibType)
End If
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If Not b3Ribs.IsEmpty() Then
b3Print.Add(b3Ribs)
End If
End If
Return b3Print
End Function
Private m_RotAxes As Boolean() = { False, False, False}
Public Property RotX As Boolean
Get
@@ -131,19 +210,25 @@ Public Class DispositionPanelVM
Return
End If
Dim vtMovedPart As Vector3d
if EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, "MovedPart", vtMovedPart) Then
Dim nEntId = EgtGetFirstInGroup( Map.refTopPanelVM.SelPart.nPrintSolidLayerId)
If EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART, vtMovedPart) Then
Dim nEntId = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nPrintSolidLayerId)
While nEntId <> GDB_ID.NULL
EgtMove(nEntId, -vtMovedPart, GDB_RT.GLOB)
nEntId = EgtGetNext( nEntId)
nEntId = EgtGetNext(nEntId)
End While
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, "MovedPart")
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART)
End If
If EgtGetInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART2, vtMovedPart) Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, -vtMovedPart, GDB_RT.GLOB)
EgtMove(Map.refTopPanelVM.SelPart.nReferenceId, vtMovedPart, GDB_RT.GLOB)
EgtRemoveInfo(Map.refTopPanelVM.SelPart.nPartId, KEY_MOVEDPART2)
End If
Dim b3PrintSolid As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPartId, GDB_BB.STANDARD, b3PrintSolid)
If EgtRotate(Map.refTopPanelVM.SelPart.nPartId, b3PrintSolid.Center, vtSelRotAxes, dNewAngle, GDB_RT.GLOB) Then
m_sRotAngle = 0
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
RefreshPos()
EgtDraw()
NotifyPropertyChanged(NameOf(sRotAngle))
@@ -221,6 +306,7 @@ Public Class DispositionPanelVM
' seleziono percorso corrente
EgtDeselectAll()
EgtSelectObj(Map.refTopPanelVM.SelPart.nPartId)
EgtDraw()
End Sub
Friend Sub UpdateUI()
@@ -229,8 +315,9 @@ Public Class DispositionPanelVM
m_bRotating = False
' ripristino griglia
EgtSetGridFrame(m_PrevGridOrigin)
EgtDraw()
End If
EgtDeselectAll()
EgtDraw()
End Sub
Friend Sub OnKeyDown(Key As Forms.Keys)
@@ -239,8 +326,9 @@ Public Class DispositionPanelVM
m_bRotating = False
' ripristino griglia
EgtSetGridFrame(m_PrevGridOrigin)
EgtDraw()
End If
EgtDeselectAll()
EgtDraw()
End If
End Sub
+8
View File
@@ -209,6 +209,10 @@
<DependentUpon>RibPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="RibPanel\RibPanelVM.vb" />
<Compile Include="RibParamPanel\CopyFromWndV.xaml.vb">
<DependentUpon>CopyFromWndV.xaml</DependentUpon>
</Compile>
<Compile Include="RibParamPanel\CopyFromWndVM.vb" />
<Compile Include="RibParamPanel\RibParamPanelV.xaml.vb">
<DependentUpon>RibParamPanelV.xaml</DependentUpon>
</Compile>
@@ -401,6 +405,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RibParamPanel\CopyFromWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="RibParamPanel\RibParamPanelV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -1,15 +1,45 @@
Imports System.Collections.ObjectModel
Imports System.Drawing
Imports System.IO
Imports System.Reflection
Imports EgtUILib
Imports EgtWPFLib5
Imports Icarus.ImportExportMachiningPanelVM
Public Class ImportExportMachiningPanelVM
Inherits VMBase
Private Const m_MaterialDataExtension As String = ".mtd"
Public Shared ReadOnly Property MaterialDataExtension As String
Get
Return m_MaterialDataExtension
End Get
End Property
Private Const m_OriginalMaterialDataExtension As String = ".omtd"
Public Shared ReadOnly Property OriginalMaterialDataExtension As String
Get
Return m_OriginalMaterialDataExtension
End Get
End Property
Private Const m_MachiningDataExtension As String = ".mcd"
Public Shared ReadOnly Property MachiningDataExtension As String
Get
Return m_MachiningDataExtension
End Get
End Property
' Modalita' di apertura della finestra
Public Enum WindowModeEnum As Integer
IMPORT
EXPORT
IMPORT = 1
EXPORT = 2
IMPORT_ORIG = 3
EXPORT_ORIG = 4
End Enum
' Tipo da importare/esportare
Public Enum WindowTypeEnum As Integer
MATERIAL = 1
MACHINING = 2
End Enum
Private m_WindowMode As WindowModeEnum
@@ -19,6 +49,13 @@ Public Class ImportExportMachiningPanelVM
End Get
End Property
Private m_WindowType As WindowTypeEnum
Public ReadOnly Property WindowType As WindowTypeEnum
Get
Return m_WindowType
End Get
End Property
' Lista delle lavorazioni
Private m_MachiningList As New ObservableCollection(Of ImpExpMachiningItem)
Public Property MachiningList As ObservableCollection(Of ImpExpMachiningItem)
@@ -85,22 +122,112 @@ Public Class ImportExportMachiningPanelVM
#Region "CONSTRUCTOR"
' export
Sub New()
m_WindowMode = WindowModeEnum.EXPORT
Sub New(Type As WindowTypeEnum, Mode As WindowModeEnum, Optional sImportFilePath As String = "")
m_WindowType = Type
ImpExpMachiningItem.SetWindowType(m_WindowType)
m_WindowMode = Mode
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
nIndex += 1
End While
Select Case Mode
Case WindowModeEnum.IMPORT
Select Case Type
Case WindowTypeEnum.MATERIAL
m_ImportFilePath = sImportFilePath
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
Dim bIsOriginal = False
Dim bIsCustom = False
While ReadMachiningParamString(nIndex, MAT_GUID, "", sGUID, sImportFilePath) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAT_NAME, "", sName, sImportFilePath)
Dim sOrigGUID As String = ""
ReadMachiningParamString(nIndex, MAT_ORIG, "", sOrigGUID, sImportFilePath)
If sOrigGUID = ORIG_MATERIAL Then
If Not bIsOriginal Then bIsOriginal = True
Else
If Not bIsCustom Then bIsCustom = True
End If
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, AlreadyExist(sName)))
nIndex += 1
End While
If bIsOriginal AndAlso bIsCustom Then
MessageBox.Show("Corrupted file! Impossible to import it!")
ElseIf bIsOriginal Then
LoadOriginalMaterial()
End If
Case WindowTypeEnum.MACHINING
m_ImportFilePath = sImportFilePath
' carico lista lavorazioni
MachiningList.Clear()
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
Dim sMaterials As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID, sImportFilePath) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName, sImportFilePath)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, AlreadyExist(sName)))
nIndex += 1
End While
End Select
Case WindowModeEnum.EXPORT
Select Case Type
Case WindowTypeEnum.MATERIAL
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID <> ORIG_MATERIAL Then
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMaterialParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
End If
nIndex += 1
End While
Case WindowTypeEnum.MACHINING
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
nIndex += 1
End While
End Select
Case WindowModeEnum.EXPORT_ORIG
If Type = WindowTypeEnum.MATERIAL Then
' leggo ed aggiungo le altre
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID = ORIG_MATERIAL Then
Dim Guid As Guid = Guid.Empty
Guid.TryParse(sGUID, Guid)
ReadMaterialParamString(nIndex, MAC_NAME, "", sName)
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
End If
nIndex += 1
End While
End If
End Select
ImpExpMachiningItem.m_delEnableOkBtn = AddressOf EnableOkBtn
End Sub
@@ -134,9 +261,104 @@ Public Class ImportExportMachiningPanelVM
End Sub
Private Function AlreadyExist(MachiningName As String) As Boolean
Return Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = MachiningName)
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Return Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = MachiningName)
Case WindowTypeEnum.MACHINING
Return Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = MachiningName)
End Select
End Function
Enum MaterialState As Integer
NOTFOUND = 1
FOUND = 2
NOTORIGSAMENAME = 3
End Enum
Private Sub LoadOriginalMaterial()
m_WindowMode = WindowModeEnum.IMPORT_ORIG
' verifico se esistono materiali con lo stesso nome ma non originali
Dim ImportedMaterialList As New List(Of MaterialState)
For Each ImpExpMaterial In m_MachiningList
Dim IsNotOrigSameName As MaterialState = MaterialState.NOTFOUND
For Each DbMaterial In Map.refMaterialDbVM.MaterialList
If DbMaterial.sName = ImpExpMaterial.sName Then
Dim sOrigGUID As String = ""
ReadMaterialParamString(DbMaterial.nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID <> ORIG_MATERIAL Then
If Not IsNotOrigSameName Then IsNotOrigSameName = MaterialState.NOTORIGSAMENAME
End If
Else
IsNotOrigSameName = MaterialState.FOUND
End If
Next
ImportedMaterialList.Add(IsNotOrigSameName)
Next
If ImportedMaterialList.Contains(True) Then
Dim sDuplicatedMaterialList As String = ""
For Index = 0 To ImportedMaterialList.Count - 1
If ImportedMaterialList(Index) = MaterialState.NOTORIGSAMENAME Then
sDuplicatedMaterialList &= " - " & m_MachiningList(Index).sName & Environment.NewLine
End If
Next
MessageBox.Show("Impossible to import the package because materials named:" & Environment.NewLine &
sDuplicatedMaterialList & Environment.NewLine &
"Please modify the names of these machining and then retry to import the materials.")
Return
End If
' aggiorno/aggiungo materiali
Dim OrigFilePath As String = CurrentMachine.sMaterialFilePath
Dim NewMaterial As Material = Nothing
For Each Material In m_MachiningList
Dim nIndex As Integer = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
If Material.Active Then
CurrentMachine.SetMaterialFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMaterial = New Material(Material.nIndex)
' cambio guid, indice e verifico nome
NewMaterial.sGUID = Guid.NewGuid.ToString()
NewMaterial.SetIndex(nIndex)
If Material.AlreadyExist Then
If Material.ChangeName Then
NewMaterial.sName = Material.sName
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMaterial As Material = Map.refMaterialDbVM.MaterialList.FirstOrDefault(Function(x) x.sName = Material.sName)
NewMaterial.SetIndex(ToSubstituteMaterial.nIndex)
NewMaterial.sGUID = ToSubstituteMaterial.sGUID
Dim nToReplaceIndex As Integer = Map.refMaterialDbVM.MaterialList.IndexOf(ToSubstituteMaterial)
Map.refMaterialDbVM.MaterialList(nToReplaceIndex) = NewMaterial
End If
Else
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
End If
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' salvo la lavorazione
NewMaterial.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMaterial) Then
Map.refMaterialDbVM.SelMaterial = NewMaterial
Map.refMaterialDbVM.NotifyPropertyChanged(NameOf(Map.refMaterialDbVM.SelMaterial))
End If
' imposto Db modificato
Map.refMaterialDbVM.SetIsModified(True)
' messaggio con modifiche
Dim sMaterialList As String = ""
For Index = 0 To ImportedMaterialList.Count - 1
sMaterialList &= " - " & m_MachiningList(Index).sName & " (" & If(ImportedMaterialList(Index) = MaterialState.NOTFOUND, "New", "Updated") & ")" & Environment.NewLine
Next
MessageBox.Show("List of the materials:" & Environment.NewLine &
sMaterialList & Environment.NewLine &
"Import successfully completed.")
Return
End Sub
#End Region ' METHODS
#Region "COMMANDS"
@@ -159,52 +381,109 @@ Public Class ImportExportMachiningPanelVM
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub ConfirmImpExpMachinings(param As Object)
Select Case WindowMode
Select Case m_WindowMode
Case WindowModeEnum.IMPORT
Dim OrigFilePath As String = CurrentMachine.sMachiningFilePath
Dim NewMachining As Machining = Nothing
For Each Machining In m_MachiningList
Dim nIndex As Integer = Map.refMachiningDbVM.MachiningList.Max(Function(x) x.nIndex) + 1
If Machining.Active Then
CurrentMachine.SetMachiningFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMachining = New Machining(Machining.nIndex)
' cambio guid, indice e verifico nome
NewMachining.sGUID = Guid.NewGuid.ToString()
NewMachining.SetIndex(nIndex)
If Machining.AlreadyExist Then
If Machining.ChangeName Then
NewMachining.sName = Machining.sName
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Dim OrigFilePath As String = CurrentMachine.sMaterialFilePath
Dim NewMaterial As Material = Nothing
For Each Material In m_MachiningList
Dim nIndex As Integer = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
If Material.Active Then
CurrentMachine.SetMaterialFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMaterial = New Material(Material.nIndex)
' cambio guid, indice e verifico nome
NewMaterial.sGUID = Guid.NewGuid.ToString()
NewMaterial.SetIndex(nIndex)
If Material.AlreadyExist Then
If Material.ChangeName Then
NewMaterial.sName = Material.sName
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMaterial As Material = Map.refMaterialDbVM.MaterialList.FirstOrDefault(Function(x) x.sName = Material.sName)
NewMaterial.SetIndex(ToSubstituteMaterial.nIndex)
NewMaterial.sGUID = ToSubstituteMaterial.sGUID
Dim nToReplaceIndex As Integer = Map.refMaterialDbVM.MaterialList.IndexOf(ToSubstituteMaterial)
Map.refMaterialDbVM.MaterialList(nToReplaceIndex) = NewMaterial
End If
Else
Map.refMaterialDbVM.MaterialList.Add(NewMaterial)
End If
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' salvo la lavorazione
NewMaterial.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMaterialFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMaterial) Then
Map.refMaterialDbVM.SelMaterial = NewMaterial
Map.refMaterialDbVM.NotifyPropertyChanged(NameOf(Map.refMaterialDbVM.SelMaterial))
End If
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
' imposto Db modificato
Map.refMaterialDbVM.SetIsModified(True)
Case WindowTypeEnum.MACHINING
Dim OrigFilePath As String = CurrentMachine.sMachiningFilePath
Dim NewMachining As Machining = Nothing
For Each Machining In m_MachiningList
Dim nIndex As Integer = Map.refMachiningDbVM.MachiningList.Max(Function(x) x.nIndex) + 1
If Machining.Active Then
CurrentMachine.SetMachiningFilePath(ImportFilePath)
' leggo lavorazione da file di import
NewMachining = New Machining(Machining.nIndex)
' cambio guid, indice e verifico nome
NewMachining.sGUID = Guid.NewGuid.ToString()
NewMachining.SetIndex(nIndex)
If Machining.AlreadyExist Then
If Machining.ChangeName Then
NewMachining.sName = Machining.sName
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
Else
' sostituisco lavorazione gia' presente con stesso nome
Dim ToSubstituteMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.sName = Machining.sName)
NewMachining.SetIndex(ToSubstituteMachining.nIndex)
NewMachining.sGUID = ToSubstituteMachining.sGUID
Dim nToReplaceIndex As Integer = Map.refMachiningDbVM.MachiningList.IndexOf(ToSubstituteMachining)
Map.refMachiningDbVM.MachiningList(nToReplaceIndex) = NewMachining
End If
Else
Map.refMachiningDbVM.MachiningList.Add(NewMachining)
End If
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' salvo la lavorazione
NewMachining.Save()
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' salvo la lavorazione
NewMachining.Save()
' seleziono ultima importata
If Not IsNothing(NewMachining) Then
Map.refMachiningDbVM.SelMachining = NewMachining
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.SelMachining))
End If
' imposto Db modificato
Map.refMachiningDbVM.SetIsModified(True)
End Select
Case WindowModeEnum.EXPORT, WindowModeEnum.EXPORT_ORIG
' chiedo il nome con cui salvare il file
Dim sExtension As String =""
If m_WindowType = WindowTypeEnum.MATERIAL Then
If m_WindowMode = WindowModeEnum.EXPORT_ORIG Then
sExtension = OriginalMaterialDataExtension
Else
sExtension = MaterialDataExtension
End If
Next
' ripristino path corretta del Db
CurrentMachine.SetMachiningFilePath(OrigFilePath)
' seleziono ultima importata
If Not IsNothing(NewMachining) Then
Map.refMachiningDbVM.SelMachining = NewMachining
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.SelMachining))
Else
sExtension = MachiningDataExtension
End If
Case WindowModeEnum.EXPORT
' recupero le lavorazioni checkate
Dim FinalNameList As New List(Of String)
For Each Machining In MachiningList
If Machining.Active Then
FinalNameList.Add(Machining.sName)
End If
Next
If FinalNameList.Count() = 0 Then Return
Dim FinalNameArray = FinalNameList.ToArray()
' chiedo il nome con cui salvare il file .data
Dim SaveFileDlg As New System.Windows.Forms.SaveFileDialog() With {
.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*.data)|*.data|Tutti i file (*.*)|*.*",
.Filter = "File data (*" & sExtension & ")|*" & sExtension,
.FileName = String.Empty
}
If SaveFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
@@ -224,15 +503,25 @@ Public Class ImportExportMachiningPanelVM
Catch ex As Exception
End Try
End If
Dim ActiveMachiningList As List(Of Machining) = (From Machining In Map.refMachiningDbVM.MachiningList
Select Machining
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Machining.sGUID AndAlso x.Active)).ToList()
' salvo tutte le lavorazioni sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Dim ActiveMachiningList As List(Of Material) = (From Material In Map.refMaterialDbVM.MaterialList
Select Material
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Material.sGUID AndAlso x.Active)).ToList()
' salvo tutti i materiali sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
Case WindowTypeEnum.MACHINING
Dim ActiveMachiningList As List(Of Machining) = (From Machining In Map.refMachiningDbVM.MachiningList
Select Machining
Where m_MachiningList.Any(Function(x) x.sGUID.ToString() = Machining.sGUID AndAlso x.Active)).ToList()
' salvo tutte le lavorazioni sul Db
For Index = 0 To ActiveMachiningList.Count - 1
ActiveMachiningList(Index).WriteParamsOnDb(Index + 1, sFilePath)
Next
End Select
End Select
' Chiusura finestra
RaiseEvent m_CloseWindow(True)
End Sub
@@ -246,13 +535,18 @@ End Class
Public Class ImpExpMachiningItem
Inherits VMBase
Public Const IMPEXTNAME As String = "_imp"
Public Const IMPEXPNAME As String = "_imp"
' Actions
Friend Shared m_delEnableOkBtn As Action
Private Shared m_Empty As New MachiningIndex(-1, Guid.Empty, "None")
Private Shared m_WindowType As WindowTypeEnum
Friend Shared Sub SetWindowType(value As WindowTypeEnum)
m_WindowType = value
End Sub
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
@@ -284,26 +578,51 @@ Public Class ImpExpMachiningItem
' se esiste gia' chiedo se sovrascriverla
If value Then
If m_AlreadyExist Then
Select Case System.Windows.MessageBox.Show(EgtMsg(31453), "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXTNAME) Then
nImpNameIndex += 1
While Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXTNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXTNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Machining will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
Select Case m_WindowType
Case WindowTypeEnum.MATERIAL
Select Case System.Windows.MessageBox.Show("Material already existing in Db. Overwrite it?", "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME) Then
nImpNameIndex += 1
While Map.refMaterialDbVM.MaterialList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXPNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Material will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
Case WindowTypeEnum.MACHINING
Select Case System.Windows.MessageBox.Show("Machining already existing in Db. Overwrite it?", "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
Dim bImpNameAlreadyInList = False
Dim nImpNameIndex As Integer = 0
If Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME) Then
nImpNameIndex += 1
While Map.refMachiningDbVM.MachiningList.Any(Function(x) x.sName = m_sOrigName & IMPEXPNAME & "_" & nImpNameIndex)
nImpNameIndex += 1
End While
End If
m_sName = m_sOrigName & IMPEXPNAME & If(nImpNameIndex > 0, "_" & nImpNameIndex, "")
System.Windows.MessageBox.Show("Machining will be imported with the name: " & m_sName, "", MessageBoxButton.OK)
NotifyPropertyChanged(NameOf(sName))
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
End Select
NotifyPropertyChanged(NameOf(Active))
Else
@@ -360,82 +679,3 @@ Public Class ImpExpMachiningItem
End Function
End Class
Public Class MachiningItem
Inherits VMBase
' Actions
Friend Shared m_delEnableOkBtn As Action
Private m_Name As String
Public Property Name As String
Get
If m_ChangeName Then
Return m_Name & "_imp"
Else
Return m_Name
End If
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_Active As Boolean
Public Property Active As Boolean
Get
Return m_Active
End Get
Set(value As Boolean)
' se esiste gia' chiedo se sovrascriverla
If value Then
If m_AlreadyExist Then
Select Case System.Windows.MessageBox.Show(EgtMsg(31453), "", MessageBoxButton.YesNoCancel)
Case MessageBoxResult.Yes
m_ChangeName = False
m_Active = True
Case MessageBoxResult.No
System.Windows.MessageBox.Show(EgtMsg(31454), "", MessageBoxButton.OK)
m_ChangeName = True
m_Active = True
Case Else
m_Active = False
End Select
NotifyPropertyChanged("Active")
Else
m_Active = True
End If
Else
m_ChangeName = False
m_Active = False
End If
If Not IsNothing(m_delEnableOkBtn) Then m_delEnableOkBtn()
End Set
End Property
' Parametro che indica se questo item da importare esiste gia'
Private m_AlreadyExist As Boolean
Friend ReadOnly Property AlreadyExist As Boolean
Get
Return m_AlreadyExist
End Get
End Property
' Parametro che indica se cambiare il nome di un item che esiste gia' o sovrascriverlo
Private m_ChangeName As Boolean
Friend Property ChangeName As Boolean
Get
Return m_ChangeName
End Get
Set(value As Boolean)
m_ChangeName = value
NotifyPropertyChanged("Name")
End Set
End Property
Sub New(Name As String, AlreadyExist As Boolean)
m_Name = Name
m_AlreadyExist = AlreadyExist
End Sub
End Class
+266 -10
View File
@@ -1,4 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports EgtUILib
Imports EgtWPFLib5
@@ -53,6 +54,17 @@ Public Class Machining
FAST = 2
End Enum
Public Enum MPAR_PRINT_ORDER As Integer
SHELL = 1
EXTRA_SHELL = 2
INFILL = 3
AUX_SOLID = 4
RIB_UNBOUNDED = 5
RIB_EXTERNAL = 6
RIB_INTERNAL = 7
RIB_SUPPORT = 8
End Enum
Protected m_CathegoryList As New ObservableCollection(Of MachiningCathegory)
Public ReadOnly Property CathegoryList As ObservableCollection(Of MachiningCathegory)
Get
@@ -125,7 +137,7 @@ Public Class Machining
Else
nIndex = -1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "PrintingParam"
m_sName = "New Machining"
End If
m_sOrigName = m_sName
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.GENERAL, nIndex))
@@ -160,7 +172,7 @@ Public Class Machining
NotifyPropertyChanged(NameOf(ghName))
End Sub
Friend Sub Save()
Friend Overridable Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
@@ -171,7 +183,7 @@ Public Class Machining
End If
End Sub
Private Sub SaveParams()
Protected Overridable Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
@@ -204,8 +216,9 @@ Public Class Machining
Friend Overridable Sub OnMachiningParamPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue)
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue), NameOf(sender.Value)
UpdateIsModified()
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Select
End Sub
@@ -316,7 +329,8 @@ Public Class MachiningCathegory
New NumericMachiningParam(MachiningParam.Params.G0FEEDZ, nIndex),
New NumericMachiningParam(MachiningParam.Params.TOOLDIAM, nIndex),
New NumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nIndex),
New ComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nIndex)})
New ComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nIndex),
New OrderedMachiningParam(MachiningParam.Params.PRINT_ORDER, nIndex)})
Case Cathegories.LINK
m_sName = "Shell"
m_MachiningParamList = New List(Of MachiningParam)({New ComboMachiningParam(MachiningParam.Params.LINKTYPE, nIndex),
@@ -342,6 +356,7 @@ Public Class MachiningCathegory
New CheckMachiningParam(MachiningParam.Params.RIBSLINK, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTORDER, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nIndex),
New CheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nIndex),
@@ -463,6 +478,8 @@ Public MustInherit Class MachiningParam
STRANDOVERLAP = 57
FLOWRATE_PC = 58
DYNAMIC_MODE = 59
PRINT_ORDER = 60
RIBSINVERTSTRANDORDER = 61
MATERIALS = 100
End Enum
@@ -549,6 +566,8 @@ Public MustInherit Class MachiningParam
m_sName = "Invert Order"
Case Params.RIBSINVERTDIRECTION
m_sName = "Invert Direction"
Case Params.RIBSINVERTSTRANDORDER
m_sName = "Invert Strand Order"
Case Params.RIBSLEADININVERT
m_sName = "Lead In Invert"
Case Params.RIBSLEADINLEN
@@ -599,6 +618,8 @@ Public MustInherit Class MachiningParam
m_sName = "Flow rate [%]"
Case Params.DYNAMIC_MODE
m_sName = "Dynamic Mode"
Case Params.PRINT_ORDER
m_sName = "Print Order"
End Select
End Sub
@@ -637,7 +658,6 @@ Public Class NumericMachiningParam
StringToDouble(value, m_dValue)
End If
NotifyPropertyChanged(NameOf(sValue))
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Set
End Property
@@ -903,7 +923,6 @@ Public Class StringMachiningParam
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Set
End Property
@@ -962,7 +981,6 @@ Public Class ComboMachiningParam
Set(value As IdNameStruct)
m_SelValue = value
NotifyPropertyChanged(NameOf(SelValue))
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Set
End Property
@@ -1110,7 +1128,6 @@ Public Class CheckMachiningParam
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Set
End Property
@@ -1145,6 +1162,8 @@ Public Class CheckMachiningParam
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTORDER, 0)
Case Params.RIBSINVERTDIRECTION
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTDIRECTION, 0)
Case Params.RIBSINVERTSTRANDORDER
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSINVERTSTRANDORDER, 0)
Case Params.RIBSLEADININVERT
m_bValue = ReadMachiningParamDouble(nIndex, MAC_RIBSLEADININVERT, 0)
Case Params.RIBSLEADOUTINVERT
@@ -1164,6 +1183,8 @@ Public Class CheckMachiningParam
WriteMachiningParam(nIndex, MAC_RIBSINVERTORDER, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSINVERTDIRECTION
WriteMachiningParam(nIndex, MAC_RIBSINVERTDIRECTION, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSINVERTSTRANDORDER
WriteMachiningParam(nIndex, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSLEADININVERT
WriteMachiningParam(nIndex, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0), sFilePath)
Case Params.RIBSLEADOUTINVERT
@@ -1203,7 +1224,6 @@ Public Class MaterialMachiningParam
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
Map.refMachiningDbVM.NotifyPropertyChanged(NameOf(Map.refMachiningDbVM.ImpExp_IsEnabled))
End Set
End Property
@@ -1257,3 +1277,239 @@ Public Class MaterialMachiningParam
End Class
Public Class OrderedMachiningParam
Inherits MachiningParam
Protected m_StandardValueOrderList As List(Of Integer)
Protected m_ValueList As ObservableCollection(Of IdNameStruct)
Public ReadOnly Property ValueList As ObservableCollection(Of IdNameStruct)
Get
Return m_ValueList
End Get
End Property
Protected m_SelValue As IdNameStruct
Public Overridable Property SelValue As IdNameStruct
Get
Return m_SelValue
End Get
Set(value As IdNameStruct)
m_SelValue = value
End Set
End Property
Protected m_OrigValue As String
Public ReadOnly Property OrigValue As String
Get
Return m_OrigValue
End Get
End Property
Public Property Value As String
Get
Dim Temp As String = ""
For Each Item In m_ValueList
Temp &= Item.Id & ","
Next
Return Temp.TrimEnd(","c)
End Get
Set(value As String)
Select Case Type
Case Params.PRINT_ORDER
Dim StringValueList() As String
Dim IntegerValueList As New List(Of Integer)
If value.Length = 15 Then
StringValueList = value.Split(","c)
For Each StringValue In StringValueList
Dim IntegerValue As Integer = 0
If Integer.TryParse(StringValue, IntegerValue) Then
IntegerValueList.Add(IntegerValue)
End If
Next
End If
If IntegerValueList.Count <> 8 Then
IntegerValueList = m_StandardValueOrderList
End If
If Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.SHELL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.INFILL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.AUX_SOLID) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL) OrElse
Not IntegerValueList.Contains(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT) Then
IntegerValueList = m_StandardValueOrderList
End If
OrderByReference(m_ValueList, IntegerValueList)
End Select
End Set
End Property
Public Shared Sub OrderByReference(collection As ObservableCollection(Of IdNameStruct), comparison As List(Of Integer))
For i As Integer = 0 To comparison.Count - 1
Dim Index As Integer = i
If Not comparison.ElementAt(i).Equals(collection.ElementAt(i)) Then
collection.Move(collection.IndexOf(collection.FirstOrDefault(Function(x) x.Id = comparison(Index))), i)
End If
Next
End Sub
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return Value <> m_OrigValue
End Get
End Property
' Definizione comandi
Private m_cmdMoveUpOrder As ICommand
Private m_cmdMoveDownOrder As ICommand
Private m_cmdResetOrder As ICommand
Sub New(Type As Params)
MyBase.New(Type)
End Sub
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
If nIndex = 0 Then
Select Case Type
Case Params.PRINT_ORDER
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
m_SelValue = Nothing
End Select
Else
Select Case Type
Case Params.PRINT_ORDER
m_StandardValueOrderList = New List(Of Integer)({Machining.MPAR_PRINT_ORDER.SHELL,
Machining.MPAR_PRINT_ORDER.EXTRA_SHELL,
Machining.MPAR_PRINT_ORDER.INFILL,
Machining.MPAR_PRINT_ORDER.AUX_SOLID,
Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED,
Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_INTERNAL,
Machining.MPAR_PRINT_ORDER.RIB_SUPPORT})
m_ValueList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_PRINT_ORDER.SHELL, "Shell"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.EXTRA_SHELL, "Extra Shells"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.INFILL, "Infills"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.AUX_SOLID, "Filled Solids"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_UNBOUNDED, "Unbounded Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_EXTERNAL, "External Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_INTERNAL, "Internal Ribs"),
New IdNameStruct(Machining.MPAR_PRINT_ORDER.RIB_SUPPORT, "Support Ribs")})
ReadMachiningParamString(nIndex, MAC_PRINTORDER, "", Value)
End Select
End If
m_OrigValue = Value
m_SelValue = Nothing
NotifyPropertyChanged(NameOf(SelValue))
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
Case Params.PRINT_ORDER
WriteMachiningParam(nIndex, MAC_PRINTORDER, Value, sFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_OrigValue = Value
End Sub
Friend Overrides Sub ResetParam()
Value = m_OrigValue
m_SelValue = Nothing
NotifyPropertyChanged(NameOf(ValueList))
NotifyPropertyChanged(NameOf(SelValue))
End Sub
#Region "COMMANDS"
#Region "MoveUpOrder"
Public ReadOnly Property MoveUpOrder_Command As ICommand
Get
If m_cmdMoveUpOrder Is Nothing Then
m_cmdMoveUpOrder = New Command(AddressOf MoveUpOrder)
End If
Return m_cmdMoveUpOrder
End Get
End Property
Public Sub MoveUpOrder()
If IsNothing(m_SelValue) Then Return
Dim nIndex As Integer = m_ValueList.IndexOf(m_SelValue)
If nIndex < 0 Then Return
If nIndex > 0 Then
m_ValueList.Move(nIndex, nIndex - 1)
NotifyPropertyChanged(NameOf(Value))
End If
End Sub
#End Region ' MoveUpOrder
#Region "MoveDownOrder"
Public ReadOnly Property MoveDownOrder_Command As ICommand
Get
If m_cmdMoveDownOrder Is Nothing Then
m_cmdMoveDownOrder = New Command(AddressOf MoveDownOrder)
End If
Return m_cmdMoveDownOrder
End Get
End Property
Public Sub MoveDownOrder()
If IsNothing(m_SelValue) Then Return
Dim nIndex As Integer = m_ValueList.IndexOf(m_SelValue)
If nIndex < 0 Then Return
If nIndex < m_ValueList.Count - 1 Then
m_ValueList.Move(nIndex, nIndex + 1)
NotifyPropertyChanged(NameOf(Value))
End If
End Sub
#End Region ' MoveDownOrder
#Region "ResetOrder"
Public ReadOnly Property ResetOrder_Command As ICommand
Get
If m_cmdResetOrder Is Nothing Then
m_cmdResetOrder = New Command(AddressOf ResetOrder)
End If
Return m_cmdResetOrder
End Get
End Property
Public Sub ResetOrder()
Dim CurrValue As String = Value
OrderByReference(m_ValueList, m_StandardValueOrderList)
m_ValueList = New ObservableCollection(Of IdNameStruct)(m_ValueList.OrderBy(Function(x) x.Id))
If Value <> CurrValue Then
NotifyPropertyChanged(NameOf(ValueList))
NotifyPropertyChanged(NameOf(Value))
NotifyPropertyChanged(NameOf(SelValue))
End If
End Sub
#End Region ' ResetOrder
#End Region ' COMMANDS
End Class
+36 -5
View File
@@ -8,7 +8,6 @@
Style="{StaticResource RightPanel_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
@@ -63,6 +62,7 @@
Visibility="{Binding Combo_Visibility}"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelectedItem.sName, ElementName=MachiningCombo, UpdateSourceTrigger=Explicit}"
ExplicitUpdateSource="EnterKeyPressOrLostFocus"
IsExplicitFocused="{Binding UserShouldEditValueNow}"
Visibility="{Binding Name_Visibility}"
Style="{StaticResource OptionTextBox}"/>
@@ -72,7 +72,7 @@
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<ScrollViewer Grid.Row="3"
<ScrollViewer Grid.Row="2"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
@@ -91,8 +91,7 @@
<ItemsControl ItemsSource="{Binding MachiningParamList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"
HorizontalAlignment="Stretch"/>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Resources>
@@ -186,6 +185,38 @@
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="1"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</Expander>
@@ -193,7 +224,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<UniformGrid Grid.Row="3" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsEnabled="{Binding IsEnabled}"
+8 -7
View File
@@ -291,6 +291,9 @@ Public Class MachiningDbVM
Case MessageBoxResult.Yes
m_MachiningList.Remove(m_SelMachining)
SetIsModified(True)
If m_MachiningList.Count > 0 Then
SelMachining = m_MachiningList(0)
End If
Case MessageBoxResult.No
Return
End Select
@@ -330,13 +333,11 @@ Public Class MachiningDbVM
Public Sub Import()
' chiedo il nome del file .data da aprire
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {
.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*.data)|*.data|Tutti i file (*.*)|*.*",
.FileName = String.Empty
}
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "File data (*" & ImportExportMachiningPanelVM.MachiningDataExtension & ")|*" & ImportExportMachiningPanelVM.MachiningDataExtension,
.FileName = String.Empty}
If OpenFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
Dim ImportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(OpenFileDlg.FileName))
Dim ImportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MACHINING, ImportExportMachiningPanelVM.WindowModeEnum.IMPORT, OpenFileDlg.FileName))
ImportWindow.ShowDialog()
End Sub
@@ -354,7 +355,7 @@ Public Class MachiningDbVM
End Property
Public Sub Export()
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM)
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MACHINING, ImportExportMachiningPanelVM.WindowModeEnum.EXPORT))
ExportWindow.ShowDialog()
End Sub
+2 -2
View File
@@ -195,8 +195,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(5583, 2501, 1, m_nKeyLevel) And
EgtGetKeyOptions(5583, 2501, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(5583, 2502, 1, m_nKeyLevel) And
EgtGetKeyOptions(5583, 2502, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
+6 -9
View File
@@ -359,14 +359,17 @@ Public Class ManagePartPanelVM
nRibsLayerId = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
Dim nRibsIndex As Integer = 1
For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
EgtSetInfo(PartManager_GeomEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetInfo(PartManager_GeomEntity.nId, RIB_ID, nRibsIndex)
EgtRelocateGlob(PartManager_GeomEntity.nId, nRibsLayerId, GDB_POS.LAST_SON)
' elimino colore entita'
EgtResetColor(PartManager_GeomEntity.nId)
If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
End If
nRibsIndex += 1
Next
Case ManagePart_Layer.LayerType.SHELL_NUMBER
nShellNumberLayerId = EgtCreateGroup(nPartId)
@@ -432,17 +435,9 @@ Public Class ManagePartPanelVM
End If
End Select
Next
' aggiungo riferimento
' aggiungo layer riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Dim frPrintSolid As New Frame3d(ptOrig)
nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
If nFrameId Then
EgtSetName(nFrameId, FRAME_PART)
EgtSetMode(nFrameId, GDB_MD.LOCKED)
End If
EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -454,6 +449,8 @@ Public Class ManagePartPanelVM
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Next
End If
'EgtAddMachGroup("3dPrint")
+46 -26
View File
@@ -1,4 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports EgtUILib
Imports EgtWPFLib5
@@ -375,10 +376,11 @@ Public Class ManagePart_Layer
Public Enum LayerType As Integer
PRINT_SOLID = 1
MACH_START = 2
RIBS = 3
SHELL_NUMBER = 4
AUX_SOLIDS = 5
'REFERENCE = 2
MACH_START = 3
RIBS = 4
SHELL_NUMBER = 5
AUX_SOLIDS = 6
OTHERS = 7
CHANGENAME = 15
DELETE = 16
@@ -639,7 +641,7 @@ Public Class GeomEntity_MenuItem
End If
' se e' presente elimino flag di spostamento a 45 gradi
Dim nPartId As Integer = EgtGetParent(EgtGetParent(m_OrigEntity.nId))
EgtRemoveInfo(nPartId, "MovedPart")
EgtRemoveInfo(nPartId, KEY_MOVEDPART)
EgtDraw()
' aggiorno riferimenti nel context menu item
Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
@@ -666,6 +668,8 @@ Public Class GeomEntity_MenuItem
NewLayer.EntityList.Add(m_OrigEntity)
' aggiorno riferimenti nell'entita'
m_OrigEntity.UpdateOrigLayer(NewLayer)
' aggiorno colore
EgtSetColor(m_OrigEntity.nId, GetColor(LayerType.PRINTPART))
End If
End If
' aggiorno i contextmenu di tutti gli entity
@@ -684,44 +688,38 @@ Public Class GeomEntity_MenuItem
' creo layer solido di stampa
Dim nPrintPartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nPrintPartLayerId, PRINT_SOLID)
EgtSetColor(nPrintPartLayerId, GeomEntityColors.c3Print)
EgtRelocateGlob(m_OrigEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
' calcolo box superficie per creazione riferimento
EgtGetBBoxGlob(m_OrigEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
' coloro l'entita'
EgtSetColor(m_OrigEntity.nId, GeomEntityColors.c3Print)
' creo layer mach start
Dim nMachStartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nMachStartLayerId, LAY_MACH_START)
EgtSetColor(nMachStartLayerId, GeomEntityColors.c3MachStart)
Dim nMachStartId As Integer = GDB_ID.NULL
' creo punto di partenza
Dim ptStart As Point3d = b3PrintSolid.Center() - 0.6 * b3PrintSolid.DimY() * Vector3d.Y_AX() - 0.5 * b3PrintSolid.DimZ() * Vector3d.Z_AX()
nMachStartId = EgtCreateGeoPoint(nMachStartLayerId, ptStart, GDB_RT.GLOB)
EgtSetName(nMachStartId, START_GEOM)
' coloro l'entita' di rosso
EgtSetColor(nMachStartId, GeomEntityColors.c3MachStart)
' creo layer ribs
Dim nRibsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
' creo layer shell number
Dim nShellNumberLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
EgtSetColor(nShellNumberLayerId, GeomEntityColors.c3ShellNumber)
' creo layer aux
Dim nAuxSolidsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
EgtSetColor(nAuxSolidsLayerId, GeomEntityColors.c3AuxSolids)
' creo layer others
Dim nOthersLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nOthersLayerId, LAY_OTHERS)
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
' aggiungo riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Dim frPrintSolid As New Frame3d(ptOrig)
nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
If nFrameId Then
EgtSetName(nFrameId, FRAME_PART)
EgtSetMode(nFrameId, GDB_MD.LOCKED)
End If
EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -730,6 +728,8 @@ Public Class GeomEntity_MenuItem
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Dim ManagePart_Part As ManagePart_Part = New ManagePart_Part(NewPart)
' elimino da posizione originale
m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
@@ -741,9 +741,10 @@ Public Class GeomEntity_MenuItem
' Imposto flag di ricalcolo slice
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
End Select
'' aggiorno visibilita' da check di categoria
'Dim PrintLayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = ViewLayer.ViewLayerType.PRINT_SOLID)
'EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintLayer.bIsVisible) OrElse PrintLayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
' aggiorno visibilita' da check di categoria
Dim PrintViewlayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = ViewLayer.ViewLayerType.PRINT_SOLID)
EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintViewlayer.bIsVisible) OrElse PrintViewlayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
EgtDraw()
Return
End If
Select Case Map.refManagePartPanelVM.Type
@@ -763,11 +764,18 @@ Public Class GeomEntity_MenuItem
NewLayer.EntityList.Add(m_OrigEntity)
' aggiorno riferimenti nell'entita'
m_OrigEntity.UpdateOrigLayer(NewLayer)
' aggiorno colore
EgtSetColor(m_OrigEntity.nId, GetColor(m_Type))
' aggiorno visibilita' da check di categoria
Dim PrintViewlayer As ViewLayer = Map.refViewLayerManagerVM.LayerList.FirstOrDefault(Function(x) x.Type = m_Type)
EgtSetStatus(m_OrigEntity.nId, If(IsNothing(PrintViewlayer.bIsVisible) OrElse PrintViewlayer.bIsVisible, GDB_ST.ON_, GDB_ST.OFF))
EgtDraw()
End If
End If
' aggiorno riferimenti nel context menu item
m_OrigEntity.UpdateContextMenu()
Case ManagePartPanelVM.ManagePartType.MODIFY
Dim bIsMovedRib As Boolean = False
' recupero layer da pezzo
Dim nLayerId As Integer = GDB_ID.NULL
Select Case m_Type
@@ -789,18 +797,20 @@ Public Class GeomEntity_MenuItem
' elimino info vecchio layer
Select Case m_OrigEntity.OrigLayer.Type
Case ManagePart_Layer.LayerType.PRINT_SOLID
EgtResetMark(m_OrigEntity.nId)
'EgtResetMark(m_OrigEntity.nId)
' se e' presente flag di spostamento a 45 gradi
Dim nPartId As Integer = EgtGetParent(EgtGetParent(m_OrigEntity.nId))
Dim vtMoved As Vector3d
If EgtGetInfo(nPartId, "MovedPart", vtMoved) Then
If EgtGetInfo(nPartId, KEY_MOVEDPART, vtMoved) Then
' lo sposto e rimuovo info
EgtMove(m_OrigEntity.nId, -vtMoved, GDB_RT.GLOB)
EgtRemoveInfo(nPartId, "MovedPart")
EgtRemoveInfo(nPartId, KEY_MOVEDPART)
End If
Case ManagePart_Layer.LayerType.MACH_START
Case ManagePart_Layer.LayerType.RIBS
EgtRemoveInfo(m_OrigEntity.nId, KEY_RIB_TYPE)
EgtRemoveInfo(m_OrigEntity.nId, RIB_ID)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtRemoveInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE)
Case ManagePart_Layer.LayerType.AUX_SOLIDS
@@ -826,14 +836,16 @@ Public Class GeomEntity_MenuItem
EgtSetName(m_OrigEntity.nId, PRINT_SOLID)
EgtSetColor(m_OrigEntity.nId, c3Print)
' rimuovo eventuale nota spostamento per 45 gradi
EgtRemoveInfo(m_OrigEntity.OrigLayer.OrigPart.nId, "MovedPart")
EgtRemoveInfo(m_OrigEntity.OrigLayer.OrigPart.nId, KEY_MOVEDPART)
Case ManagePart_Layer.LayerType.MACH_START
EgtSetName(m_OrigEntity.nId, LAY_MACH_START)
EgtSetColor(m_OrigEntity.nId, c3MachStart)
Case ManagePart_Layer.LayerType.RIBS
EgtSetName(m_OrigEntity.nId, LAY_RIBS)
EgtSetInfo(m_OrigEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetInfo(m_OrigEntity.nId, RIB_ID, RibPanelVM.GetNextRibIndex())
EgtSetColor(m_OrigEntity.nId, c3Rib)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtSetName(m_OrigEntity.nId, LAY_SHELL_NBR)
EgtSetInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
@@ -846,6 +858,11 @@ Public Class GeomEntity_MenuItem
EgtSetName(m_OrigEntity.nId, LAY_OTHERS)
EgtSetColor(m_OrigEntity.nId, c3Others)
End Select
' se spostato un Rib, aggiorno posizione riferimento e pezzo
If bIsMovedRib Then
Map.refReferencePanelVM.UpdateFramePosition(NewPart.PrintPart)
Map.refDispositionPanelVM.UpdateZPos()
End If
EgtDraw()
' aggiorno riferimenti nel context menu item
If bUpdateAllContextMenu Then
@@ -924,7 +941,8 @@ Public Class ManagerPart_MenuItem
Select Case Map.refManagePartPanelVM.Type
Case ManagePartPanelVM.ManagePartType.IMPORT
For Each Layer In m_OrigPart.LayerList
For Each Entity In Layer.EntityList
For EntityIndex = Layer.EntityList.Count - 1 To 0 Step -1
Dim Entity As PartManager_GeomEntity = Layer.EntityList(EntityIndex)
' le rimuovo da lista entita' pezzo
Layer.EntityList.Remove(Entity)
' la rimetto in lista importati
@@ -947,7 +965,9 @@ Public Class ManagerPart_MenuItem
' aggiorno riferimenti nel context menu item
Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
' Imposto flag di ricalcolo slice
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
If Not IsNothing(Map.refTopPanelVM.SelPart) Then ' in prima importazione non c'e' alcun pezzo selezionato
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
End If
End Select
End Sub
+74 -45
View File
@@ -21,7 +21,7 @@ Public Class Material
End Get
End Property
Friend Sub UpdateIsModified()
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified))
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified)) OrElse bIsModifiedName
NotifyPropertyChanged(NameOf(ghName))
End Sub
@@ -31,23 +31,32 @@ Public Class Material
Return m_nIndex
End Get
End Property
Friend Sub SetIndex(nValue As Integer)
m_nIndex = nValue
End Sub
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Public Property sGUID As String
Get
Return m_sGUID
End Get
Set(value As String)
m_sGUID = value
End Set
End Property
Private m_sOrigName As String = ""
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
Dim bIsModified As Boolean = m_sName <> value
m_sName = value
Map.refMaterialDbVM.SetNameVisibility(False)
NotifyPropertyChanged(NameOf(ghName))
If bIsModified Then UpdateIsModified()
Map.refMaterialDbVM.SetIsEnabled(True)
End Set
End Property
Public ReadOnly Property ghName As String
@@ -55,12 +64,18 @@ Public Class Material
Return m_sName & If(m_bIsModified, "*", "")
End Get
End Property
Public ReadOnly Property bIsModifiedName As Boolean
Get
Return m_sName <> m_sOrigName
End Get
End Property
' per lettura da file
Sub New(nIndex As Integer)
m_nIndex = nIndex
ReadMaterialParamString(nIndex, MAT_GUID, "", m_sGUID)
ReadMaterialParamString(nIndex, MAT_NAME, "", m_sName)
m_sOrigName = m_sName
'EgtGetStringUtf8FromIni(nIndex, MAT_NAME, "", m_sName, sMatIniFilePath)
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nIndex))
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.TEMPERATURES, nIndex))
@@ -76,7 +91,8 @@ Public Class Material
Sub New()
m_nIndex = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "New Material Param"
m_sName = "New Material"
m_sOrigName = m_sName
Dim nCopyIndex As Integer = Map.refMaterialDbVM.SelMaterial.m_nIndex
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nCopyIndex))
Dim Orig As StringMaterialParam = m_CathegoryList(0).MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
@@ -133,6 +149,16 @@ Public Class Material
'm_dRibsLeadOutWipeDir = ReadMaterialParamDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, CurrentMachine.sMachiningFilePath)
End Sub
Private Sub SaveName()
m_sOrigName = m_sName
End Sub
Private Sub ResetName()
m_sName = m_sOrigName
NotifyPropertyChanged(NameOf(ghName))
NotifyPropertyChanged(NameOf(sName))
End Sub
Friend Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
@@ -145,15 +171,17 @@ Public Class Material
End Sub
Private Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub ResetModification()
ResetName()
If bIsModified Then
' annullo le modifiche di tutti i parametri
SaveParams()
ResetParams()
' resetto stato di modificata
UpdateIsModified()
End If
@@ -165,12 +193,12 @@ Public Class Material
Next
End Sub
Friend Sub WriteParamsOnDb(nIndex As Integer)
WriteMaterialParam(nIndex, MAT_GUID, m_sGUID)
WriteMaterialParam(nIndex, MAT_NAME, m_sName)
Friend Sub WriteParamsOnDb(nIndex As Integer, Optional sFilePath As String = "")
WriteMaterialParam(nIndex, MAT_GUID, m_sGUID, sFilePath)
WriteMaterialParam(nIndex, MAT_NAME, m_sName, sFilePath)
' EgtWriteStringUtf8toIni(nIndex, MAT_NAME, m_sName)
For Each Cathegory In m_CathegoryList
Cathegory.WriteParamOnDb(nIndex)
Cathegory.WriteParamOnDb(nIndex, sFilePath)
Next
End Sub
@@ -215,6 +243,7 @@ Public Class MaterialIndex
Friend Function GetSelMaterialData(Param As MaterialParam.Params) As Double
Dim sParamKey As String = ""
Dim dDefault As Double = 0
Select Case Param
Case MaterialParam.Params.T1
sParamKey = MAT_T1
@@ -228,8 +257,10 @@ Public Class MaterialIndex
sParamKey = MAT_T5
Case MaterialParam.Params.K_EXTRUSION
sParamKey = MAT_KEXTRUSION
dDefault = 100
Case MaterialParam.Params.K_LAY_TIME
sParamKey = MAT_KLAYERTIME
dDefault = 100
Case MaterialParam.Params.C1
sParamKey = MAT_C1
Case MaterialParam.Params.C2
@@ -255,7 +286,7 @@ Public Class MaterialIndex
Case MaterialParam.Params.KN
sParamKey = MAT_KN
End Select
Return ReadMaterialParamDouble(m_nIndex, sParamKey, 0)
Return ReadMaterialParamDouble(m_nIndex, sParamKey, dDefault)
End Function
End Class
@@ -355,9 +386,9 @@ Public Class MaterialCathegory
Next
End Sub
Friend Sub WriteParamOnDb(nIndex As Integer)
Friend Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
For Each Param In m_MaterialParamList
Param.WriteParamOnDb(nIndex)
Param.WriteParamOnDb(nIndex, sFilePath)
Next
End Sub
@@ -453,7 +484,7 @@ Public MustInherit Class MaterialParam
End Sub
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer)
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Friend MustOverride Sub SaveParam()
Friend MustOverride Sub ResetParam()
@@ -556,7 +587,7 @@ Public Class NumericMaterialParam
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Dim sWriteValue As String = ""
If m_bIsLen Then
sWriteValue = LenToString(m_dValue, 5)
@@ -565,43 +596,43 @@ Public Class NumericMaterialParam
End If
Select Case Type
Case Params.T1
WriteMaterialParam(nIndex, MAT_T1, sWriteValue)
WriteMaterialParam(nIndex, MAT_T1, sWriteValue, sFilePath)
Case Params.T2
WriteMaterialParam(nIndex, MAT_T2, sWriteValue)
WriteMaterialParam(nIndex, MAT_T2, sWriteValue, sFilePath)
Case Params.T3
WriteMaterialParam(nIndex, MAT_T3, sWriteValue)
WriteMaterialParam(nIndex, MAT_T3, sWriteValue, sFilePath)
Case Params.T4
WriteMaterialParam(nIndex, MAT_T4, sWriteValue)
WriteMaterialParam(nIndex, MAT_T4, sWriteValue, sFilePath)
Case Params.T5
WriteMaterialParam(nIndex, MAT_T5, sWriteValue)
WriteMaterialParam(nIndex, MAT_T5, sWriteValue, sFilePath)
Case Params.K_EXTRUSION
WriteMaterialParam(nIndex, MAT_KEXTRUSION, sWriteValue)
WriteMaterialParam(nIndex, MAT_KEXTRUSION, sWriteValue, sFilePath)
Case Params.K_LAY_TIME
WriteMaterialParam(nIndex, MAT_KLAYERTIME, sWriteValue)
WriteMaterialParam(nIndex, MAT_KLAYERTIME, sWriteValue, sFilePath)
Case Params.C1
WriteMaterialParam(nIndex, MAT_C1, sWriteValue)
WriteMaterialParam(nIndex, MAT_C1, sWriteValue, sFilePath)
Case Params.C2
WriteMaterialParam(nIndex, MAT_C2, sWriteValue)
WriteMaterialParam(nIndex, MAT_C2, sWriteValue, sFilePath)
Case Params.DENSITY
WriteMaterialParam(nIndex, MAT_DENSITY, sWriteValue)
WriteMaterialParam(nIndex, MAT_DENSITY, sWriteValue, sFilePath)
Case Params.AMAX
WriteMaterialParam(nIndex, MAT_AMAX, sWriteValue)
WriteMaterialParam(nIndex, MAT_AMAX, sWriteValue, sFilePath)
Case Params.ATRG
WriteMaterialParam(nIndex, MAT_ATRG, sWriteValue)
WriteMaterialParam(nIndex, MAT_ATRG, sWriteValue, sFilePath)
Case Params.AMIN
WriteMaterialParam(nIndex, MAT_AMIN, sWriteValue)
WriteMaterialParam(nIndex, MAT_AMIN, sWriteValue, sFilePath)
Case Params.BMAX
WriteMaterialParam(nIndex, MAT_BMAX, sWriteValue)
WriteMaterialParam(nIndex, MAT_BMAX, sWriteValue, sFilePath)
Case Params.BTRG
WriteMaterialParam(nIndex, MAT_BTRG, sWriteValue)
WriteMaterialParam(nIndex, MAT_BTRG, sWriteValue, sFilePath)
Case Params.BMIN
WriteMaterialParam(nIndex, MAT_BMIN, sWriteValue)
WriteMaterialParam(nIndex, MAT_BMIN, sWriteValue, sFilePath)
Case Params.KW
WriteMaterialParam(nIndex, MAT_KW, sWriteValue)
WriteMaterialParam(nIndex, MAT_KW, sWriteValue, sFilePath)
Case Params.KZ
WriteMaterialParam(nIndex, MAT_KZ, sWriteValue)
WriteMaterialParam(nIndex, MAT_KZ, sWriteValue, sFilePath)
Case Params.KN
WriteMaterialParam(nIndex, MAT_KN, sWriteValue)
WriteMaterialParam(nIndex, MAT_KN, sWriteValue, sFilePath)
End Select
End Sub
@@ -618,8 +649,6 @@ End Class
Public Class StringMaterialParam
Inherits MaterialParam
Public Const DEFAULT_MATERIAL As String = "***"
Private m_sGUID As String
Public Property sGUID As String
Get
@@ -684,9 +713,9 @@ Public Class StringMaterialParam
Case Params.ORIG
Dim sOrigGUID As String = ""
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
If sOrigGUID = DEFAULT_MATERIAL Then
m_sGUID = DEFAULT_MATERIAL
m_sValue = DEFAULT_MATERIAL
If sOrigGUID = ORIG_MATERIAL Then
m_sGUID = ORIG_MATERIAL
m_sValue = ORIG_MATERIAL
' se livello alto, lo visualizzo comunque
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
m_String_Visibility = Visibility.Visible
@@ -711,10 +740,10 @@ Public Class StringMaterialParam
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
Case Params.ORIG
WriteMaterialParam(nIndex, MAT_ORIG, m_sGUID)
WriteMaterialParam(nIndex, MAT_ORIG, m_sGUID, sFilePath)
End Select
End Sub
@@ -741,8 +770,8 @@ Public Class StringMaterialParam
Public Sub Original()
If MessageBox.Show("Are you sure you want to set this material as original?", "Original material confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
m_sGUID = DEFAULT_MATERIAL
m_sValue = DEFAULT_MATERIAL
m_sGUID = ORIG_MATERIAL
m_sValue = ORIG_MATERIAL
NotifyPropertyChanged(NameOf(sValue))
End If
End Sub
@@ -798,10 +827,10 @@ Public Class ComboMaterialParam
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
'Case Params.STRANDORDER
' WriteMaterialParam(nIndex, MAC_STRANDORDER, m_SelValue.Id)
' WriteMaterialParam(nIndex, MAC_STRANDORDER, m_SelValue.Id, sFilePath)
End Select
End Sub
@@ -849,7 +878,7 @@ Public Class CheckMaterialParam
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Friend Overrides Sub WriteParamOnDb(nIndex As Integer, Optional sFilePath As String = "")
Select Case Type
End Select
End Sub
+50 -47
View File
@@ -13,39 +13,70 @@
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Rows="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Content="Copy"
Command="{Binding Copy_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Save"
<Button Grid.Column="1"
Content="Save"
Command="{Binding Save_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Delete"
<Button Grid.Column="2" Content="Delete"
Command="{Binding Delete_Command}"
IsEnabled="{Binding Delete_IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
<ComboBox Grid.Row="1"
Name="MaterialCombo"
ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelMaterial}"
DisplayMemberPath="ghName"/>
<Grid Grid.Row="2"
Visibility="{Binding Name_Visibility}">
<Button Grid.Column="3"
Command="{Binding Import_Command}"
ToolTip="{Binding ImportToolTip}"
IsEnabled="{Binding ImpExp_IsEnabled}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/MachiningDB/Import.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="4"
Command="{Binding Export_Command}"
ToolTip="{Binding ImportToolTip}"
IsEnabled="{Binding ImpExp_IsEnabled}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/MachiningDB/Export.png" Stretch="Uniform"/>
</Button>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name_Msg}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SelectedItem.sName, ElementName=MaterialCombo, UpdateSourceTrigger=Explicit}"/>
<ComboBox Grid.Row="1"
Name="MaterialCombo"
ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelMaterial}"
DisplayMemberPath="ghName"
Visibility="{Binding Combo_Visibility}"
Style="{StaticResource FeatureComboBox}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding SelectedItem.sName, ElementName=MaterialCombo, UpdateSourceTrigger=Explicit}"
ExplicitUpdateSource="EnterKeyPressOrLostFocus"
IsExplicitFocused="{Binding UserShouldEditValueNow}"
Visibility="{Binding Name_Visibility}"/>
<Button Grid.Column="1"
Command="{Binding EditName_Command}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<ScrollViewer Grid.Row="3"
<ScrollViewer Grid.Row="2"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MaterialCombo}">
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MaterialCombo}"
IsEnabled="{Binding IsEnabled}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
@@ -80,15 +111,6 @@
<TextBlock Text="{Binding sName}"/>
<TextBox Grid.Column="1"
Text="{Binding dValue}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:StringMaterialParam}">
@@ -117,22 +139,12 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"
HorizontalAlignment="Stretch"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:CheckMaterialParam}">
@@ -140,22 +152,12 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<CheckBox Grid.Column="1"
IsChecked="{Binding bValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -165,9 +167,10 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<UniformGrid Grid.Row="3" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
+151 -15
View File
@@ -60,10 +60,13 @@ Public Class MaterialDbVM
Return m_Name_Visibility
End Get
End Property
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
End Sub
Private m_Combo_Visibility As Visibility = Visibility.Visible
Public ReadOnly Property Combo_Visibility As Visibility
Get
Return m_Combo_Visibility
End Get
End Property
' variabile che indica se una qualunque lavorazione e' stata modificata
Private m_bIsModified As Boolean
@@ -76,10 +79,22 @@ Public Class MaterialDbVM
m_bIsModified = value
End Sub
Private m_IsEnabled As Boolean = True
Public ReadOnly Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
End Property
Friend Sub SetIsEnabled(value As Boolean)
m_IsEnabled = value
NotifyPropertyChanged(NameOf(IsEnabled))
NotifyPropertyChanged(NameOf(Delete_IsEnabled))
End Sub
Private m_Delete_IsEnabled As Boolean = True
Public ReadOnly Property Delete_IsEnabled As Boolean
Get
Return m_Delete_IsEnabled
Return m_IsEnabled AndAlso m_Delete_IsEnabled
End Get
End Property
Friend Sub SetDeleteIsEnabled(value As Boolean)
@@ -91,11 +106,36 @@ Public Class MaterialDbVM
NotifyPropertyChanged(NameOf(Delete_IsEnabled))
End Sub
Private m_UserShouldEditValueNow As Boolean = False
Public Property UserShouldEditValueNow As Boolean
Get
Return m_UserShouldEditValueNow
End Get
Set(value As Boolean)
m_UserShouldEditValueNow = value
End Set
End Property
Friend Sub SetUserShouldEditValueNow()
m_UserShouldEditValueNow = True
NotifyPropertyChanged(NameOf(UserShouldEditValueNow))
m_UserShouldEditValueNow = False
NotifyPropertyChanged(NameOf(UserShouldEditValueNow))
End Sub
Public ReadOnly Property ImpExp_IsEnabled As Boolean
Get
Return m_IsEnabled AndAlso (IsNothing(m_SelMaterial) OrElse Not m_SelMaterial.bIsModified)
End Get
End Property
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCopy As ICommand
Private m_cmdSave As ICommand
Private m_cmdDelete As ICommand
Private m_cmdEditName As ICommand
Private m_cmdImport As ICommand
Private m_cmdExport As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -133,6 +173,14 @@ Public Class MaterialDbVM
End If
End Sub
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
m_Combo_Visibility = If(Not bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
NotifyPropertyChanged(NameOf(Combo_Visibility))
If bValue Then SetUserShouldEditValueNow()
End Sub
Private Function SelMaterialIsOriginal() As Boolean
If IsNothing(m_SelMaterial) Then Return False
' verifico abilitazione delete
@@ -140,7 +188,7 @@ Public Class MaterialDbVM
If Not IsNothing(General) Then
Dim Original As MaterialParam = General.MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
If Not IsNothing(Original) Then
If DirectCast(Original, StringMaterialParam).sValue = StringMaterialParam.DEFAULT_MATERIAL Then
If DirectCast(Original, StringMaterialParam).sValue = ORIG_MATERIAL Then
Return True
End If
End If
@@ -176,7 +224,7 @@ Public Class MaterialDbVM
End Select
End If
If m_bIsModified Then
Dim sBakMatIniFilePath As String = Path.ChangeExtension(CurrentMachine.sMaterialsFilePath, ".bak")
Dim sBakMatIniFilePath As String = Path.ChangeExtension(CurrentMachine.sMaterialFilePath, ".bak")
If File.Exists(sBakMatIniFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
@@ -184,24 +232,24 @@ Public Class MaterialDbVM
Catch ex As Exception
End Try
End If
If File.Exists(CurrentMachine.sMaterialsFilePath) Then
If File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
File.Move(CurrentMachine.sMaterialsFilePath, sBakMatIniFilePath)
File.Move(CurrentMachine.sMaterialFilePath, sBakMatIniFilePath)
Catch ex As Exception
End Try
End If
' se ancora esiste lo elimino
If File.Exists(CurrentMachine.sMaterialsFilePath) Then
If File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
File.Delete(CurrentMachine.sMaterialsFilePath)
File.Delete(CurrentMachine.sMaterialFilePath)
Catch ex As Exception
End Try
End If
' creo nuovo file
If Not File.Exists(CurrentMachine.sMaterialsFilePath) Then
If Not File.Exists(CurrentMachine.sMaterialFilePath) Then
Try
File.WriteAllLines(CurrentMachine.sMaterialsFilePath, {"; Commento per evitare BOM con UTF-8"})
File.WriteAllLines(CurrentMachine.sMaterialFilePath, {"; Commento per evitare BOM con UTF-8"})
Catch ex As Exception
End Try
End If
@@ -291,12 +339,28 @@ Public Class MaterialDbVM
End Property
Public Sub Delete()
Dim sCheckMessage As String = "Are you sure you want to delete selected material?"
' se materiale originale, esco
If SelMaterialIsOriginal() Then Return
If SelMaterialIsOriginal() Then
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
If MessageBox.Show("Trying to delete an Original Material! Are you sure you want to delete it?", "", MessageBoxButton.YesNo, MessageBoxImage.Warning) <> MessageBoxResult.Yes Then
Return
End If
sCheckMessage = "Trying to delete an Original Material! Are you ABSOLUTELY sure you want to delete it?"
Else
MessageBox.Show("Original material impossible to delete!")
Return
End If
End If
' chiedo conferma
Select Case MessageBox.Show("Are you sure you want to delete selected material?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Select Case MessageBox.Show(sCheckMessage, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_MaterialList.Remove(m_SelMaterial)
SetIsModified(True)
If m_MaterialList.Count > 0 Then
SelMaterial = m_MaterialList(0)
NotifyPropertyChanged(NameOf(SelMaterial))
End If
' segno Db come modificato
Map.refMaterialDbVM.SetIsModified(True)
Case MessageBoxResult.No
@@ -306,6 +370,78 @@ Public Class MaterialDbVM
#End Region ' Delete
#Region "EditName"
Public ReadOnly Property EditName_Command As ICommand
Get
If m_cmdEditName Is Nothing Then
m_cmdEditName = New Command(AddressOf EditName)
End If
Return m_cmdEditName
End Get
End Property
Public Sub EditName()
If IsNothing(m_SelMaterial) Then Return
SetNameVisibility(True)
SetIsEnabled(False)
End Sub
#End Region ' EditName
#Region "Import"
Public ReadOnly Property Import_Command As ICommand
Get
If m_cmdImport Is Nothing Then
m_cmdImport = New Command(AddressOf Import)
End If
Return m_cmdImport
End Get
End Property
Public Sub Import()
' chiedo il nome del file .data da aprire
Dim OpenFileDlg As New System.Windows.Forms.OpenFileDialog() With {.Title = EgtMsg(31451) & " " & EgtMsg(31452),
.Filter = "Material file data (*" & ImportExportMachiningPanelVM.MaterialDataExtension & ")|*" & ImportExportMachiningPanelVM.MaterialDataExtension &
"|Original Material file data (*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension & ")|*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension &
"|All Material file data (*" & ImportExportMachiningPanelVM.MaterialDataExtension & "," & ImportExportMachiningPanelVM.OriginalMaterialDataExtension & ")|*" &
ImportExportMachiningPanelVM.MaterialDataExtension & ";*" & ImportExportMachiningPanelVM.OriginalMaterialDataExtension,
.FilterIndex = 3,
.FileName = String.Empty}
If OpenFileDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return
Dim ImportWindowVM As New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MATERIAL, ImportExportMachiningPanelVM.WindowModeEnum.IMPORT, OpenFileDlg.FileName)
If ImportWindowVM.WindowMode <> ImportExportMachiningPanelVM.WindowModeEnum.IMPORT_ORIG Then
Dim ImportWindowV As New ImportExportMachiningPanelV(Application.Current.MainWindow, ImportWindowVM)
ImportWindowV.ShowDialog()
End If
End Sub
#End Region ' Import
#Region "Export"
Public ReadOnly Property Export_Command As ICommand
Get
If m_cmdExport Is Nothing Then
m_cmdExport = New Command(AddressOf Export)
End If
Return m_cmdExport
End Get
End Property
Public Sub Export()
Dim ExportMode As ImportExportMachiningPanelVM.WindowModeEnum = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
ExportMode = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT_ORIG
End If
Dim ExportWindowVM As New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MATERIAL, ExportMode)
Dim ExportWindowV As New ImportExportMachiningPanelV(Application.Current.MainWindow, ExportWindowVM)
ExportWindowV.ShowDialog()
End Sub
#End Region ' Export
#End Region ' COMMANDS
End Class
+2 -2
View File
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.1.1")>
<Assembly: AssemblyFileVersion("2.5.1.1")>
<Assembly: AssemblyVersion("2.5.2.2")>
<Assembly: AssemblyFileVersion("2.5.2.2")>
+6 -5
View File
@@ -1162,11 +1162,12 @@ Public Class LayerColor
Public Enum LayerType As Integer
PRINTPART = 1
RIBS = 2
SHELLNUMBERS = 3
AUXSOLIDS = 4
MACHSTART = 5
OTHERS = 6
'REFERENCE = 2
MACHSTART = 3
RIBS = 4
SHELLNUMBERS = 5
AUXSOLIDS = 6
OTHERS = 7
End Enum
Private m_Type As LayerType
+27 -19
View File
@@ -30,6 +30,7 @@ Public Class ReferencePanelVM
End Get
Set(value As ReferenceBtn)
m_SelReference = value.Type
EgtSetInfo(Map.refTopPanelVM.SelPart.nReferenceLayerId, KEY_REFERENCE, value.Type)
UpdateFramePosition()
End Set
End Property
@@ -42,6 +43,7 @@ Public Class ReferencePanelVM
If value Then
m_SelReference = ReferenceBtn.References.FROM_IMPORT
NotifyPropertyChanged(NameOf(ghSelReference))
EgtSetInfo(Map.refTopPanelVM.SelPart.nReferenceLayerId, KEY_REFERENCE, ReferenceBtn.References.FROM_IMPORT)
UpdateFramePosition()
End If
End Set
@@ -68,45 +70,51 @@ Public Class ReferencePanelVM
End Sub
Friend Sub UpdateFramePosition(Optional SelPart As Print3dPartVM = Nothing)
If IsNothing(SelPart) Then SelPart = Map.refTopPanelVM.SelPart
Dim SelReference As Integer = ReferenceBtn.References.BL
If IsNothing(SelPart) Then
SelPart = Map.refTopPanelVM.SelPart
End If
EgtGetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, SelReference)
' elimino precedente
EgtEmptyGroup(SelPart.nReferenceLayerId)
' Creo riferimento
Dim frPrintSolid As New Frame3d()
If m_SelReference = ReferenceBtn.References.FROM_IMPORT Then
If SelReference = ReferenceBtn.References.FROM_IMPORT Then
EgtGetGlobFrame(SelPart.nPrintSolidId, frPrintSolid)
frPrintSolid.Setup(New Point3d(frPrintSolid.Orig.x, frPrintSolid.Orig.y, 0))
Else
Dim b3PrintSolid As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.STANDARD, b3PrintSolid)
Dim b3ToBePrintSolid As BBox3d = Map.refDispositionPanelVM.GetSolidForReferenceBBox(SelPart)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Select Case m_SelReference
Dim ptOrig As New Point3d(b3ToBePrintSolid.Min())
Select Case SelReference
Case ReferenceBtn.References.TL
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX
Case ReferenceBtn.References.TR
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BL
Case ReferenceBtn.References.BR
ptOrig += b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.ML
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BC
ptOrig += b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MC
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
End Select
Dim vtMovedPart As Vector3d
EgtGetInfo(SelPart.nPartId, "MovedPart", vtMovedPart)
ptOrig = ptOrig - vtMovedPart
If EgtGetInfo(SelPart.nPartId, KEY_MOVEDPART, vtMovedPart) Then
ptOrig = ptOrig - vtMovedPart
ElseIf EgtGetInfo(SelPart.nPartId, KEY_MOVEDPART2, vtMovedPart) Then
ptOrig = ptOrig - vtMovedPart
End If
frPrintSolid = New Frame3d(ptOrig)
End If
Dim nFrameId As Integer = EgtCreateGeoFrame(SelPart.nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
@@ -115,7 +123,7 @@ Public Class ReferencePanelVM
EgtSetMode(nFrameId, GDB_MD.LOCKED)
SelPart.UpdateReferenceId(nFrameId)
End If
EgtSetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, m_SelReference)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End Sub
+42 -5
View File
@@ -1,8 +1,10 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.Globalization
Imports System.Windows.Markup
Imports EgtUILib
Imports EgtWPFLib5
Imports Icarus.RibEntity
Public Class RibPanelVM
Inherits VMBase
@@ -73,7 +75,16 @@ Public Class RibPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewXPos As Double = b3Reference.Min.x
StringToLen(value, dNewXPos)
If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimX
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(m_SelRib.nExtrusionId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
dMax -= b3Reference.DimX
Else
dMin -= b3Reference.DimX
End If
If dNewXPos >= dMin AndAlso dNewXPos <= dMax Then
EgtMove(m_SelRib.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelRib.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
@@ -102,7 +113,16 @@ Public Class RibPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewYPos As Double = b3Reference.Min.y
StringToLen(value, dNewYPos)
If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimY
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(m_SelRib.nExtrusionId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
dMax -= b3Reference.DimY
Else
dMin -= b3Reference.DimY
End If
If dNewYPos >= dMin AndAlso dNewYPos <= dMax Then
EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
@@ -131,7 +151,7 @@ Public Class RibPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewZPos As Double = b3Reference.Min.y
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
If dNewZPos >= -1000 Then
EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
@@ -676,6 +696,20 @@ Public Class RibPanelVM
NotifyPropertyChanged(NameOf(SelRib))
End Sub
Friend Shared Function GetNextRibIndex()
Dim nRibIndex As Integer = 0
Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nCurrIndex As Integer = GDB_ID.NULL
EgtGetInfo(nRibId, RIB_ID, nCurrIndex)
If nCurrIndex > nRibIndex Then
nRibIndex = nCurrIndex
End If
nRibId = EgtGetNext(nRibId)
End While
Return nRibIndex + 1
End Function
#End Region ' METHODS
#Region "COMMANDS"
@@ -1201,7 +1235,7 @@ Public Class RibPanelVM
End While
EgtDeselectAll()
m_bCPlaneObj_IsActive = True
' Map.refControllerInputPanelVM.PrepareInputBox("Grid from Selection", "Select the face of the object where to place the grid", "", False, False)
' Map.refControllerInputPanelVM.PrepareInputBox("Grid from Selection", "Select the face of the object where to place the grid", "", False, False)
End Sub
#End Region ' CPlaneObj
@@ -1332,7 +1366,10 @@ Public Class RibEntity
End Property
Sub New(Type As RibTypes, nId As Integer)
m_nIndex = nSharedIndex
If Not EgtGetInfo(nId, RIB_ID, m_nIndex) Then
m_nIndex = RibPanelVM.GetNextRibIndex()
EgtSetInfo(nId, RIB_ID, m_nIndex)
End If
m_Type = Type
EgtSetInfo(nId, KEY_RIB_TYPE, Type)
Select Case Type
+35
View File
@@ -0,0 +1,35 @@
<EgtWPFLib5:EgtCustomWindow x:Class="CopyFromWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
Title="{Binding sTitle}" Icon="/Resources/Icarus.ico"
WindowStyle="None" ResizeMode="NoResize" IsClosable="False"
WindowStartupLocation="CenterOwner"
SizeToContent="WidthAndHeight">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Select Rib to Copy"
HorizontalAlignment="Center"
Margin="0,0,0,2.5"/>
<ComboBox Grid.Row="1"
ItemsSource="{Binding RibList}"
SelectedItem="{Binding SelRib}"
DisplayMemberPath="ghName"
Margin="0,2.5,0,2.5"/>
<UniformGrid Grid.Row="2"
Rows="1"
Margin="0,2.5,0,0">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Cancel"
Command="{Binding Cancel_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+18
View File
@@ -0,0 +1,18 @@
Public Class CopyFromWndV
Private WithEvents m_CopyFromWndVM As CopyFromWndVM
Sub New(Owner As Window, CopyFromWndVM As CopyFromWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = CopyFromWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_CopyFromWndVM = CopyFromWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_CopyFromWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
+182
View File
@@ -0,0 +1,182 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class CopyFromWndVM
Inherits VMBase
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_RibList As ObservableCollection(Of RibEntity)
Public ReadOnly Property RibList As ObservableCollection(Of RibEntity)
Get
Return m_RibList
End Get
End Property
Private m_SelRib As RibEntity
Public Property SelRib As RibEntity
Get
Return m_SelRib
End Get
Set(value As RibEntity)
m_SelRib = value
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Sub New()
m_RibList = New ObservableCollection(Of RibEntity)(Map.refRibPanelVM.RibList)
m_RibList.Remove(m_RibList.FirstOrDefault(Function(x) x.nExtrusionId = Map.refRibPanelVM.SelRib.nExtrusionId))
If m_RibList.Count > 0 Then
m_SelRib = m_RibList(0)
End If
End Sub
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
If IsNothing(m_SelRib) Then
MessageBox.Show("Please select the rib from which to copy the parameters!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
' copio i parametri nella rib corrente
Dim ParamList As New List(Of MachiningParam.Params)({MachiningParam.Params.RIBSTYPE,
MachiningParam.Params.RIBSOVERLAP,
MachiningParam.Params.RIBSSTRANDCOUNT,
MachiningParam.Params.RIBSLINK,
MachiningParam.Params.RIBSINVERTDIRECTION,
MachiningParam.Params.RIBSINVERTSTRANDORDER,
MachiningParam.Params.RIBSLEADININVERT,
MachiningParam.Params.RIBSLEADINLEN,
MachiningParam.Params.RIBSLEADOUTINVERT,
MachiningParam.Params.RIBSLEADOUTLEN,
MachiningParam.Params.RIBSLEADOUTCOASTING,
MachiningParam.Params.RIBSLEADOUTWIPE,
MachiningParam.Params.RIBSLEADOUTWIPEDIR})
For Each Param In ParamList
Select Case Map.refRibPanelVM.SelRib.Type
'Case RibEntity.RibTypes.FROMDRAW
' CopyParam(Param, m_SelRib.nExtrusionId, Map.refRibPanelVM.SelRib.nCurveId)
' CopyParam(Param, m_SelRib.nExtrusionId, Map.refRibPanelVM.SelRib.nExtrusionId)
Case RibEntity.RibTypes.FROMIMPORT
CopyParam(Param, m_SelRib.nExtrusionId, Map.refRibPanelVM.SelRib.nExtrusionId)
End Select
Next
'' ricarico i parametri
'Map.refRibParamPanelVM.Init()
RaiseEvent m_CloseWindow(True)
End Sub
Private Sub CopyParam(Type As MachiningParam.Params, nFromId As Integer, nToId As Integer)
Dim bRead As Boolean = False
Select Case Type
Case MachiningParam.Params.RIBSTYPE
Dim RibTypeParam As RibComboMachiningParam = Nothing
Dim nRibParam As Integer = 0
Select Case Type
Case MachiningParam.Params.RIBSTYPE
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSTYPE)
bRead = EgtGetInfo(nFromId, MAC_RIBSTYPE, nRibParam)
End Select
If Not IsNothing(RibTypeParam) AndAlso bRead Then
RibTypeParam.SelValue = RibTypeParam.ValueList.FirstOrDefault(Function(x) x.Id = nRibParam)
Else
RibTypeParam.SelValue = RibTypeParam.PartSelValue
End If
Case MachiningParam.Params.RIBSOVERLAP, MachiningParam.Params.RIBSSTRANDCOUNT, MachiningParam.Params.RIBSLEADINLEN, MachiningParam.Params.RIBSLEADOUTLEN,
MachiningParam.Params.RIBSLEADOUTCOASTING, MachiningParam.Params.RIBSLEADOUTWIPE, MachiningParam.Params.RIBSLEADOUTWIPEDIR
Dim RibTypeParam As RibNumericMachiningParam = Nothing
Dim dRibParam As Double = 0
Select Case Type
Case MachiningParam.Params.RIBSOVERLAP
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSOVERLAP)
bRead = EgtGetInfo(nFromId, MAC_RIBSOVERLAP, dRibParam)
Case MachiningParam.Params.RIBSSTRANDCOUNT
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSSTRANDCOUNT)
bRead = EgtGetInfo(nFromId, MAC_RIBSSTRANDCOUNT, dRibParam)
Case MachiningParam.Params.RIBSLEADINLEN
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADINLEN)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADINLEN, dRibParam)
Case MachiningParam.Params.RIBSLEADOUTLEN
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADOUTLEN)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADOUTLEN, dRibParam)
Case MachiningParam.Params.RIBSLEADOUTCOASTING
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADOUTCOASTING)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADOUTCOASTING, dRibParam)
Case MachiningParam.Params.RIBSLEADOUTWIPE
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADOUTWIPE)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADOUTWIPE, dRibParam)
Case MachiningParam.Params.RIBSLEADOUTWIPEDIR
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADOUTWIPEDIR)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADOUTWIPEDIR, dRibParam)
End Select
If Not IsNothing(RibTypeParam) AndAlso bRead Then
RibTypeParam.SetValue(dRibParam)
Else
RibTypeParam.SetValue(RibTypeParam.dPartValue)
End If
Case MachiningParam.Params.RIBSLINK, MachiningParam.Params.RIBSINVERTDIRECTION, MachiningParam.Params.RIBSINVERTSTRANDORDER, MachiningParam.Params.RIBSLEADININVERT, MachiningParam.Params.RIBSLEADOUTINVERT
Dim RibTypeParam As RibCheckMachiningParam = Nothing
Dim bRibParam As Boolean = False
Select Case Type
Case MachiningParam.Params.RIBSLINK
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLINK)
bRead = EgtGetInfo(nFromId, MAC_RIBSLINK, bRibParam)
Case MachiningParam.Params.RIBSINVERTDIRECTION
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSINVERTDIRECTION)
bRead = EgtGetInfo(nFromId, MAC_RIBSINVERTDIRECTION, bRibParam)
Case MachiningParam.Params.RIBSINVERTSTRANDORDER
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSINVERTSTRANDORDER)
bRead = EgtGetInfo(nFromId, MAC_RIBSINVERTSTRANDORDER, bRibParam)
Case MachiningParam.Params.RIBSLEADININVERT
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADININVERT)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADININVERT, bRibParam)
Case MachiningParam.Params.RIBSLEADOUTINVERT
RibTypeParam = Map.refRibParamPanelVM.MachiningParamList.FirstOrDefault(Function(x) x.Type = MachiningParam.Params.RIBSLEADOUTINVERT)
bRead = EgtGetInfo(nFromId, MAC_RIBSLEADOUTINVERT, bRibParam)
End Select
If Not IsNothing(RibTypeParam) AndAlso bRead Then
RibTypeParam.bValue = bRibParam
Else
RibTypeParam.bValue = RibTypeParam.bPartValue
End If
End Select
End Sub
#End Region ' Ok
#Region "Cancel"
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Cancel()
RaiseEvent m_CloseWindow(False)
End Sub
#End Region ' Cancel
#End Region ' COMMANDS
End Class
+3
View File
@@ -120,6 +120,9 @@
<Button Content="Cancel"
Command="{Binding Cancel_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Copy From"
Command="{Binding CopyFrom_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
</Border>
+58
View File
@@ -10,6 +10,7 @@ Public Class RibParamPanelVM
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Private m_cmdCopyFrom As ICommand
#End Region ' FIELDS & PROPERTIES
@@ -46,6 +47,7 @@ Public Class RibParamPanelVM
New RibNumericMachiningParam(MachiningParam.Params.RIBSSTRANDCOUNT, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLINK, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSINVERTSTRANDORDER, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nRibId, nPartId),
@@ -111,6 +113,12 @@ Public Class RibParamPanelVM
Public Sub Ok()
If Not IsNothing(Map.refRibPanelVM.SelRib) Then
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsTypeParam As MachiningParam = MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
' scrivo i parametri modificati
Select Case Map.refRibPanelVM.SelRib.Type
Case RibEntity.RibTypes.FROMDRAW
@@ -119,6 +127,12 @@ Public Class RibParamPanelVM
Case RibEntity.RibTypes.FROMIMPORT
WriteParamsInRib(Map.refRibPanelVM.SelRib.nExtrusionId)
End Select
SaveCurrParams()
' se modificata tipologia Ribs, aggiorno posizione riferimento e pezzo
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
End If
' ripristino modalita' standard
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL)
@@ -146,6 +160,26 @@ Public Class RibParamPanelVM
#End Region ' Cancel
#Region "CopyFrom"
Public ReadOnly Property CopyFrom_Command As ICommand
Get
If m_cmdCopyFrom Is Nothing Then
m_cmdCopyFrom = New Command(AddressOf CopyFrom)
End If
Return m_cmdCopyFrom
End Get
End Property
Public Sub CopyFrom()
Dim CopyFromWndVM As New CopyFromWndVM
Dim CopyFromWndV As New CopyFromWndV(Application.Current.MainWindow, CopyFromWndVM)
CopyFromWndV.ShowDialog()
Dim x = CopyFromWndVM.SelRib
End Sub
#End Region ' CopyFrom
#End Region ' COMMANDS
End Class
@@ -167,6 +201,11 @@ Public Class RibNumericMachiningParam
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Set
End Property
Friend Sub SetValue(value As Double)
m_dValue = value
NotifyPropertyChanged(NameOf(sValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Sub
Private m_dPartValue As Double
Public ReadOnly Property dPartValue As Double
@@ -200,6 +239,10 @@ Public Class RibNumericMachiningParam
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTDIRECTION, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_dPartValue)
m_bIsLen = True
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_dPartValue)
m_bIsLen = True
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADININVERT, m_dValue)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_dPartValue)
@@ -262,6 +305,12 @@ Public Class RibNumericMachiningParam
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTDIRECTION)
End If
Case Params.RIBSINVERTSTRANDORDER
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, sWriteValue)
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTSTRANDORDER)
End If
Case Params.RIBSLEADININVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADININVERT, sWriteValue)
@@ -485,6 +534,9 @@ Public Class RibCheckMachiningParam
Case Params.RIBSINVERTDIRECTION
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTDIRECTION, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_bPartValue)
Case Params.RIBSINVERTSTRANDORDER
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTSTRANDORDER, m_bPartValue)
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADININVERT, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_bPartValue)
@@ -513,6 +565,12 @@ Public Class RibCheckMachiningParam
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTDIRECTION)
End If
Case Params.RIBSINVERTSTRANDORDER
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSINVERTSTRANDORDER, If(m_bValue, 1, 0))
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTSTRANDORDER)
End If
Case Params.RIBSLEADININVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0))
+7 -6
View File
@@ -451,9 +451,10 @@ Public Class MySceneHostVM
' elimino colore entita'
EgtResetColor(nNewEntityId)
' aggiorno riferimento pezzo
Map.refReferencePanelVM.UpdateFramePosition(MenuItem.OrigLayer.OrigPart.PrintPart)
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
' elimino eventuale flag di spostamento a 45 gradi
EgtRemoveInfo(MenuItem.OrigLayer.OrigPart.PrintPart.nPartId, "MovedPart")
EgtRemoveInfo(MenuItem.OrigLayer.OrigPart.PrintPart.nPartId, KEY_MOVEDPART)
' elimino vecchio elemento ed aggiungo nuovo
MenuItem.OrigLayer.EntityList.Clear()
MenuItem.OrigLayer.EntityList.Add(New PartManager_GeomEntity(MenuItem.OrigLayer, nNewEntityId))
@@ -552,10 +553,10 @@ Public Class MySceneHostVM
'Assegnazione nome file con dialogo
Dim SaveFileDialog As New SaveFileDialog With {
.Title = "Export",
.Filter = "Stereolithography (*.stl)|*.stl" &
"|3D Manufacturing format (*.3mf)|*.3mf",
.FilterIndex = 0,
.FileName = Path.ChangeExtension(MainController.GetCurrFile(), "stl")
.Filter = "3D Manufacturing format (*.3mf)|*.3mf" &
"|Stereolithography (*.stl)|*.stl",
.FilterIndex = 1,
.FileName = Path.ChangeExtension(MainController.GetCurrFile(), "").TrimEnd("."c)
}
Dim DialogResult As Boolean? = SaveFileDialog.ShowDialog
If IsNothing(DialogResult) OrElse Not DialogResult Then Return
@@ -73,7 +73,7 @@ Public Class ShellNumberPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewXPos As Double = b3Reference.Min.x
StringToLen(value, dNewXPos)
If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then
If dNewXPos >= -b3Reference.DimX AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX - b3Reference.DimX Then
EgtMove(m_SelShellNumber.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
@@ -102,7 +102,7 @@ Public Class ShellNumberPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewYPos As Double = b3Reference.Min.y
StringToLen(value, dNewYPos)
If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then
If dNewYPos >= -b3Reference.DimY AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY - b3Reference.DimY Then
EgtMove(m_SelShellNumber.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
@@ -131,7 +131,7 @@ Public Class ShellNumberPanelVM
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
Dim dNewZPos As Double = b3Reference.Min.y
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
If dNewZPos >= -1000 Then
EgtMove(m_SelShellNumber.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
EgtDraw()
+9 -2
View File
@@ -376,7 +376,8 @@ Public Class SliceManagerVM
' verifico esistenza e correttezza machgroup
InitMachGroup(True)
' eseguo generazione CN
bOk = ExecGenerate()
Dim sMsg As String = ""
bOk = ExecGenerate(sMsg)
' leggo stima tempo e la riporto in layer di calcolo
EgtGetInfo(EgtGetFirstMachGroup(), "Ttot", m_dTime)
NotifyPropertyChanged(NameOf(ghTime))
@@ -391,7 +392,13 @@ Public Class SliceManagerVM
nCurrPartId = EgtGetNextPart(nCurrPartId)
End While
Else
MessageBox.Show("Error in NC code generation! See log file.", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Dim sOut As String = "Error in NC code generation : "
If String.IsNullOrWhiteSpace(sMsg) Then
sOut &= "See log file."
Else
sOut &= sMsg
End If
MessageBox.Show(sOut, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End If
' Aggiorno intestazione programma
+1 -1
View File
@@ -117,7 +117,7 @@ Public Class StartMachPanelVM
EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
If dNewZPos >= -1000 Then
EgtMove(m_SelStart.nId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
EgtDraw()
Else
+11 -11
View File
@@ -166,14 +166,14 @@ Public Class TopPanelVM
End Get
Set(value As Print3dPartVM)
If Not IsNothing(m_SelPart) Then
' deseleziono eventuale pezzo precedente
EgtResetMark(m_SelPart.nPrintSolidId)
'' deseleziono eventuale pezzo precedente
'EgtResetMark(m_SelPart.nPrintSolidId)
End If
m_SelPart = value
If Not IsNothing(value) Then
' Eseguo la selezione
EgtDeselectAll()
EgtSetMark(m_SelPart.nPrintSolidId)
' EgtSetMark(m_SelPart.nPrintSolidId)
EgtDraw()
' imposto lavorazione e materiale del pezzo selezionato
Map.refCurrMachiningPanelVM.ReadMachParamFromSelPart()
@@ -553,10 +553,10 @@ Public Class TopPanelVM
Map.refSliderManagerVM.SetLayerIndexIsEnabled(False)
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(False)
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(False)
' tolgo mark da pezzo selezionato
If Not IsNothing(SelPart) Then
EgtResetMark(SelPart.nPrintSolidId)
End If
'' tolgo mark da pezzo selezionato
'If Not IsNothing(SelPart) Then
' EgtResetMark(SelPart.nPrintSolidId)
'End If
' imposto pagina
Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.MODIFYPART)
End Sub
@@ -569,10 +569,10 @@ Public Class TopPanelVM
Map.refSliderManagerVM.SetLayerIndexIsEnabled(True)
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(True)
Map.refInstrumentPanelVM.SetEdgeAnalysisIsEnabled(True)
' ripristino mark su pezzo selezionato
If Not IsNothing(SelPart) Then
EgtSetMark(SelPart.nPrintSolidId)
End If
'' ripristino mark su pezzo selezionato
'If Not IsNothing(SelPart) Then
' EgtSetMark(SelPart.nPrintSolidId)
'End If
Return True
End Function
+9 -6
View File
@@ -46,12 +46,15 @@ Public Module CurrentMachine
m_sMachiningFilePath = sValue
End Sub
' Cartella dei materiali
Private m_sMaterialsFilePath As String = String.Empty
Friend ReadOnly Property sMaterialsFilePath As String
Private m_sMaterialFilePath As String = String.Empty
Friend ReadOnly Property sMaterialFilePath As String
Get
Return m_sMaterialsFilePath
Return m_sMaterialFilePath
End Get
End Property
Friend Sub SetMaterialFilePath(sValue As String)
m_sMaterialFilePath = sValue
End Sub
' box della tavola macchina
Private m_b3Tab As New BBox3d
@@ -75,7 +78,7 @@ Public Module CurrentMachine
' impostazione cartella lavorazioni
m_sMachiningFilePath = sMachinesRootDir & "\" & sMachineName & "\Machinings\Machinings.ini"
' impostazione cartella materiali
m_sMaterialsFilePath = sMachinesRootDir & "\" & sMachineName & "\Materials\Materials.ini"
m_sMaterialFilePath = sMachinesRootDir & "\" & sMachineName & "\Materials\Materials.ini"
' Disabilito segnalazione modificato
Dim DisableMgr As New DisableModifiedMgr
' recupero box macchina
@@ -180,7 +183,7 @@ Public Module CurrentMachine
End Function
Friend Function ReadMaterialParamString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, Optional sFilePath As String = "") As Integer
Dim nResult As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialsFilePath))
Dim nResult As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialFilePath))
If Not String.IsNullOrWhiteSpace(lpString) Then
lpString = EgwCrypto.PowerDecryptString(lpString, m_Salt)
Else
@@ -198,7 +201,7 @@ Public Module CurrentMachine
End Function
Friend Function WriteMaterialParam(lpAppName As String, lpKeyName As String, lpString As String, Optional sFilePath As String = "") As Boolean
Return WritePrivateProfileString(lpAppName, lpKeyName, EgwCrypto.PowerEncryptString(lpString, m_Salt), If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialsFilePath))
Return WritePrivateProfileString(lpAppName, lpKeyName, EgwCrypto.PowerEncryptString(lpString, m_Salt), If(Not String.IsNullOrWhiteSpace(sFilePath), sFilePath, m_sMaterialFilePath))
End Function
#End Region 'Methods
+34 -7
View File
@@ -5,11 +5,12 @@ Module GeomEntityColors
Public Enum LayerType As Integer
PRINTPART = 1
RIBS = 2
SHELLNUMBERS = 3
AUXSOLIDS = 4
MACHSTART = 5
OTHERS = 6
'REFERENCE = 2
MACHSTART = 3
RIBS = 4
SHELLNUMBERS = 5
AUXSOLIDS = 6
OTHERS = 7
ALL = 10
End Enum
@@ -124,6 +125,23 @@ Module GeomEntityColors
WritePrivateProfileColor(S_COLORS, sIniKey, c3Temp)
UpdateColors(Type)
End Sub
Friend Function GetColor(Type As LayerType) As Color3d
Dim sIniKey As String = ""
Select Case Type
Case LayerType.PRINTPART
Return c3Print
Case LayerType.RIBS
Return c3Rib
Case LayerType.SHELLNUMBERS
Return c3ShellNumber
Case LayerType.AUXSOLIDS
Return c3AuxSolids
Case LayerType.MACHSTART
Return c3MachStart
Case LayerType.OTHERS
Return c3Others
End Select
End Function
Friend Sub SetAlpha(Type As LayerType, dAlpha As Double)
Dim c3Temp As Color3d = c3Print
Dim sIniKey As String = ""
@@ -222,12 +240,21 @@ Module GeomEntityColors
End While
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
End If
' Ripristino stato segnalazione modifica
DisableMgr.ReEnable()
nPartId = EgtGetNextPart(nPartId)
End While
' se in import, aggiorno anche i pezzi di import
If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
For Each ImportPart In Map.refManagePartPanelVM.ManagerPartList
Dim Layer As ManagePart_Layer = ImportPart.LayerList.FirstOrDefault(Function(x) x.Type = Type)
If Not IsNothing(Layer) Then
For Each Entity In Layer.EntityList
EgtSetColor(Entity.nId, GetColor(Type))
Next
End If
Next
End If
EgtDraw()
End Sub
+13 -7
View File
@@ -10,6 +10,7 @@ Module LuaExec
If bSlice Then
EgtLuaCreateGlobTable("PRINT")
EgtLuaSetGlobIntVar("PRINT.PROGRAM", 1)
EgtLuaSetGlobStringVar("PRINT.BASEDIR", Map.refMainWindowVM.MainWindowM.s3dPrintingDir)
bOk = bOk AndAlso EgtLuaExecFile(Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\Slicing.lua")
' Cancello tavola globale
EgtLuaResetGlobVar("PRINT")
@@ -29,6 +30,9 @@ Module LuaExec
dMachiningConstant = MachiningConstant.dValue
End If
End If
EgtLuaCreateGlobTable("PRINT")
EgtLuaSetGlobIntVar("PRINT.PROGRAM", 1)
EgtLuaSetGlobStringVar("PRINT.BASEDIR", Map.refMainWindowVM.MainWindowM.s3dPrintingDir)
EgtLuaCreateGlobTable("MACHINING")
EgtLuaSetGlobNumVar("MACHINING.K", dMachiningConstant)
EgtLuaCreateGlobTable("MATERIAL")
@@ -49,30 +53,29 @@ Module LuaExec
' Eseguo lo script
If EgtLuaExecFile(sExecPath) Then
bOk = True
'' Recupero i risultati
'Dim nErr As Integer = 999
'EgtLuaGetGlobIntVar("MATERIAL.ERR", nErr)
'bOk = (nErr <= 0)
'If Not bOk Then EgtOutLog("ExecSlice Err=" & nErr.ToString())
Else
EgtOutLog("Error executing Slice Exec script " & sExecPath)
bOk = False
End If
' Cancello tavola globale
EgtLuaResetGlobVar("MATERIAL")
EgtLuaResetGlobVar("MACHINING")
EgtLuaResetGlobVar("PRINT")
Return bOk
End Function
Friend Function ExecGenerate() As Boolean
Friend Function ExecGenerate(ByRef sMsg As String) As Boolean
sMsg = ""
EgtOutLog("-- Start ExecGenerate --")
' eseguo generazione
EgtLuaCreateGlobTable("PRINT")
EgtLuaSetGlobIntVar("PRINT.PROGRAM", 1)
EgtLuaSetGlobStringVar("PRINT.BASEDIR", Map.refMainWindowVM.MainWindowM.s3dPrintingDir)
Dim sIsoFilePath As String = ""
Dim nTabPartId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, TABLE)
If nTabPartId <> GDB_ID.NULL Then
If Not EgtGetInfo(nTabPartId, KEY_ISOFILE_PATH, sIsoFilePath) OrElse
Not IO.Directory.Exists( IO.Path.GetDirectoryName(sIsoFilePath)) Then
Not IO.Directory.Exists(IO.Path.GetDirectoryName(sIsoFilePath)) Then
EgtGetCurrFilePath(sIsoFilePath)
Dim sExtension As String = ""
GetPrivateProfileString(S_PARTPROGRAM, K_EXTENSION, "", sExtension, CurrentMachine.sMachIniFile)
@@ -87,6 +90,7 @@ Module LuaExec
If bOk Then
Dim nErr As Integer = 999
EgtLuaGetGlobIntVar("PRINT.ERR", nErr)
EgtLuaGetGlobStringVar("PRINT.MSG", sMsg)
bOk = (nErr <= 0)
End If
' Cancello tavola globale
@@ -98,6 +102,8 @@ Module LuaExec
EgtOutLog("-- Start ExecSolid --")
' eseguo generazione
EgtLuaCreateGlobTable("PRINT")
EgtLuaSetGlobIntVar("PRINT.PROGRAM", 1)
EgtLuaSetGlobStringVar("PRINT.BASEDIR", Map.refMainWindowVM.MainWindowM.s3dPrintingDir)
Dim bOk As Boolean = EgtLuaExecFile(Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\CalcSolids.lua")
If bOk Then
Dim nErr As Integer = 999
+20 -20
View File
@@ -95,9 +95,9 @@ Public Class ViewLayer
RIBS = 4
SHELL_NUMBER = 5
AUX_SOLIDS = 6
SOLID_SLICE = 7
SLICE_TOOLPATH = 8
OTHERS = 9
OTHERS = 7
SOLID_SLICE = 8
SLICE_TOOLPATH = 9
End Enum
Private m_Type As ViewLayerType
@@ -229,23 +229,23 @@ Public Class ViewLayer
EgtSetStatus(CurrPart.nOthersLayerId, Status)
End Select
Next
'' se sono in importazione, dis/attivo anche queste superfici
'If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
' For Each CurrPart In Map.refManagePartPanelVM.ManagerPartList
' For Each Layer In CurrPart.LayerList
' If (Layer.Type = ManagePart_Layer.LayerType.PRINT_SOLID AndAlso m_Type = ViewLayerType.PRINT_SOLID) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.MACH_START AndAlso m_Type = ViewLayerType.START_MACHINING) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.RIBS AndAlso m_Type = ViewLayerType.RIBS) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.SHELL_NUMBER AndAlso m_Type = ViewLayerType.SHELL_NUMBER) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.AUX_SOLIDS AndAlso m_Type = ViewLayerType.AUX_SOLIDS) OrElse
' (Layer.Type = ManagePart_Layer.LayerType.OTHERS AndAlso m_Type = ViewLayerType.OTHERS) Then
' For Each Entity In Layer.EntityList
' EgtSetStatus(Entity.nId, Status)
' Next
' End If
' Next
' Next
'End If
' se sono in importazione, dis/attivo anche queste superfici
If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
For Each CurrPart In Map.refManagePartPanelVM.ManagerPartList
For Each Layer In CurrPart.LayerList
If (Layer.Type = ManagePart_Layer.LayerType.PRINT_SOLID AndAlso m_Type = ViewLayerType.PRINT_SOLID) OrElse
(Layer.Type = ManagePart_Layer.LayerType.MACH_START AndAlso m_Type = ViewLayerType.START_MACHINING) OrElse
(Layer.Type = ManagePart_Layer.LayerType.RIBS AndAlso m_Type = ViewLayerType.RIBS) OrElse
(Layer.Type = ManagePart_Layer.LayerType.SHELL_NUMBER AndAlso m_Type = ViewLayerType.SHELL_NUMBER) OrElse
(Layer.Type = ManagePart_Layer.LayerType.AUX_SOLIDS AndAlso m_Type = ViewLayerType.AUX_SOLIDS) OrElse
(Layer.Type = ManagePart_Layer.LayerType.OTHERS AndAlso m_Type = ViewLayerType.OTHERS) Then
For Each Entity In Layer.EntityList
EgtSetStatus(Entity.nId, Status)
Next
End If
Next
Next
End If
' Ripristino stato segnalazione modifica
DisableMgr.ReEnable()
End Sub