1239 lines
45 KiB
VB.net
1239 lines
45 KiB
VB.net
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class DxfImportWindowVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Costante per formato TRF
|
|
Private Const FT_TRF As Integer = 51
|
|
|
|
' Dati file corrente
|
|
Private m_sFilePath As String = String.Empty
|
|
Private m_nFileType As Integer = FT.NULL
|
|
Private m_bEnableTrf As Boolean = False
|
|
|
|
Private m_sCad2dName As String
|
|
Private m_sCad2dPath As String
|
|
|
|
Private m_nButton As Integer = 1
|
|
Public ReadOnly Property nButton As Integer
|
|
Get
|
|
Return m_nButton
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Open_IsEnabled As Boolean = True
|
|
Public Property Open_IsEnabled As Boolean
|
|
Get
|
|
Return m_Open_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Open_IsEnabled = value
|
|
NotifyPropertyChanged("Open_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Type_IsEnabled As Boolean = False
|
|
Public Property Type_IsEnabled As Boolean
|
|
Get
|
|
Return m_Type_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Type_IsEnabled = value
|
|
NotifyPropertyChanged("Type_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Measure_IsEnabled As Boolean = False
|
|
Public Property Measure_IsEnabled As Boolean
|
|
Get
|
|
Return m_Measure_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Measure_IsEnabled = value
|
|
NotifyPropertyChanged("Measure_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OkIsEnabled As Boolean = False
|
|
Public Property OkIsEnabled As Boolean
|
|
Get
|
|
Return m_OkIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_OkIsEnabled = value
|
|
NotifyPropertyChanged("OkIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UseRegionIsEnabled As Boolean = False
|
|
Public Property UseRegionIsEnabled As Boolean
|
|
Get
|
|
Return m_UseRegionIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_UseRegionIsEnabled = value
|
|
NotifyPropertyChanged("UseRegionIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UseLayerIsEnabled As Boolean = False
|
|
Public Property UseLayerIsEnabled As Boolean
|
|
Get
|
|
Return m_UseLayerIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_UseLayerIsEnabled = value
|
|
NotifyPropertyChanged("UseLayerIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UseClosedCurveIsEnabled As Boolean = False
|
|
Public Property UseClosedCurveIsEnabled As Boolean
|
|
Get
|
|
Return m_UseClosedCurveIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_UseClosedCurveIsEnabled = value
|
|
NotifyPropertyChanged("UseClosedCurveIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ResetIsEnabled As Boolean = False
|
|
Public Property ResetIsEnabled As Boolean
|
|
Get
|
|
Return m_ResetIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_ResetIsEnabled = value
|
|
NotifyPropertyChanged("ResetIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SideEntityControlVM As SideEntityControlVM
|
|
Private m_SideEntityControl As UserControl
|
|
Public Property SideEntityControl As UserControl
|
|
Get
|
|
Return m_SideEntityControl
|
|
End Get
|
|
Set(value As UserControl)
|
|
m_SideEntityControl = value
|
|
NotifyPropertyChanged("SideEntityControl")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SideEntity_IsEnabled As Boolean = False
|
|
Public Property SideEntity_IsEnabled As Boolean
|
|
Get
|
|
Return m_SideEntity_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_SideEntity_IsEnabled = value
|
|
NotifyPropertyChanged("SideEntity_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SideAngle_IsChecked As Boolean
|
|
Public Property SideAngle_IsChecked As Boolean
|
|
Get
|
|
Return m_SideAngle_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If m_Drip_IsChecked Or m_UnderDrill_IsChecked Or m_FiloTop_IsChecked Or m_Engrave_IsChecked Then Return
|
|
m_SideAngle_IsChecked = value
|
|
If value Then
|
|
' Aggiungo regioni per percorsi interni
|
|
AdjustSelectRegions()
|
|
' Messaggio di selezione contorno
|
|
SetOutputMessage(EgtMsg(MSG_DRAWPAGEUC + 6), MSG_TYPE.INFO) ' Selezionare un contorno
|
|
' Imposto modalità sideangle
|
|
m_SideEntityControlVM = New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.DXFIMPORT,
|
|
DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene,
|
|
SideEntityControlVM.ModeOpt.SIDEANGLE)
|
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
|
Open_IsEnabled = False
|
|
Type_IsEnabled = False
|
|
Measure_IsEnabled = False
|
|
PartData_Visibility = Visibility.Collapsed
|
|
OrderList_Visibility = Visibility.Collapsed
|
|
OkIsEnabled = False
|
|
Else
|
|
' Rimuovo regioni per percorsi interni
|
|
RemoveSelectRegions()
|
|
m_SideEntityControlVM.Close()
|
|
Open_IsEnabled = True
|
|
Type_IsEnabled = True
|
|
Measure_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
OkIsEnabled = True
|
|
m_SideEntityControlVM = Nothing
|
|
SideEntityControl = Nothing
|
|
' Elimino scritte angoli per input e inserisco quelle definitive
|
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Deseleziono tutto
|
|
DxfImportWindowMap.refDxfImportSceneHostV.Deselect()
|
|
' Pulisco area messaggi
|
|
ClearOutputMessage()
|
|
End If
|
|
NotifyPropertyChanged("SideAngle_IsChecked")
|
|
EgtZoom(ZM.ALL)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_FiloTop_IsChecked As Boolean
|
|
Public Property FiloTop_IsChecked As Boolean
|
|
Get
|
|
Return m_FiloTop_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If m_SideAngle_IsChecked Or m_Drip_IsChecked Or m_UnderDrill_IsChecked Or m_Engrave_IsChecked Then Return
|
|
m_FiloTop_IsChecked = value
|
|
If value Then
|
|
' Aggiungo regioni per percorsi interni
|
|
AdjustSelectRegions()
|
|
' Messaggio di selezione contorno
|
|
SetOutputMessage(EgtMsg(MSG_DRAWPAGEUC + 6), MSG_TYPE.INFO) ' Selezionare un contorno
|
|
' Imposto modalità FiloTop
|
|
m_SideEntityControlVM = New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.DXFIMPORT,
|
|
DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene,
|
|
SideEntityControlVM.ModeOpt.FILOTOP)
|
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
|
Open_IsEnabled = False
|
|
Type_IsEnabled = False
|
|
Measure_IsEnabled = False
|
|
PartData_Visibility = Visibility.Collapsed
|
|
OrderList_Visibility = Visibility.Collapsed
|
|
OkIsEnabled = False
|
|
Else
|
|
' Rimuovo regioni per percorsi interni
|
|
RemoveSelectRegions()
|
|
m_SideEntityControlVM.Close()
|
|
Open_IsEnabled = True
|
|
Type_IsEnabled = True
|
|
Measure_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
OkIsEnabled = True
|
|
m_SideEntityControlVM = Nothing
|
|
SideEntityControl = Nothing
|
|
' Elimino scritte angoli per input e inserisco quelle definitive
|
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Deseleziono tutto
|
|
DxfImportWindowMap.refDxfImportSceneHostV.Deselect()
|
|
' Pulisco area messaggi
|
|
ClearOutputMessage()
|
|
End If
|
|
NotifyPropertyChanged("FiloTop_IsChecked")
|
|
EgtZoom(ZM.ALL)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Engrave_IsChecked As Boolean
|
|
Public Property Engrave_IsChecked As Boolean
|
|
Get
|
|
Return m_Engrave_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If m_Drip_IsChecked Or m_UnderDrill_IsChecked Or m_FiloTop_IsChecked Or m_SideAngle_IsChecked Then Return
|
|
m_Engrave_IsChecked = value
|
|
If value Then
|
|
' Aggiungo regioni per percorsi interni
|
|
AdjustSelectRegions()
|
|
' Messaggio di selezione contorno
|
|
SetOutputMessage(EgtMsg(MSG_DRAWPAGEUC + 6), MSG_TYPE.INFO) ' Selezionare un contorno
|
|
' Imposto modalità sideangle
|
|
m_SideEntityControlVM = New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.DXFIMPORT,
|
|
DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene,
|
|
SideEntityControlVM.ModeOpt.ENGRAVE)
|
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
|
Open_IsEnabled = False
|
|
Type_IsEnabled = False
|
|
Measure_IsEnabled = False
|
|
PartData_Visibility = Visibility.Collapsed
|
|
OrderList_Visibility = Visibility.Collapsed
|
|
OkIsEnabled = False
|
|
Else
|
|
' Rimuovo regioni per percorsi interni
|
|
RemoveSelectRegions()
|
|
m_SideEntityControlVM.Close()
|
|
Open_IsEnabled = True
|
|
Type_IsEnabled = True
|
|
Measure_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
OkIsEnabled = True
|
|
m_SideEntityControlVM = Nothing
|
|
SideEntityControl = Nothing
|
|
' Elimino scritte angoli per input e inserisco quelle definitive
|
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Deseleziono tutto
|
|
DxfImportWindowMap.refDxfImportSceneHostV.Deselect()
|
|
' Pulisco area messaggi
|
|
ClearOutputMessage()
|
|
End If
|
|
NotifyPropertyChanged("EngraveIsChecked")
|
|
EgtZoom(ZM.ALL)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Drip_IsChecked As Boolean
|
|
Public Property Drip_IsChecked As Boolean
|
|
Get
|
|
Return m_Drip_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If m_SideAngle_IsChecked Or m_UnderDrill_IsChecked Or m_FiloTop_IsChecked Or m_Engrave_IsChecked Then Return
|
|
m_Drip_IsChecked = value
|
|
If value Then
|
|
' Messaggio di selezione contorno
|
|
SetOutputMessage(EgtMsg(MSG_DRAWPAGEUC + 6), MSG_TYPE.INFO) ' Selezionare un contorno
|
|
' Imposto modalità drip
|
|
m_SideEntityControlVM = New SideEntityControlVM(SideEntityControlVM.CallingWindowOpt.DXFIMPORT,
|
|
DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene,
|
|
SideEntityControlVM.ModeOpt.DRIP)
|
|
SideEntityControl = New SideEntityControlV(m_SideEntityControlVM)
|
|
Open_IsEnabled = False
|
|
Type_IsEnabled = False
|
|
Measure_IsEnabled = False
|
|
PartData_Visibility = Visibility.Collapsed
|
|
OrderList_Visibility = Visibility.Collapsed
|
|
OkIsEnabled = False
|
|
Else
|
|
m_SideEntityControlVM.Close()
|
|
Open_IsEnabled = True
|
|
Type_IsEnabled = True
|
|
Measure_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
OkIsEnabled = True
|
|
m_SideEntityControlVM = Nothing
|
|
SideEntityControl = Nothing
|
|
' Elimino scritte angoli per input e inserisco quelle definitive
|
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Deseleziono tutto
|
|
DxfImportWindowMap.refDxfImportSceneHostV.Deselect()
|
|
' Pulisco area messaggi
|
|
ClearOutputMessage()
|
|
End If
|
|
NotifyPropertyChanged("Drip_IsChecked")
|
|
EgtZoom(ZM.ALL)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UnderDrill_IsChecked As Boolean
|
|
Public Property UnderDrill_IsChecked As Boolean
|
|
Get
|
|
Return m_UnderDrill_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If m_SideAngle_IsChecked Or m_Drip_IsChecked Or m_FiloTop_IsChecked Or m_Engrave_IsChecked Then Return
|
|
m_UnderDrill_IsChecked = value
|
|
If value Then
|
|
' Aggiungo regioni di selezione per percorsi interni
|
|
AdjustSelectRegions()
|
|
' Disabilito SideAngleBtn, DripCutBtn e unità di misura
|
|
Open_IsEnabled = False
|
|
Type_IsEnabled = False
|
|
Measure_IsEnabled = False
|
|
PartData_Visibility = Visibility.Collapsed
|
|
OrderList_Visibility = Visibility.Collapsed
|
|
OkIsEnabled = False
|
|
' Disabilito bottone reset
|
|
ResetIsEnabled = False
|
|
' Messaggio di selezione da effettuare
|
|
SetOutputMessage(EgtMsg(MSG_DRAWPAGEUC + 15), MSG_TYPE.INFO) ' Selezionare uno o più fori
|
|
' Imposto modalità fori da sotto
|
|
SideEntityControl = New UnderDrillControlV(New UnderDrillControlVM(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene))
|
|
Else
|
|
' Rimuovo regioni per percorsi interni
|
|
RemoveSelectRegions()
|
|
SideEntityControl = Nothing
|
|
' Deseleziono eventuali pezzi rimasti selezionati
|
|
DxfImportWindowMap.refDxfImportSceneHostV.SelectedPart = GDB_ID.NULL
|
|
DxfImportWindowMap.refDxfImportSceneHostV.SelectedLayer = GDB_ID.NULL
|
|
EgtDeselectAll()
|
|
' Elimino regioni di selezione per percorsi interni
|
|
Dim nPartId As Integer = EgtGetFirstPart()
|
|
While nPartId <> GDB_ID.NULL
|
|
' Se layer con regioni di selezione dei percorsi interni non definito ...
|
|
Dim nSelRegId As Integer = EgtGetFirstNameInGroup(nPartId, SELECT_REGION_LAYER)
|
|
EgtErase(nSelRegId)
|
|
' Passo al pezzo successivo
|
|
nPartId = EgtGetNextPart(nPartId)
|
|
End While
|
|
' Riabilito SideAngleBtn, DripCutBtn e unità di misura
|
|
Open_IsEnabled = True
|
|
Type_IsEnabled = True
|
|
Measure_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
OkIsEnabled = True
|
|
' Riabilito bottone reset
|
|
ResetIsEnabled = True
|
|
' Pulisco area messaggi
|
|
ClearOutputMessage()
|
|
End If
|
|
NotifyPropertyChanged("UnderDrill_IsChecked")
|
|
EgtZoom(ZM.ALL)
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Drip_IsEnabled As Boolean
|
|
Public Property Drip_IsEnabled As Boolean
|
|
Get
|
|
Return m_Drip_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_Drip_IsEnabled = value
|
|
NotifyPropertyChanged("Drip_IsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MmIsChecked As Boolean = EgtUiUnitsAreMM()
|
|
Public Property MmIsChecked As Boolean
|
|
Get
|
|
Return m_MmIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_MmIsChecked Then
|
|
m_MmIsChecked = value
|
|
If Not String.IsNullOrWhiteSpace(m_sFilePath) Then
|
|
LoadCurrFile()
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property InchIsChecked As Boolean
|
|
Get
|
|
Return Not m_MmIsChecked
|
|
End Get
|
|
End Property
|
|
|
|
Private m_PartNum As Integer = 1
|
|
Public Property PartNum As String
|
|
Get
|
|
Return m_PartNum.ToString()
|
|
End Get
|
|
Set(value As String)
|
|
Dim TempPartNum As Integer = 0
|
|
StringToInt(value, TempPartNum)
|
|
m_PartNum = Math.Min(Math.Max(1, TempPartNum), 50)
|
|
NotifyPropertyChanged("PartNum")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_OutputMessage As String
|
|
Public Property OutputMessage As String
|
|
Get
|
|
Return m_OutputMessage
|
|
End Get
|
|
Set(value As String)
|
|
m_OutputMessage = value
|
|
NotifyPropertyChanged("OutputMessage")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MsgColor As Brush = Brushes.Black
|
|
Public Property MsgColor As Brush
|
|
Get
|
|
Return m_MsgColor
|
|
End Get
|
|
Set(value As Brush)
|
|
m_MsgColor = value
|
|
NotifyPropertyChanged("MsgColor")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TopIsChecked As Boolean = False
|
|
Public Property TopIsChecked As Boolean
|
|
Get
|
|
Return m_TopIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_TopIsChecked = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PartData_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property PartData_Visibility As Visibility
|
|
Get
|
|
Return m_PartData_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_PartData_Visibility = value
|
|
NotifyPropertyChanged("PartData_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_sOrder As String = ""
|
|
Public Property Order As String
|
|
Get
|
|
Return m_sOrder
|
|
End Get
|
|
Set(value As String)
|
|
m_sOrder = value
|
|
NotifyPropertyChanged("Order")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_sList As String = ""
|
|
Public Property List As String
|
|
Get
|
|
Return m_sList
|
|
End Get
|
|
Set(value As String)
|
|
m_sList = value
|
|
NotifyPropertyChanged("List")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_bEnableOrderList As Boolean = False
|
|
Private m_OrderList_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property OrderList_Visibility As Visibility
|
|
Get
|
|
Return m_OrderList_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_OrderList_Visibility = If( m_bEnableOrderList, value, Visibility.Collapsed)
|
|
NotifyPropertyChanged("OrderList_Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Cad2d_IsVisible As Visibility
|
|
Public Property Cad2d_IsVisible As Visibility
|
|
Get
|
|
Return m_Cad2d_IsVisible
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Cad2d_IsVisible = value
|
|
NotifyPropertyChanged("m_Cad2d_IsVisible")
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property TitleMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 13)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OpenDxfMsg As String
|
|
Get
|
|
Return "Open"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TypeMsg As String
|
|
Get
|
|
Return "Metodo"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property SideAngleMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 7)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EngraveMsg As String
|
|
Get
|
|
Return EgtMsg(90397)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DripMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 8)
|
|
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UnderDrillMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 14) 'Foro da sotto
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UseLayerMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UseClosedCurveMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 6)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property UseRegionMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ResetMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MeasureUnitMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MmMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 4)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property InchMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_IMPORTPAGEUC + 5)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OrderMsg As String
|
|
Get
|
|
Return EgtMsg( 90467) ' Ordine
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ListMsg As String
|
|
Get
|
|
Return EgtMsg( 90468) ' Distinta
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TopMsg As String
|
|
Get
|
|
Return EgtMsg( 90384) ' Indica lato sopra
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PartNumMsg As String
|
|
Get
|
|
Return EgtMsg( 90465) ' Quantità
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OkMsg As String
|
|
Get
|
|
Return "Ok"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CancelMsg As String
|
|
Get
|
|
Return "Cancel"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Cad2dMsg As String
|
|
Get
|
|
Return "Cad2d"
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property FiloTopMsg As String
|
|
Get
|
|
Return EgtMsg(90400) ' FiloTop
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comandi
|
|
Private m_cmdOpenDxf As ICommand
|
|
Private m_cmdUseLayer As ICommand
|
|
Private m_cmdUseClosedCurve As ICommand
|
|
Private m_cmdUseRegion As ICommand
|
|
Private m_cmdReset As ICommand
|
|
Private m_cmdCad2dBtn As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Avvio l'inizializzazione della mappa passandogli il riferimento al DxfImportWindowVM
|
|
DxfImportWindowMap.BeginInit(Me)
|
|
' impostazioni per Cad2d
|
|
GetMainPrivateProfileString(S_CAD2D, K_CAD2D_NAME, "", m_sCad2dName)
|
|
GetMainPrivateProfileString(S_CAD2D, K_CAD2D_EXEPATH, "", m_sCad2dPath)
|
|
If My.Computer.FileSystem.FileExists(m_sCad2dPath) Then
|
|
m_nButton = 2
|
|
Cad2d_IsVisible = Visibility.Visible
|
|
Else
|
|
m_nButton = 1
|
|
Cad2d_IsVisible = Visibility.Collapsed
|
|
End If
|
|
' imposto importazione TRF
|
|
m_bEnableTrf = (OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.TRF_IMPORT))
|
|
' imposto abilitazione Ordine e Distinta in import DXF
|
|
m_bEnableOrderList = (GetMainPrivateProfileInt(S_COMPO, K_CSVDATA, 0) <> 0)
|
|
' imposto quantità
|
|
m_PartNum = 1
|
|
NotifyPropertyChanged("PartNum")
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Function LoadCurrFile() As Boolean
|
|
' Pulisco il DB geometrico locale
|
|
EgtNewFile()
|
|
' Riconoscimento tipo
|
|
m_nFileType = EgtGetFileType(m_sFilePath)
|
|
If m_nFileType = FT.NULL And m_bEnableTrf And Path.GetExtension(m_sFilePath).ToUpper() = ".TRF" Then m_nFileType = FT_TRF
|
|
Select Case m_nFileType
|
|
Case FT.DXF
|
|
' recupero unità di misura del file
|
|
Dim dScale As Double = If(m_MmIsChecked, ONEMM, ONEINCH)
|
|
' Importo file DXF
|
|
If Not EgtImportDxf(m_sFilePath, dScale) Then Return False
|
|
' Riporto al piano tutte le superifici
|
|
EgtSelectAll()
|
|
EgtScale(GDB_ID.SEL, Frame3d.GLOB, 1, 1, 0)
|
|
EgtDeselectAll()
|
|
Case FT.NGE
|
|
' Carico Nge
|
|
If Not EgtOpenFile(m_sFilePath) Then Return False
|
|
' Filtro Nge
|
|
EstProject.FilterNge()
|
|
Case FT_TRF
|
|
' Carico Trf
|
|
If Not ImportTrf(m_sFilePath) Then Return False
|
|
Case Else
|
|
Return False
|
|
End Select
|
|
' se formato DXF o NGE
|
|
If m_nFileType = FT.DXF Or m_nFileType = FT.NGE Then
|
|
' Aggiorno stato visualizzazione bottoni
|
|
UseRegionIsEnabled = True
|
|
UseLayerIsEnabled = True
|
|
UseClosedCurveIsEnabled = True
|
|
ResetIsEnabled = False
|
|
Measure_IsEnabled = (m_nFileType = FT.DXF)
|
|
OkIsEnabled = False
|
|
SideEntity_IsEnabled = False
|
|
Drip_IsEnabled = False
|
|
ElseIf m_nFileType = FT_TRF Then
|
|
UseRegionIsEnabled = False
|
|
UseLayerIsEnabled = False
|
|
UseClosedCurveIsEnabled = False
|
|
ResetIsEnabled = False
|
|
Measure_IsEnabled = False
|
|
OkIsEnabled = True
|
|
SideEntity_IsEnabled = False
|
|
Drip_IsEnabled = False
|
|
End If
|
|
' Eseguo zoom
|
|
EgtZoom(ZM.ALL)
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ImportTrf(sPath As String) As Boolean
|
|
' Definizione variabili
|
|
EgtLuaCreateGlobTable("TRF")
|
|
EgtLuaSetGlobStringVar("TRF.FILE", sPath)
|
|
' Path script da eseguire
|
|
Dim sLuaPath = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTrfAutoDir & "\TrfRead.lua"
|
|
' Esecuzione
|
|
Dim nErr As Integer = 999
|
|
If EgtLuaExecFile(sLuaPath) AndAlso
|
|
EgtLuaExecLine("TRF.Read()") Then
|
|
' Verifica stato di errore
|
|
EgtLuaGetGlobIntVar("TRF.ERR", nErr)
|
|
End If
|
|
If nErr <> 0 Then EgtOutLog("Error in TrfRead : " & nErr.ToString())
|
|
EgtLuaResetGlobVar("TRF")
|
|
Return (nErr = 0)
|
|
End Function
|
|
|
|
Friend Sub LoadFlatParts()
|
|
' Cancello regioni di selezione dai pezzi
|
|
Dim PartId As Integer = EgtGetFirstPart()
|
|
While PartId <> GDB_ID.NULL
|
|
EgtErase(EgtGetFirstNameInGroup(PartId, SELECT_REGION_LAYER))
|
|
PartId = EgtGetNextPart(PartId)
|
|
End While
|
|
' identificativo univoico del gruppo di pezzi, se più di un pezzo
|
|
Dim sGUICode As New List(Of String)
|
|
' Scrivo testi per nesting
|
|
SideEntityControlVM.WriteSideAngleForNest(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Imposto riferimento sul centro geometrico di ogni pezzo
|
|
VeinMatching.SetRefOnAllParts()
|
|
' Eventuale spostamento dei pezzi per stare nell'area valida
|
|
If Not VeinMatching.PutAllPartsOnValidPosition() Then
|
|
' Ingombro dei pezzi DXF troppo grande per VeinMatching
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage( EgtMsg( 91608), 5, MSG_TYPE.WARNING)
|
|
EgtOutLog( "Warning : Dxf parts BoundingBox too big for VeinMatching")
|
|
End If
|
|
' Eventuale pulizia VeinMatching
|
|
Dim bVmClear As Boolean = ( GetMainPrivateProfileInt(S_VEINMATCHING, K_VEINMA_CLEARONNEWDXF, 1) <> 0)
|
|
If bVmClear Then VeinMatching.Clear()
|
|
' Salvo tutti i pezzi in un file temporaneo
|
|
Dim sTmpFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\FlatPart" & ".Nge"
|
|
If Not EgtSaveFile(sTmpFile, NGE.BIN) Then Return
|
|
' Passo al contesto principale
|
|
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
|
' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio)
|
|
Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
|
|
' Elimino eventuali precedenti pezzi vuoti
|
|
EgtEraseEmptyParts()
|
|
' creo il riferimento
|
|
If m_PartNum > 1 Then
|
|
' per ogni pezze del file DXF creo un gruppo
|
|
Dim nIdTemp As Integer = EgtGetFirstPart()
|
|
While nIdTemp <> GDB_ID.NULL
|
|
Dim sPreGuid As String = CreatePreGuidCode(nIdTemp)
|
|
sGUICode.Add(sPreGuid & System.Guid.NewGuid.ToString)
|
|
nIdTemp = EgtGetNextPart(nIdTemp)
|
|
End While
|
|
End If
|
|
' Inserisco i pezzi nell'ambiente principale e recupero Id primo pezzo inserito
|
|
Dim nFirstId As Integer = EgtGetLastPart()
|
|
For nInd As Integer = 1 To m_PartNum
|
|
Dim nFirst2Id As Integer = EgtGetLastPart()
|
|
EgtInsertFile(sTmpFile)
|
|
Dim FirstOfImport As Integer = EgtGetNextPart(nFirst2Id)
|
|
Dim Index As Integer = 1
|
|
While FirstOfImport <> GDB_ID.NULL And Index <= sGUICode.Count
|
|
If Not String.IsNullOrEmpty(sGUICode(Index - 1)) Then
|
|
EgtSetInfo(FirstOfImport, INFO_REFGROUP, sGUICode(Index - 1))
|
|
Index += 1
|
|
Else
|
|
Exit While
|
|
End If
|
|
FirstOfImport = EgtGetNextPart(FirstOfImport)
|
|
End While
|
|
nFirst2Id = If(nFirst2Id <> GDB_ID.NULL, EgtGetNextPart(nFirst2Id), EgtGetFirstPart())
|
|
Next
|
|
nFirstId = If(nFirstId <> GDB_ID.NULL, EgtGetNextPart(nFirstId), EgtGetFirstPart())
|
|
' Cancello il file
|
|
If My.Computer.FileSystem.FileExists(sTmpFile) Then
|
|
My.Computer.FileSystem.DeleteFile(sTmpFile)
|
|
End If
|
|
' Nascondo tutti i pezzi inseriti (per evitare interferenze con pezzi in fase di parcheggio)
|
|
Dim nId As Integer = nFirstId
|
|
While nId <> GDB_ID.NULL
|
|
EgtSetStatus(nId, GDB_ST.OFF)
|
|
' Passo al pezzo successivo
|
|
nId = EgtGetNextPart(nId)
|
|
End While
|
|
' Ciclo sui pezzi inseriti
|
|
nId = nFirstId
|
|
While nId <> GDB_ID.NULL
|
|
' lo salvo come Id originale
|
|
EgtSetInfo(nId, KEY_ORI_ID, nId)
|
|
' Muovo la regione in Z per evitare problemi in visualizzazione
|
|
Dim nRegId = EgtGetFirstNameInGroup(nId, NAME_REGION)
|
|
EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
|
|
' Se file origine Dxf o Nge
|
|
If m_nFileType = FT.DXF Or m_nFileType = FT.NGE Then
|
|
' Eventuale testo per indicare il sopra
|
|
If TopIsChecked Then
|
|
AddTopToPartRegion( nRegId)
|
|
End If
|
|
' Se richiesti, inserisco dati Ordine, Distinta, Nome, Origine
|
|
If m_bEnableOrderList Then
|
|
' Cerco il nome del pezzo
|
|
Dim sName As String = ""
|
|
EgtGetName( nId, sName)
|
|
' Recupero il box del pezzo
|
|
Dim b3Reg As New BBox3d : EgtGetBBox( nRegId, GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, b3Reg)
|
|
' Aggiungo info equivalenti a CSV
|
|
EgtSetInfo(nId, INFO_CSV_PART, sName)
|
|
EgtSetInfo(nId, INFO_CSV_ORD, Order)
|
|
EgtSetInfo(nId, INFO_CSV_DIST, List)
|
|
EgtSetInfo(nId, INFO_CSV_MAT, CurrentMachine.CurrMat.sName)
|
|
EgtSetInfo(nId, INFO_CSV_V1, b3Reg.DimX())
|
|
EgtSetInfo(nId, INFO_CSV_V2, b3Reg.DimY())
|
|
End If
|
|
End If
|
|
' Imposto colore testi
|
|
EstCalc.SetTextColor( nRegId)
|
|
' Imposto path di provenienza
|
|
EgtSetInfo(nId, INFO_SOU_PATH, m_sFilePath)
|
|
' Lo rendo visibile
|
|
EgtSetStatus(nId, GDB_ST.ON_)
|
|
' Eventuale inserimento pezzo in VeinMatching (prima del parcheggio per conservare la posizione originale)
|
|
VeinMatching.AddPart(nId)
|
|
' Inserisco in parcheggio
|
|
EstCalc.StoreOnePart(nId, True)
|
|
' Recupero Id di pezzo successivo
|
|
Dim nNextId As Integer = EgtGetNextPart(nId)
|
|
' Se richiesto posizionamento diretto, lo eseguo
|
|
If bDirect Then
|
|
If EstCalc.InsertOnePart(nId, CurrentMachine.bAligned, CurrentMachine.bReducedCut) Then
|
|
' Eventuale notifica al VeinMatching
|
|
VeinMatching.OnInsertPartInRaw(nId)
|
|
End If
|
|
End If
|
|
' Passo al pezzo successivo
|
|
nId = nNextId
|
|
End While
|
|
|
|
' Eventuale aggiornamento VeinMatching
|
|
VeinMatching.ZoomAll()
|
|
' Aggiorno ambiente principale
|
|
EgtZoom(ZM.ALL)
|
|
End Sub
|
|
|
|
Friend Function VerifyIfSelectPart() As Boolean
|
|
' Solo se in modalità angoli o gocciolatoio su lati esterni
|
|
Return (SideAngle_IsChecked Or Drip_IsChecked)
|
|
End Function
|
|
|
|
Friend Sub SelectedPartChanged()
|
|
' Se sono in modalità inclinazioni o gocciolatoio calcolo lati inclinabili e creo testi
|
|
If SideAngle_IsChecked() Or Drip_IsChecked() Or FiloTop_IsChecked Or Engrave_IsChecked Then
|
|
m_SideEntityControlVM.ReLoadSideAnglePage(SideEntityControlVM.CallingWindowOpt.DXFIMPORT)
|
|
End If
|
|
End Sub
|
|
|
|
Private Function AdjustSelectRegions() As Boolean
|
|
' Ciclo sui pezzi
|
|
Dim nPartId As Integer = EgtGetFirstPart()
|
|
While nPartId <> GDB_ID.NULL
|
|
' Se layer con regioni di selezione dei percorsi interni non definito ...
|
|
Dim nSelRegId As Integer = EgtGetFirstNameInGroup(nPartId, SELECT_REGION_LAYER)
|
|
If nSelRegId = GDB_ID.NULL Then
|
|
' Creo layer per regioni di selezione
|
|
nSelRegId = EgtCreateGroup(nPartId)
|
|
EgtSetName(nSelRegId, SELECT_REGION_LAYER)
|
|
RegionFromGroup(nPartId, nSelRegId, NAME_INLOOP)
|
|
RegionFromGroup(nPartId, nSelRegId, NAME_UNDERDRILL)
|
|
End If
|
|
' Passo al pezzo successivo
|
|
nPartId = EgtGetNextPart(nPartId)
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Function RemoveSelectRegions() As Boolean
|
|
' Ciclo sui pezzi
|
|
Dim nPartId As Integer = EgtGetFirstPart()
|
|
While nPartId <> GDB_ID.NULL
|
|
' Se layer con regioni di selezione dei percorsi interni non definito ...
|
|
Dim nSelRegId As Integer = EgtGetFirstNameInGroup(nPartId, SELECT_REGION_LAYER)
|
|
EgtErase(nSelRegId)
|
|
' Passo al pezzo successivo
|
|
nPartId = EgtGetNextPart(nPartId)
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub RegionFromGroup(nPartId As Integer, nSelRegId As Integer, GroupName As String)
|
|
' Ciclo sui percorsi interni chiusi
|
|
Dim nIntLayId As Integer = EgtGetFirstNameInGroup(nPartId, GroupName)
|
|
While nIntLayId <> GDB_ID.NULL
|
|
' Recupero gli identificatori delle curve che formano il loop
|
|
Dim vCrvId As New List(Of Integer)
|
|
Dim nCrvId As Integer = EgtGetFirstInGroup(nIntLayId)
|
|
While nCrvId <> GDB_ID.NULL
|
|
Dim nType As Integer = EgtGetType(nCrvId)
|
|
If (UnderDrill_IsChecked And nType = GDB_TY.CRV_ARC) Or ((SideAngle_IsChecked Or FiloTop_IsChecked) And (nType = GDB_TY.CRV_LINE Or nType = GDB_TY.CRV_ARC Or nType = GDB_TY.CRV_COMPO)) Then
|
|
vCrvId.Add(nCrvId)
|
|
End If
|
|
nCrvId = EgtGetNext(nCrvId)
|
|
End While
|
|
' Creo curva chiusa
|
|
Dim nLoopId As Integer = EgtCreateCurveCompoByReorder(nSelRegId, vCrvId.Count(), vCrvId.ToArray(), Point3d.ORIG(), False)
|
|
EgtInvertCurve(nLoopId)
|
|
' Creo superficie
|
|
Dim nRegId As Integer = EgtCreateSurfFlatRegion(nSelRegId, nLoopId)
|
|
EgtSetName(nRegId, nIntLayId.ToString())
|
|
EgtSetInfo(nRegId, "ID", nIntLayId)
|
|
EgtSetColor(nRegId, New Color3d(0, 255, 0, 25))
|
|
EgtErase(nLoopId)
|
|
If GroupName = NAME_UNDERDRILL Then
|
|
EgtSelectObj(nRegId)
|
|
EgtSelectObj(nIntLayId)
|
|
End If
|
|
' Passo al successivo layer interno
|
|
nIntLayId = EgtGetNextName(nIntLayId, GroupName)
|
|
End While
|
|
End Sub
|
|
|
|
Friend Overloads Sub SetOutputMessage(sMessage As String, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
|
|
SetMsgColor(nMsgType)
|
|
m_OutputMessage = sMessage
|
|
NotifyPropertyChanged("OutputMessage")
|
|
End Sub
|
|
|
|
Friend Sub ClearOutputMessage()
|
|
m_MsgColor = Brushes.Black
|
|
NotifyPropertyChanged("MsgColor")
|
|
m_OutputMessage = String.Empty
|
|
NotifyPropertyChanged("OutputMessage")
|
|
End Sub
|
|
|
|
Private Sub SetMsgColor(nMsgType As MSG_TYPE)
|
|
Select Case nMsgType
|
|
Case MSG_TYPE.INFO
|
|
m_MsgColor = Brushes.White
|
|
Case MSG_TYPE.WARNING
|
|
m_MsgColor = Brushes.Gold
|
|
Case MSG_TYPE.ERROR_
|
|
m_MsgColor = Brushes.Red
|
|
End Select
|
|
NotifyPropertyChanged("MsgColor")
|
|
End Sub
|
|
|
|
' metodo utilizzato per definire il colore dei pezzi DXF importati
|
|
Private Sub ColorRegion(nCtx As Integer)
|
|
|
|
' Leggo dati corrispondenza colore
|
|
Dim InsertColor As Color3d = CompoColor(IniFile.m_sIniFile)
|
|
|
|
' Imposto contesto corrente
|
|
EgtSetCurrentContext(nCtx)
|
|
' Ciclo sui pezzi
|
|
Dim PartId As Integer = EgtGetFirstPart()
|
|
While PartId <> GDB_ID.NULL
|
|
' Ciclo sui layer delle regioni
|
|
Dim RegionId As Integer = EgtGetFirstNameInGroup(PartId, NAME_REGION)
|
|
While RegionId <> GDB_ID.NULL
|
|
EgtSetColor(RegionId, InsertColor)
|
|
' Ciclo sulle regioni
|
|
Dim EntId As Integer = EgtGetFirstInGroup(RegionId)
|
|
While EntId <> GDB_ID.NULL
|
|
If EgtGetType(EntId) = GDB_TY.SRF_FRGN Then EgtSetColor(EntId, InsertColor)
|
|
EntId = EgtGetNext(EntId)
|
|
End While
|
|
RegionId = EgtGetNextName(PartId, NAME_REGION)
|
|
End While
|
|
' passo al pezzo successico
|
|
PartId = EgtGetNextPart(PartId)
|
|
End While
|
|
' Aggiorno scritte per angoli sui lati
|
|
'WriteSideAngleForNest(nCtx)
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "OpenDxfCommand"
|
|
|
|
Public ReadOnly Property OpenDxfCommand As ICommand
|
|
Get
|
|
If m_cmdOpenDxf Is Nothing Then
|
|
m_cmdOpenDxf = New Command(AddressOf OpenDxf)
|
|
End If
|
|
Return m_cmdOpenDxf
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OpenDxf(ByVal param As Object)
|
|
' Scelgo file da importare
|
|
Dim DxfDlg As New Microsoft.Win32.OpenFileDialog()
|
|
DxfDlg.Title = "Open"
|
|
Dim sFilter As String = "Dxf file(*.dxf)|*.dxf|"
|
|
If m_bEnableTrf Then sFilter &= "Trf file(*.trf)|*.trf|"
|
|
sFilter &= "New geometry EgalTech(*.nge)|*.nge"
|
|
DxfDlg.Filter = sFilter
|
|
DxfDlg.FilterIndex = 1
|
|
GetMainPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, "", DxfDlg.InitialDirectory)
|
|
If Not Directory.Exists(DxfDlg.InitialDirectory) Then DxfDlg.InitialDirectory = ""
|
|
If Not DxfDlg.ShowDialog() Then Return
|
|
' Assegno path del file
|
|
m_sFilePath = DxfDlg.FileName
|
|
' Salvo nuovo direttorio corrente per DXF
|
|
WriteMainPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, Path.GetDirectoryName(m_sFilePath))
|
|
' Carico il file
|
|
LoadCurrFile()
|
|
Type_IsEnabled = True
|
|
PartData_Visibility = Visibility.Visible
|
|
OrderList_Visibility = Visibility.Visible
|
|
End Sub
|
|
|
|
#End Region ' OpenDxfCommand
|
|
|
|
#Region "UseRegionCommand"
|
|
|
|
Public ReadOnly Property UseRegionCommand As ICommand
|
|
Get
|
|
If m_cmdUseRegion Is Nothing Then
|
|
m_cmdUseRegion = New Command(AddressOf UseRegion)
|
|
End If
|
|
Return m_cmdUseRegion
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub UseRegion(ByVal param As Object)
|
|
' Creo i pezzi
|
|
Dim nType As Integer = If(m_nFileType = FT.NGE, FPC_TYPE.NGE, FPC_TYPE.REGION)
|
|
Dim dToler As Double = GetPrivateProfileDouble(S_FLATPARTS, K_FLPTOLERANCE, 0.1, IniFile.m_sIniFile)
|
|
EgtCreateAdjustFlatParts(nType, dToler)
|
|
' Se prevista gestione colore->angolo di fianco
|
|
If GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToSideAngle(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
' Se prevista gestione colore->incisioni
|
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Eseguo zoom
|
|
EgtZoom(ZM.ALL)
|
|
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
|
UseRegionIsEnabled = False
|
|
UseLayerIsEnabled = False
|
|
UseClosedCurveIsEnabled = False
|
|
ResetIsEnabled = True
|
|
OkIsEnabled = True
|
|
' abilito bottone angoli su lati esterni
|
|
SideEntity_IsEnabled = True
|
|
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption( KEY_OPT.UNDER_CUT) And
|
|
Not String.IsNullOrWhiteSpace( CurrentMachine.sCurrDripSaw)
|
|
End Sub
|
|
|
|
#End Region ' UseRegionCommand
|
|
|
|
#Region "UseLayerCommand"
|
|
|
|
Public ReadOnly Property UseLayerCommand As ICommand
|
|
Get
|
|
If m_cmdUseLayer Is Nothing Then
|
|
m_cmdUseLayer = New Command(AddressOf UseLayer)
|
|
End If
|
|
Return m_cmdUseLayer
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub UseLayer(ByVal param As Object)
|
|
' Creo i pezzi
|
|
Dim nType As Integer = If(m_nFileType = FT.NGE, FPC_TYPE.NGE, FPC_TYPE.LAYER)
|
|
Dim dToler As Double = GetPrivateProfileDouble(S_FLATPARTS, K_FLPTOLERANCE, 0.1, IniFile.m_sIniFile)
|
|
EgtCreateAdjustFlatParts(nType, dToler)
|
|
' Se prevista gestione colore->angolo di fianco
|
|
If GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToSideAngle(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
' Se prevista gestione colore->incisioni
|
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Eseguo zoom
|
|
EgtZoom(ZM.ALL)
|
|
' disabilito bottoni UseLayer. UseRegion e UseClosedCurve, abilito bottoni Reset e Insert
|
|
UseRegionIsEnabled = False
|
|
UseLayerIsEnabled = False
|
|
UseClosedCurveIsEnabled = False
|
|
ResetIsEnabled = True
|
|
OkIsEnabled = True
|
|
' abilito bottone angoli su lati esterni
|
|
SideEntity_IsEnabled = True
|
|
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption( KEY_OPT.UNDER_CUT) And
|
|
Not String.IsNullOrWhiteSpace( CurrentMachine.sCurrDripSaw)
|
|
End Sub
|
|
|
|
#End Region ' UseLayerCommand
|
|
|
|
#Region "UseClosedCurveCommand"
|
|
|
|
Public ReadOnly Property UseClosedCurveCommand As ICommand
|
|
Get
|
|
If m_cmdUseClosedCurve Is Nothing Then
|
|
m_cmdUseClosedCurve = New Command(AddressOf UseClosedCurve)
|
|
End If
|
|
Return m_cmdUseClosedCurve
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub UseClosedCurve(ByVal param As Object)
|
|
' Creo i pezzi
|
|
Dim nType As Integer = If(m_nFileType = FT.NGE, FPC_TYPE.NGE, FPC_TYPE.CLOSEDCURVE)
|
|
Dim dToler As Double = GetPrivateProfileDouble(S_FLATPARTS, K_FLPTOLERANCE, 0.1, IniFile.m_sIniFile)
|
|
EgtCreateAdjustFlatParts(nType, dToler)
|
|
' Se prevista gestione colore->angolo di fianco
|
|
If GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToSideAngle(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
' Se prevista gestione colore->incisioni
|
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, IniFile.m_sIniFile) <> 0 Then
|
|
SideEntityControlVM.ColorToEngrave(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
End If
|
|
ColorRegion(DxfImportWindowMap.refDxfImportSceneHostV.ImportDxfScene.GetCtx())
|
|
' Eseguo zoom
|
|
EgtZoom(ZM.ALL)
|
|
' disabilito bottoni UseLayer e UseRegion, abilito bottoni Reset e Insert
|
|
UseRegionIsEnabled = False
|
|
UseLayerIsEnabled = False
|
|
UseClosedCurveIsEnabled = False
|
|
ResetIsEnabled = True
|
|
OkIsEnabled = True
|
|
' abilito bottone angoli su lati esterni
|
|
SideEntity_IsEnabled = True
|
|
Drip_IsEnabled = OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption( KEY_OPT.UNDER_CUT) And
|
|
Not String.IsNullOrWhiteSpace( CurrentMachine.sCurrDripSaw)
|
|
End Sub
|
|
|
|
#End Region ' UseClosedCurveCommand
|
|
|
|
#Region "ResetCommand"
|
|
|
|
Public ReadOnly Property ResetCommand As ICommand
|
|
Get
|
|
If m_cmdReset Is Nothing Then
|
|
m_cmdReset = New Command(AddressOf Reset)
|
|
End If
|
|
Return m_cmdReset
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Reset(ByVal param As Object)
|
|
' Ricarico file corrente
|
|
LoadCurrFile()
|
|
' abilito bottone angoli su lati esterni
|
|
SideEntity_IsEnabled = False
|
|
Drip_IsEnabled = False
|
|
End Sub
|
|
|
|
#End Region ' ResetCommand
|
|
|
|
#Region "Cad2dCommand"
|
|
|
|
' Returns a command that manage the MainWindow_Unloaded command
|
|
Public ReadOnly Property Cad2dBtnCommand() As ICommand
|
|
Get
|
|
If m_cmdCad2dBtn Is Nothing Then
|
|
m_cmdCad2dBtn = New Command(AddressOf Cad2dBtn)
|
|
End If
|
|
Return m_cmdCad2dBtn
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Cad2dBtn()
|
|
Dim ProcsCad2d As Process() = Process.GetProcessesByName(m_sCad2dName)
|
|
If ProcsCad2d.Length() > 0 Then
|
|
ShowWindow(ProcsCad2d(0).MainWindowHandle, 3)
|
|
Else
|
|
Try
|
|
Process.Start(m_sCad2dPath)
|
|
Catch ex As Exception
|
|
EgtOutLog(ex.ToString)
|
|
End Try
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Cad2dCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|