185293847f
- impostazione struttura programma - esecuzione slicing - gestione lavorazione e materiali - importazione migliorata
473 lines
14 KiB
VB.net
473 lines
14 KiB
VB.net
Imports System.Globalization
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class StartMachPanelVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public Enum StartMachTypes As Integer
|
|
NULL = 0
|
|
POINT = 1
|
|
COMPO = 2
|
|
End Enum
|
|
|
|
Private m_nPartId As Integer = GDB_ID.NULL
|
|
Private m_nStartMachLayerId As Integer = GDB_ID.NULL
|
|
Private m_nStartMachId As Integer = GDB_ID.NULL
|
|
|
|
Private m_TypeList() As Boolean = {True, False}
|
|
Public ReadOnly Property TypeList As Boolean()
|
|
Get
|
|
Return m_TypeList
|
|
End Get
|
|
End Property
|
|
|
|
Public Property SelType As StartMachTypes
|
|
Get
|
|
Dim Index As Integer = m_TypeList.FirstOrDefault(Function(x) x)
|
|
Select Case Index
|
|
Case -1
|
|
Return StartMachTypes.NULL
|
|
Case 0
|
|
Return StartMachTypes.POINT
|
|
Case 1
|
|
Return StartMachTypes.COMPO
|
|
End Select
|
|
End Get
|
|
Set(value As StartMachTypes)
|
|
m_TypeList(value - 1) = True
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sXPos As String
|
|
Get
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Return LenToString(ptReference.x, 1)
|
|
End Get
|
|
Set(value As String)
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Dim dNewXPos As Double = ptReference.x
|
|
StringToLen(value, dNewXPos)
|
|
If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then
|
|
EgtMove(m_nStartMachId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sYPos As String
|
|
Get
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Return LenToString(ptReference.y, 1)
|
|
End Get
|
|
Set(value As String)
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Dim dNewYPos As Double = ptReference.y
|
|
StringToLen(value, dNewYPos)
|
|
If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then
|
|
EgtMove(m_nStartMachId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sZPos As String
|
|
Get
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Return LenToString(ptReference.z, 1)
|
|
End Get
|
|
Set(value As String)
|
|
Dim ptReference As New Point3d
|
|
EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference)
|
|
Dim dNewZPos As Double = ptReference.z
|
|
StringToLen(value, dNewZPos)
|
|
If dNewZPos >= 0 Then
|
|
EgtMove(m_nStartMachId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RotAxes() As Boolean = {False, False, True}
|
|
Public Property RotAxes As Boolean()
|
|
Get
|
|
Return m_RotAxes
|
|
End Get
|
|
Set(value As Boolean())
|
|
m_RotAxes = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property vtSelRotAxes As Vector3d
|
|
Get
|
|
If m_RotAxes(0) Then
|
|
Return Vector3d.X_AX
|
|
ElseIf m_RotAxes(1) Then
|
|
Return Vector3d.Y_AX
|
|
ElseIf m_RotAxes(2) Then
|
|
Return Vector3d.Z_AX
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sRotAngle As String
|
|
Public Property sRotAngle As String
|
|
Get
|
|
Return m_sRotAngle
|
|
End Get
|
|
Set(value As String)
|
|
Dim dNewAngle As Double = 0
|
|
If Not StringToLen(value, dNewAngle) Then
|
|
m_sRotAngle = 0
|
|
NotifyPropertyChanged(NameOf(sRotAngle))
|
|
Return
|
|
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) Then
|
|
EgtDraw()
|
|
RefreshPos()
|
|
m_sRotAngle = 0
|
|
NotifyPropertyChanged(NameOf(sRotAngle))
|
|
Else
|
|
m_sRotAngle = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bType_IsChecked As Boolean
|
|
Public Property bType_IsChecked As Boolean
|
|
Get
|
|
Return m_bType_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bType_IsChecked = value
|
|
If value Then
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bEdit_IsChecked As Boolean
|
|
Public Property bEdit_IsChecked As Boolean
|
|
Get
|
|
Return m_bEdit_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bEdit_IsChecked = value
|
|
If value Then
|
|
m_bType_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bType_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bGrid_IsChecked As Boolean
|
|
Public Property bGrid_IsChecked As Boolean
|
|
Get
|
|
Return m_bGrid_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bGrid_IsChecked = value
|
|
If value Then
|
|
m_bType_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bType_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bMove_IsChecked As Boolean
|
|
Public Property bMove_IsChecked As Boolean
|
|
Get
|
|
Return m_bMove_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bMove_IsChecked = value
|
|
If value Then
|
|
m_bType_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bType_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdCPlaneTop As ICommand
|
|
Private m_cmdCPlaneFront As ICommand
|
|
Private m_cmdCPlaneRight As ICommand
|
|
Private m_cmdCPlaneBack As ICommand
|
|
Private m_cmdCPlaneLeft As ICommand
|
|
Private m_cmdCPlaneBottom As ICommand
|
|
Private m_cmdCPlaneView As ICommand
|
|
Private m_cmdCPlaneElevation As ICommand
|
|
Private m_cmdCPlaneOrigin As ICommand
|
|
Private m_cmdCPlaneRotate As ICommand
|
|
Private m_cmdCPlane3P As ICommand
|
|
Private m_cmdCPlanePerpObj As ICommand
|
|
Private m_cmdCPlaneObj As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTORS"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in EgtCAM5Map
|
|
Map.SetRefStartMachPanelVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTORS
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub Init()
|
|
' recupero dati pezzo selezionato layer ed entita'
|
|
m_nPartId = Map.refTopPanelVM.SelPart.nPartId
|
|
m_nStartMachLayerId = Map.refTopPanelVM.SelPart.nMachStartLayerId
|
|
m_nStartMachId = Map.refTopPanelVM.SelPart.nMachStartId
|
|
' verifico se punto o curva
|
|
Dim StartMachType As GDB_TY = EgtGetType(m_nStartMachId)
|
|
Select Case StartMachType
|
|
Case GDB_TY.GEO_POINT
|
|
SelType = StartMachTypes.POINT
|
|
Case GDB_TY.CRV_LINE, GDB_TY.CRV_ARC, GDB_TY.CRV_COMPO
|
|
SelType = StartMachTypes.COMPO
|
|
End Select
|
|
NotifyPropertyChanged(NameOf(TypeList))
|
|
' aggiorno campi di testo posizione
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End Sub
|
|
|
|
Friend Sub RefreshPos()
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "CPlaneTop"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneTop_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneTop Is Nothing Then
|
|
m_cmdCPlaneTop = New Command(AddressOf CPlaneTop)
|
|
End If
|
|
Return m_cmdCPlaneTop
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneTop(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.TOP)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneTop
|
|
|
|
#Region "CPlaneFront"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneFront.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneFront_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneFront Is Nothing Then
|
|
m_cmdCPlaneFront = New Command(AddressOf CPlaneFront)
|
|
End If
|
|
Return m_cmdCPlaneFront
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneFront(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.FRONT)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneFront
|
|
|
|
#Region "CPlaneRight"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneRight.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneRight_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneRight Is Nothing Then
|
|
m_cmdCPlaneRight = New Command(AddressOf CPlaneRight)
|
|
End If
|
|
Return m_cmdCPlaneRight
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneRight(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.RIGHT)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneRight
|
|
|
|
#Region "CPlaneBack"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneBack.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneBack_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneBack Is Nothing Then
|
|
m_cmdCPlaneBack = New Command(AddressOf CPlaneBack)
|
|
End If
|
|
Return m_cmdCPlaneBack
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneBack(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BACK)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneBack
|
|
|
|
#Region "CPlaneLeft"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneLeft.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneLeft_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneLeft Is Nothing Then
|
|
m_cmdCPlaneLeft = New Command(AddressOf CPlaneLeft)
|
|
End If
|
|
Return m_cmdCPlaneLeft
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneLeft(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.LEFT)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneLeft
|
|
|
|
#Region "CPlaneBottom"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneBottom.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneBottom_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneBottom Is Nothing Then
|
|
m_cmdCPlaneBottom = New Command(AddressOf CPlaneBottom)
|
|
End If
|
|
Return m_cmdCPlaneBottom
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneBottom(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BOTTOM)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneBottom
|
|
|
|
#Region "CPlaneElevation"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneElevation.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneElevation_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneElevation Is Nothing Then
|
|
m_cmdCPlaneElevation = New Command(AddressOf CPlaneElevation)
|
|
End If
|
|
Return m_cmdCPlaneElevation
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneElevation(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ELEVATION)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneElevation
|
|
|
|
#Region "CPlaneOrigin"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneOrigin.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneOrigin_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneOrigin Is Nothing Then
|
|
m_cmdCPlaneOrigin = New Command(AddressOf CPlaneOrigin)
|
|
End If
|
|
Return m_cmdCPlaneOrigin
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneOrigin(ByVal param As Object)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ORIGIN)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneOrigin
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class |