diff --git a/Icarus/Constants/Const3dPrint.vb b/Icarus/Constants/Const3dPrint.vb
index 81204a8..69f4636 100644
--- a/Icarus/Constants/Const3dPrint.vb
+++ b/Icarus/Constants/Const3dPrint.vb
@@ -3,7 +3,6 @@
Public Const TABLE = "Table"
Public Const TABLE_OUTLINE = "TableOutline"
Public Const PART = "Part"
- Public Const ORIGINAL_SOLID = "OriginalSolid"
Public Const PRINT_SOLID = "PrintSolid"
Public Const LAY_MACH_START = "MachStart"
Public Const LAY_REFERENCE = "Frame"
@@ -151,5 +150,7 @@
Public Const KEY_ISOFILE_PATH = "IsoFilePath"
Public Const FILE_PATH = "FilePath"
+ Public Const PART_NAME = "PartName"
+ Public Const ENTITY_NAME = "EntityName"
End Module
diff --git a/Icarus/Constants/ConstIni.vb b/Icarus/Constants/ConstIni.vb
index c0cd3a9..2042fb3 100644
--- a/Icarus/Constants/ConstIni.vb
+++ b/Icarus/Constants/ConstIni.vb
@@ -111,6 +111,7 @@ Public Module ConstIni
Public Const K_CURRMATERIAL As String = "CurrMaterial"
Public Const K_CURRMACHINING As String = "CurrMachining"
Public Const K_VIEWSLIDER As String = "ViewSlider"
+ Public Const K_IMPORTCURREXTENSION As String = "ImportCurrExtension"
Public Const S_MRUFILES As String = "MruFiles"
Public Const S_MRUIMPORTFILES As String = "MruImportFiles"
diff --git a/Icarus/Icarus.vbproj b/Icarus/Icarus.vbproj
index 6dae7de..f42ff59 100644
--- a/Icarus/Icarus.vbproj
+++ b/Icarus/Icarus.vbproj
@@ -123,11 +123,6 @@
DispositionPanelV.xaml
-
- ImportPanelV.xaml
-
-
- InstrumentPanelV.xaml
@@ -154,16 +149,16 @@
MachSaveInDbWindowV.xaml
+
+ ManagePartPanelV.xaml
+
+
+ MaterialDbV.xaml
-
- ModifyPartPanelV.xaml
-
-
- MachineBox.xaml
@@ -304,10 +299,6 @@
MSBuild:CompileDesigner
-
- Designer
- MSBuild:Compile
- MSBuild:CompileDesigner
@@ -348,14 +339,14 @@
MSBuild:CompileDesigner
+
+ MSBuild:Compile
+ Designer
+ DesignerMSBuild:Compile
-
- MSBuild:Compile
- Designer
- MSBuild:CompileDesigner
diff --git a/Icarus/LeftPanel/LeftPanelV.xaml b/Icarus/LeftPanel/LeftPanelV.xaml
index acfcd48..d96e2dd 100644
--- a/Icarus/LeftPanel/LeftPanelV.xaml
+++ b/Icarus/LeftPanel/LeftPanelV.xaml
@@ -15,7 +15,8 @@
-
+
+
@@ -36,7 +37,8 @@
-
+
+
diff --git a/Icarus/LeftPanel/LeftPanelVM.vb b/Icarus/LeftPanel/LeftPanelVM.vb
index 91706da..af5e13d 100644
--- a/Icarus/LeftPanel/LeftPanelVM.vb
+++ b/Icarus/LeftPanel/LeftPanelVM.vb
@@ -55,7 +55,8 @@ Public Class LeftPanelVM
Case Panels.SHELLNUMBER
Map.refShellNumberPanelVM.Init()
Case Panels.MODIFYPART
- Map.refModifyPartPanelVM.Init()
+ ''Map.refModifyPartPanelVM.Init()
+ Map.refManagePartPanelVM.Init(ManagePartPanelVM.ManagePartType.MODIFY)
End Select
Map.refViewLayerManagerVM.UpdateForced()
NotifyPropertyChanged(NameOf(SelPanel))
diff --git a/Icarus/MainWindow/MainWindowV.xaml.vb b/Icarus/MainWindow/MainWindowV.xaml.vb
index 31c3d68..fb72bd8 100644
--- a/Icarus/MainWindow/MainWindowV.xaml.vb
+++ b/Icarus/MainWindow/MainWindowV.xaml.vb
@@ -19,6 +19,7 @@ Class MainWindowV
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
AddHandler Me.Closing, AddressOf MainWindowV_Closing
AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown
+ AddHandler Me.StateChanged, AddressOf MainWindowV_StateChanged
End Sub
#End Region ' CONSTRUCTOR
@@ -63,6 +64,14 @@ Class MainWindowV
End If
End Sub
+ Private Sub MainWindowV_StateChanged(sender As Object, e As EventArgs)
+ If Not IsNothing(Map.refSecondaryWindowV) AndAlso Not Map.refSecondaryWindowV.WindowChangingState Then
+ Map.refSecondaryWindowV.WindowState = Me.WindowState
+ 'Application.Current.MainWindow.Topmost = True
+ 'Application.Current.MainWindow.Topmost = False
+ End If
+ End Sub
+
#End Region ' EVENTS
End Class
diff --git a/Icarus/ManagePartPanel/ManagePartPanelV.xaml b/Icarus/ManagePartPanel/ManagePartPanelV.xaml
new file mode 100644
index 0000000..4f98579
--- /dev/null
+++ b/Icarus/ManagePartPanel/ManagePartPanelV.xaml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Icarus/ManagePartPanel/ManagePartPanelV.xaml.vb b/Icarus/ManagePartPanel/ManagePartPanelV.xaml.vb
new file mode 100644
index 0000000..c4f4723
--- /dev/null
+++ b/Icarus/ManagePartPanel/ManagePartPanelV.xaml.vb
@@ -0,0 +1,24 @@
+Public Class ManagePartPanelV
+
+ Protected Sub Item_ContextMenuOpening(sender As Object, e As ContextMenuEventArgs)
+ Dim PartItem As ManagePart_Part
+ Dim LayerItem As ManagePart_Layer
+ Dim EntityItem As PartManager_GeomEntity
+ Select Case e.OriginalSource.DataContext.GetType()
+ Case GetType(ManagePart_Part)
+ PartItem = DirectCast(e.OriginalSource.DataContext, ManagePart_Part)
+ If PartItem.MenuList.Count = 0 Then
+ e.Handled = True
+ End If
+ Case GetType(ManagePart_Layer)
+ LayerItem = DirectCast(e.OriginalSource.DataContext, ManagePart_Layer)
+ e.Handled = True
+ Case GetType(PartManager_GeomEntity)
+ EntityItem = DirectCast(e.OriginalSource.DataContext, PartManager_GeomEntity)
+ If EntityItem.MenuList.Count = 0 Then
+ e.Handled = True
+ End If
+ End Select
+ End Sub
+
+End Class
diff --git a/Icarus/ManagePartPanel/ManagePartPanelVM.vb b/Icarus/ManagePartPanel/ManagePartPanelVM.vb
new file mode 100644
index 0000000..9913742
--- /dev/null
+++ b/Icarus/ManagePartPanel/ManagePartPanelVM.vb
@@ -0,0 +1,506 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class ManagePartPanelVM
+ Inherits VMBase
+
+ Public Enum ManagePartType
+ IMPORT = 1
+ MODIFY = 2
+ End Enum
+
+ Private m_Type As ManagePartType
+ Friend ReadOnly Property Type As ManagePartType
+ Get
+ Return m_Type
+ End Get
+ End Property
+
+ Private m_nImportedPartId As Integer = GDB_ID.NULL
+ Friend ReadOnly Property nImportedPartId As Integer
+ Get
+ Return m_nImportedPartId
+ End Get
+ End Property
+
+ Private m_ImportedEntityList As New ObservableCollection(Of PartManager_GeomEntity)
+ Public Property ImportedEntityList As ObservableCollection(Of PartManager_GeomEntity)
+ Get
+ Return m_ImportedEntityList
+ End Get
+ Set(value As ObservableCollection(Of PartManager_GeomEntity))
+ m_ImportedEntityList = value
+ End Set
+ End Property
+
+ Private m_SelImportedEntity As PartManager_GeomEntity
+ Public Property SelImportedEntity As PartManager_GeomEntity
+ Get
+ Return m_SelImportedEntity
+ End Get
+ Set(value As PartManager_GeomEntity)
+ m_SelImportedEntity = value
+ EgtDeselectAll()
+ If Not IsNothing(m_SelImportedEntity) Then
+ EgtSelectObj(m_SelImportedEntity.nId)
+ End If
+ EgtDraw()
+ End Set
+ End Property
+ Friend Sub SetSelImportedEntity(nId As Integer)
+ Dim SelEntity As PartManager_GeomEntity = Nothing
+ ' cerco tra entita' importate
+ SelEntity = m_ImportedEntityList.FirstOrDefault(Function(x) x.nId = nId)
+ If IsNothing(SelEntity) Then
+ ' cerco tra pezzi creati
+ For Each ManagePart In m_ManagerPartList
+ For Each Layer In ManagePart.LayerList
+ SelEntity = Layer.EntityList.FirstOrDefault(Function(x) x.nId = nId)
+ If Not IsNothing(SelEntity) Then
+ SelEntity.bIsSelected = True
+ SelEntity.NotifyPropertyChanged(NameOf(SelEntity.bIsSelected))
+ Exit For
+ End If
+ Next
+ If Not IsNothing(SelEntity) Then
+ Exit For
+ End If
+ Next
+ End If
+ m_SelImportedEntity = SelEntity
+ EgtDeselectAll()
+ If Not IsNothing(m_SelImportedEntity) Then
+ EgtSelectObj(m_SelImportedEntity.nId)
+ End If
+ EgtDraw()
+ NotifyPropertyChanged(NameOf(SelImportedEntity))
+ End Sub
+
+ Private m_ManagerPartList As New ObservableCollection(Of ManagePart_Part)
+ Public ReadOnly Property ManagerPartList As ObservableCollection(Of ManagePart_Part)
+ Get
+ Return m_ManagerPartList
+ End Get
+ End Property
+
+ Private m_SelManagerPart As ManagePart_Part
+ Friend Sub SetSelManagerPart(SelManagePart_Part As ManagePart_Part)
+ m_SelManagerPart = SelManagePart_Part
+ m_SelManagerLayer = Nothing
+ End Sub
+ Public ReadOnly Property SelManagerPart As ManagePart_Part
+ Get
+ Return m_SelManagerPart
+ End Get
+ End Property
+
+ Private m_SelManagerLayer As ManagePart_Layer
+ Public ReadOnly Property SelManagerLayer As ManagePart_Layer
+ Get
+ Return m_SelManagerLayer
+ End Get
+ End Property
+ Friend Sub SetSelManagerLayer(SelManagePart_Layer As ManagePart_Layer)
+ m_SelManagerPart = m_ManagerPartList.FirstOrDefault(Function(x) x.LayerList.Contains(SelManagePart_Layer))
+ m_SelManagerLayer = SelManagePart_Layer
+ End Sub
+
+ Private m_SelPartManager_GeomEntity As PartManager_GeomEntity
+ Public ReadOnly Property SelPartManager_GeomEntity As PartManager_GeomEntity
+ Get
+ Return m_SelPartManager_GeomEntity
+ End Get
+ End Property
+ Friend Sub SetSelPartManager_GeomEntity(SelPartManager_GeomEntity As PartManager_GeomEntity)
+ For Each CurrPart In m_ManagerPartList
+ Dim CurrLayer As ManagePart_Layer = CurrPart.LayerList.FirstOrDefault(Function(x) x.EntityList.Contains(SelPartManager_GeomEntity))
+ If Not IsNothing(CurrLayer) Then
+ m_SelManagerPart = CurrPart
+ m_SelManagerLayer = CurrLayer
+ Exit For
+ End If
+ Next
+ m_SelPartManager_GeomEntity = SelPartManager_GeomEntity
+ End Sub
+
+ Public ReadOnly Property IsImport_Visibility As Visibility
+ Get
+ Select Case m_Type
+ Case ManagePartType.IMPORT
+ Return Visibility.Visible
+ Case Else ' ManagePartType.MODIFY
+ Return Visibility.Collapsed
+ End Select
+ End Get
+ End Property
+
+ 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))
+ End Sub
+
+ ' Definizione comandi
+ Private m_cmdSetReference As ICommand
+ Private m_cmdAddPart As ICommand
+ Private m_cmdRemovePart As ICommand
+ Private m_cmdOk As ICommand
+ Private m_cmdCancel As ICommand
+
+ Sub New()
+ ' Creo riferimento a questa classe in EgtCAM5Map
+ Map.SetRefManagePartPanelVM(Me)
+ End Sub
+
+#Region "METHODS"
+
+ Friend Sub Init(Type As ManagePartType)
+ m_Type = Type
+ Select Case Type
+ Case ManagePartType.IMPORT
+ ' import
+ m_ImportedEntityList.Clear()
+ m_ManagerPartList.Clear()
+ ' aggiungo geometrie importate a lista
+ m_nImportedPartId = EgtGetLastPart()
+ Dim nLayerId As Integer = EgtGetFirstLayer(m_nImportedPartId)
+ Dim nGeometryId As Integer = EgtGetFirstInGroup(nLayerId)
+ While nGeometryId <> GDB_ID.NULL
+ Dim sGeometryName As String = ""
+ EgtGetName(nGeometryId, sGeometryName)
+ m_ImportedEntityList.Add(New PartManager_GeomEntity(Nothing, nGeometryId))
+ nGeometryId = EgtGetNext(nGeometryId)
+ End While
+ ' aggiungo primo pezzo
+ m_ManagerPartList.Add(New ManagePart_Part(Nothing))
+ m_ManagerPartList(0).LayerList.FirstOrDefault(Function(x) x.Type = ManagePart_Layer.LayerType.PRINT_SOLID).bIsSelected = True
+ ' aggiorno i contextmenu di tutti gli entity
+ UpdateAllEntityContextMenu()
+ Case ManagePartType.MODIFY
+ ' modify
+ m_ImportedEntityList.Clear()
+ m_ManagerPartList.Clear()
+ ' carico pezzi in lista
+ For Each PrintPart In Map.refTopPanelVM.PartList
+ m_ManagerPartList.Add(New ManagePart_Part(PrintPart))
+ Next
+ End Select
+ NotifyPropertyChanged(NameOf(IsImport_Visibility))
+ EgtDeselectAll()
+ End Sub
+
+ Friend Sub UpdateAllEntityContextMenu()
+ ' aggiorno i contextmenu di tutti gli entity
+ For Each ManagePart In m_ManagerPartList
+ For Each Layer In ManagePart.LayerList
+ For Each Entity In Layer.EntityList
+ Entity.UpdateContextMenu()
+ Next
+ Next
+ Next
+ For Each Entity In ImportedEntityList
+ Entity.UpdateContextMenu()
+ Next
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "AddPart"
+
+ Public ReadOnly Property AddPart_Command As ICommand
+ Get
+ If m_cmdAddPart Is Nothing Then
+ m_cmdAddPart = New Command(AddressOf AddPart)
+ End If
+ Return m_cmdAddPart
+ End Get
+ End Property
+
+ Public Sub AddPart()
+ m_ManagerPartList.Add(New ManagePart_Part(Nothing))
+ ' aggiorno i contextmenu di tutti gli entity
+ UpdateAllEntityContextMenu()
+ End Sub
+
+#End Region ' AddPart
+
+#Region "RemovePart"
+
+ Public ReadOnly Property RemovePart_Command As ICommand
+ Get
+ If m_cmdRemovePart Is Nothing Then
+ m_cmdRemovePart = New Command(AddressOf RemovePart)
+ End If
+ Return m_cmdRemovePart
+ End Get
+ End Property
+
+ Public Sub RemovePart()
+ If IsNothing(SelManagerLayer) AndAlso m_ManagerPartList.Count > 1 Then
+ ' rimuovo pezzo
+ m_ManagerPartList.Remove(SelManagerPart)
+ 'Else
+ ' ' rimuovo geometria
+ ' Dim CurrEntity As PartManager_GeomEntity = m_SelPartManager_GeomEntity
+ ' SelManagerLayer.EntityList.Remove(m_SelPartManager_GeomEntity)
+ ' ' la rimetto in lista importati
+ ' ImportedEntityList.Add(CurrEntity)
+ End If
+ End Sub
+
+#End Region ' RemovePart
+
+#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()
+ Select Case m_Type
+ Case ManagePartType.IMPORT
+ Dim sErr As New List(Of String)
+ ' verifico che tutti i pezzi abbiano una superficie da stampare nel layer apposito
+ For Each CurrPart In m_ManagerPartList
+ For Each CurrLayer In CurrPart.LayerList
+ Select Case CurrLayer.Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ If CurrLayer.EntityList.Count = 0 Then
+ If sErr.Count > 0 Then sErr(sErr.Count - 1) &= Environment.NewLine
+ sErr.Add(CurrPart.sName & " - No print surface defined!")
+ End If
+ End Select
+ Next
+ Next
+ If sErr.Count > 0 Then
+ MessageBox.Show(String.Concat(sErr), "Error")
+ Return
+ Else
+ ' Creo pezzi e layer necessari
+ For ManagePart_PartIndex = 0 To m_ManagerPartList.Count - 1
+ Dim ManagePart_Part As ManagePart_Part = m_ManagerPartList(ManagePart_PartIndex)
+ Dim frImportedPart As New Frame3d
+ EgtGetGroupGlobFrame(m_nImportedPartId, frImportedPart)
+ Dim nPartId As Integer = EgtCreateGroup(GDB_ID.ROOT, frImportedPart)
+ EgtSetName(nPartId, PART)
+ Dim nFrameId As Integer = GDB_ID.NULL
+ Dim b3PrintSolid As New BBox3d
+ Dim nPrintPartLayerId As Integer = GDB_ID.NULL
+ Dim PrintSolidEntity As PartManager_GeomEntity = Nothing
+ Dim nRibsLayerId As Integer = GDB_ID.NULL
+ Dim nShellNumberLayerId As Integer = GDB_ID.NULL
+ Dim nAuxSolidsLayerId As Integer = GDB_ID.NULL
+ Dim nMachStartLayerId As Integer = GDB_ID.NULL
+ Dim nOthersLayerId As Integer = GDB_ID.NULL
+ For Each ManagePart_Layer In ManagePart_Part.LayerList
+ Select Case ManagePart_Layer.Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ nPrintPartLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nPrintPartLayerId, PRINT_SOLID)
+ If ManagePart_Layer.EntityList.Count > 0 Then
+ PrintSolidEntity = ManagePart_Layer.EntityList(0)
+ EgtRelocateGlob(PrintSolidEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
+ ' calcolo box superficie per creazione riferimento
+ EgtGetBBoxGlob(PrintSolidEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
+ ' coloro l'entita'
+ EgtSetColor(PrintSolidEntity.nId, GeomEntityColors.c3Print)
+ If PrintSolidEntity.sName <> PrintSolidEntity.nId.ToString() Then
+ EgtSetInfo(PrintSolidEntity.nId, ENTITY_NAME, PrintSolidEntity.sName)
+ End If
+ End If
+ Case ManagePart_Layer.LayerType.MACH_START
+ nMachStartLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nMachStartLayerId, LAY_MACH_START)
+ Dim nMachStartId As Integer = GDB_ID.NULL
+ If ManagePart_Layer.EntityList.Count > 0 Then
+ For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
+ ' se punto o curva compo
+ Dim EntityType As GDB_TY = EgtGetType(PartManager_GeomEntity.nId)
+ Select Case EntityType
+ Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO
+ ' gli cambio layer
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nMachStartLayerId, GDB_POS.LAST_SON)
+ nMachStartId = PartManager_GeomEntity.nId
+ Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
+ ' altrimenti la trasformo in curva compo
+ nMachStartId = EgtCreateCurveCompo(nMachStartLayerId, PartManager_GeomEntity.nId, True)
+ End Select
+ EgtSetName(nMachStartId, START_GEOM)
+ ' coloro l'entita'
+ EgtSetColor(nMachStartId, GeomEntityColors.c3MachStart)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Next
+ Else
+ ' 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)
+ End If
+ Case ManagePart_Layer.LayerType.RIBS
+ nRibsLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nRibsLayerId, LAY_RIBS)
+ For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
+ EgtSetInfo(PartManager_GeomEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nRibsLayerId, GDB_POS.LAST_SON)
+ ' coloro l'entita'
+ EgtSetColor(PartManager_GeomEntity.nId, GeomEntityColors.c3Rib)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Next
+ Case ManagePart_Layer.LayerType.SHELL_NUMBER
+ nShellNumberLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
+ For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
+ EgtSetInfo(PartManager_GeomEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nShellNumberLayerId, GDB_POS.LAST_SON)
+ ' coloro l'entita'
+ EgtSetColor(PartManager_GeomEntity.nId, GeomEntityColors.c3ShellNumber)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Next
+ Case ManagePart_Layer.LayerType.AUX_SOLIDS
+ nAuxSolidsLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
+ For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
+ EgtSetInfo(PartManager_GeomEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nAuxSolidsLayerId, GDB_POS.LAST_SON)
+ ' coloro l'entita'
+ EgtSetColor(PartManager_GeomEntity.nId, GeomEntityColors.c3AuxSolids)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Next
+ Case ManagePart_Layer.LayerType.OTHERS
+ nOthersLayerId = EgtCreateGroup(nPartId)
+ EgtSetName(nOthersLayerId, LAY_OTHERS)
+ For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
+ ' coloro l'entita'
+ EgtSetColor(PartManager_GeomEntity.nId, GeomEntityColors.c3Others)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Next
+ If ManagePart_PartIndex = 0 Then
+ For Each PartManager_GeomEntity In ImportedEntityList
+ ' se curva
+ Dim EntityType As GDB_TY = EgtGetType(PartManager_GeomEntity.nId)
+ Select Case EntityType
+ Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
+ ' la trasformo in curva compo
+ Dim nOtherId As Integer = EgtCreateCurveCompo(nOthersLayerId, PartManager_GeomEntity.nId, True)
+ ' coloro l'entita'
+ EgtSetColor(nOtherId, GeomEntityColors.c3Others)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(nOtherId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ Case Else
+ ' altrimenti la sposto solamente
+ EgtRelocateGlob(PartManager_GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
+ ' coloro l'entita'
+ EgtSetColor(PartManager_GeomEntity.nId, GeomEntityColors.c3Others)
+ If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
+ EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
+ End If
+ End Select
+ Next
+ End If
+ End Select
+ Next
+ ' 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))
+ ' lo aggiungo a lista pezzi
+ Dim sFilePath As String = ""
+ EgtGetInfo(m_nImportedPartId, FILE_PATH, sFilePath)
+ EgtSetInfo(nPartId, FILE_PATH, sFilePath)
+ EgtSetInfo(nPartId, PART_NAME, ManagePart_Part.sName)
+ EgtSetInfo(nPartId, "PartOnTable", 1)
+ Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
+ Map.refTopPanelVM.PartList.Add(NewPart)
+ Next
+ End If
+ 'EgtAddMachGroup("3dPrint")
+ 'EgtSetTable("Tab")
+
+ 'Dim nRawId As Integer = EgtAddRawPart(b3PrintSolid.Min, b3PrintSolid.DimX, b3PrintSolid.DimY, b3PrintSolid.DimZ, New Color3d(128, 128, 128, 30))
+ 'EgtAddPartToRawPart(nPartId, b3PrintSolid.Min, nRawId)
+ 'EgtMoveToCornerRawPart(nRawId, New Point3d(dPosX, dPosY, 0), MCH_CR.BL)
+
+ 'EgtResetCurrMachGroup()
+
+ ' seleziono ultimo pezzo aggiunto
+ Map.refTopPanelVM.SelLastPart()
+ ' elimino vecchio pezzo d'importazione
+ EgtErase(m_nImportedPartId)
+
+ EgtDraw()
+
+ Case ManagePartType.MODIFY
+ ' nulla da fare
+ End Select
+ ' ripristino modalita' standard
+ Map.refTopPanelVM.SelPage = Pages.MODIFY
+ 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()
+ ' elimino pezzo importato
+ EgtErase(m_nImportedPartId)
+ EgtDraw()
+ ' se ci sono pezzi
+ If Map.refTopPanelVM.PartList.Count > 0 Then
+ ' ripristino modalita' standard
+ Map.refTopPanelVM.SelPage = Pages.MODIFY
+ Else
+ Map.refTopPanelVM.SelPage = Pages.NULL
+ End If
+ End Sub
+
+#End Region ' Cancel
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/Icarus/ManagePartPanel/ManagePartUtility.vb b/Icarus/ManagePartPanel/ManagePartUtility.vb
new file mode 100644
index 0000000..fa553e5
--- /dev/null
+++ b/Icarus/ManagePartPanel/ManagePartUtility.vb
@@ -0,0 +1,907 @@
+Imports System.Collections.ObjectModel
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class PartManager_GeomEntity
+ Inherits VMBase
+
+ ' layer sotto cui e' questa entita'
+ Private m_OrigLayer As ManagePart_Layer
+ Friend ReadOnly Property OrigLayer As ManagePart_Layer
+ Get
+ Return m_OrigLayer
+ End Get
+ End Property
+
+ Private m_bIsSelected As Boolean
+ Public Property bIsSelected As Boolean
+ Get
+ Return m_bIsSelected
+ End Get
+ Set(value As Boolean)
+ m_bIsSelected = value
+ ' seleziono in scena
+ EgtDeselectAll()
+ If Not IsNothing(value) Then
+ EgtSelectObj(m_nId)
+ End If
+ EgtDraw()
+ ' segno come elemento selezionato in treeview
+ Map.refManagePartPanelVM.SetSelPartManager_GeomEntity(Me)
+ End Set
+ End Property
+
+ Private m_nId As Integer = GDB_ID.NULL
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ SetTextBoxVisibility(False)
+ NotifyPropertyChanged(NameOf(sName))
+ If Map.refManagePartPanelVM.Type = ManagePartPanelVM.ManagePartType.MODIFY Then
+ EgtSetInfo(m_nId, ENTITY_NAME, value)
+ End If
+ Map.refManagePartPanelVM.SetIsEnabled(True)
+ End Set
+ End Property
+
+ Public ReadOnly Property ghName As String
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_MenuList As New ObservableCollection(Of GeomEntity_MenuItem)
+ Public Property MenuList As ObservableCollection(Of GeomEntity_MenuItem)
+ Get
+ Return m_MenuList
+ End Get
+ Set(value As ObservableCollection(Of GeomEntity_MenuItem))
+ m_MenuList = value
+ End Set
+ End Property
+
+ 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
+
+ Private m_TextBox_Visibility As Visibility = Visibility.Collapsed
+ Public ReadOnly Property TextBox_Visibility As Visibility
+ Get
+ Return m_TextBox_Visibility
+ End Get
+ End Property
+
+ Private m_TextBlock_Visibility As Visibility = Visibility.Visible
+ Public ReadOnly Property TextBlock_Visibility As Visibility
+ Get
+ Return m_TextBlock_Visibility
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdGeomEntityDoubleClick As ICommand
+
+ Sub New(OrigLayer As ManagePart_Layer, nId As Integer)
+ m_nId = nId
+ Dim sName As String = ""
+ EgtGetInfo(m_nId, ENTITY_NAME, sName)
+ m_sName = If(String.IsNullOrWhiteSpace(sName), m_nId, sName)
+ m_OrigLayer = OrigLayer
+ ' aggiungo voci layer a contextmenu
+ UpdateContextMenu()
+ End Sub
+
+ Friend Sub UpdateContextMenu()
+ m_MenuList.Clear()
+ Select Case Map.refManagePartPanelVM.Type
+ Case ManagePartPanelVM.ManagePartType.IMPORT
+ Dim bIsSurface As Boolean = False
+ For Each ProjectPart In Map.refManagePartPanelVM.ManagerPartList
+ ' verifico in quali layer puo' andare questo elemento
+ Dim EntityType As GDB_TY = EgtGetType(nId)
+ Dim nPrintSolidCount As Integer = 0
+ Dim ManageLayer As ManagePart_Layer = ProjectPart.LayerList.FirstOrDefault(Function(x) x.Type = ManagePart_Layer.LayerType.PRINT_SOLID)
+ If Not IsNothing(ManageLayer) Then
+ nPrintSolidCount = ManageLayer.EntityList.Count
+ End If
+ Select Case EntityType
+ Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO, GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
+ If Not IsNothing(OrigLayer) Then
+ ' recupero i layer
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.MACH_START Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.MACH_START, ProjectPart))
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.OTHERS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ Else
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.MACH_START, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ End If
+ Case GDB_TY.SRF_MESH
+ bIsSurface = True
+ If Not IsNothing(OrigLayer) Then
+ ' verifico se volume chiuso
+ If nPrintSolidCount = 0 AndAlso (Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.PRINT_SOLID) Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.PRINT_SOLID, ProjectPart))
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.SHELL_NUMBER Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, ProjectPart))
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.AUX_SOLIDS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, ProjectPart))
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.RIBS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.RIBS, ProjectPart))
+ If Not ProjectPart Is OrigLayer.OrigPart OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.OTHERS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ Else
+ If nPrintSolidCount = 0 Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.PRINT_SOLID, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.RIBS, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ End If
+ End Select
+ Next
+ If bIsSurface Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.NEWPART))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.CHANGENAME))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.DELETE))
+ Case ManagePartPanelVM.ManagePartType.MODIFY
+ Dim bIsSurface As Boolean = False
+ For Each ProjectPart In Map.refTopPanelVM.PartList
+ ' verifico in quali layer puo' andare questo elemento
+ Dim EntityType As GDB_TY = EgtGetType(nId)
+ Dim nPrintSolidCount As Integer = EgtGetGroupObjs(ProjectPart.nPrintSolidLayerId)
+ Select Case EntityType
+ Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO, GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
+ If Not IsNothing(OrigLayer) Then
+ ' recupero i layer
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.MACH_START Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.MACH_START, ProjectPart))
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.OTHERS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ Else
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.MACH_START, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ End If
+ Case GDB_TY.SRF_MESH
+ bIsSurface = True
+ If Not IsNothing(OrigLayer) Then
+ ' verifico se volume chiuso
+ If nPrintSolidCount = 0 AndAlso (ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.PRINT_SOLID) Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.PRINT_SOLID, ProjectPart))
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.SHELL_NUMBER Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, ProjectPart))
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.AUX_SOLIDS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, ProjectPart))
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.RIBS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.RIBS, ProjectPart))
+ If ProjectPart.nPartId <> OrigLayer.OrigPart.PrintPart.nPartId OrElse OrigLayer.Type <> ManagePart_Layer.LayerType.OTHERS Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ Else
+ If nPrintSolidCount = 0 Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.PRINT_SOLID, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.RIBS, ProjectPart))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.OTHERS, ProjectPart))
+ End If
+ End Select
+ Next
+ If bIsSurface Then m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.NEWPART))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.CHANGENAME))
+ m_MenuList.Add(New GeomEntity_MenuItem(Me, ManagePart_Layer.LayerType.DELETE))
+ End Select
+ End Sub
+
+ Friend Sub UpdateOrigLayer(NewLayer As ManagePart_Layer)
+ m_OrigLayer = NewLayer
+ End Sub
+
+ Friend Sub SetTextBoxVisibility(bValue As Boolean)
+ m_TextBox_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
+ m_TextBlock_Visibility = If(Not bValue, Visibility.Visible, Visibility.Collapsed)
+ NotifyPropertyChanged(NameOf(TextBox_Visibility))
+ NotifyPropertyChanged(NameOf(TextBlock_Visibility))
+ If bValue Then SetUserShouldEditValueNow()
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "GeomEntityDoubleClick"
+
+ Public ReadOnly Property GeomEntityDoubleClick_Command As ICommand
+ Get
+ If m_cmdGeomEntityDoubleClick Is Nothing Then
+ m_cmdGeomEntityDoubleClick = New Command(AddressOf GeomEntityDoubleClick)
+ End If
+ Return m_cmdGeomEntityDoubleClick
+ End Get
+ End Property
+
+ Public Sub GeomEntityDoubleClick()
+ If Not IsNothing(Map.refManagePartPanelVM.SelManagerLayer) Then
+ Map.refManagePartPanelVM.ImportedEntityList.Remove(Me)
+ ' aggiorno riferimenti layer e context menu
+ UpdateOrigLayer(Map.refManagePartPanelVM.SelManagerLayer)
+ UpdateContextMenu()
+ Map.refManagePartPanelVM.SelManagerLayer.EntityList.Add(Me)
+ End If
+ End Sub
+
+#End Region ' ImportedEntity
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class ManagePart_Part
+ Inherits VMBase
+
+ Private m_bIsSelected As Boolean
+ Public Property bIsSelected As Boolean
+ Get
+ Return m_bIsSelected
+ End Get
+ Set(value As Boolean)
+ m_bIsSelected = value
+ Map.refManagePartPanelVM.SetSelManagerPart(Me)
+ End Set
+ End Property
+
+ Private m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_PrintPart As Print3dPartVM
+ Public ReadOnly Property PrintPart As Print3dPartVM
+ Get
+ Return m_PrintPart
+ End Get
+ End Property
+
+ Private m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ SetTextBoxVisibility(False)
+ NotifyPropertyChanged(NameOf(sName))
+ If Map.refManagePartPanelVM.Type = ManagePartPanelVM.ManagePartType.MODIFY Then
+ m_PrintPart.UpdateName(value)
+ EgtSetInfo(m_PrintPart.nPartId, PART_NAME, value)
+ End If
+ Map.refManagePartPanelVM.SetIsEnabled(True)
+ End Set
+ End Property
+
+ Private m_MenuList As New List(Of ManagerPart_MenuItem)
+ Public Property MenuList As List(Of ManagerPart_MenuItem)
+ Get
+ Return m_MenuList
+ End Get
+ Set(value As List(Of ManagerPart_MenuItem))
+ m_MenuList = value
+ End Set
+ End Property
+
+ Private m_LayerList As New ObservableCollection(Of ManagePart_Layer)
+ Public ReadOnly Property LayerList As ObservableCollection(Of ManagePart_Layer)
+ Get
+ Return m_LayerList
+ End Get
+ End Property
+
+ 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
+
+ Private m_TextBox_Visibility As Visibility = Visibility.Collapsed
+ Public ReadOnly Property TextBox_Visibility As Visibility
+ Get
+ Return m_TextBox_Visibility
+ End Get
+ End Property
+
+ Private m_TextBlock_Visibility As Visibility = Visibility.Visible
+ Public ReadOnly Property TextBlock_Visibility As Visibility
+ Get
+ Return m_TextBlock_Visibility
+ End Get
+ End Property
+
+ Sub New(PrintPart As Print3dPartVM)
+ m_PrintPart = PrintPart
+ 'NotifyPropertyChanged(NameOf(sName))
+ If Map.refManagePartPanelVM.ManagerPartList.Count = 0 Then
+ m_nId = 1
+ Else
+ m_nId = Map.refManagePartPanelVM.ManagerPartList.Max(Function(x) x.nId) + 1
+ End If
+ If Not IsNothing(PrintPart) Then
+ m_sName = m_PrintPart.sName
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.PRINT_SOLID, "Print", PrintPart))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.MACH_START, "Layer Start", PrintPart))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.RIBS, "Ribs", PrintPart))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, "Reduce Shell Number", PrintPart))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, "Filled Solids", PrintPart))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.OTHERS, "Others", PrintPart))
+ Else
+ m_sName = "Part" & m_nId
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.PRINT_SOLID, "Print"))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.MACH_START, "Layer Start"))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.RIBS, "Ribs"))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.SHELL_NUMBER, "Reduce Shell Number"))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.AUX_SOLIDS, "Filled Solids"))
+ m_LayerList.Add(New ManagePart_Layer(Me, ManagePart_Layer.LayerType.OTHERS, "Others"))
+ End If
+ ' creo context menu per cambio nome ed eliminazione
+ m_MenuList.Add(New ManagerPart_MenuItem(Me, ManagerPart_MenuItem.PartMenuCmd.CHANGENAME))
+ m_MenuList.Add(New ManagerPart_MenuItem(Me, ManagerPart_MenuItem.PartMenuCmd.DELETE))
+ End Sub
+
+ Friend Sub SetTextBoxVisibility(bValue As Boolean)
+ m_TextBox_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
+ m_TextBlock_Visibility = If(Not bValue, Visibility.Visible, Visibility.Collapsed)
+ NotifyPropertyChanged(NameOf(TextBox_Visibility))
+ NotifyPropertyChanged(NameOf(TextBlock_Visibility))
+ If bValue Then SetUserShouldEditValueNow()
+ End Sub
+
+End Class
+
+Public Class ManagePart_Layer
+ Inherits VMBase
+
+ Public Enum LayerType As Integer
+ PRINT_SOLID = 1
+ MACH_START = 2
+ RIBS = 3
+ SHELL_NUMBER = 4
+ AUX_SOLIDS = 5
+ OTHERS = 7
+ CHANGENAME = 15
+ DELETE = 16
+ NEWPART = 17
+ End Enum
+
+ ' enita' di origine
+ Private m_OrigPart As ManagePart_Part
+ Public ReadOnly Property OrigPart As ManagePart_Part
+ Get
+ Return m_OrigPart
+ End Get
+ End Property
+
+ Private m_nLayerId As Integer
+
+ Private m_bIsSelected As Boolean
+ Public Property bIsSelected As Boolean
+ Get
+ Return m_bIsSelected
+ End Get
+ Set(value As Boolean)
+ m_bIsSelected = value
+ Map.refManagePartPanelVM.SetSelManagerLayer(Me)
+ End Set
+ End Property
+
+ Private m_Type As LayerType
+ Public Property Type As LayerType
+ Get
+ Return m_Type
+ End Get
+ Set(value As LayerType)
+ m_Type = value
+ End Set
+ End Property
+
+ Private m_sName As String
+ Public Property sName As String
+ Get
+ Return m_sName
+ End Get
+ Set(value As String)
+ m_sName = value
+ End Set
+ End Property
+
+ Private m_EntityList As New ObservableCollection(Of PartManager_GeomEntity)
+ Public Property EntityList As ObservableCollection(Of PartManager_GeomEntity)
+ Get
+ Return m_EntityList
+ End Get
+ Set(value As ObservableCollection(Of PartManager_GeomEntity))
+ m_EntityList = value
+ End Set
+ End Property
+
+ Sub New(OrigPart As ManagePart_Part, Type As LayerType, sName As String)
+ m_OrigPart = OrigPart
+ m_Type = Type
+ m_sName = sName
+ End Sub
+
+ Sub New(OrigPart As ManagePart_Part, Type As LayerType, sName As String, PrintPart As Print3dPartVM)
+ m_OrigPart = OrigPart
+ m_Type = Type
+ m_sName = sName
+ Select Case Type
+ Case LayerType.PRINT_SOLID
+ m_nLayerId = PrintPart.nPrintSolidLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ If nEntityId <> GDB_ID.NULL Then
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ End If
+ Case LayerType.MACH_START
+ m_nLayerId = PrintPart.nMachStartLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ While nEntityId <> GDB_ID.NULL
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ nEntityId = EgtGetNext(nEntityId)
+ End While
+ Case LayerType.RIBS
+ m_nLayerId = PrintPart.nRibsLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ While nEntityId <> GDB_ID.NULL
+ Dim RibType As Integer = RibEntity.RibTypes.FROMDRAW
+ EgtGetInfo(nEntityId, KEY_RIB_TYPE, RibType)
+ If RibType = RibEntity.RibTypes.FROMIMPORT Then
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ End If
+ nEntityId = EgtGetNext(nEntityId)
+ End While
+ Case LayerType.SHELL_NUMBER
+ m_nLayerId = PrintPart.nShellNumberLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ While nEntityId <> GDB_ID.NULL
+ Dim ShellType As Integer = ShellNumberEntity.ShellNumberTypes.FROMDRAW
+ EgtGetInfo(nEntityId, KEY_SHELLNBR_TYPE, ShellType)
+ If ShellType = ShellNumberEntity.ShellNumberTypes.FROMIMPORT Then
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ End If
+ nEntityId = EgtGetNext(nEntityId)
+ End While
+ Case LayerType.AUX_SOLIDS
+ m_nLayerId = PrintPart.nAuxSolidsLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ While nEntityId <> GDB_ID.NULL
+ 'Dim ShellType As Integer = ShellNumberEntity.ShellNumberTypes.FROMDRAW
+ 'EgtGetInfo(nEntityId, KEY_SHELLNBR_TYPE, ShellType)
+ 'If ShellType = ShellNumberEntity.ShellNumberTypes.FROMIMPORT Then
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ 'End If
+ nEntityId = EgtGetNext(nEntityId)
+ End While
+ Case LayerType.OTHERS
+ m_nLayerId = PrintPart.nOthersLayerId
+ Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
+ While nEntityId <> GDB_ID.NULL
+ m_EntityList.Add(New PartManager_GeomEntity(Me, nEntityId))
+ nEntityId = EgtGetNext(nEntityId)
+ End While
+ End Select
+ End Sub
+
+End Class
+
+Public Class GeomEntity_MenuItem
+ Inherits VMBase
+
+ ' enita' di origine
+ Private m_OrigEntity As PartManager_GeomEntity
+
+ ' pezzo in cui spostare
+ Private m_GeomPart As Print3dPartVM
+ Private m_Part As ManagePart_Part
+
+ ' tipo del layer indicato
+ Private m_Type As ManagePart_Layer.LayerType
+ Public Property Type As ManagePart_Layer.LayerType
+ Get
+ Return m_Type
+ End Get
+ Set(value As ManagePart_Layer.LayerType)
+ m_Type = value
+ End Set
+ End Property
+
+ Public ReadOnly Property sMsg As String
+ Get
+ Dim sType As String = ""
+ Select Case m_Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ sType = "Print"
+ Case ManagePart_Layer.LayerType.MACH_START
+ sType = "Layer Start"
+ Case ManagePart_Layer.LayerType.RIBS
+ sType = "Ribs"
+ Case ManagePart_Layer.LayerType.SHELL_NUMBER
+ sType = "Reduce shell number"
+ Case ManagePart_Layer.LayerType.AUX_SOLIDS
+ sType = "Filled Solids"
+ Case ManagePart_Layer.LayerType.OTHERS
+ sType = "Others"
+ Case ManagePart_Layer.LayerType.NEWPART
+ Return "Create New Part"
+ Case ManagePart_Layer.LayerType.CHANGENAME
+ Return "Change Name"
+ Case ManagePart_Layer.LayerType.DELETE
+ Return "Delete Entity"
+ End Select
+ Dim PartName As String = ""
+ If Map.refManagePartPanelVM.ManagerPartList.Count > 1 Then
+ Dim NewPart As ManagePart_Part = Nothing
+ Select Case Map.refManagePartPanelVM.Type
+ Case ManagePartPanelVM.ManagePartType.IMPORT
+ NewPart = Map.refManagePartPanelVM.ManagerPartList.FirstOrDefault(Function(x) x Is m_Part)
+ Case ManagePartPanelVM.ManagePartType.MODIFY
+ NewPart = Map.refManagePartPanelVM.ManagerPartList.FirstOrDefault(Function(x) x.PrintPart.nPartId = m_GeomPart.nPartId)
+ End Select
+ If Not IsNothing(NewPart) Then
+ PartName = " (" & NewPart.sName & ")"
+ End If
+ End If
+ Return "Move to " & sType & PartName
+ End Get
+ End Property
+
+ ' Definizione comando
+ Private m_cmdCommand As ICommand
+
+ Sub New(OrigEntity As PartManager_GeomEntity, Type As ManagePart_Layer.LayerType, GeomPart As Print3dPartVM)
+ m_OrigEntity = OrigEntity
+ m_Type = Type
+ m_GeomPart = GeomPart
+ End Sub
+
+ Sub New(OrigEntity As PartManager_GeomEntity, Type As ManagePart_Layer.LayerType, Part As ManagePart_Part)
+ m_OrigEntity = OrigEntity
+ m_Type = Type
+ m_Part = Part
+ End Sub
+
+ Sub New(OrigEntity As PartManager_GeomEntity, Type As ManagePart_Layer.LayerType)
+ m_OrigEntity = OrigEntity
+ m_Type = Type
+ End Sub
+
+#Region "Command"
+
+ Public ReadOnly Property MenuItem_Command As ICommand
+ Get
+ If m_cmdCommand Is Nothing Then
+ m_cmdCommand = New Command(AddressOf Command)
+ End If
+ Return m_cmdCommand
+ End Get
+ End Property
+
+ Public Sub Command()
+ If m_Type = ManagePart_Layer.LayerType.CHANGENAME Then
+ m_OrigEntity.SetTextBoxVisibility(True)
+ Map.refManagePartPanelVM.SetIsEnabled(True)
+ Return
+ ElseIf m_Type = ManagePart_Layer.LayerType.DELETE Then
+ If MessageBox.Show("Are you sure you want to delete this entity?", "Delete confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
+ EgtErase(m_OrigEntity.nId)
+ ' se l'entita' e' gia' in lista pezzi
+ If Not IsNothing(m_OrigEntity.OrigLayer) Then
+ ' elimino dalla lista pezzi
+ m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
+ Else
+ ' altrimenti lo elimino dalla lista entita' importate
+ Map.refManagePartPanelVM.ImportedEntityList.Remove(m_OrigEntity)
+ End If
+ EgtDraw()
+ End If
+ Return
+ ElseIf m_Type = ManagePart_Layer.LayerType.NEWPART Then
+ Select Case Map.refManagePartPanelVM.Type
+ Case ManagePartPanelVM.ManagePartType.IMPORT
+ Dim NewPart As ManagePart_Part = New ManagePart_Part(Nothing)
+ Map.refManagePartPanelVM.ManagerPartList.Add(NewPart)
+ ' elimino entity dalla lista entita' importate
+ Map.refManagePartPanelVM.ImportedEntityList.Remove(m_OrigEntity)
+ If Not IsNothing(NewPart) Then
+ Dim NewLayer As ManagePart_Layer = NewPart.LayerList.FirstOrDefault(Function(x) x.Type = ManagePart_Layer.LayerType.PRINT_SOLID)
+ If Not IsNothing(NewLayer) Then
+ NewLayer.EntityList.Add(m_OrigEntity)
+ ' aggiorno riferimenti nell'entita'
+ m_OrigEntity.UpdateOrigLayer(NewLayer)
+ End If
+ End If
+ ' aggiorno i contextmenu di tutti gli entity
+ Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
+ Case ManagePartPanelVM.ManagePartType.MODIFY
+ ' recupero path da vecchio pezzo
+ Dim sFilePath As String = ""
+ EgtGetInfo(m_OrigEntity.OrigLayer.OrigPart.PrintPart.nPartId, FILE_PATH, sFilePath)
+ 'Dim frImportedPart As New Frame3d
+ 'EgtGetGroupGlobFrame(m_nImportedPartId, frImportedPart)
+ ' creo pezzo
+ Dim nPartId As Integer = EgtCreateGroup(GDB_ID.ROOT) ', frImportedPart)
+ EgtSetName(nPartId, PART)
+ Dim nFrameId As Integer = GDB_ID.NULL
+ Dim b3PrintSolid As New BBox3d
+ ' creo layer solido di stampa
+ Dim nPrintPartLayerId As Integer = EgtCreateGroup(nPartId)
+ EgtSetName(nPrintPartLayerId, PRINT_SOLID)
+ 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)
+ 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)
+ ' creo layer shell number
+ Dim nShellNumberLayerId As Integer = EgtCreateGroup(nPartId)
+ EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
+ ' creo layer aux
+ Dim nAuxSolidsLayerId As Integer = EgtCreateGroup(nPartId)
+ EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
+ ' creo layer others
+ Dim nOthersLayerId As Integer = EgtCreateGroup(nPartId)
+ EgtSetName(nOthersLayerId, LAY_OTHERS)
+ ' 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))
+ ' lo aggiungo a lista pezzi
+ EgtSetInfo(nPartId, FILE_PATH, sFilePath)
+ EgtSetInfo(nPartId, "PartOnTable", 1)
+ Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
+ Map.refTopPanelVM.PartList.Add(NewPart)
+ Dim ManagePart_Part As ManagePart_Part = New ManagePart_Part(NewPart)
+ ' elimino da posizione originale
+ m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
+ 'Dim bUpdateAllContextMenu As Boolean = False
+ 'Dim NewLayer As ManagePart_Layer = ManagePart_Part.LayerList.FirstOrDefault(Function(x) x.Type = ManagePart_Layer.LayerType.PRINT_SOLID)
+ 'If Not IsNothing(NewLayer) Then
+ ' NewLayer.EntityList.Add(m_OrigEntity)
+ ' ' aggiorno riferimenti nell'entita'
+ ' m_OrigEntity.UpdateOrigLayer(NewLayer)
+ 'End If
+ EgtSetInfo(nPartId, PART_NAME, ManagePart_Part.sName)
+ ' lo aggiungo a lista
+ Map.refManagePartPanelVM.ManagerPartList.Add(ManagePart_Part)
+ ' aggiorno riferimenti nel context menu item
+ Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
+ End Select
+ Return
+ End If
+ Select Case Map.refManagePartPanelVM.Type
+ Case ManagePartPanelVM.ManagePartType.IMPORT
+ ' se l'entita' e' gia' in lista pezzi
+ If Not IsNothing(m_OrigEntity.OrigLayer) Then
+ ' elimino dalla lista pezzi
+ m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
+ Else
+ ' altrimenti lo elimino dalla lista entita' importate
+ Map.refManagePartPanelVM.ImportedEntityList.Remove(m_OrigEntity)
+ End If
+ Dim NewPart As ManagePart_Part = Map.refManagePartPanelVM.ManagerPartList.FirstOrDefault(Function(x) x Is m_Part)
+ If Not IsNothing(NewPart) Then
+ Dim NewLayer As ManagePart_Layer = NewPart.LayerList.FirstOrDefault(Function(x) x.Type = m_Type)
+ If Not IsNothing(NewLayer) Then
+ NewLayer.EntityList.Add(m_OrigEntity)
+ ' aggiorno riferimenti nell'entita'
+ m_OrigEntity.UpdateOrigLayer(NewLayer)
+ End If
+ End If
+ ' aggiorno riferimenti nel context menu item
+ m_OrigEntity.UpdateContextMenu()
+ Case ManagePartPanelVM.ManagePartType.MODIFY
+ ' recupero layer da pezzo
+ Dim nLayerId As Integer = GDB_ID.NULL
+ Select Case m_Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ nLayerId = m_GeomPart.nPrintSolidLayerId
+ Case ManagePart_Layer.LayerType.MACH_START
+ nLayerId = m_GeomPart.nMachStartLayerId
+ Case ManagePart_Layer.LayerType.RIBS
+ nLayerId = m_GeomPart.nRibsLayerId
+ Case ManagePart_Layer.LayerType.SHELL_NUMBER
+ nLayerId = m_GeomPart.nShellNumberLayerId
+ Case ManagePart_Layer.LayerType.AUX_SOLIDS
+ nLayerId = m_GeomPart.nAuxSolidsLayerId
+ Case ManagePart_Layer.LayerType.OTHERS
+ nLayerId = m_GeomPart.nOthersLayerId
+ End Select
+ ' sposto entita'
+ If EgtRelocateGlob(m_OrigEntity.nId, nLayerId) Then
+ ' elimino info vecchio layer
+ Select Case m_OrigEntity.OrigLayer.Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ EgtResetMark(m_OrigEntity.nId)
+ Case ManagePart_Layer.LayerType.MACH_START
+ Case ManagePart_Layer.LayerType.RIBS
+ EgtRemoveInfo(m_OrigEntity.nId, KEY_RIB_TYPE)
+ Case ManagePart_Layer.LayerType.SHELL_NUMBER
+ EgtRemoveInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE)
+ Case ManagePart_Layer.LayerType.AUX_SOLIDS
+ EgtRemoveInfo(m_OrigEntity.nId, KEY_AUXSOLID_TYPE)
+ Case ManagePart_Layer.LayerType.OTHERS
+ End Select
+ ' sposto in lista
+ m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
+ Dim bUpdateAllContextMenu As Boolean = False
+ Dim NewPart As ManagePart_Part = Map.refManagePartPanelVM.ManagerPartList.FirstOrDefault(Function(x) x.PrintPart.nPartId = m_GeomPart.nPartId)
+ If Not IsNothing(NewPart) Then
+ Dim NewLayer As ManagePart_Layer = NewPart.LayerList.FirstOrDefault(Function(x) x.Type = m_Type)
+ If Not IsNothing(NewLayer) Then
+ NewLayer.EntityList.Add(m_OrigEntity)
+ bUpdateAllContextMenu = (m_OrigEntity.OrigLayer.Type = ManagePart_Layer.LayerType.PRINT_SOLID) OrElse (NewLayer.Type = ManagePart_Layer.LayerType.PRINT_SOLID)
+ ' aggiorno riferimenti nell'entita'
+ m_OrigEntity.UpdateOrigLayer(NewLayer)
+ End If
+ End If
+ ' aggiungo info nuovo layer
+ Select Case m_Type
+ Case ManagePart_Layer.LayerType.PRINT_SOLID
+ EgtSetName(m_OrigEntity.nId, PRINT_SOLID)
+ EgtSetColor(m_OrigEntity.nId, c3Print)
+ 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)
+ EgtSetColor(m_OrigEntity.nId, c3Rib)
+ Case ManagePart_Layer.LayerType.SHELL_NUMBER
+ EgtSetName(m_OrigEntity.nId, LAY_SHELL_NBR)
+ EgtSetInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
+ EgtSetColor(m_OrigEntity.nId, c3ShellNumber)
+ Case ManagePart_Layer.LayerType.AUX_SOLIDS
+ EgtSetName(m_OrigEntity.nId, LAY_AUX_SOLIDS)
+ EgtSetInfo(m_OrigEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
+ EgtSetColor(m_OrigEntity.nId, c3AuxSolids)
+ Case ManagePart_Layer.LayerType.OTHERS
+ EgtSetName(m_OrigEntity.nId, LAY_OTHERS)
+ EgtSetColor(m_OrigEntity.nId, c3Others)
+ End Select
+ EgtDraw()
+ ' aggiorno riferimenti nel context menu item
+ If bUpdateAllContextMenu Then
+ Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
+ Else
+ m_OrigEntity.UpdateContextMenu()
+ End If
+ End If
+ End Select
+ End Sub
+
+#End Region ' Command
+
+End Class
+
+Public Class ManagerPart_MenuItem
+ Inherits VMBase
+
+ Public Enum PartMenuCmd
+ CHANGENAME = 1
+ DELETE = 2
+ End Enum
+
+ Private m_OrigPart As ManagePart_Part
+
+ ' tipo del comando
+ Private m_Type As PartMenuCmd
+ Public Property Type As PartMenuCmd
+ Get
+ Return m_Type
+ End Get
+ Set(value As PartMenuCmd)
+ m_Type = value
+ End Set
+ End Property
+
+ Public ReadOnly Property sMsg As String
+ Get
+ Select Case m_Type
+ Case PartMenuCmd.CHANGENAME
+ Return "Change Name"
+ Case Else ' PartMenuCmd.DELETE
+ Return "Delete Part"
+ End Select
+ End Get
+ End Property
+
+ ' Definizione comando
+ Private m_cmdCommand As ICommand
+
+ Sub New(OrigPart As ManagePart_Part, Type As PartMenuCmd)
+ m_OrigPart = OrigPart
+ m_Type = Type
+ End Sub
+
+#Region "Cancel"
+
+ Public ReadOnly Property MenuItem_Command As ICommand
+ Get
+ If m_cmdCommand Is Nothing Then
+ m_cmdCommand = New Command(AddressOf Command)
+ End If
+ Return m_cmdCommand
+ End Get
+ End Property
+
+ Public Sub Command()
+ Select Case m_Type
+ Case PartMenuCmd.CHANGENAME
+ m_OrigPart.SetTextBoxVisibility(True)
+ Map.refManagePartPanelVM.SetIsEnabled(True)
+ Case PartMenuCmd.DELETE
+ If Map.refManagePartPanelVM.ManagerPartList.Count <= 1 Then Return
+ Select Case Map.refManagePartPanelVM.Type
+ Case ManagePartPanelVM.ManagePartType.IMPORT
+ For Each Layer In m_OrigPart.LayerList
+ For Each Entity In Layer.EntityList
+ ' le rimuovo da lista entita' pezzo
+ Layer.EntityList.Remove(Entity)
+ ' la rimetto in lista importati
+ Map.refManagePartPanelVM.ImportedEntityList.Add(Entity)
+ Next
+ Next
+ ' elimino pezzo da lista
+ Map.refManagePartPanelVM.ManagerPartList.Remove(m_OrigPart)
+ Case ManagePartPanelVM.ManagePartType.MODIFY
+ ' elimino pezzo geometrico
+ EgtErase(m_OrigPart.PrintPart.nPartId)
+ ' elimino pezzo da lista
+ Map.refManagePartPanelVM.ManagerPartList.Remove(m_OrigPart)
+ Dim bSelFirstPart As Boolean = m_OrigPart.PrintPart.nPartId = Map.refTopPanelVM.SelPart.nPartId
+ ' elimino pezzo da lista Top
+ Map.refTopPanelVM.PartList.Remove(m_OrigPart.PrintPart)
+ EgtDraw()
+ If bSelFirstPart Then Map.refTopPanelVM.SelFirstPart()
+ End Select
+ ' aggiorno riferimenti nel context menu item
+ Map.refManagePartPanelVM.UpdateAllEntityContextMenu()
+ End Select
+ End Sub
+
+#End Region ' Cancel
+
+End Class
\ No newline at end of file
diff --git a/Icarus/ProjManager/ProjManagerVM.vb b/Icarus/ProjManager/ProjManagerVM.vb
index 763f004..586b999 100644
--- a/Icarus/ProjManager/ProjManagerVM.vb
+++ b/Icarus/ProjManager/ProjManagerVM.vb
@@ -162,6 +162,9 @@ Public Class ProjManagerVM
End Sub
Friend Sub NewProject(bDialog As Boolean)
+ ' Gestisco eventuale file corrente modificato
+ If Not Map.refSceneHostVM.MainController.ManageModified() Then Return
+ EgtResetModified()
Dim NewProjMachine As Machine
If bDialog AndAlso Map.refMachinePanelVM.MachineList.Count > 0 Then
Dim ChooseMachineWndVM As New ChooseMachineWndVM
diff --git a/Icarus/SceneHost/MySceneHostVM.vb b/Icarus/SceneHost/MySceneHostVM.vb
index 309ac0b..ee15c7e 100644
--- a/Icarus/SceneHost/MySceneHostVM.vb
+++ b/Icarus/SceneHost/MySceneHostVM.vb
@@ -309,6 +309,7 @@ Public Class MySceneHostVM
sDir = Path.GetDirectoryName(sDir)
End If
If Not Directory.Exists(sDir) Then sDir = ""
+ Dim ExtIndex As Integer = GetMainPrivateProfileInt(S_PRINTING3D, K_IMPORTCURREXTENSION, 1)
Dim OpenFileDialog As New OpenFileDialog With {.Title = "Insert",
.Filter = "Stereolithography (*.stl)|*.stl" &
"|Iges files (*.igs;*.iges)|*.igs;*.iges" &
@@ -316,11 +317,12 @@ Public Class MySceneHostVM
"|3D Manufacturing format (*.3mf)|*.3mf" &
"|New geometry EgalTech(*.nge)|*.nge" &
"|All Files (*.*)|*.*",
- .FilterIndex = 1,
+ .FilterIndex = ExtIndex,
.InitialDirectory = sDir}
If Not OpenFileDialog.ShowDialog Then
Return
End If
+ WriteMainPrivateProfileString(S_PRINTING3D, K_IMPORTCURREXTENSION, OpenFileDialog.FilterIndex)
Dim sFile As String = String.Empty
sFile = OpenFileDialog.FileName
' importo la nuova geometria
@@ -898,7 +900,7 @@ Public Class MySceneHostVM
ProjectMaterial = Map.refTopPanelVM.MaterialList.FirstOrDefault(Function(x) x.sName = sMaterialName)
End If
If Not IsNothing(ProjectMaterial) Then
- Map.refTopPanelVM.SelMaterial = ProjectMaterial
+ Map.refTopPanelVM.SetSelMaterial(ProjectMaterial, True)
Map.refTopPanelVM.NotifyPropertyChanged(NameOf(Map.refTopPanelVM.SelMaterial))
End If
End If
@@ -914,7 +916,6 @@ Public Class MySceneHostVM
End If
Dim nPrintPartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, PRINT_SOLID)
Dim nPrintPartId As Integer = EgtGetFirstInGroup(nPrintPartLayerId)
- Dim nOriginalPartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, ORIGINAL_SOLID)
Dim nRibsLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_RIBS)
Dim nShellNumberLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_SHELL_NBR)
Dim nAuxSolidsLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_AUX_SOLIDS)
@@ -924,7 +925,7 @@ Public Class MySceneHostVM
EgtGetInfo(nPartId, FILE_PATH, sFilePath)
Dim nReferenceLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_REFERENCE)
Dim nFrameId As Integer = EgtGetFirstInGroup(nReferenceLayerId)
- Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nPrintPartId, nOriginalPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
+ Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
Dim bPartToRecalc As Boolean = False
EgtGetInfo(nPartId, MAC_TORECALC_SLICE, bPartToRecalc)
@@ -1175,7 +1176,7 @@ Public Class MySceneHostVM
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
- If nPartId = Map.refImportPanelVM.nImportedPartId Then
+ If nPartId = Map.refManagePartPanelVM.nImportedPartId Then
Dim EntityType As GDB_TY = EgtGetType(nId)
Select Case EntityType
Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_COMPO, GDB_TY.CRV_LINE
@@ -1225,7 +1226,7 @@ Public Class MySceneHostVM
If Not m_bDragToStart Then
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
- Map.refImportPanelVM.SetSelImportedEntity(m_nIdToSel)
+ Map.refManagePartPanelVM.SetSelImportedEntity(m_nIdToSel)
End If
' Reset
m_bDrag = False
diff --git a/Icarus/SecondaryWindow/SecondaryWindowV.xaml.vb b/Icarus/SecondaryWindow/SecondaryWindowV.xaml.vb
index 47bec95..270cbb7 100644
--- a/Icarus/SecondaryWindow/SecondaryWindowV.xaml.vb
+++ b/Icarus/SecondaryWindow/SecondaryWindowV.xaml.vb
@@ -4,6 +4,12 @@ Imports EgtUILib
Public Class SecondaryWindowV
Private m_SecondaryWindowVM As SecondaryWindowVM
+ Private m_WindowChangingState As Boolean = False
+ Public ReadOnly Property WindowChangingState As Boolean
+ Get
+ Return m_WindowChangingState
+ End Get
+ End Property
#Region "CONSTRUCTOR"
@@ -55,9 +61,11 @@ Public Class SecondaryWindowV
End Sub
Private Sub SecondaryWindowV_StateChanged(sender As Object, e As EventArgs)
+ m_WindowChangingState = True
Application.Current.MainWindow.WindowState = Me.WindowState
Application.Current.MainWindow.Topmost = True
Application.Current.MainWindow.Topmost = False
+ m_WindowChangingState = False
End Sub
#End Region ' CONSTRUCTOR
diff --git a/Icarus/TopPanel/TopPanelV.xaml b/Icarus/TopPanel/TopPanelV.xaml
index afc3bc8..8bf3f33 100644
--- a/Icarus/TopPanel/TopPanelV.xaml
+++ b/Icarus/TopPanel/TopPanelV.xaml
@@ -36,7 +36,7 @@
Grid.Row="1"
ItemsSource="{Binding PartList}"
SelectedItem="{Binding SelPart}"
- DisplayMemberPath="sImportedFileName"
+ DisplayMemberPath="sName"
FontSize="14"
FontFamily="/Resources/Fonts/#Roboto"
FontWeight="Light"
diff --git a/Icarus/TopPanel/TopPanelVM.vb b/Icarus/TopPanel/TopPanelVM.vb
index 9ac54cc..9871554 100644
--- a/Icarus/TopPanel/TopPanelVM.vb
+++ b/Icarus/TopPanel/TopPanelVM.vb
@@ -205,7 +205,7 @@ Public Class TopPanelVM
Set(value As MaterialIndex)
' salvo materiale selezionato come ultimo utilizzato
If Not IsNothing(value) Then WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, value.sGUID)
- ' salvo lavorazione selezionata per riselezionarlo
+ ' salvo lavorazione selezionata per riselezionarla
Dim PrevMachiningGuid As Guid = Guid.Empty
If Not IsNothing(m_SelMachining) Then PrevMachiningGuid = m_SelMachining.sGUID
' seleziono materiale
@@ -224,9 +224,18 @@ Public Class TopPanelVM
SetSelMachining(If(Not IsNothing(PrevMachining), PrevMachining, MachiningIndex.Empty()))
End Set
End Property
- Friend Sub SetSelMaterial(value As MaterialIndex)
+ Friend Sub SetSelMaterial(value As MaterialIndex, Optional bUpdateMaterialList As Boolean = False)
m_SelMaterial = value
NotifyPropertyChanged(NameOf(SelMaterial))
+ If bUpdateMaterialList Then
+ ' salvo lavorazione selezionata per riselezionarla
+ Dim PrevMachiningGuid As Guid = Guid.Empty
+ If Not IsNothing(m_SelMachining) Then PrevMachiningGuid = m_SelMachining.sGUID
+ ' ricarico lista lavorazioni valide per il materiale selezionato
+ InitMachiningsList()
+ Dim PrevMachining As MachiningIndex = m_MachiningList.FirstOrDefault(Function(x) x.sGUID = PrevMachiningGuid)
+ SetSelMachining(If(Not IsNothing(PrevMachining), PrevMachining, MachiningIndex.Empty()))
+ End If
End Sub
#End Region ' Material
@@ -394,11 +403,25 @@ Public Class TopPanelVM
#Region "Pages"
Private Sub InitIMPORT()
+ ' disabilito ProjManager, TopPanel, TFS, Slider, bottoni e uscita dal programma
+ Map.refProjManagerVM.SetProjCmdIsEnabled(False)
+ Map.refTopPanelVM.SetTopPanelIsEnabled(False)
+ Map.refSliceManagerVM.SetButtonsIsEnabled(False)
+ Map.refSliderManagerVM.SetLayerIndexIsEnabled(False)
+ Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(False)
+ ' imposto pagina
Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.IMPORT)
- Map.refImportPanelVM.Init()
+ ''Map.refImportPanelVM.Init()
+ Map.refManagePartPanelVM.Init(ManagePartPanelVM.ManagePartType.IMPORT)
End Sub
Private Function ExitIMPORT()
+ ' riabilito ProjManager, TopPanel, TFS, Slider, bottoni e uscita dal programma
+ Map.refProjManagerVM.SetProjCmdIsEnabled(True)
+ Map.refTopPanelVM.SetTopPanelIsEnabled(True)
+ Map.refSliceManagerVM.SetButtonsIsEnabled(True)
+ Map.refSliderManagerVM.SetLayerIndexIsEnabled(True)
+ Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(True)
Return True
End Function
@@ -510,11 +533,31 @@ Public Class TopPanelVM
End Function
Private Sub InitMODIFYPART()
+ ' disabilito ProjManager, TopPanel, TFS, Slider, bottoni e uscita dal programma
+ Map.refProjManagerVM.SetProjCmdIsEnabled(False)
+ Map.refTopPanelVM.SetTopPanelIsEnabled(False)
+ Map.refSliceManagerVM.SetButtonsIsEnabled(False)
+ Map.refSliderManagerVM.SetLayerIndexIsEnabled(False)
+ Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(False)
+ ' 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
Private Function ExitMODIFYPART()
-
+ ' riabilito ProjManager, TopPanel, TFS, Slider, bottoni e uscita dal programma
+ Map.refProjManagerVM.SetProjCmdIsEnabled(True)
+ Map.refTopPanelVM.SetTopPanelIsEnabled(True)
+ Map.refSliceManagerVM.SetButtonsIsEnabled(True)
+ Map.refSliderManagerVM.SetLayerIndexIsEnabled(True)
+ Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(True)
+ ' ripristino mark su pezzo selezionato
+ If Not IsNothing(SelPart) Then
+ EgtSetMark(SelPart.nPrintSolidId)
+ End If
Return True
End Function
@@ -530,8 +573,8 @@ Public Class TopPanelVM
' rinomino pezzo e layer
Dim nPartId As Integer = EgtGetLastPart()
EgtSetName(nPartId, PART)
- Dim nLayerId As Integer = EgtGetFirstInGroup(nPartId)
- EgtSetName(nLayerId, ORIGINAL_SOLID)
+ 'Dim nLayerId As Integer = EgtGetFirstInGroup(nPartId)
+ 'EgtSetName(nLayerId, ORIGINAL_SOLID)
'' Recupero o creo layer ausiliario
'Dim nAuxId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_AUX)
diff --git a/Icarus/Utility/Dictionary.xaml b/Icarus/Utility/Dictionary.xaml
index 24d00a2..681b201 100644
--- a/Icarus/Utility/Dictionary.xaml
+++ b/Icarus/Utility/Dictionary.xaml
@@ -29,7 +29,7 @@
-
+
@@ -44,7 +44,8 @@
-
+
+