530 lines
24 KiB
VB.net
530 lines
24 KiB
VB.net
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")
|
|
EgtMessageBoxV.Show(Application.Current.MainWindow, 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)
|
|
EgtSetColor(nPrintPartLayerId, GeomEntityColors.c3Print)
|
|
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)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PrintSolidEntity.nId)
|
|
EgtSetStatus(PrintSolidEntity.nId, GDB_ST.ON_)
|
|
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)
|
|
EgtSetColor(nMachStartLayerId, GeomEntityColors.c3MachStart)
|
|
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)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(nMachStartId)
|
|
EgtSetStatus(nMachStartId, GDB_ST.ON_)
|
|
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)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(nMachStartId)
|
|
EgtSetStatus(nMachStartId, GDB_ST.ON_)
|
|
End If
|
|
Case ManagePart_Layer.LayerType.RIBS
|
|
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' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
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)
|
|
EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
|
|
EgtSetColor(nShellNumberLayerId, GeomEntityColors.c3ShellNumber)
|
|
Dim nShellNumberIndex As Integer = 1
|
|
For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
|
|
EgtSetInfo(PartManager_GeomEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
|
|
EgtSetInfo(PartManager_GeomEntity.nId, SHELLNUMBER_ID, nShellNumberIndex)
|
|
EgtRelocateGlob(PartManager_GeomEntity.nId, nShellNumberLayerId, GDB_POS.LAST_SON)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
|
|
EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
|
|
End If
|
|
nShellNumberIndex += 1
|
|
Next
|
|
Case ManagePart_Layer.LayerType.AUX_SOLIDS
|
|
nAuxSolidsLayerId = EgtCreateGroup(nPartId)
|
|
EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
|
|
EgtSetColor(nAuxSolidsLayerId, GeomEntityColors.c3AuxSolids)
|
|
Dim nFilledSolidIndex As Integer = 1
|
|
For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
|
|
EgtSetInfo(PartManager_GeomEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
|
|
EgtSetInfo(PartManager_GeomEntity.nId, FILLEDSOLID_ID, nFilledSolidIndex)
|
|
EgtRelocateGlob(PartManager_GeomEntity.nId, nAuxSolidsLayerId, GDB_POS.LAST_SON)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
If PartManager_GeomEntity.sName <> PartManager_GeomEntity.nId.ToString() Then
|
|
EgtSetInfo(PartManager_GeomEntity.nId, ENTITY_NAME, PartManager_GeomEntity.sName)
|
|
End If
|
|
nFilledSolidIndex += 1
|
|
Next
|
|
Case ManagePart_Layer.LayerType.OTHERS
|
|
nOthersLayerId = EgtCreateGroup(nPartId)
|
|
EgtSetName(nOthersLayerId, LAY_OTHERS)
|
|
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
|
|
For Each PartManager_GeomEntity In ManagePart_Layer.EntityList
|
|
EgtRelocateGlob(PartManager_GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
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)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
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)
|
|
' elimino colore entita' e rendo visibile
|
|
EgtResetColor(PartManager_GeomEntity.nId)
|
|
EgtSetStatus(PartManager_GeomEntity.nId, GDB_ST.ON_)
|
|
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 layer riferimento
|
|
Dim nPartReferenceLayerId As Integer = EgtCreateGroup(nPartId)
|
|
EgtSetName(nPartReferenceLayerId, LAY_PARTREFERENCE)
|
|
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
|
|
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
|
|
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, nPartReferenceLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
|
|
Map.refTopPanelVM.PartList.Add(NewPart)
|
|
' aggiorno riferimento
|
|
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
|
|
Map.refSliceManagerVM.UpdateDimensions()
|
|
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)
|
|
|
|
Case ManagePartType.MODIFY
|
|
' nulla da fare
|
|
End Select
|
|
EgtDeselectAll()
|
|
EgtDraw()
|
|
' 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)
|
|
EgtDeselectAll()
|
|
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
|