4d37978789
- modifiche per gestione griglia come tavola / standard.
1433 lines
51 KiB
VB.net
1433 lines
51 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.Collections.Specialized
|
|
Imports System.Globalization
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class FilledSolidPanelVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public Enum FilledSolidSelectionTypes As Integer
|
|
CURVE = 1
|
|
EXTRUSION = 2
|
|
BOTH = 3
|
|
End Enum
|
|
|
|
Private m_nPartId As Integer = GDB_ID.NULL
|
|
Private m_nFilledSolidLayerId As Integer = GDB_ID.NULL
|
|
Friend ReadOnly Property nFilledSolidLayerId As Integer
|
|
Get
|
|
Return m_nFilledSolidLayerId
|
|
End Get
|
|
End Property
|
|
|
|
Private m_FilledSolidList As New ObservableCollection(Of FilledSolidEntity)
|
|
Public ReadOnly Property FilledSolidList As ObservableCollection(Of FilledSolidEntity)
|
|
Get
|
|
Return m_FilledSolidList
|
|
End Get
|
|
End Property
|
|
Private m_SelFilledSolid As FilledSolidEntity
|
|
Public Property SelFilledSolid As FilledSolidEntity
|
|
Get
|
|
Return m_SelFilledSolid
|
|
End Get
|
|
Set(value As FilledSolidEntity)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse Map.refFilledSolidPanelVM.bCPlaneObj_IsActive Then
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
Return
|
|
End If
|
|
m_SelFilledSolid = value
|
|
EgtDeselectAll()
|
|
If Not IsNothing(value) Then
|
|
EgtSelectObj(value.nCurveId)
|
|
EgtSelectObj(value.nExtrusionId)
|
|
' aggiorno visibilita' bottoni edit
|
|
NotifyPropertyChanged(NameOf(Compo_Visibility))
|
|
' aggiorno campi di testo posizione
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End If
|
|
EgtDraw()
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sXPos As String
|
|
Get
|
|
If Not IsNothing(m_SelFilledSolid) Then
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Return LenToString(b3Reference.Min.x, 1)
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Dim dNewXPos As Double = b3Reference.Min.x
|
|
StringToLen(value, dNewXPos)
|
|
If dNewXPos >= -b3Reference.DimX AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX - b3Reference.DimX Then
|
|
EgtMove(m_SelFilledSolid.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtMove(m_SelFilledSolid.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
End If
|
|
' Imposto flag di ricalcolo slice
|
|
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sYPos As String
|
|
Get
|
|
If Not IsNothing(m_SelFilledSolid) Then
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Return LenToString(b3Reference.Min.y, 1)
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Dim dNewYPos As Double = b3Reference.Min.y
|
|
StringToLen(value, dNewYPos)
|
|
If dNewYPos >= -b3Reference.DimY AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY - b3Reference.DimY Then
|
|
EgtMove(m_SelFilledSolid.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtMove(m_SelFilledSolid.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
End If
|
|
' Imposto flag di ricalcolo slice
|
|
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sZPos As String
|
|
Get
|
|
If Not IsNothing(m_SelFilledSolid) Then
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Return LenToString(b3Reference.Min.z, 1)
|
|
Else
|
|
Return ""
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
Dim nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Reference As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference)
|
|
Dim dNewZPos As Double = b3Reference.Min.y
|
|
StringToLen(value, dNewZPos)
|
|
If dNewZPos >= -1000 Then
|
|
EgtMove(m_SelFilledSolid.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtMove(m_SelFilledSolid.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End If
|
|
' Imposto flag di ricalcolo slice
|
|
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RotAxes() As Boolean = {False, False, True}
|
|
Public Property RotX As Boolean
|
|
Get
|
|
Return m_RotAxes(0)
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_RotAxes(0) = value
|
|
End Set
|
|
End Property
|
|
Public Property RotY As Boolean
|
|
Get
|
|
Return m_RotAxes(1)
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_RotAxes(1) = value
|
|
End Set
|
|
End Property
|
|
Public Property RotZ As Boolean
|
|
Get
|
|
Return m_RotAxes(2)
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_RotAxes(2) = 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
|
|
Else
|
|
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 nId As Integer = If(m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, m_SelFilledSolid.nCurveId, m_SelFilledSolid.nExtrusionId)
|
|
Dim b3Rib As New BBox3d
|
|
EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Rib)
|
|
Dim bOk As Boolean = False
|
|
bOk = EgtRotate(nId, b3Rib.Center(), vtSelRotAxes, dNewAngle, GDB_RT.GLOB)
|
|
If bOk AndAlso m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW Then EgtRotate(m_SelFilledSolid.nExtrusionId, b3Rib.Center, vtSelRotAxes, dNewAngle, GDB_RT.GLOB)
|
|
If bOk Then
|
|
EgtDraw()
|
|
RefreshPos()
|
|
m_sRotAngle = 0
|
|
NotifyPropertyChanged(NameOf(sRotAngle))
|
|
' Imposto flag di ricalcolo slice
|
|
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
|
|
Else
|
|
m_sRotAngle = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bAdd_IsChecked As Boolean
|
|
Public Property bAdd_IsChecked As Boolean
|
|
Get
|
|
Return m_bAdd_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If Not m_bMachParam_IsChecked AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive Then
|
|
m_bAdd_IsChecked = value
|
|
If value Then
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
m_bRotate_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
End If
|
|
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)
|
|
If Not IsNothing(m_SelFilledSolid) AndAlso Not m_bMachParam_IsChecked AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive Then
|
|
m_bEdit_IsChecked = value
|
|
If value Then
|
|
m_bAdd_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
m_bRotate_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bAdd_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
End If
|
|
Else
|
|
NotifyPropertyChanged(NameOf(bEdit_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)
|
|
If Not m_bMachParam_IsChecked AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive Then
|
|
m_bGrid_IsChecked = value
|
|
If value Then
|
|
m_bAdd_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
m_bRotate_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bAdd_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property bGrid_IsEnabled As Boolean
|
|
Get
|
|
Return Map.refMyStatusBarVM.bGridVisibility
|
|
End Get
|
|
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)
|
|
If Not IsNothing(m_SelFilledSolid) AndAlso Not m_bMachParam_IsChecked AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive Then
|
|
m_bMove_IsChecked = value
|
|
If value Then
|
|
m_bAdd_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bRotate_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bAdd_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
End If
|
|
Else
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bRotate_IsChecked As Boolean
|
|
Public Property bRotate_IsChecked As Boolean
|
|
Get
|
|
Return m_bRotate_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If Not IsNothing(m_SelFilledSolid) AndAlso Not m_bMachParam_IsChecked AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive Then
|
|
m_bRotate_IsChecked = value
|
|
If value Then
|
|
m_bAdd_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bAdd_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
End If
|
|
Else
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bMachParam_IsChecked As Boolean
|
|
Public Property bMachParam_IsChecked As Boolean
|
|
Get
|
|
Return m_bMachParam_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If Not IsNothing(m_SelFilledSolid) AndAlso Map.refSceneHostVM.MainController.GetStep = 0 AndAlso Not m_bCPlaneObj_IsActive AndAlso Not IsNothing(Map.refTopPanelVM.SelMachining) AndAlso value Then
|
|
m_bMachParam_IsChecked = True
|
|
m_bAdd_IsChecked = False
|
|
m_bEdit_IsChecked = False
|
|
m_bGrid_IsChecked = False
|
|
m_bMove_IsChecked = False
|
|
m_bRotate_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bAdd_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bEdit_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bGrid_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bMove_IsChecked))
|
|
NotifyPropertyChanged(NameOf(bRotate_IsChecked))
|
|
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.AUXSOLIDPARAM)
|
|
NotifyPropertyChanged(NameOf(FilledSolidList_IsEnabled))
|
|
' disattivo interfaccia
|
|
ManageInterface(False)
|
|
Else
|
|
NotifyPropertyChanged(NameOf(m_bMachParam_IsChecked))
|
|
End If
|
|
End Set
|
|
End Property
|
|
Friend Sub ResetMachParamIsChecked()
|
|
m_bMachParam_IsChecked = False
|
|
NotifyPropertyChanged(NameOf(bMachParam_IsChecked))
|
|
NotifyPropertyChanged(NameOf(FilledSolidList_IsEnabled))
|
|
' riattivo interfaccia
|
|
ManageInterface(True)
|
|
End Sub
|
|
|
|
Public ReadOnly Property Compo_Visibility As Visibility
|
|
Get
|
|
Return If(Not IsNothing(m_SelFilledSolid) AndAlso m_SelFilledSolid.Type = FilledSolidEntity.FilledSolidTypes.FROMDRAW, Visibility.Visible, Visibility.Collapsed)
|
|
End Get
|
|
End Property
|
|
|
|
Private m_FilledSolidList_IsEnabled As Boolean = False
|
|
Public ReadOnly Property FilledSolidList_IsEnabled As Boolean
|
|
Get
|
|
Return If(m_FilledSolidList.Count > 0, m_FilledSolidList_IsEnabled, False)
|
|
End Get
|
|
End Property
|
|
Friend Sub SetFilledSolidListIsEnabled(bValue As Boolean)
|
|
m_FilledSolidList_IsEnabled = bValue
|
|
NotifyPropertyChanged(NameOf(FilledSolidList_IsEnabled))
|
|
End Sub
|
|
|
|
' riferimento griglia all'ingresso in questa pagina
|
|
Private m_OriginalGridFrame As New Frame3d
|
|
|
|
' parametro che indica se e' in corso il disegno di un percorso
|
|
Private m_bIsCreatingPath As Boolean = False
|
|
Public ReadOnly Property bIsCreatingPath As Boolean
|
|
Get
|
|
Return m_bIsCreatingPath
|
|
End Get
|
|
End Property
|
|
Private m_bIsCreatingExtrusion As Boolean = False
|
|
Public ReadOnly Property bIsCreatingExtrusion As Boolean
|
|
Get
|
|
Return m_bIsCreatingExtrusion
|
|
End Get
|
|
End Property
|
|
|
|
Private m_bEscOnLine2P As Boolean = False
|
|
|
|
#Region "Tooltip"
|
|
|
|
Public ReadOnly Property Import_ToolTip As String
|
|
Get
|
|
Return "Import"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Point_ToolTip As String
|
|
Get
|
|
Return "Point"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Line2P_ToolTip As String
|
|
Get
|
|
Return "Multiline"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Delete_ToolTip As String
|
|
Get
|
|
Return "Delete"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ModifyCurve_ToolTip As String
|
|
Get
|
|
Return "Modify Curve"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AddPointCurve_ToolTip As String
|
|
Get
|
|
Return "Add Point to Curve"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RemovePointCurve_ToolTip As String
|
|
Get
|
|
Return "Remove Point From Curve"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Extrude_ToolTip As String
|
|
Get
|
|
Return "Modify Extrusion"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneTop_ToolTip As String
|
|
Get
|
|
Return "Grid From Top"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneFront_ToolTip As String
|
|
Get
|
|
Return "Grid From Front"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneRight_ToolTip As String
|
|
Get
|
|
Return "Grid From Right"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneBack_ToolTip As String
|
|
Get
|
|
Return "Grid From Back"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneLeft_ToolTip As String
|
|
Get
|
|
Return "Grid From Left"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneBottom_ToolTip As String
|
|
Get
|
|
Return "Grid From Bottom"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneElevation_ToolTip As String
|
|
Get
|
|
Return "Grid Elevation"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneOrigin_ToolTip As String
|
|
Get
|
|
Return "Grid Origin"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CPlaneObj_ToolTip As String
|
|
Get
|
|
Return "Grid On Object"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Tooltip
|
|
|
|
' Definizione comandi
|
|
Private m_cmdImport As ICommand
|
|
Private m_cmdLine2P As ICommand
|
|
Private m_cmdDelete As ICommand
|
|
Private m_cmdModifyCurve As ICommand
|
|
Private m_cmdAddPointCurve As ICommand
|
|
Private m_cmdRemovePointCurve As ICommand
|
|
Private m_cmdExtrude As ICommand
|
|
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
|
|
Private m_cmdDragMove As ICommand
|
|
Private m_cmdDragRotate As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTORS"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in EgtCAM5Map
|
|
Map.SetRefFilledSolidPanelVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTORS
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub Init()
|
|
' asse rotazione di default
|
|
RotZ = True
|
|
NotifyPropertyChanged(NameOf(RotZ))
|
|
' azzero indice
|
|
StartEntity.ResetSharedIndex()
|
|
' fisso frame originale
|
|
m_OriginalGridFrame = EgtGetGridFrame()
|
|
' recupero dati pezzo selezionato layer ed entita'
|
|
m_nPartId = Map.refTopPanelVM.SelPart.nPartId
|
|
m_nFilledSolidLayerId = Map.refTopPanelVM.SelPart.nAuxSolidsLayerId
|
|
If m_nFilledSolidLayerId = GDB_ID.NULL Then
|
|
m_nFilledSolidLayerId = EgtCreateGroup(m_nPartId)
|
|
EgtSetName(m_nFilledSolidLayerId, LAY_AUX_SOLIDS)
|
|
End If
|
|
'recupero tutte le entita' filled solid
|
|
m_FilledSolidList.Clear()
|
|
Dim nFilledSolidId As Integer = EgtGetFirstInGroup(m_nFilledSolidLayerId)
|
|
While nFilledSolidId <> GDB_ID.NULL
|
|
Dim EntityType As GDB_TY = EgtGetType(nFilledSolidId)
|
|
Dim DrawType As Integer = FilledSolidEntity.FilledSolidTypes.FROMDRAW
|
|
EgtGetInfo(nFilledSolidId, KEY_AUXSOLID_TYPE, DrawType)
|
|
If EntityType = GDB_TY.CRV_COMPO AndAlso DrawType = FilledSolidEntity.FilledSolidTypes.FROMDRAW Then
|
|
Dim nExtrusionId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(nFilledSolidId, KEY_EXTRUSION_ID, nExtrusionId)
|
|
Dim FilledSolidEntity As FilledSolidEntity = New FilledSolidEntity(FilledSolidEntity.FilledSolidTypes.FROMDRAW, nFilledSolidId)
|
|
If nExtrusionId <> GDB_ID.NULL Then
|
|
FilledSolidEntity.SetExtrusionId(nExtrusionId)
|
|
End If
|
|
m_FilledSolidList.Add(FilledSolidEntity)
|
|
ElseIf (EntityType = GDB_TY.SRF_BEZ OrElse EntityType = GDB_TY.SRF_MESH OrElse EntityType = GDB_TY.SRF_FRGN) AndAlso DrawType = FilledSolidEntity.FilledSolidTypes.FROMIMPORT Then
|
|
Dim FilledSolidEntity As FilledSolidEntity = New FilledSolidEntity(FilledSolidEntity.FilledSolidTypes.FROMIMPORT, nFilledSolidId)
|
|
m_FilledSolidList.Add(FilledSolidEntity)
|
|
End If
|
|
nFilledSolidId = EgtGetNext(nFilledSolidId)
|
|
End While
|
|
If m_FilledSolidList.Count > 0 Then
|
|
SelFilledSolid = m_FilledSolidList(0)
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
End If
|
|
' attivo lista filled solid
|
|
SetFilledSolidListIsEnabled(True)
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
End Sub
|
|
|
|
Friend Sub Dispose()
|
|
' ripristino frame originale
|
|
EgtSetGridFrame(m_OriginalGridFrame)
|
|
EgtSetGridGeoAdv( -1, -1, -1, 0, CurrentMachine.b3Tab.DimX(), 0, CurrentMachine.b3Tab.DimY())
|
|
' se in modifica parametri
|
|
If m_bMachParam_IsChecked Then
|
|
' ripristino modalita' standard
|
|
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL)
|
|
Map.refFilledSolidPanelVM.ResetMachParamIsChecked()
|
|
End If
|
|
EgtDeselectAll()
|
|
EgtDraw()
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
End Sub
|
|
|
|
Friend Sub RefreshPos()
|
|
NotifyPropertyChanged(NameOf(sXPos))
|
|
NotifyPropertyChanged(NameOf(sYPos))
|
|
NotifyPropertyChanged(NameOf(sZPos))
|
|
End Sub
|
|
|
|
Private Function InitCommand(FilledSolidSelectionType As FilledSolidSelectionTypes) As Boolean
|
|
' attivo modifiche su scena
|
|
Map.refSceneHostVM.MainScene.ResetStatus()
|
|
' rendo traspanete estrusione
|
|
EgtSetAlpha(m_SelFilledSolid.nExtrusionId, 50)
|
|
' seleziono percorso corrente
|
|
EgtDeselectAll()
|
|
Select Case FilledSolidSelectionType
|
|
Case FilledSolidSelectionTypes.CURVE
|
|
EgtSelectObj(m_SelFilledSolid.nCurveId)
|
|
Case FilledSolidSelectionTypes.EXTRUSION
|
|
' creo layer per estrusione
|
|
Dim nNewExtrusionLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWEXTRUSION)
|
|
If nNewExtrusionLayerId = GDB_ID.NULL Then
|
|
nNewExtrusionLayerId = EgtCreateGroup(m_nPartId)
|
|
EgtSetName(nNewExtrusionLayerId, LAY_NEWEXTRUSION)
|
|
Else
|
|
EgtEmptyGroup(nNewExtrusionLayerId)
|
|
End If
|
|
EgtSetCurrPartLayer(m_nPartId, nNewExtrusionLayerId)
|
|
EgtSelectObj(m_SelFilledSolid.nCurveId)
|
|
Case FilledSolidSelectionTypes.BOTH
|
|
EgtSelectObj(m_SelFilledSolid.nCurveId)
|
|
EgtSelectObj(m_SelFilledSolid.nExtrusionId)
|
|
End Select
|
|
EgtDraw()
|
|
' disattivo il resto dell'interfaccia
|
|
ManageInterface(False)
|
|
Return True
|
|
End Function
|
|
|
|
Friend Sub UpdateUI()
|
|
' se attiva operazione in piu' passaggi, esco
|
|
If Map.refSceneHostVM.MainController.GetContinue() Then Return
|
|
End Sub
|
|
|
|
Friend Sub OnExecCmdEnd(command As Controller.CMD)
|
|
m_bEscOnLine2P = False
|
|
Select Case command
|
|
Case Controller.CMD.MODIFYCURVE, Controller.CMD.ADDPOINTCURVE, Controller.CMD.REMOVEPOINTCURVE
|
|
' leggo altezza estrusione
|
|
Dim dExtrusionLength As Double = 0
|
|
EgtGetInfo(m_SelFilledSolid.nExtrusionId, KEY_EXTRUSION_LENGTH, dExtrusionLength)
|
|
' cancello estrusione
|
|
EgtErase(m_SelFilledSolid.nExtrusionId)
|
|
Dim nNewEntityId As Integer = EgtCreateSurfTmByRegionExtrusion(m_nFilledSolidLayerId, 1, {m_SelFilledSolid.nCurveId}, Vector3d.Z_AX * dExtrusionLength, EPS_STM)
|
|
EgtSetName(nNewEntityId, RIB_EXTRUSION)
|
|
EgtSetInfo(nNewEntityId, KEY_EXTRUSION_LENGTH, dExtrusionLength)
|
|
' resetto colore entita'
|
|
EgtResetColor(nNewEntityId)
|
|
' aggiorno riferimento nella curva
|
|
m_SelFilledSolid.SetExtrusionId(nNewEntityId)
|
|
' seleziono nuova estrusione
|
|
EgtSelectObj(m_SelFilledSolid.nExtrusionId)
|
|
' ripristino trasparenza estrusione
|
|
EgtSetAlpha(m_SelFilledSolid.nExtrusionId, 100)
|
|
EgtDraw()
|
|
' rimetto la selezione scena a null
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
Case Controller.CMD.MOVE, Controller.CMD.ROTATE
|
|
EgtSetAlpha(Map.refFilledSolidPanelVM.SelFilledSolid.nExtrusionId, 100)
|
|
' seleziono nuova estrusione
|
|
EgtSelectObj(m_SelFilledSolid.nExtrusionId)
|
|
EgtDraw()
|
|
' rimetto la selezione scena a null
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
Case Controller.CMD.GRID_ELEVATION, Controller.CMD.GRID_3P, Controller.CMD.GRID_ORIGIN, Controller.CMD.GRID_PERPCURVE,
|
|
Controller.CMD.GRID_ROTATE, Controller.CMD.GRID_ROTATE3D, Controller.CMD.GRID_OBJ
|
|
' rimetto la selezione scena a null
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
End Select
|
|
Select Case command
|
|
Case Controller.CMD.LINE2P, Controller.CMD.DELETE, Controller.CMD.MODIFYCURVE, Controller.CMD.ADDPOINTCURVE, Controller.CMD.REMOVEPOINTCURVE, Controller.CMD.EXTRUDE,
|
|
Controller.CMD.MOVE, Controller.CMD.ROTATE
|
|
' Imposto flag di ricalcolo slice
|
|
EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True)
|
|
End Select
|
|
' se non ho creato percorso riabilito interfaccia
|
|
If Not m_bIsCreatingPath Then
|
|
ManageInterface(True)
|
|
End If
|
|
If command <> Controller.CMD.LINE2P AndAlso command <> Controller.CMD.EXTRUDE Then Return
|
|
' se finita creazione estrusione
|
|
If m_bIsCreatingExtrusion Then
|
|
m_bIsCreatingExtrusion = False
|
|
' se riferimento non nullo, elimino vecchia estrusione
|
|
If m_SelFilledSolid.nExtrusionId <> GDB_ID.NULL Then
|
|
EgtErase(m_SelFilledSolid.nExtrusionId)
|
|
End If
|
|
Dim NewEntity As FilledSolidEntity = Nothing
|
|
Dim nNewExtrusionLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWEXTRUSION)
|
|
Dim nNewEntityId As Integer = EgtGetFirstInGroup(nNewExtrusionLayerId)
|
|
Dim NewGeomType As GDB_TY = EgtGetType(nNewEntityId)
|
|
If NewGeomType = GDB_TY.SRF_FRGN OrElse NewGeomType = GDB_TY.SRF_MESH Then
|
|
EgtSetName(nNewEntityId, RIB_EXTRUSION)
|
|
Dim dExtrusionLength As Double = 0
|
|
StringToLen(Map.refControllerInputPanelVM.Text, dExtrusionLength)
|
|
EgtSetInfo(nNewEntityId, KEY_EXTRUSION_LENGTH, dExtrusionLength)
|
|
' resetto colore entita'
|
|
EgtResetColor(nNewEntityId)
|
|
'' lo sposto nel layer dei rib
|
|
EgtRelocateGlob(nNewEntityId, m_nFilledSolidLayerId, GDB_POS.LAST_SON)
|
|
' aggiungo riferimento a curva
|
|
m_SelFilledSolid.SetExtrusionId(nNewEntityId)
|
|
End If
|
|
' cancello layer estrusione
|
|
EgtErase(nNewExtrusionLayerId)
|
|
' aggiorno posizione
|
|
RefreshPos()
|
|
EgtDraw()
|
|
' rimetto la selezione scena a null
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
End If
|
|
' se finita creazione curva
|
|
If bIsCreatingPath Then
|
|
m_bIsCreatingPath = False
|
|
Dim NewEntity As FilledSolidEntity = Nothing
|
|
Dim nNewRibLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWRIB)
|
|
Dim nNewEntityId As Integer = EgtGetFirstInGroup(nNewRibLayerId)
|
|
Dim NewGeomType As GDB_TY = EgtGetType(nNewEntityId)
|
|
If NewGeomType = GDB_TY.CRV_COMPO Then
|
|
If Not EgtCurveIsClosed(nNewEntityId) Then
|
|
EgtCloseCurveCompo(nNewEntityId)
|
|
m_bEscOnLine2P = True
|
|
End If
|
|
EgtSetName(nNewEntityId, RIB_CURVE)
|
|
' resetto colore entita'
|
|
EgtResetColor(nNewEntityId)
|
|
' lo sposto nel layer dei rib
|
|
EgtRelocateGlob(nNewEntityId, m_nFilledSolidLayerId, GDB_POS.LAST_SON)
|
|
' lo aggiungo alla lista
|
|
NewEntity = New FilledSolidEntity(FilledSolidEntity.FilledSolidTypes.FROMDRAW, nNewEntityId)
|
|
m_FilledSolidList.Add(NewEntity)
|
|
' lo seleziono
|
|
SelFilledSolid = NewEntity
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
' verifico se esiste gia' layer estrusione e lo svuoto
|
|
Dim nNewExtrusionLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWEXTRUSION)
|
|
If nNewExtrusionLayerId <> GDB_ID.NULL Then
|
|
EgtEmptyGroup(nNewExtrusionLayerId)
|
|
Else
|
|
' altrimenti lo creo
|
|
nNewExtrusionLayerId = EgtCreateGroup(m_nPartId)
|
|
EgtSetName(nNewExtrusionLayerId, LAY_NEWEXTRUSION)
|
|
End If
|
|
EgtSetCurrPartLayer(m_nPartId, nNewExtrusionLayerId)
|
|
' seleziono percorso da estrudere
|
|
EgtDeselectAll()
|
|
EgtSelectObj(nNewEntityId)
|
|
If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.EXTRUDE) Then
|
|
m_bIsCreatingExtrusion = True
|
|
Map.refControllerInputPanelVM.IsChecked = True
|
|
Else
|
|
' cancello layer
|
|
EgtErase(nNewExtrusionLayerId)
|
|
End If
|
|
End If
|
|
' cancello layer di disegno
|
|
EgtErase(nNewRibLayerId)
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub OnKeyDown(Key As Forms.Keys)
|
|
If Key = Forms.Keys.Escape Then
|
|
' se attiva, disattivo griglia su oggetto
|
|
If m_bCPlaneObj_IsActive Then
|
|
m_bCPlaneObj_IsActive = False
|
|
ResetCPlaneObjIsActive()
|
|
' ripristino selezioni precedenti
|
|
For Each Id In Map.refFilledSolidPanelVM.PrevSelObjs
|
|
EgtSelectObj(Id)
|
|
Next
|
|
EgtDraw()
|
|
' rimetto la selezione scena a null
|
|
Map.refSceneHostVM.MainScene.SetStatusNull()
|
|
End If
|
|
' se esc su creazione percorso, lo annullo, altrimenti riabilito interfaccia
|
|
If m_bEscOnLine2P Then
|
|
m_bEscOnLine2P = False
|
|
Else
|
|
If m_bIsCreatingExtrusion Then m_bIsCreatingExtrusion = False
|
|
ManageInterface(True)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Friend Function OnMouseSelectingObj(nId As Integer) As Boolean
|
|
Return EgtGetParent(nId) = m_nFilledSolidLayerId
|
|
End Function
|
|
|
|
Friend Sub SelStartFromId(nId)
|
|
Dim SelFilledSolidEntity As FilledSolidEntity = m_FilledSolidList.FirstOrDefault(Function(x) x.nCurveId = nId OrElse x.nExtrusionId = nId)
|
|
If Not IsNothing(SelFilledSolidEntity) Then
|
|
SelFilledSolid = SelFilledSolidEntity
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub SelLastFilledSolid()
|
|
If FilledSolidList.Count <= 0 Then Return
|
|
SelFilledSolid = FilledSolidList(FilledSolidList.Count - 1)
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
End Sub
|
|
|
|
Friend Shared Function GetNextFilledSolidIndex()
|
|
Dim nFilledSolidIndex As Integer = 0
|
|
Dim nFilledSolidId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nAuxSolidsLayerId)
|
|
While nFilledSolidId <> GDB_ID.NULL
|
|
Dim nCurrIndex As Integer = GDB_ID.NULL
|
|
EgtGetInfo(nFilledSolidId, FILLEDSOLID_ID, nCurrIndex)
|
|
If nCurrIndex > nFilledSolidIndex Then
|
|
nFilledSolidIndex = nCurrIndex
|
|
End If
|
|
nFilledSolidId = EgtGetNext(nFilledSolidId)
|
|
End While
|
|
Return nFilledSolidIndex + 1
|
|
End Function
|
|
|
|
Friend Sub ManageInterface(bValue As Boolean)
|
|
' disabilito ProjManager, TopPanel, TFS, Slider, bottoni e uscita dal programma
|
|
Map.refProjManagerVM.SetProjCmdIsEnabled(bValue)
|
|
Map.refTopPanelVM.SetTopPanelIsEnabled(bValue)
|
|
Map.refViewLayerManagerVM.SetViewLayerManagerIsEnabled(bValue)
|
|
Map.refSliderManagerVM.SetLayerIndexIsEnabled(bValue)
|
|
Map.refSliderManagerVM.SetLayerAdvancementIsEnabled(bValue)
|
|
Map.refSliceManagerVM.SetButtonsIsEnabled(bValue)
|
|
Map.refInstrumentPanelVM.SetInstrumentPanelIsEnabled(bValue)
|
|
SetFilledSolidListIsEnabled(bValue)
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Import"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Import_Command As ICommand
|
|
Get
|
|
If m_cmdImport Is Nothing Then
|
|
m_cmdImport = New Command(AddressOf Import)
|
|
End If
|
|
Return m_cmdImport
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub Import(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
ManageInterface(False)
|
|
Map.refSceneHostVM.InsertFilledSolid()
|
|
ManageInterface(True)
|
|
End Sub
|
|
|
|
#End Region ' Import
|
|
|
|
#Region "Line2P"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Line2P_Command As ICommand
|
|
Get
|
|
If m_cmdLine2P Is Nothing Then
|
|
m_cmdLine2P = New Command(AddressOf Line2P)
|
|
End If
|
|
Return m_cmdLine2P
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub Line2P(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
ManageInterface(False)
|
|
Dim nNewShellNumberLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWRIB)
|
|
If nNewShellNumberLayerId = GDB_ID.NULL Then nNewShellNumberLayerId = EgtCreateGroup(m_nPartId)
|
|
EgtSetName(nNewShellNumberLayerId, LAY_NEWRIB)
|
|
EgtSetCurrPartLayer(m_nPartId, nNewShellNumberLayerId)
|
|
Map.refSceneHostVM.MainController.SetContinue()
|
|
If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.LINE2P) Then
|
|
m_bIsCreatingPath = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Line2P
|
|
|
|
#Region "Delete"
|
|
|
|
Public ReadOnly Property Delete_Command As ICommand
|
|
Get
|
|
If m_cmdDelete Is Nothing Then
|
|
m_cmdDelete = New Command(AddressOf Delete)
|
|
End If
|
|
Return m_cmdDelete
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Delete()
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
If IsNothing(SelFilledSolid) Then Return
|
|
Dim bOk As Boolean = False
|
|
Select Case m_SelFilledSolid.Type
|
|
Case FilledSolidEntity.FilledSolidTypes.FROMDRAW
|
|
bOk = EgtErase(m_SelFilledSolid.nCurveId)
|
|
If bOk Then EgtErase(m_SelFilledSolid.nExtrusionId)
|
|
Case FilledSolidEntity.FilledSolidTypes.FROMIMPORT
|
|
bOk = EgtErase(m_SelFilledSolid.nExtrusionId)
|
|
End Select
|
|
If bOk Then
|
|
Dim nSelStartIndex As Integer = m_FilledSolidList.IndexOf(SelFilledSolid)
|
|
m_FilledSolidList.Remove(SelFilledSolid)
|
|
If nSelStartIndex < m_FilledSolidList.Count Then
|
|
SelFilledSolid = m_FilledSolidList(nSelStartIndex)
|
|
ElseIf m_FilledSolidList.Count > 0 Then
|
|
SelFilledSolid = m_FilledSolidList(m_FilledSolidList.Count - 1)
|
|
Else
|
|
SelFilledSolid = Nothing
|
|
m_bEdit_IsChecked = False
|
|
NotifyPropertyChanged(NameOf( bEdit_IsChecked))
|
|
End If
|
|
NotifyPropertyChanged(NameOf(SelFilledSolid))
|
|
End If
|
|
SetFilledSolidListIsEnabled(True)
|
|
End Sub
|
|
|
|
#End Region ' Delete
|
|
|
|
#Region "ModifyCurve"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Linear Dimension.
|
|
''' </summary>
|
|
Public ReadOnly Property ModifyCurve_Command As ICommand
|
|
Get
|
|
If m_cmdModifyCurve Is Nothing Then
|
|
m_cmdModifyCurve = New Command(AddressOf ModifyCurve)
|
|
End If
|
|
Return m_cmdModifyCurve
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the LinearDimension. This method is invoked by the LinDimCommand.
|
|
''' </summary>
|
|
Public Sub ModifyCurve(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.CURVE)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MODIFYCURVE)
|
|
End Sub
|
|
|
|
#End Region ' ModifyCurve
|
|
|
|
#Region "AddPointCurve"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Linear Dimension.
|
|
''' </summary>
|
|
Public ReadOnly Property AddPointCurve_Command As ICommand
|
|
Get
|
|
If m_cmdAddPointCurve Is Nothing Then
|
|
m_cmdAddPointCurve = New Command(AddressOf AddPointCurve)
|
|
End If
|
|
Return m_cmdAddPointCurve
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the LinearDimension. This method is invoked by the LinDimCommand.
|
|
''' </summary>
|
|
Public Sub AddPointCurve(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.CURVE)
|
|
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOARC)
|
|
Else
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.ADDPOINTCURVE)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' AddPointCurve
|
|
|
|
#Region "RemovePointCurve"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Linear Dimension.
|
|
''' </summary>
|
|
Public ReadOnly Property RemovePointCurve_Command As ICommand
|
|
Get
|
|
If m_cmdRemovePointCurve Is Nothing Then
|
|
m_cmdRemovePointCurve = New Command(AddressOf RemovePointCurve)
|
|
End If
|
|
Return m_cmdRemovePointCurve
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the LinearDimension. This method is invoked by the LinDimCommand.
|
|
''' </summary>
|
|
Public Sub RemovePointCurve(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.CURVE)
|
|
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOLINE)
|
|
Else
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.REMOVEPOINTCURVE)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' RemovePointCurve
|
|
|
|
#Region "Extrude"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Extrude.
|
|
''' </summary>
|
|
Public ReadOnly Property Extrude_Command As ICommand
|
|
Get
|
|
If m_cmdExtrude Is Nothing Then
|
|
m_cmdExtrude = New Command(AddressOf Extrude)
|
|
End If
|
|
Return m_cmdExtrude
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Extrude. This method is invoked by the ExtrudeCommand.
|
|
''' </summary>
|
|
Public Sub Extrude(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.EXTRUSION)
|
|
If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.EXTRUDE) Then
|
|
m_bIsCreatingExtrusion = True
|
|
Map.refControllerInputPanelVM.IsChecked = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Extrude
|
|
|
|
#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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeoAdv( -1, -1, -1, 0, CurrentMachine.b3Tab.DimX(), 0, CurrentMachine.b3Tab.DimY())
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
ManageInterface(False)
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
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)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
ManageInterface(False)
|
|
EgtSetGridGeo( -1, -1, -1, OptionModule.m_nExtSStep)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ORIGIN)
|
|
End Sub
|
|
|
|
#End Region ' CPlaneOrigin
|
|
|
|
#Region "CPlaneObj"
|
|
|
|
Private m_bCPlaneObj_IsActive As Boolean = False
|
|
Friend ReadOnly Property bCPlaneObj_IsActive As Boolean
|
|
Get
|
|
Return m_bCPlaneObj_IsActive
|
|
End Get
|
|
End Property
|
|
Friend Sub ResetCPlaneObjIsActive()
|
|
m_bCPlaneObj_IsActive = False
|
|
End Sub
|
|
Private m_PrevSelObjs As New List(Of Integer)
|
|
Friend ReadOnly Property PrevSelObjs As List(Of Integer)
|
|
Get
|
|
Return m_PrevSelObjs
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlanepObj.
|
|
''' </summary>
|
|
Public ReadOnly Property CPlaneObj_Command As ICommand
|
|
Get
|
|
If m_cmdCPlaneObj Is Nothing Then
|
|
m_cmdCPlaneObj = New Command(AddressOf CPlaneObj)
|
|
End If
|
|
Return m_cmdCPlaneObj
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand.
|
|
''' </summary>
|
|
Public Sub CPlaneObj(ByVal param As Object)
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
ManageInterface(False)
|
|
' salvo selezione precedente e deseleziono altri oggetti
|
|
m_PrevSelObjs.Clear()
|
|
Dim nSelObjId As Integer = EgtGetFirstSelectedObj()
|
|
While nSelObjId <> GDB_ID.NULL
|
|
m_PrevSelObjs.Add(nSelObjId)
|
|
nSelObjId = EgtGetNextSelectedObj()
|
|
End While
|
|
EgtDeselectAll()
|
|
m_bCPlaneObj_IsActive = True
|
|
Map.refControllerInputPanelVM.ShowMessage("Grid from Selection", "Select the face of the object where to place the grid")
|
|
End Sub
|
|
|
|
#End Region ' CPlaneObj
|
|
|
|
#Region "DragMove"
|
|
|
|
Public ReadOnly Property DragMove_Command As ICommand
|
|
Get
|
|
If m_cmdDragMove Is Nothing Then
|
|
m_cmdDragMove = New Command(AddressOf DragMove)
|
|
End If
|
|
Return m_cmdDragMove
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub DragMove()
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.BOTH)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MOVE)
|
|
End Sub
|
|
|
|
#End Region ' DragMove
|
|
|
|
#Region "DragRotate"
|
|
|
|
Public ReadOnly Property DragRotate_Command As ICommand
|
|
Get
|
|
If m_cmdDragRotate Is Nothing Then
|
|
m_cmdDragRotate = New Command(AddressOf DragRotate)
|
|
End If
|
|
Return m_cmdDragRotate
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub DragRotate()
|
|
If Map.refSceneHostVM.MainController.GetStep <> 0 OrElse m_bCPlaneObj_IsActive Then Return
|
|
InitCommand(FilledSolidSelectionTypes.BOTH)
|
|
Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.ROTATE)
|
|
End Sub
|
|
|
|
#End Region ' DragRotate
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|
|
|
|
Public Class FilledSolidEntity
|
|
Inherits VMBase
|
|
|
|
Public Enum FilledSolidTypes As Integer
|
|
FROMDRAW = 1
|
|
FROMIMPORT = 2
|
|
End Enum
|
|
|
|
Private Shared m_nSharedIndex As Integer = 0
|
|
Private ReadOnly Property nSharedIndex As Integer
|
|
Get
|
|
m_nSharedIndex += 1
|
|
Return m_nSharedIndex
|
|
End Get
|
|
End Property
|
|
Friend Shared Sub ResetSharedIndex()
|
|
m_nSharedIndex = 0
|
|
End Sub
|
|
|
|
Private m_Type As FilledSolidTypes
|
|
Public ReadOnly Property Type As FilledSolidTypes
|
|
Get
|
|
Return m_Type
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nCurveId As Integer = GDB_ID.NULL
|
|
Public ReadOnly Property nCurveId As Integer
|
|
Get
|
|
Return m_nCurveId
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nExtrusionId As Integer = GDB_ID.NULL
|
|
Public ReadOnly Property nExtrusionId As Integer
|
|
Get
|
|
Return m_nExtrusionId
|
|
End Get
|
|
End Property
|
|
Friend Sub SetExtrusionId(nId As Integer)
|
|
m_nExtrusionId = nId
|
|
EgtSetInfo(m_nCurveId, KEY_EXTRUSION_ID, m_nExtrusionId)
|
|
End Sub
|
|
|
|
Private m_nIndex As Integer
|
|
Public ReadOnly Property nIndex As Integer
|
|
Get
|
|
Return m_nIndex
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ghName As String
|
|
Get
|
|
Return String.Format("[{0}] {1}", {m_nIndex, If(m_Type = FilledSolidTypes.FROMDRAW, "Draw Filled Solid", "Import Filled Solid")})
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(Type As FilledSolidTypes, nId As Integer)
|
|
If Not EgtGetInfo(nId, FILLEDSOLID_ID, m_nIndex) Then
|
|
m_nIndex = FilledSolidPanelVM.GetNextFilledSolidIndex()
|
|
EgtSetInfo(nId, FILLEDSOLID_ID, m_nIndex)
|
|
End If
|
|
m_Type = Type
|
|
EgtSetInfo(nId, KEY_AUXSOLID_TYPE, Type)
|
|
Select Case Type
|
|
Case FilledSolidTypes.FROMDRAW
|
|
m_nCurveId = nId
|
|
Case FilledSolidTypes.FROMIMPORT
|
|
m_nExtrusionId = nId
|
|
End Select
|
|
End Sub
|
|
|
|
End Class
|