Merge remote-tracking branch 'ICARUS/main' into NewInterface

This commit is contained in:
Emmanuele Sassi
2023-01-04 12:24:30 +01:00
64 changed files with 41 additions and 2990 deletions
-275
View File
@@ -1,275 +0,0 @@
' Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
'
' Step 1a) Using this custom control in a XAML file that exists in the current project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Icarus"
'
'
' Step 1b) Using this custom control in a XAML file that exists in a different project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Icarus;assembly=Icarus"
'
' You will also need to add a project reference from the project where the XAML file lives
' to this project and Rebuild to avoid compilation errors:
'
' Right click on the target project in the Solution Explorer and
' "Add Reference"->"Projects"->[Browse to and select this project]
'
'
' Step 2)
' Go ahead and use your control in the XAML file. Note that Intellisense in the
' XML editor does not currently work on custom controls and its child elements.
'
' <MyNamespace:AirspacePopup/>
'
Imports System.Windows.Controls.Primitives
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Interop
Public Class AirspacePopup
Inherits Popup
Public Shared ReadOnly IsTopmostProperty As DependencyProperty = DependencyProperty.Register("IsTopmost", GetType(Boolean), GetType(AirspacePopup), New FrameworkPropertyMetadata(False, AddressOf OnIsTopmostChanged))
Public Shared ReadOnly FollowPlacementTargetProperty As DependencyProperty = DependencyProperty.RegisterAttached("FollowPlacementTarget", GetType(Boolean), GetType(AirspacePopup), New UIPropertyMetadata(False))
Public Shared ReadOnly AllowOutsideScreenPlacementProperty As DependencyProperty = DependencyProperty.RegisterAttached("AllowOutsideScreenPlacement", GetType(Boolean), GetType(AirspacePopup), New UIPropertyMetadata(False))
Public Shared ReadOnly ParentWindowProperty As DependencyProperty = DependencyProperty.RegisterAttached("ParentWindow", GetType(Window), GetType(AirspacePopup), New UIPropertyMetadata(Nothing, AddressOf ParentWindowPropertyChanged))
Private Shared Sub OnIsTopmostChanged(ByVal source As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
Dim airspacePopup As AirspacePopup = TryCast(source, AirspacePopup)
airspacePopup.SetTopmostState(airspacePopup.IsTopmost)
End Sub
Private Shared Sub ParentWindowPropertyChanged(ByVal source As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
Dim airspacePopup As AirspacePopup = TryCast(source, AirspacePopup)
airspacePopup.ParentWindowChanged()
End Sub
Private m_appliedTopMost As Boolean?
Private m_alreadyLoaded As Boolean
Private m_parentWindow As Window
Shared Sub New()
'This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
'This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(GetType(AirspacePopup), New FrameworkPropertyMetadata(GetType(AirspacePopup)))
End Sub
Public Sub New()
AddHandler Loaded, AddressOf OnPopupLoaded
AddHandler Unloaded, AddressOf OnPopupUnloaded
Dim descriptor As DependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(PlacementTargetProperty, GetType(AirspacePopup))
descriptor.AddValueChanged(Me, AddressOf PlacementTargetChanged)
End Sub
Public Property IsTopmost As Boolean
Get
Return CBool(GetValue(IsTopmostProperty))
End Get
Set(ByVal value As Boolean)
SetValue(IsTopmostProperty, value)
End Set
End Property
Public Property FollowPlacementTarget As Boolean
Get
Return CBool(GetValue(FollowPlacementTargetProperty))
End Get
Set(ByVal value As Boolean)
SetValue(FollowPlacementTargetProperty, value)
End Set
End Property
Public Property AllowOutsideScreenPlacement As Boolean
Get
Return CBool(GetValue(AllowOutsideScreenPlacementProperty))
End Get
Set(ByVal value As Boolean)
SetValue(AllowOutsideScreenPlacementProperty, value)
End Set
End Property
Public Property ParentWindow As Window
Get
Return CType(GetValue(ParentWindowProperty), Window)
End Get
Set(ByVal value As Window)
SetValue(ParentWindowProperty, value)
End Set
End Property
Private Sub ParentWindowChanged()
If ParentWindow IsNot Nothing Then
AddHandler ParentWindow.LocationChanged, Function(sender, e2)
UpdatePopupPosition()
End Function
AddHandler ParentWindow.SizeChanged, Function(sender, e2)
UpdatePopupPosition()
End Function
End If
End Sub
Private Sub PlacementTargetChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim placementTarget As FrameworkElement = TryCast(Me.PlacementTarget, FrameworkElement)
If placementTarget IsNot Nothing Then
AddHandler placementTarget.SizeChanged, Function(sender2, e2)
UpdatePopupPosition()
End Function
End If
End Sub
Private Sub UpdatePopupPosition()
Dim placementTarget As FrameworkElement = TryCast(Me.PlacementTarget, FrameworkElement)
Dim child As FrameworkElement = TryCast(Me.Child, FrameworkElement)
If PresentationSource.FromVisual(placementTarget) IsNot Nothing AndAlso AllowOutsideScreenPlacement = True Then
Dim leftOffset As Double = CutLeft(placementTarget)
Dim topOffset As Double = CutTop(placementTarget)
Dim rightOffset As Double = CutRight(placementTarget)
Dim bottomOffset As Double = CutBottom(placementTarget)
Debug.WriteLine(bottomOffset)
Me.Width = Math.Max(0, Math.Min(leftOffset, rightOffset) + placementTarget.ActualWidth)
Me.Height = Math.Max(0, Math.Min(topOffset, bottomOffset) + placementTarget.ActualHeight)
If child IsNot Nothing Then
child.Margin = New Thickness(leftOffset, topOffset, rightOffset, bottomOffset)
End If
End If
If FollowPlacementTarget = True Then
Me.HorizontalOffset += 0.01
Me.HorizontalOffset -= 0.01
End If
End Sub
Private Function CutLeft(ByVal placementTarget As FrameworkElement) As Double
Dim point As Point = placementTarget.PointToScreen(New Point(0, placementTarget.ActualWidth))
Return Math.Min(0, point.X)
End Function
Private Function CutTop(ByVal placementTarget As FrameworkElement) As Double
Dim point As Point = placementTarget.PointToScreen(New Point(placementTarget.ActualHeight, 0))
Return Math.Min(0, point.Y)
End Function
Private Function CutRight(ByVal placementTarget As FrameworkElement) As Double
Dim point As Point = placementTarget.PointToScreen(New Point(0, placementTarget.ActualWidth))
point.X += placementTarget.ActualWidth
Return Math.Min(0, SystemParameters.VirtualScreenWidth - (Math.Max(SystemParameters.VirtualScreenWidth, point.X)))
End Function
Private Function CutBottom(ByVal placementTarget As FrameworkElement) As Double
Dim point As Point = placementTarget.PointToScreen(New Point(placementTarget.ActualHeight, 0))
point.Y += placementTarget.ActualHeight
Return Math.Min(0, SystemParameters.VirtualScreenHeight - (Math.Max(SystemParameters.VirtualScreenHeight, point.Y)))
End Function
Private Sub OnPopupLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
If m_alreadyLoaded Then Return
m_alreadyLoaded = True
If Child IsNot Nothing Then
Child.[AddHandler](PreviewMouseLeftButtonDownEvent, New MouseButtonEventHandler(AddressOf OnChildPreviewMouseLeftButtonDown), True)
End If
m_parentWindow = Window.GetWindow(Me)
If m_parentWindow Is Nothing Then Return
AddHandler m_parentWindow.Activated, AddressOf OnParentWindowActivated
AddHandler m_parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
End Sub
Private Sub OnPopupUnloaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
If m_parentWindow Is Nothing Then Return
RemoveHandler m_parentWindow.Activated, AddressOf OnParentWindowActivated
RemoveHandler m_parentWindow.Deactivated, AddressOf OnParentWindowDeactivated
End Sub
Private Sub OnParentWindowActivated(ByVal sender As Object, ByVal e As EventArgs)
SetTopmostState(True)
End Sub
Private Sub OnParentWindowDeactivated(ByVal sender As Object, ByVal e As EventArgs)
If IsTopmost = False Then
SetTopmostState(IsTopmost)
End If
End Sub
Private Sub OnChildPreviewMouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
SetTopmostState(True)
If Not m_parentWindow.IsActive AndAlso IsTopmost = False Then
m_parentWindow.Activate()
End If
End Sub
Protected Overrides Sub OnOpened(ByVal e As EventArgs)
SetTopmostState(IsTopmost)
MyBase.OnOpened(e)
End Sub
Private Sub SetTopmostState(ByVal isTop As Boolean)
If m_appliedTopMost.HasValue AndAlso m_appliedTopMost = isTop Then
Return
End If
If Child Is Nothing Then Return
Dim hwndSource = TryCast((PresentationSource.FromVisual(Child)), HwndSource)
If hwndSource Is Nothing Then Return
Dim hwnd = hwndSource.Handle
Dim rect As RECT
If Not GetWindowRect(hwnd, rect) Then Return
Debug.WriteLine("setting z-order " & isTop)
If isTop Then
SetWindowPos(hwnd, HWND_TOPMOST, rect.Left, rect.Top, CInt(Width), CInt(Height), TOPMOST_FLAGS)
Else
SetWindowPos(hwnd, HWND_BOTTOM, rect.Left, rect.Top, CInt(Width), CInt(Height), TOPMOST_FLAGS)
SetWindowPos(hwnd, HWND_TOP, rect.Left, rect.Top, CInt(Width), CInt(Height), TOPMOST_FLAGS)
SetWindowPos(hwnd, HWND_NOTOPMOST, rect.Left, rect.Top, CInt(Width), CInt(Height), TOPMOST_FLAGS)
End If
m_appliedTopMost = isTop
End Sub
<StructLayout(LayoutKind.Sequential)>
Public Structure RECT
Public Left As Integer
Public Top As Integer
Public Right As Integer
Public Bottom As Integer
End Structure
<DllImport("user32.dll")>
Private Shared Function GetWindowRect(ByVal hWnd As IntPtr, <Out> ByRef lpRect As RECT) As Boolean
End Function
<DllImport("user32.dll")>
Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As UInteger) As Boolean
End Function
Shared ReadOnly HWND_TOPMOST As IntPtr = New IntPtr(-1)
Shared ReadOnly HWND_NOTOPMOST As IntPtr = New IntPtr(-2)
Shared ReadOnly HWND_TOP As IntPtr = New IntPtr(0)
Shared ReadOnly HWND_BOTTOM As IntPtr = New IntPtr(1)
Private Const SWP_NOSIZE As UInt32 = &H1
Const SWP_NOMOVE As UInt32 = &H2
Const SWP_NOZORDER As UInt32 = &H4
Const SWP_NOREDRAW As UInt32 = &H8
Const SWP_NOACTIVATE As UInt32 = &H10
Const SWP_FRAMECHANGED As UInt32 = &H20
Const SWP_SHOWWINDOW As UInt32 = &H40
Const SWP_HIDEWINDOW As UInt32 = &H80
Const SWP_NOCOPYBITS As UInt32 = &H100
Const SWP_NOOWNERZORDER As UInt32 = &H200
Const SWP_NOSENDCHANGING As UInt32 = &H400
Const TOPMOST_FLAGS As UInt32 = SWP_NOACTIVATE Or SWP_NOOWNERZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOREDRAW Or SWP_NOSENDCHANGING
End Class
+1
View File
@@ -126,6 +126,7 @@
Public Const MAC_AUXSOLIDSCOASTINGLEN = "AuxSolidsCoastingLen"
Public Const MAC_AUXSOLIDSWIPELEN = "AuxSolidsWipeLen"
Public Const MAC_AUXSOLIDSWIPEDIR = "AuxSolidsWipeDir"
Public Const MAC_DYNAMICMODE = "DynamicMode"
Public Const MAC_CONSTANT = "Constant"
Public Const MAC_MATERIALS = "Materials"
+1 -11
View File
@@ -51,17 +51,7 @@ Public Module ConstGen
' Abilitazioni licenza
Friend Enum KEY_OPT As UInteger
BASE = 1 ' Prodotto EgtCAM5
DOORS = 2
GUNSTOCK = 4
DOORCREATOR = 8 ' Prodotto DOORCreator
VIRTUALMILLING = 16
JAMBS = 32
BEAM = 64
CAD2D = 128
STEELDORS = 256
WALL = 512
_3DPRINT = 1024
BASE = 1 ' Prodotto Icarus
End Enum
' File di log generale
+14 -2
View File
@@ -196,7 +196,8 @@ Public Class CurrMachiningCathegory
New CurrNumericMachiningParam(MachiningParam.Params.G0FEED, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.G0FEEDZ, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.TOOLDIAM, nPartId, nIndex, bForceFromDb),
New CurrNumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nPartId, nIndex, bForceFromDb)})
New CurrNumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nPartId, nIndex, bForceFromDb),
New CurrComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nPartId, nIndex, bForceFromDb)})
Case Cathegories.LINK
m_sName = "Shell"
m_MachiningParamList = New List(Of MachiningParam)({New CurrComboMachiningParam(MachiningParam.Params.LINKTYPE, nPartId, nIndex, bForceFromDb),
@@ -765,12 +766,18 @@ Public Class CurrComboMachiningParam
Dim nSelValue As Integer = 0
bReadFromPart = EgtGetInfo(nPartId, MAC_AUXSOLIDSLINKTYPE, nSelValue)
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue)
Case Params.DYNAMIC_MODE
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_DYNAMIC_MODE.STANDARD, "Standard"),
New IdNameStruct(Machining.MPAR_DYNAMIC_MODE.FAST, "Fast")})
Dim nSelValue As Integer = 0
bReadFromPart = EgtGetInfo(nPartId, MAC_DYNAMICMODE, nSelValue)
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue)
End Select
m_OrigSelValue = m_SelValue
If nIndex > 0 Then
Dim DbMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.nIndex = nIndex)
Select Case Type
Case Params.SLICINGTYPE, Params.STRANDORDER, Params.DIRECTION
Case Params.SLICINGTYPE, Params.STRANDORDER, Params.DIRECTION, Params.DYNAMIC_MODE
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
Case Params.LINKTYPE, Params.LEADIN, Params.LEADOUT
m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.LINK).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type)
@@ -786,6 +793,9 @@ Public Class CurrComboMachiningParam
ElseIf Type = Params.RIBSTYPE AndAlso Not bReadFromPart Then
m_OrigSelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = Machining.MPAR_RIBSTYPE.INTERNAL)
m_SelValue = m_OrigSelValue
ElseIf Type = Params.DYNAMIC_MODE AndAlso Not bReadFromPart Then
m_OrigSelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = Machining.MPAR_DYNAMIC_MODE.STANDARD)
m_SelValue = m_OrigSelValue
End If
End Sub
@@ -811,6 +821,8 @@ Public Class CurrComboMachiningParam
EgtSetInfo(nPartId, MAC_AUXSOLIDSSTRANDORDER, m_SelValue.Id)
Case Params.AUXSOLIDSLINKTYPE
EgtSetInfo(nPartId, MAC_AUXSOLIDSLINKTYPE, m_SelValue.Id)
Case Params.DYNAMIC_MODE
EgtSetInfo(nPartId, MAC_DYNAMICMODE, m_SelValue.Id)
End Select
End Sub
-109
View File
@@ -1,109 +0,0 @@
<UserControl x:Class="ImportPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Icarus"
Width="150"
Margin="5,0,0,0">
<Grid DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Style="{StaticResource LeftPanelTitle_Border}">
<TextBlock Text="New part list"
FontWeight="DemiBold"
FontSize="14"/>
</Border>
<DockPanel Grid.Row="1">
<Button DockPanel.Dock="Left"
Content="+"
FontSize="20"
Command="{Binding AddPart_Command}"
Style="{StaticResource LeftPanel_Button}"/>
<Button DockPanel.Dock="Left"
Content="-"
FontSize="20"
Command="{Binding RemovePart_Command}"
Style="{StaticResource LeftPanel_Button}"/>
<Button Content="Reference"
Command="{Binding SetReference_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</DockPanel>
<TreeView Grid.Row="2"
ItemsSource="{Binding ImportPartList}"
MinHeight="300">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:ImportPart}"
ItemsSource="{Binding LayerList}">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/TreeView/Folder.png"
Height="15"/>
<TextBlock Text="{Binding ghName}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:ImportLayer}"
ItemsSource="{Binding EntityList, UpdateSourceTrigger=PropertyChanged}">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/TreeView/Folder.png"
Height="15"/>
<TextBlock Text="{Binding sName}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:GeomEntity}">
<StackPanel Orientation="Horizontal">
<!--<Image Source="/WpfTutorialSamples;component/Images/user.png" Margin="0,0,5,0" />-->
<TextBlock Text="{Binding ghName}" />
<TextBlock Text="{Binding ghReference, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.Resources>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding bIsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="IsExpanded" Value="True" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<Border Grid.Row="3"
Style="{StaticResource LeftPanelTitle_Border}">
<TextBlock Text="Imported entity list"
FontWeight="DemiBold"
FontSize="14"/>
</Border>
<ListBox Grid.Row="4"
ItemsSource="{Binding ImportedEntityList, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelImportedEntity}"
MinHeight="200">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.InputBindings>
<MouseBinding Gesture="LeftDoubleClick"
Command="{Binding ImportedEntity_DoubleClick}"/>
</Grid.InputBindings>
<TextBlock Text="{Binding ghName}">
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Row="5"
Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
<Button Content="Cancel"
Command="{Binding Cancel_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</UniformGrid>
</Grid>
</UserControl>
-3
View File
@@ -1,3 +0,0 @@
Public Class ImportPanelV
End Class
-443
View File
@@ -1,443 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class ImportPanelVM
Inherits VMBase
Private m_nImportedPartId As Integer = GDB_ID.NULL
Friend ReadOnly Property nImportedPartId As Integer
Get
Return m_nImportedPartId
End Get
End Property
Private m_ImportedEntityList As New ObservableCollection(Of GeomEntity)
Public Property ImportedEntityList As ObservableCollection(Of GeomEntity)
Get
Return m_ImportedEntityList
End Get
Set(value As ObservableCollection(Of GeomEntity))
m_ImportedEntityList = value
End Set
End Property
Private m_SelImportedEntity As GeomEntity
Public Property SelImportedEntity As GeomEntity
Get
Return m_SelImportedEntity
End Get
Set(value As GeomEntity)
m_SelImportedEntity = value
EgtDeselectAll()
If Not IsNothing(m_SelImportedEntity) Then
EgtSelectObj(m_SelImportedEntity.nId)
End If
EgtDraw()
End Set
End Property
Friend Sub SetSelImportedEntity(nId As Integer)
m_SelImportedEntity = Map.refImportPanelVM.ImportedEntityList.FirstOrDefault(Function(x) x.nId = nId)
EgtDeselectAll()
If Not IsNothing(m_SelImportedEntity) Then
EgtSelectObj(m_SelImportedEntity.nId)
End If
EgtDraw()
NotifyPropertyChanged(NameOf(SelImportedEntity))
End Sub
Private m_ImportPartList As New ObservableCollection(Of ImportPart)
Public ReadOnly Property ImportPartList As ObservableCollection(Of ImportPart)
Get
Return m_ImportPartList
End Get
End Property
Private m_SelImportPart As ImportPart
Friend Sub SetSelImportPart(SelImportPart As ImportPart)
m_SelImportPart = SelImportPart
m_SelImportLayer = Nothing
End Sub
Public ReadOnly Property SelImportPart As ImportPart
Get
Return m_SelImportPart
End Get
End Property
Private m_SelImportLayer As ImportLayer
Public ReadOnly Property SelImportLayer As ImportLayer
Get
Return m_SelImportLayer
End Get
End Property
Friend Sub SetSelImportLayer(SelImportLayer As ImportLayer)
m_SelImportPart = m_ImportPartList.FirstOrDefault(Function(x) x.LayerList.Contains(SelImportLayer))
m_SelImportLayer = SelImportLayer
End Sub
Private m_SelGeomEntity As GeomEntity
Public ReadOnly Property SelGeomEntity As GeomEntity
Get
Return m_SelGeomEntity
End Get
End Property
Friend Sub SetSelGeomEntity(SelGeomEntity As GeomEntity)
For Each CurrPart In m_ImportPartList
Dim CurrLayer As ImportLayer = CurrPart.LayerList.FirstOrDefault(Function(x) x.EntityList.Contains(SelGeomEntity))
If Not IsNothing(CurrLayer) Then
m_SelImportPart = CurrPart
m_SelImportLayer = CurrLayer
Exit For
End If
Next
m_SelGeomEntity = SelGeomEntity
End Sub
' Definizione comandi
Private m_cmdSetReference As ICommand
Private m_cmdAddPart As ICommand
Private m_cmdRemovePart As ICommand
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefImportPanelVM(Me)
End Sub
#Region "METHODS"
Friend Sub Init()
m_ImportedEntityList.Clear()
m_ImportPartList.Clear()
' aggiungo geometrie importate a lista
m_nImportedPartId = EgtGetLastPart()
Dim nLayerId As Integer = EgtGetFirstLayer(m_nImportedPartId)
Dim nGeometryId As Integer = EgtGetFirstInGroup(nLayerId)
While nGeometryId <> GDB_ID.NULL
Dim sGeometryName As String = ""
EgtGetName(nGeometryId, sGeometryName)
m_ImportedEntityList.Add(New GeomEntity(nGeometryId, sGeometryName))
nGeometryId = EgtGetNext(nGeometryId)
End While
' aggiungo primo pezzo
m_ImportPartList.Add(New ImportPart())
m_ImportPartList(0).LayerList.FirstOrDefault(Function(x) x.Type = ImportLayer.LayerType.PRINT_SOLID).bIsSelected = True
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "SetReference"
Public ReadOnly Property SetReference_Command As ICommand
Get
If m_cmdSetReference Is Nothing Then
m_cmdSetReference = New Command(AddressOf SetReference)
End If
Return m_cmdSetReference
End Get
End Property
Public Sub SetReference()
If Not IsNothing(SelGeomEntity) Then
Dim ChooseReferenceWndVM As New ChooseReferenceWndVM
Dim ChooseReferenceWndV As New ChooseReferenceWndV(Application.Current.MainWindow, ChooseReferenceWndVM)
If Not ChooseReferenceWndV.ShowDialog() Then Return
SelGeomEntity.Reference = ChooseReferenceWndVM.SelReference
End If
End Sub
#End Region ' SetReference
#Region "AddPart"
Public ReadOnly Property AddPart_Command As ICommand
Get
If m_cmdAddPart Is Nothing Then
m_cmdAddPart = New Command(AddressOf AddPart)
End If
Return m_cmdAddPart
End Get
End Property
Public Sub AddPart()
m_ImportPartList.Add(New ImportPart)
End Sub
#End Region ' AddPart
#Region "RemovePart"
Public ReadOnly Property RemovePart_Command As ICommand
Get
If m_cmdRemovePart Is Nothing Then
m_cmdRemovePart = New Command(AddressOf RemovePart)
End If
Return m_cmdRemovePart
End Get
End Property
Public Sub RemovePart()
If IsNothing(SelImportLayer) Then
' rimuovo pezzo
m_ImportPartList.Remove(SelImportPart)
Else
' rimuovo geometria
Dim CurrEntity As GeomEntity = m_SelGeomEntity
SelImportLayer.EntityList.Remove(m_SelGeomEntity)
' la rimetto in lista importati
ImportedEntityList.Add(CurrEntity)
End If
End Sub
#End Region ' RemovePart
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
Dim sErr As New List(Of String)
' verifico che tutti i pezzi abbiano una superficie da stampare nel layer apposito
For Each CurrPart In m_ImportPartList
For Each CurrLayer In CurrPart.LayerList
Select Case CurrLayer.Type
Case ImportLayer.LayerType.PRINT_SOLID
If CurrLayer.EntityList.Count = 0 Then
If sErr.Count > 0 Then sErr(sErr.Count - 1) &= Environment.NewLine
sErr.Add(CurrPart.ghName & " - No print surface defined!")
End If
End Select
Next
Next
If sErr.Count > 0 Then
MessageBox.Show(String.Concat(sErr), "Error")
Return
Else
' Creo pezzi e layer necessari
For ImportPartIndex = 0 To m_ImportPartList.Count - 1
Dim ImportPart As ImportPart = m_ImportPartList(ImportPartIndex)
Dim frImportedPart As New Frame3d
EgtGetGroupGlobFrame(m_nImportedPartId, frImportedPart)
Dim nPartId As Integer = EgtCreateGroup(GDB_ID.ROOT, frImportedPart)
EgtSetName(nPartId, PART)
Dim nFrameId As Integer = GDB_ID.NULL
Dim b3PrintSolid As New BBox3d
Dim nPrintPartLayerId As Integer = GDB_ID.NULL
Dim PrintSolidEntity As GeomEntity = Nothing
Dim nOriginalPartLayerId As Integer = GDB_ID.NULL
Dim nRibsLayerId As Integer = GDB_ID.NULL
Dim nShellNumberLayerId As Integer = GDB_ID.NULL
Dim nAuxSolidsLayerId As Integer = GDB_ID.NULL
Dim nMachStartLayerId As Integer = GDB_ID.NULL
Dim nOthersLayerId As Integer = GDB_ID.NULL
For Each ImportLayer In ImportPart.LayerList
Select Case ImportLayer.Type
Case ImportLayer.LayerType.PRINT_SOLID
nPrintPartLayerId = EgtCreateGroup(nPartId)
EgtSetName(nPrintPartLayerId, PRINT_SOLID)
If ImportLayer.EntityList.Count > 0 Then
PrintSolidEntity = ImportLayer.EntityList(0)
EgtRelocateGlob(PrintSolidEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
' calcolo box superficie per creazione riferimento
EgtGetBBoxGlob(PrintSolidEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
End If
'Case ImportLayer.LayerType.ORIGINAL_SOLID
' nOriginalPartLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nOriginalPartLayerId, ORIGINAL_SOLID)
' For Each GeomEntity In ImportLayer.EntityList
' EgtRelocateGlob(GeomEntity.nId, nOriginalPartLayerId, GDB_POS.LAST_SON)
' Next
Case ImportLayer.LayerType.MACH_START
nMachStartLayerId = EgtCreateGroup(nPartId)
EgtSetName(nMachStartLayerId, LAY_MACH_START)
Dim nMachStartId As Integer = GDB_ID.NULL
If ImportLayer.EntityList.Count > 0 Then
For Each GeomEntity In ImportLayer.EntityList
' se punto o curva compo
Dim EntityType As GDB_TY = EgtGetType(GeomEntity.nId)
Select Case EntityType
Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO
' gli cambio layer
EgtRelocateGlob(GeomEntity.nId, nMachStartLayerId, GDB_POS.LAST_SON)
nMachStartId = GeomEntity.nId
Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
' altrimenti la trasformo in curva compo
nMachStartId = EgtCreateCurveCompo(nMachStartLayerId, GeomEntity.nId, True)
End Select
EgtSetName(nMachStartId, START_GEOM)
' coloro l'entita' di rosso
Dim c3Red As Color3d
c3Red.FromColor(System.Drawing.Color.Red)
EgtSetColor(nMachStartId, c3Red)
Next
Else
' creo punto di partenza
Dim ptStart As Point3d = b3PrintSolid.Center() - 0.6 * b3PrintSolid.DimY() * Vector3d.Y_AX() - 0.5 * b3PrintSolid.DimZ() * Vector3d.Z_AX()
nMachStartId = EgtCreateGeoPoint(nMachStartLayerId, ptStart, GDB_RT.GLOB)
EgtSetName(nMachStartId, START_GEOM)
' coloro l'entita' di rosso
Dim c3Red As Color3d
c3Red.FromColor(System.Drawing.Color.Red)
EgtSetColor(nMachStartId, c3Red)
End If
Case ImportLayer.LayerType.RIBS
nRibsLayerId = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
For Each GeomEntity In ImportLayer.EntityList
EgtSetInfo(GeomEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtRelocateGlob(GeomEntity.nId, nRibsLayerId, GDB_POS.LAST_SON)
' coloro l'entita' di viola
Dim c3LightBlue As Color3d
c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid)
EgtSetColor(GeomEntity.nId, c3LightBlue)
Next
Case ImportLayer.LayerType.SHELL_NUMBER
nShellNumberLayerId = EgtCreateGroup(nPartId)
EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
For Each GeomEntity In ImportLayer.EntityList
EgtSetInfo(GeomEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
EgtRelocateGlob(GeomEntity.nId, nShellNumberLayerId, GDB_POS.LAST_SON)
' coloro l'entita' di verde
Dim c3LightBlue As Color3d
c3LightBlue.FromColor(System.Drawing.Color.Lime)
EgtSetColor(GeomEntity.nId, c3LightBlue)
Next
Case ImportLayer.LayerType.AUX_SOLIDS
nAuxSolidsLayerId = EgtCreateGroup(nPartId)
EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
For Each GeomEntity In ImportLayer.EntityList
EgtSetInfo(GeomEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtRelocateGlob(GeomEntity.nId, nAuxSolidsLayerId, GDB_POS.LAST_SON)
' coloro l'entita' di oro
Dim c3LightBlue As Color3d
c3LightBlue.FromColor(System.Drawing.Color.DarkGoldenrod)
EgtSetColor(GeomEntity.nId, c3LightBlue)
Next
Case ImportLayer.LayerType.OTHERS
nOthersLayerId = EgtCreateGroup(nPartId)
EgtSetName(nOthersLayerId, LAY_OTHERS)
For Each GeomEntity In ImportLayer.EntityList
EgtRelocateGlob(GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
Next
If ImportPartIndex = 0 Then
For Each GeomEntity In ImportedEntityList
' se curva
Dim EntityType As GDB_TY = EgtGetType(GeomEntity.nId)
Select Case EntityType
Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
' la trasformo in curva compo
EgtCreateCurveCompo(nOthersLayerId, GeomEntity.nId, True)
Case Else
' altrimenti la sposto solamente
EgtRelocateGlob(GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
End Select
Next
End If
End Select
Next
' aggiungo riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Select Case PrintSolidEntity.Reference
Case ChooseReferenceWndVM.References.TL
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX
Case ChooseReferenceWndVM.References.TR
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
Case ChooseReferenceWndVM.References.BL
Case ChooseReferenceWndVM.References.BR
ptOrig += b3PrintSolid.DimX() * Vector3d.X_AX
Case ChooseReferenceWndVM.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
Case ChooseReferenceWndVM.References.ML
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX
Case ChooseReferenceWndVM.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
Case ChooseReferenceWndVM.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
Case ChooseReferenceWndVM.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
Case ChooseReferenceWndVM.References.BC
ptOrig += b3PrintSolid.DimX() / 2 * Vector3d.X_AX
Case ChooseReferenceWndVM.References.MC
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
End Select
Dim frPrintSolid As New Frame3d(ptOrig)
nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
If nFrameId Then
EgtSetName(nFrameId, FRAME_PART)
EgtSetMode(nFrameId, GDB_MD.LOCKED)
End If
EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, PrintSolidEntity.Reference)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
' lo aggiungo a lista pezzi
Dim sFilePath As String = ""
EgtGetInfo(m_nImportedPartId, FILE_PATH, sFilePath)
EgtSetInfo(nPartId, FILE_PATH, sFilePath)
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, PrintSolidEntity.nId, nOriginalPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
Next
End If
'EgtAddMachGroup("3dPrint")
'EgtSetTable("Tab")
'Dim nRawId As Integer = EgtAddRawPart(b3PrintSolid.Min, b3PrintSolid.DimX, b3PrintSolid.DimY, b3PrintSolid.DimZ, New Color3d(128, 128, 128, 30))
'EgtAddPartToRawPart(nPartId, b3PrintSolid.Min, nRawId)
'EgtMoveToCornerRawPart(nRawId, New Point3d(dPosX, dPosY, 0), MCH_CR.BL)
'EgtResetCurrMachGroup()
' seleziono ultimo pezzo aggiunto
Map.refTopPanelVM.SelLastPart()
' elimino vecchio pezzo d'importazione
EgtErase(m_nImportedPartId)
EgtDraw()
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Ok
#Region "Cancel"
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Cancel()
' elimino pezzo importato
EgtErase(m_nImportedPartId)
EgtDraw()
' se ci sono pezzi
If Map.refTopPanelVM.PartList.Count > 0 Then
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
Else
Map.refTopPanelVM.SelPage = Pages.NULL
End If
End Sub
#End Region ' Cancel
#End Region ' COMMANDS
End Class
-231
View File
@@ -1,231 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class GeomEntity
Inherits VMBase
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
' seleziono in scena
EgtDeselectAll()
If Not IsNothing(value) Then
EgtSelectObj(m_nId)
End If
EgtDraw()
' segno come elemento selezionato in treeview
Map.refImportPanelVM.SetSelGeomEntity(Me)
End Set
End Property
Private m_nId As Integer = GDB_ID.NULL
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Public ReadOnly Property ghName As String
Get
Return m_nId & If(Not String.IsNullOrWhiteSpace(m_sName), " - " & m_sName, "")
End Get
End Property
Private m_Reference As ChooseReferenceWndVM.References = ChooseReferenceWndVM.References.BL
Public Property Reference As ChooseReferenceWndVM.References
Get
Return m_Reference
End Get
Set(value As ChooseReferenceWndVM.References)
m_Reference = value
NotifyPropertyChanged(NameOf(ghReference))
End Set
End Property
Public ReadOnly Property ghReference As String
Get
Select Case m_Reference
Case ChooseReferenceWndVM.References.TL
Return ""
Case ChooseReferenceWndVM.References.TR
Return ""
Case ChooseReferenceWndVM.References.BL
Return ""
Case ChooseReferenceWndVM.References.BR
Return ""
Case ChooseReferenceWndVM.References.TC
Return ""
Case ChooseReferenceWndVM.References.ML
Return ""
Case ChooseReferenceWndVM.References.MR
Return ""
Case ChooseReferenceWndVM.References.BC
Return ""
Case ChooseReferenceWndVM.References.MC
Return ""
Case Else
Return "X"
End Select
End Get
End Property
' Definizione comandi
Private m_cmdImportedEntity As ICommand
Sub New(nId As Integer, sName As String)
m_nId = nId
m_sName = sName
End Sub
#Region "COMMANDS"
#Region "ImportedEntity"
Public ReadOnly Property ImportedEntity_DoubleClick As ICommand
Get
If m_cmdImportedEntity Is Nothing Then
m_cmdImportedEntity = New Command(AddressOf ImportedEntity)
End If
Return m_cmdImportedEntity
End Get
End Property
Public Sub ImportedEntity()
If Not IsNothing(Map.refImportPanelVM.SelImportLayer) Then
Map.refImportPanelVM.ImportedEntityList.Remove(Me)
Map.refImportPanelVM.SelImportLayer.EntityList.Add(Me)
End If
End Sub
#End Region ' ImportedEntity
#End Region ' COMMANDS
End Class
Public Class ImportPart
Inherits VMBase
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
Map.refImportPanelVM.SetSelImportPart(Me)
End Set
End Property
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Public ReadOnly Property ghName As String
Get
Return If(Not String.IsNullOrWhiteSpace(m_sName), m_nId & " - " & m_sName, "Part" & m_nId)
End Get
End Property
Private m_LayerList As New ObservableCollection(Of ImportLayer)
Public ReadOnly Property LayerList As ObservableCollection(Of ImportLayer)
Get
Return m_LayerList
End Get
End Property
Sub New()
m_nId = If(Map.refImportPanelVM.ImportPartList.Count = 0, 1, Map.refImportPanelVM.ImportPartList.Max(Function(x) x.m_nId) + 1)
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.PRINT_SOLID, "Print"))
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.MACH_START, "Layer Start"))
'm_LayerList.Add(New ImportLayer(ImportLayer.LayerType.ORIGINAL_SOLID, "Original Solid"))
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.RIBS, "Ribs"))
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.SHELL_NUMBER, "Reduce Shell Number"))
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.AUX_SOLIDS, "Filled Solids"))
m_LayerList.Add(New ImportLayer(ImportLayer.LayerType.OTHERS, "Others"))
End Sub
End Class
Public Class ImportLayer
Inherits VMBase
Public Enum LayerType As Integer
PRINT_SOLID = 1
MACH_START = 2
RIBS = 3
SHELL_NUMBER = 4
AUX_SOLIDS = 5
OTHERS = 7
End Enum
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
Map.refImportPanelVM.SetSelImportLayer(Me)
End Set
End Property
Private m_Type As LayerType
Public Property Type As LayerType
Get
Return m_Type
End Get
Set(value As LayerType)
m_Type = value
End Set
End Property
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_EntityList As New ObservableCollection(Of GeomEntity)
Public Property EntityList As ObservableCollection(Of GeomEntity)
Get
Return m_EntityList
End Get
Set(value As ObservableCollection(Of GeomEntity))
m_EntityList = value
End Set
End Property
Sub New(Type As LayerType, sName As String)
m_Type = Type
m_sName = sName
End Sub
End Class
-10
View File
@@ -1,10 +0,0 @@
<UserControl x:Class="ImportSceneHostV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtUILib="clr-namespace:EgtUILib;assembly=EgtUILib">
<WindowsFormsHost>
<EgtUILib:Scene x:Name="MainScene"/>
</WindowsFormsHost>
</UserControl>
-33
View File
@@ -1,33 +0,0 @@
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class ImportSceneHostV
Private m_ImportSceneHostVM As ImportSceneHostVM
Sub New()
' This call is required by the designer.
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
Me.DataContext = New ImportSceneHostVM
m_ImportSceneHostVM = DirectCast(Me.DataContext, ImportSceneHostVM)
m_ImportSceneHostVM.SetMainScene(MainScene)
End Sub
Private Sub MainScene_GotFocus() Handles MainScene.GotFocus
m_ImportSceneHostVM.SetIsFocused(True)
EgtOutLog("MainScene_GotFocus")
' Map.refSecondaryWindowV.Topmost = True
'Map.refSecondaryWindowVM.SetVisibility(True)
End Sub
Private Sub MainScene_LostFocus() Handles MainScene.LostFocus
m_ImportSceneHostVM.SetIsFocused(False)
EgtOutLog("MainScene_LostFocus")
' Map.refSecondaryWindowV.Topmost = False
'Map.refSecondaryWindowVM.SetVisibility(False)
End Sub
End Class
-722
View File
@@ -1,722 +0,0 @@
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports Microsoft.Win32
Public Class ImportSceneHostVM
Inherits EgtWPFLib5.SceneHostVM
Friend m_bIsFocused As Boolean
Friend Sub SetIsFocused(bValue As Boolean)
m_bIsFocused = bValue
End Sub
' Identificativi per pezzo da selezionare/deselezionare
Private m_nIdToSel As Integer = GDB_ID.NULL
Private m_nIdToDesel As Integer = GDB_ID.NULL
' Dati movimento
Private m_dMaxStep As Double = 0
' Dati per Drag
Private m_nRestRadius As Integer = 5
Private m_bDrag As Boolean = False
Private m_bDragToStart As Boolean = False
Private m_bVerify As Boolean = False
Private m_bFromParking As Boolean = False
Private m_bDragging As Boolean = False
Private m_locPrev As System.Drawing.Point
Private m_ptPrev As Point3d
Private m_vtTotMove As Vector3d
Private m_dSnapDist As Double = 0
Private bReducedCut As Boolean = False
Private m_bMagnetic As Boolean
' punto di snap per inizializzazione
Private m_SnapType As SP
Friend ReadOnly Property SnapType As SP
Get
Return m_SnapType
End Get
End Property
#Region "CONSTRUCTOR"
Sub New()
MyBase.New()
AddHandler MainController.OnNewProject, AddressOf OnNewProject
AddHandler MainController.OnOpenProject, AddressOf OnOpenProject
AddHandler MainController.OnSavingProject, AddressOf OnSavingProject
AddHandler MainController.OnSavedProject, AddressOf OnSavedProject
AddHandler MainController.OnInsertedProject, AddressOf OnInsertedProject
AddHandler MainController.OnImportingProject, AddressOf OnImportingProject
AddHandler MainController.OnImportedProject, AddressOf OnImportedProject
AddHandler MainController.PrepareInputBox, AddressOf PrepareInputBox
AddHandler MainController.SetInputBoxText, AddressOf SetInputBoxText
AddHandler MainController.SetInputBoxCheck, AddressOf SetInputBoxCheck
AddHandler MainController.AddInputBoxCombo, AddressOf AddInputBoxCombo
AddHandler MainController.UpdateUI, AddressOf UpdateUI
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Overrides Sub InitScene()
InitSceneEvents()
' Inizializzazione Scena
PreInitializeScene()
' Se tutto bene
If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT._3DPRINT) Then
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
EgtSetCurrentContext(MainScene.GetCtx())
' inizializzo gestore lavorazioni
EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir)
Return
End If
' Problemi
' Se manca la chiave
If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then
EgtOutLog("Missing Dongle")
' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
' Altrimenti manca la licenza
Else
EgtOutLog("Problems with Licence")
' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
' Apro dialogo per richiesta file licenza
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
.DefaultExt = ".lic",
.Filter = "Licences (.lic)|*.lic",
.CheckFileExists = True,
.ValidateNames = True
}
If LicDlg.ShowDialog() = True Then
' Recupero il direttorio del file
Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
' Se il file non è già nel direttorio di configurazione lo copio
If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
Try
File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True)
Catch ex As Exception
End Try
End If
' Imposto il nuovo file di licenza nell'Ini
WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
End If
End If
End If
' Chiudo il programma
End
End Sub
Public Overrides Sub InitSceneEvents()
AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos
AddHandler MainScene.OnMouseSetObjFilterForSelect, AddressOf OnMouseSetObjFilterForSelect
AddHandler MainScene.OnMouseSelectedAll, AddressOf OnMouseSelectedAll
AddHandler MainScene.OnMouseDeselectedAll, AddressOf OnMouseDeselectedAll
AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene
AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene
AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene
AddHandler MainScene.OnMouseSelectedObj, AddressOf OnMouseSelectedObj
AddHandler MainScene.OnMouseSelectedPart, AddressOf OnMouseSelectedPart
AddHandler MainScene.OnMouseSelectedLayer, AddressOf OnMouseSelectedLayer
AddHandler MainScene.OnMouseSelectedPath, AddressOf OnMouseSelectedPath
AddHandler MainScene.OnMousePointFromSelection, AddressOf OnMousePointFromSelection
AddHandler MainScene.OnMouseDone, AddressOf OnMouseDone
AddHandler MainScene.OnMouseSelectedPoint, AddressOf OnMouseSelectedPoint
AddHandler MainScene.OnMouseSelectedDir, AddressOf OnMouseSelectedDir
AddHandler MainScene.OnMouseMoveSelPoint, AddressOf OnMouseMoveSelPoint
AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance
AddHandler MainScene.KeyDown, AddressOf OnKeyDown
AddHandler MainScene.OnCloseGetDist, AddressOf OnCloseGetDist
AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
MainScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
MainScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto spessore linee
Dim nLineWidth As Integer = 1
nLineWidth = GetMainPrivateProfileInt(S_SCENE, K_LINEWIDTH, nLineWidth)
MainScene.SetLineWidth(nLineWidth)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
MainScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
MainScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
MainScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
MainScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
MainController.SetScene(MainScene)
MainController.SetSurfTmTolerance(0.05)
MainController.SetUseCustomColors(True, S_SCENE, K_CUSTOMCOLORS)
' imposto unità di misura per interfaccia utente
Dim nMeasureUnit As Integer = GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1)
EgtSetUiUnits(nMeasureUnit <> 0)
'Map.refMyStatusBarVM.SetMeasureUnit(nMeasureUnit <> 0)
' imposto visualizzazione riferimento globale
EgtSetGlobFrameShow(True)
' imposto i dati della griglia
'LoadGridData()
EgtSetGridFrame(Frame3d.GLOB)
EgtSetGridGeo(10, 10, 100, 484)
EgtSetGridColor(New Color3d(160, 160, 160), New Color3d(160, 160, 160))
EgtSetGridShow(True, False)
' imposto tipo coordinate
MainScene.SetGridCursorPos(True)
' modo di visualizzazione
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
'''Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' tipo snap point
MainScene.SetSnapPointType(SP.PT_SKETCH)
' visualizzazione assemblato
Dim nShowBuilding As Boolean = GetMainPrivateProfileInt(S_SCENE, K_SHOWBUILDING, 0) <> 0
'''Map.refShowBeamPanelVM.SetShowBuilding(nShowBuilding)
' nascondo input box
'''Map.refFreeContourInputVM.ResetInputBox()
End Sub
#End Region ' METHODS
#Region "ProjectManager"
Public Overrides Sub NewProject()
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = MainController.NewProject()
MainScene.SetStatusNull()
End Sub
Public Overrides Sub OpenProject(sFilePath As String)
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = False
If String.IsNullOrEmpty(sFilePath) Then
' Recupero cartella dell'ultimo progetto aperto
Dim sDir As String = MainController.GetCurrFile()
If String.IsNullOrWhiteSpace(sDir) Then
GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir)
End If
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
bOk = MainController.OpenProject(sDir)
Else
bOk = MainController.OpenProject(sFilePath, False)
End If
MainScene.SetStatusNull()
End Sub
Public Overrides Sub SaveProject()
MyBase.SaveProject()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
End Sub
Public Overrides Sub SaveAsProject()
MyBase.SaveAsProject()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
End Sub
Public Overrides Sub InsertProject()
' eseguo
Dim sDir As String = String.Empty
GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir)
Dim OpenFileDialog As New OpenFileDialog With {.Title = "Insert",
.Filter = "Stereolithography (*.stl)|*.stl" &
"|New geometry EgalTech(*.nge)|*.nge" &
"|All Files (*.*)|*.*",
.FilterIndex = 1,
.InitialDirectory = sDir}
If Not OpenFileDialog.ShowDialog Then
Return
End If
Dim sFile As String = String.Empty
sFile = OpenFileDialog.FileName
Dim ChooseReferenceWndVM As New ChooseReferenceWndVM
Dim ChooseReferenceWndV As New ChooseReferenceWndV(Application.Current.MainWindow, ChooseReferenceWndVM)
If Not ChooseReferenceWndV.ShowDialog() Then Return
Dim nImportContext As Integer = EgtInitContext()
MainController.InsertProject(sFile, False)
End Sub
Public Overrides Sub ImportProject()
Dim sDir As String = String.Empty
GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir)
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
sDir.TrimEnd("\"c)
MainController.ImportProject(sDir)
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
End Sub
Friend Sub PreExecScript(bScriptInMru As Boolean)
'm_bScriptInMru = bScriptInMru
End Sub
Friend Sub ExecScript(sFilePath As String)
If String.IsNullOrEmpty(sFilePath) Then
Dim sDir As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir)
MainController.Exec(sDir)
Else
MainController.Exec(sFilePath, False)
End If
Dim bMachiningMode As Boolean = EgtGetCurrMachGroup() <> GDB_ID.NULL
If Not bMachiningMode And EgtGetCurrLayer() = GDB_ID.NULL Then
Dim nCurrPart As Integer = EgtGetCurrPart()
If nCurrPart = GDB_ID.NULL Or Not EgtSetCurrPartLayer(nCurrPart, EgtGetFirstLayer(nCurrPart, True)) Then
EgtResetCurrPartLayer()
End If
End If
End Sub
#End Region ' ProjectManager
#Region "SCENE EVENTS"
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
Map.refMyStatusBarVM.SetCurrPos(sCursorPos)
End Sub
Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean,
bSurf As Boolean, bVolume As Boolean, bExtra As Boolean)
End Sub
Private Sub OnMouseSelectedAll(ByVal sender As Object, bOnlyVisble As Boolean)
End Sub
Private Sub OnMouseDeselectedAll(ByVal sender As Object)
End Sub
Private Sub OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs)
If e.Button = Forms.MouseButtons.Middle Then Return
If Map.refInstrumentPanelVM.GetDistIsChecked Then Return
Basic_OnMouseDownScene(sender, e)
'Select Case Map.refMainMenuVM.SelPage
' Case Pages.VIEW
' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
' If Map.refFreeContourManagerVM.bIsActive Then Return
' If Map.refShowBeamPanelVM.bShowAll Then
' View_Part_OnMouseDownScene(sender, e)
' Else
' View_Feature_OnMouseDownScene(sender, e)
' End If
' End If
' Case Pages.MACHINING
' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return
' If SelectedMachGroup.nType = BWType.BEAM Then
' Beam_OnMouseDownScene(sender, e)
' ElseIf SelectedMachGroup.nType = BWType.WALL Then
' Wall_OnMouseDownScene(sender, e)
' End If
' End If
'End Select
End Sub
Private Sub OnMouseMoveScene(sender As Object, e As Forms.MouseEventArgs)
If e.Button = Forms.MouseButtons.Middle Then Return
If Map.refInstrumentPanelVM.GetDistIsChecked Then Return
Basic_OnMouseMoveScene(sender, e)
'Select Case Map.refMainMenuVM.SelPage
' Case Pages.VIEW
' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
' If Map.refFreeContourManagerVM.bIsActive Then Return
' If Map.refShowBeamPanelVM.bShowAll Then
' View_Part_OnMouseMoveScene(sender, e)
' Else
' View_Feature_OnMouseMoveScene(sender, e)
' End If
' End If
' Case Pages.MACHINING
' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return
' If SelectedMachGroup.nType = BWType.BEAM Then
' Beam_OnMouseMoveScene(sender, e)
' ElseIf SelectedMachGroup.nType = BWType.WALL Then
' Wall_OnMouseMoveScene(sender, e)
' End If
' End If
'End Select
End Sub
Private Sub OnMouseUpScene(sender As Object, e As Forms.MouseEventArgs)
If e.Button = Forms.MouseButtons.Middle Then Return
If Map.refInstrumentPanelVM.GetDistIsChecked Then Return
Basic_OnMouseUpScene(sender, e)
'Select Case Map.refMainMenuVM.SelPage
' Case Pages.VIEW
' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
' If Map.refFreeContourManagerVM.bIsActive Then Return
' If Map.refShowBeamPanelVM.bShowAll Then
' View_Part_OnMouseUpScene(sender, e)
' Else
' View_Feature_OnMouseUpScene(sender, e)
' End If
' End If
' Case Pages.MACHINING
' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return
' If SelectedMachGroup.nType = BWType.BEAM Then
' Beam_OnMouseUpScene(sender, e)
' ElseIf SelectedMachGroup.nType = BWType.WALL Then
' Wall_OnMouseUpScene(sender, e)
' End If
' End If
'End Select
End Sub
Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' ' se sto editando testo angoli
' If Map.refFreeContourManagerVM.bIsModifyingTextAngle Then
' ' passo testo selezionato
' Map.refFreeContourManagerVM.TextAngleSelected(nId)
' End If
' MainController.MouseSelectedObj(nId, bLast)
'End If
End Sub
Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.MouseSelectedPart(nId)
'End If
End Sub
Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.MouseSelectedLayer(nId)
'End If
End Sub
Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.MouseSelectedPath(nId, bHaltOnFork)
'End If
End Sub
Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.SetPointFromSelection(nId, PtP, nAux)
'End If
End Sub
Private Sub OnMouseDone(ByVal sender As Object)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.Done(Map.refFreeContourInputVM.Text)
'End If
End Sub
Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control
' MainController.MouseSelectedPoint(PtP, nSep, nId, bDone)
'End If
End Sub
Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.SetLastVector3d(VtDir)
'End If
End Sub
Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' MainController.MouseMoveInSelectionPoint(PtP)
'End If
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
Map.refMyStatusBarVM.SetOutputMessage(sDistance)
End Sub
Private Sub OnKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
'' Se in modalità edit L250
'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then
' ' Con DEL eseguo cancellazione delle entità selezionate
' If e.KeyData = System.Windows.Forms.Keys.Delete Then
' MainController.SetLastInteger(GDB_ID.SEL)
' MainController.ExecuteCommand(Controller.CMD.DELETE)
' ' Con SPAZIO ripeto l'ultimo comando
' ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then
' MainController.RepeatLastCommand()
' ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco
' ElseIf e.KeyData = System.Windows.Forms.Keys.A And MainController.GetContinue() Then
' MainController.ContinueArcPDP()
' ' Con 'L' e in modalità continuazione, forzo il passaggio a retta
' ElseIf e.KeyData = System.Windows.Forms.Keys.L And MainController.GetContinue() Then
' MainController.ContinueLine2P()
' ' Con 'V' cambio lo stato del check
' ElseIf e.KeyData = System.Windows.Forms.Keys.V Then
' Map.refFreeContourInputVM.ChangeInputBoxCheck()
' End If
'End If
End Sub
Private Sub OnCloseGetDist(sender As System.Object)
Map.refInstrumentPanelVM.SetGetDistance_IsChecked(False)
End Sub
Friend Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean)
m_SnapType = nSpType
If Not IsNothing(Map.refMyStatusBarVM) Then Map.refMyStatusBarVM.SetSnapPointType(nSpType)
End Sub
#End Region ' SCENE EVENTS
#Region "CONTROLLER EVENTS"
Private Sub OnNewProject(sender As Object, bOk As Boolean)
CurrentMachine.CreateMachineTable()
If Not bOk Then
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error
End If
EgtZoom(ZM.ALL)
MainScene.SetStatusNull()
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
EgtZoom(ZM.ALL)
WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile))
If bOk Then
Map.refProjManagerVM.MruFiles.Add(sFile)
Else
Map.refProjManagerVM.MruFiles.Remove(sFile)
Dim sMsg As String
If My.Computer.FileSystem.FileExists(sFile) Then
sMsg = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
Else
sMsg = EgtMsg(10009) & " '" & sFile & "'" 'Missing file
End If
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
MainScene.SetStatusNull()
End Sub
Private Sub OnSavingProject(ByVal sender As Object, sFile As String)
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile))
If bOk Then
Map.refProjManagerVM.MruFiles.Add(sFile)
Else
Map.refProjManagerVM.MruFiles.Remove(sFile)
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
End If
End Sub
Private Sub OnInsertedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
' Segnalo eventuale errore
If Not bOk Then
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Else
' lo aggiungo alla lista pezzi
Map.refProjectVM.AddNewPart(sFile)
End If
EgtDraw()
MainScene.SetStatusNull()
End Sub
Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer)
If nType <> FT.NULL Then
If nType = FT.CNC Then
nFlag = GetMainPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE)
Else
nFlag = 0
End If
' Abilito progress e bottone stop
Map.refMyStatusBarVM.StartLoading("", True)
Else
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error
End If
End Sub
Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
EgtZoom(ZM.ALL)
' Disabilito progress e bottone stop
Map.refMyStatusBarVM.EndLoading("")
' Salvo path
WriteMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile))
' Segnalo eventuale errore
If Not bOk Then
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
ElseIf Path.GetExtension(sFile) <> ".cnc" Then
' creo oggetto pezzo in lista
'Map.refProjectVM.
End If
MainScene.SetStatusNull()
End Sub
Private Sub PrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String,
ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean)
'Map.refFreeContourInputVM.PrepareInputBox(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn)
End Sub
Private Sub SetInputBoxText(ByVal sText As String)
'Map.refFreeContourInputVM.SetInputBoxText(sText)
End Sub
Private Sub SetInputBoxCheck(ByVal bCheck As Boolean)
'Map.refFreeContourInputVM.SetInputBoxCheck(bCheck)
End Sub
Private Sub AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean)
'Map.refFreeContourInputVM.AddInputBoxCombo(sText, bSelected)
End Sub
Private Sub UpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean)
'' pulisco input e relativi messaggi
'Map.refFreeContourInputVM.ResetInputBox()
If MainController.GetContinue() Then
Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc
Else
Map.refMyStatusBarVM.ClearOutputMessage()
End If
End Sub
#End Region ' CONTROLLER EVENTS
#Region "Part"
Friend Sub Basic_OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs)
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(True, True, True, True, True)
Dim nSel As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bFound As Boolean = False
If EgtIsPart(nPartId) Then bFound = True
If Not bFound Then
nId = EgtGetNextObjInSelWin()
Continue While
End If
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se già selezionato
If nStat = GDB_ST.SEL Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
' Memorizzo Id da selezionare
m_nIdToSel = nPartId
End If
Exit While
nId = EgtGetNextObjInSelWin()
End While
' Dati per drag
m_bDragToStart = True
End Sub
Friend Sub Basic_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se drag non abilitato o già in esecuzione, esco
If Not m_bDragToStart Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return
End If
m_bDragToStart = False
End If
End Sub
Friend Sub Basic_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se eseguito drag
If Not m_bDragToStart Then
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' Se pezzo da selezionare non è già selezionato
'If EgtIsSelectedObj(m_nIdToSel) Then
' Eseguo la selezione
Map.refProjectVM.SelPartFromId(m_nIdToSel)
'EgtDeselectAll()
'EgtSelectPartObjs(m_nIdToSel)
'EgtSelectObj(m_nIdToSel)
'EgtSetMark(m_nIdToSel)
'End If
'If IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) OrElse Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId <> m_nIdToSel Then
' ' Eseguo la selezione
' For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList
' If BTLPart.nPartId = m_nIdToSel Then
' BTLPart.SetIsSelected(True)
' ElseIf BTLPart.IsSelected Then
' BTLPart.SetIsSelected(False)
' End If
' Next
' End If
End If
' Reset
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
End Sub
#End Region ' Part
End Class
-33
View File
@@ -1,33 +0,0 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ImportWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:local="clr-namespace:Icarus">
<DockPanel>
<Grid DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ListBox ItemsSource="{Binding ImportedEntityList}"
SelectedItem="{Binding SelImportedEntity}"/>
<StackPanel Grid.Row="1"
Orientation="Horizontal">
<Button Content="+"
Command="{Binding AddPart_Command}"
Style="{StaticResource ToolBar_Button}"/>
<Button Content="-"
Command="{Binding RemovePart_Command}"
Style="{StaticResource ToolBar_Button}"/>
<Button Content="Ref"
Command="{Binding ChangeReference_Command}"
Style="{StaticResource ToolBar_Button}"/>
</StackPanel>
<ListBox Grid.Row="2"
ItemsSource="{Binding ImportPartList}"
SelectedItem="{Binding SelImportPartList}"/>
</Grid>
<!--<local:ImportSceneHostV/>-->
</DockPanel>
</EgtWPFLib5:EgtCustomWindow>
-18
View File
@@ -1,18 +0,0 @@
Public Class ImportWndV
Private WithEvents m_ImportWndVM As ImportWndVM
Sub New(Owner As Window, ImportWndVM As ImportWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = ImportWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_ImportWndVM = ImportWndVM
End Sub
'Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ImportWndVM.m_CloseWindow
' Me.DialogResult = bDialogResult
'End Sub
End Class
-106
View File
@@ -1,106 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Imports EgtUILib
Public Class ImportWndVM
Inherits VMBase
Private m_ImportedEntityList As ObservableCollection(Of GeomEntity)
Public ReadOnly Property ImportedEntityList As ObservableCollection(Of GeomEntity)
Get
Return m_ImportedEntityList
End Get
End Property
Private m_SelImportedEntity As GeomEntity
Public Property SelImportedEntity As GeomEntity
Get
Return m_SelImportedEntity
End Get
Set(value As GeomEntity)
m_SelImportedEntity = value
End Set
End Property
Private m_ImportPartList As ObservableCollection(Of ImportPart)
Public ReadOnly Property ImportPartList As ObservableCollection(Of ImportPart)
Get
Return m_ImportPartList
End Get
End Property
Private m_SelImportPartList As ImportPart
Public Property SelImportPartList As ImportPart
Get
Return m_SelImportPartList
End Get
Set(value As ImportPart)
m_SelImportPartList = value
End Set
End Property
Sub New(sFilePath As String)
End Sub
End Class
Public Class GeomEntity
Private m_nId As Integer = GDB_ID.NULL
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
End Class
Public Class ImportPart
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_LayerList As List(Of ImportLayer)
Public ReadOnly Property LayerList As List(Of ImportLayer)
Get
Return m_LayerList
End Get
End Property
End Class
Public Class ImportLayer
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_EntityList As List(Of GeomEntity)
Public ReadOnly Property EntityList As List(Of GeomEntity)
Get
Return m_EntityList
End Get
End Property
End Class
+16 -1
View File
@@ -47,6 +47,11 @@ Public Class Machining
ZIGZAG = 3
End Enum
Public Enum MPAR_DYNAMIC_MODE As Integer
STANDARD = 1
FAST = 2
End Enum
Protected m_CathegoryList As New ObservableCollection(Of MachiningCathegory)
Public ReadOnly Property CathegoryList As ObservableCollection(Of MachiningCathegory)
Get
@@ -309,7 +314,8 @@ Public Class MachiningCathegory
New NumericMachiningParam(MachiningParam.Params.G0FEED, nIndex),
New NumericMachiningParam(MachiningParam.Params.G0FEEDZ, nIndex),
New NumericMachiningParam(MachiningParam.Params.TOOLDIAM, nIndex),
New NumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nIndex)})
New NumericMachiningParam(MachiningParam.Params.FLOWRATE_PC, nIndex),
New ComboMachiningParam(MachiningParam.Params.DYNAMIC_MODE, nIndex)})
Case Cathegories.LINK
m_sName = "Shell"
m_MachiningParamList = New List(Of MachiningParam)({New ComboMachiningParam(MachiningParam.Params.LINKTYPE, nIndex),
@@ -455,6 +461,7 @@ Public MustInherit Class MachiningParam
'WIPEDIR = 56
STRANDOVERLAP = 57
FLOWRATE_PC = 58
DYNAMIC_MODE = 59
MATERIALS = 100
End Enum
@@ -589,6 +596,8 @@ Public MustInherit Class MachiningParam
m_sName = "Strand Overlap [%]"
Case Params.FLOWRATE_PC
m_sName = "Flow rate [%]"
Case Params.DYNAMIC_MODE
m_sName = "Dynamic Mode"
End Select
End Sub
@@ -1041,6 +1050,10 @@ Public Class ComboMachiningParam
New IdNameStruct(Machining.MPAR_LINKTYPES.LINEAR, "Linear"),
New IdNameStruct(Machining.MPAR_LINKTYPES.BIARC, "Biarc")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = ReadMachiningParamDouble(nIndex, MAC_AUXSOLIDSLINKTYPE, 0))
Case Params.DYNAMIC_MODE
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_DYNAMIC_MODE.STANDARD, "Standard"),
New IdNameStruct(Machining.MPAR_DYNAMIC_MODE.FAST, "Fast")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = ReadMachiningParamDouble(nIndex, MAC_DYNAMICMODE, 1))
End Select
End If
m_OrigSelValue = m_SelValue
@@ -1068,6 +1081,8 @@ Public Class ComboMachiningParam
WriteMachiningParam(nIndex, MAC_AUXSOLIDSSTRANDORDER, m_SelValue.Id, sFilePath)
Case Params.AUXSOLIDSLINKTYPE
WriteMachiningParam(nIndex, MAC_AUXSOLIDSLINKTYPE, m_SelValue.Id, sFilePath)
Case Params.DYNAMIC_MODE
WriteMachiningParam(nIndex, MAC_DYNAMICMODE, m_SelValue.Id, sFilePath)
End Select
End Sub
+2 -2
View File
@@ -195,8 +195,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(3279, 2412, 1, m_nKeyLevel) And
EgtGetKeyOptions(3279, 2412, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(5583, 2501, 1, m_nKeyLevel) And
EgtGetKeyOptions(5583, 2501, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
@@ -1,120 +0,0 @@
<UserControl x:Class="ModifyPartPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Icarus"
Width="150"
Margin="5,0,0,0">
<Grid DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Style="{StaticResource LeftPanelTitle_Border}">
<TextBlock Text="Part entity list"
FontWeight="DemiBold"
FontSize="14"/>
</Border>
<!--<DockPanel Grid.Row="1">
<Button DockPanel.Dock="Left"
Content="+"
FontSize="20"
Command="{Binding AddPart_Command}"
Style="{StaticResource LeftPanel_Button}"/>
<Button DockPanel.Dock="Left"
Content="-"
FontSize="20"
Command="{Binding RemovePart_Command}"
Style="{StaticResource LeftPanel_Button}"/>
<Button Content="Reference"
Command="{Binding SetReference_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</DockPanel>-->
<TreeView Grid.Row="2"
ItemsSource="{Binding ModifyPartList}"
MinHeight="300">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:ModifyPart}"
ItemsSource="{Binding LayerList}">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/TreeView/Folder.png"
Height="15"/>
<TextBlock Text="{Binding ghName}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:ModifyLayer}"
ItemsSource="{Binding EntityList, UpdateSourceTrigger=PropertyChanged}">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/TreeView/Folder.png"
Height="15"/>
<TextBlock Text="{Binding sName}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:ModifyEntity}">
<StackPanel Orientation="Horizontal">
<!--<Image Source="/WpfTutorialSamples;component/Images/user.png" Margin="0,0,5,0" />-->
<TextBlock Text="{Binding ghName}" />
<TextBlock Text="{Binding ghReference, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</HierarchicalDataTemplate>
<!-- Menu' tasto destro -->
<ContextMenu x:Key="RowMenu" ItemsSource="{Binding MenuList}" >
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Command" Value="{Binding MenuItem_Command}"/>
<Setter Property="CommandParameter" Value="{Binding MenuItem_Command}"/>
<Setter Property="Header" Value="{Binding sMsg}"/>
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</TreeView.Resources>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding bIsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="IsExpanded" Value="True" />
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<!--<Border Grid.Row="3"
Style="{StaticResource LeftPanelTitle_Border}">
<TextBlock Text="Lista entità importate"
FontWeight="DemiBold"
FontSize="14"/>
</Border>
<ListBox Grid.Row="4"
ItemsSource="{Binding ImportedEntityList, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelImportedEntity}"
MinHeight="200">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.InputBindings>
<MouseBinding Gesture="LeftDoubleClick"
Command="{Binding ImportedEntity_DoubleClick}"/>
</Grid.InputBindings>
<TextBlock Text="{Binding ghName}">
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>-->
<UniformGrid Grid.Row="5"
Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
<!--<Button Content="Cancel"
Command="{Binding Cancel_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>-->
</UniformGrid>
</Grid>
</UserControl>
@@ -1,3 +0,0 @@
Public Class ModifyPartPanelV
End Class
-407
View File
@@ -1,407 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class ModifyPartPanelVM
Inherits VMBase
'Private m_nImportedPartId As Integer = GDB_ID.NULL
'Friend ReadOnly Property nImportedPartId As Integer
' Get
' Return m_nImportedPartId
' End Get
'End Property
'Private m_ImportedEntityList As New ObservableCollection(Of GeomEntity)
'Public Property ImportedEntityList As ObservableCollection(Of GeomEntity)
' Get
' Return m_ImportedEntityList
' End Get
' Set(value As ObservableCollection(Of GeomEntity))
' m_ImportedEntityList = value
' End Set
'End Property
'Private m_SelImportedEntity As GeomEntity
'Public Property SelImportedEntity As GeomEntity
' Get
' Return m_SelImportedEntity
' End Get
' Set(value As GeomEntity)
' m_SelImportedEntity = value
' EgtDeselectAll()
' If Not IsNothing(m_SelImportedEntity) Then
' EgtSelectObj(m_SelImportedEntity.nId)
' End If
' EgtDraw()
' End Set
'End Property
'Friend Sub SetSelImportedEntity(nId As Integer)
' m_SelImportedEntity = Map.refImportPanelVM.ImportedEntityList.FirstOrDefault(Function(x) x.nId = nId)
' EgtDeselectAll()
' If Not IsNothing(m_SelImportedEntity) Then
' EgtSelectObj(m_SelImportedEntity.nId)
' End If
' EgtDraw()
' NotifyPropertyChanged(NameOf(SelImportedEntity))
'End Sub
Private m_ModifyPartList As New ObservableCollection(Of ModifyPart)
Public ReadOnly Property ModifyPartList As ObservableCollection(Of ModifyPart)
Get
Return m_ModifyPartList
End Get
End Property
Private m_SelModifyPart As ModifyPart
Friend Sub SetSelModifyPart(SelModifyPart As ModifyPart)
m_SelModifyPart = SelModifyPart
m_SelModifyLayer = Nothing
End Sub
Public ReadOnly Property SelModifyPart As ModifyPart
Get
Return m_SelModifyPart
End Get
End Property
Private m_SelModifyLayer As ModifyLayer
Public ReadOnly Property SelModifyLayer As ModifyLayer
Get
Return m_SelModifyLayer
End Get
End Property
Friend Sub SetSelModifyLayer(SelModifyLayer As ModifyLayer)
m_SelModifyPart = m_ModifyPartList.FirstOrDefault(Function(x) x.LayerList.Contains(SelModifyLayer))
m_SelModifyLayer = SelModifyLayer
End Sub
Private m_SelModifyEntity As ModifyEntity
Public ReadOnly Property SelModifyEntity As ModifyEntity
Get
Return m_SelModifyEntity
End Get
End Property
Friend Sub SetSelModifyEntity(SelModifyEntity As ModifyEntity)
For Each CurrPart In m_ModifyPartList
Dim CurrLayer As ModifyLayer = CurrPart.LayerList.FirstOrDefault(Function(x) x.EntityList.Contains(SelModifyEntity))
If Not IsNothing(CurrLayer) Then
m_SelModifyPart = CurrPart
m_SelModifyLayer = CurrLayer
Exit For
End If
Next
m_SelModifyEntity = SelModifyEntity
End Sub
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefModifyPartPanelVM(Me)
End Sub
#Region "METHODS"
Friend Sub Init()
m_ModifyPartList.Clear()
' carico pezzi in lista
For Each PrintPart In Map.refTopPanelVM.PartList
m_ModifyPartList.Add(New ModifyPart(PrintPart))
Next
End Sub
#End Region ' METHODS
#Region "COMMANDS"
'#Region "SetReference"
' Public ReadOnly Property SetReference_Command As ICommand
' Get
' If m_cmdSetReference Is Nothing Then
' m_cmdSetReference = New Command(AddressOf SetReference)
' End If
' Return m_cmdSetReference
' End Get
' End Property
' Public Sub SetReference()
' If Not IsNothing(SelGeomEntity) Then
' Dim ChooseReferenceWndVM As New ChooseReferenceWndVM
' Dim ChooseReferenceWndV As New ChooseReferenceWndV(Application.Current.MainWindow, ChooseReferenceWndVM)
' If Not ChooseReferenceWndV.ShowDialog() Then Return
' SelGeomEntity.Reference = ChooseReferenceWndVM.SelReference
' End If
' End Sub
'#End Region ' SetReference
'#Region "AddPart"
' Public ReadOnly Property AddPart_Command As ICommand
' Get
' If m_cmdAddPart Is Nothing Then
' m_cmdAddPart = New Command(AddressOf AddPart)
' End If
' Return m_cmdAddPart
' End Get
' End Property
' Public Sub AddPart()
' m_ImportPartList.Add(New ImportPart)
' End Sub
'#End Region ' AddPart
'#Region "RemovePart"
' Public ReadOnly Property RemovePart_Command As ICommand
' Get
' If m_cmdRemovePart Is Nothing Then
' m_cmdRemovePart = New Command(AddressOf RemovePart)
' End If
' Return m_cmdRemovePart
' End Get
' End Property
' Public Sub RemovePart()
' If IsNothing(SelImportLayer) Then
' ' rimuovo pezzo
' m_ImportPartList.Remove(SelImportPart)
' Else
' ' rimuovo geometria
' Dim CurrEntity As GeomEntity = m_SelGeomEntity
' SelImportLayer.EntityList.Remove(m_SelGeomEntity)
' ' la rimetto in lista importati
' ImportedEntityList.Add(CurrEntity)
' End If
' End Sub
'#End Region ' RemovePart
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
'Dim sErr As New List(Of String)
'' verifico che tutti i pezzi abbiano una superficie da stampare nel layer apposito
'For Each CurrPart In m_ImportPartList
' For Each CurrLayer In CurrPart.LayerList
' Select Case CurrLayer.Type
' Case ImportLayer.LayerType.PRINT_SOLID
' If CurrLayer.EntityList.Count = 0 Then
' If sErr.Count > 0 Then sErr(sErr.Count - 1) &= Environment.NewLine
' sErr.Add(CurrPart.ghName & " - No print surface defined!")
' End If
' End Select
' Next
'Next
'If sErr.Count > 0 Then
' MessageBox.Show(String.Concat(sErr), "Error")
' Return
'Else
' ' Creo pezzi e layer necessari
' For Each ImportPart In m_ImportPartList
' Dim frImportedPart As New Frame3d
' EgtGetGroupGlobFrame(m_nImportedPartId, frImportedPart)
' Dim nPartId As Integer = EgtCreateGroup(GDB_ID.ROOT, frImportedPart)
' EgtSetName(nPartId, PART)
' Dim nFrameId As Integer = GDB_ID.NULL
' Dim b3PrintSolid As New BBox3d
' Dim nPrintPartLayerId As Integer = GDB_ID.NULL
' Dim PrintSolidEntity As GeomEntity = Nothing
' Dim nOriginalPartLayerId As Integer = GDB_ID.NULL
' Dim nRibsLayerId As Integer = GDB_ID.NULL
' Dim nShellNumberLayerId As Integer = GDB_ID.NULL
' Dim nAuxSolidsLayerId As Integer = GDB_ID.NULL
' Dim nMachStartLayerId As Integer = GDB_ID.NULL
' Dim nOthersLayerId As Integer = GDB_ID.NULL
' For Each ImportLayer In ImportPart.LayerList
' Select Case ImportLayer.Type
' Case ImportLayer.LayerType.PRINT_SOLID
' nPrintPartLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nPrintPartLayerId, PRINT_SOLID)
' If ImportLayer.EntityList.Count > 0 Then
' PrintSolidEntity = ImportLayer.EntityList(0)
' EgtRelocateGlob(PrintSolidEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
' ' calcolo box superficie per creazione riferimento
' EgtGetBBoxGlob(PrintSolidEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
' End If
' 'Case ImportLayer.LayerType.ORIGINAL_SOLID
' ' nOriginalPartLayerId = EgtCreateGroup(nPartId)
' ' EgtSetName(nOriginalPartLayerId, ORIGINAL_SOLID)
' ' For Each GeomEntity In ImportLayer.EntityList
' ' EgtRelocateGlob(GeomEntity.nId, nOriginalPartLayerId, GDB_POS.LAST_SON)
' ' Next
' Case ImportLayer.LayerType.MACH_START
' nMachStartLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nMachStartLayerId, LAY_MACH_START)
' Dim nMachStartId As Integer = GDB_ID.NULL
' If ImportLayer.EntityList.Count > 0 Then
' For Each GeomEntity In ImportLayer.EntityList
' ' se punto o curva compo
' Dim EntityType As GDB_TY = EgtGetType(GeomEntity.nId)
' Select Case EntityType
' Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO
' ' gli cambio layer
' EgtRelocateGlob(GeomEntity.nId, nMachStartLayerId, GDB_POS.LAST_SON)
' nMachStartId = GeomEntity.nId
' Case GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
' ' altrimenti la trasformo in curva compo
' nMachStartId = EgtCreateCurveCompo(nMachStartLayerId, GeomEntity.nId, True)
' End Select
' EgtSetName(nMachStartId, START_GEOM)
' ' coloro l'entita' di rosso
' Dim c3Red As Color3d
' c3Red.FromColor(System.Drawing.Color.Red)
' EgtSetColor(nMachStartId, c3Red)
' Next
' Else
' ' creo punto di partenza
' Dim ptStart As Point3d = b3PrintSolid.Center() - 0.6 * b3PrintSolid.DimY() * Vector3d.Y_AX() - 0.5 * b3PrintSolid.DimZ() * Vector3d.Z_AX()
' nMachStartId = EgtCreateGeoPoint(nMachStartLayerId, ptStart, GDB_RT.GLOB)
' EgtSetName(nMachStartId, START_GEOM)
' ' coloro l'entita' di rosso
' Dim c3Red As Color3d
' c3Red.FromColor(System.Drawing.Color.Red)
' EgtSetColor(nMachStartId, c3Red)
' End If
' Case ImportLayer.LayerType.RIBS
' nRibsLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nRibsLayerId, LAY_RIBS)
' For Each GeomEntity In ImportLayer.EntityList
' EgtSetInfo(GeomEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
' EgtRelocateGlob(GeomEntity.nId, nRibsLayerId, GDB_POS.LAST_SON)
' ' coloro l'entita' di viola
' Dim c3LightBlue As Color3d
' c3LightBlue.FromColor(System.Drawing.Color.MediumOrchid)
' EgtSetColor(GeomEntity.nId, c3LightBlue)
' Next
' Case ImportLayer.LayerType.SHELL_NUMBER
' nShellNumberLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
' For Each GeomEntity In ImportLayer.EntityList
' EgtSetInfo(GeomEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
' EgtRelocateGlob(GeomEntity.nId, nShellNumberLayerId, GDB_POS.LAST_SON)
' ' coloro l'entita' di verde
' Dim c3LightBlue As Color3d
' c3LightBlue.FromColor(System.Drawing.Color.Lime)
' EgtSetColor(GeomEntity.nId, c3LightBlue)
' Next
' Case ImportLayer.LayerType.AUX_SOLIDS
' nAuxSolidsLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
' For Each GeomEntity In ImportLayer.EntityList
' EgtSetInfo(GeomEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
' EgtRelocateGlob(GeomEntity.nId, nAuxSolidsLayerId, GDB_POS.LAST_SON)
' ' coloro l'entita' di oro
' Dim c3LightBlue As Color3d
' c3LightBlue.FromColor(System.Drawing.Color.DarkGoldenrod)
' EgtSetColor(GeomEntity.nId, c3LightBlue)
' Next
' Case ImportLayer.LayerType.OTHERS
' nOthersLayerId = EgtCreateGroup(nPartId)
' EgtSetName(nOthersLayerId, LAY_OTHERS)
' For Each GeomEntity In ImportLayer.EntityList
' EgtRelocateGlob(GeomEntity.nId, nOthersLayerId, GDB_POS.LAST_SON)
' Next
' End Select
' Next
' ' aggiungo riferimento
' Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
' EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' ' Creo riferimento
' Dim ptOrig As New Point3d(b3PrintSolid.Min())
' Select Case PrintSolidEntity.Reference
' Case ChooseReferenceWndVM.References.TL
' ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX
' Case ChooseReferenceWndVM.References.TR
' ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.BL
' Case ChooseReferenceWndVM.References.BR
' ptOrig += b3PrintSolid.DimX() * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.TC
' ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.ML
' ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX
' Case ChooseReferenceWndVM.References.MR
' ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.TC
' ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.MR
' ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.BC
' ptOrig += b3PrintSolid.DimX() / 2 * Vector3d.X_AX
' Case ChooseReferenceWndVM.References.MC
' ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
' End Select
' Dim frPrintSolid As New Frame3d(ptOrig)
' nFrameId = EgtCreateGeoFrame(nReferenceLayerId, frPrintSolid, GDB_RT.GLOB)
' If nFrameId Then
' EgtSetName(nFrameId, FRAME_PART)
' EgtSetMode(nFrameId, GDB_MD.LOCKED)
' End If
' EgtSetInfo(nReferenceLayerId, KEY_REFERENCE, PrintSolidEntity.Reference)
' ' appoggio il pezzo sulla tavola
' EgtMove( nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
' ' lo aggiungo a lista pezzi
' Dim sFilePath As String = ""
' EgtGetInfo(m_nImportedPartId, FILE_PATH, sFilePath)
' EgtSetInfo(nPartId, FILE_PATH, sFilePath)
' EgtSetInfo(nPartId, "PartOnTable", 1)
' Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, PrintSolidEntity.nId, nOriginalPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
' Map.refTopPanelVM.PartList.Add(NewPart)
' Next
'End If
''EgtAddMachGroup("3dPrint")
''EgtSetTable("Tab")
''Dim nRawId As Integer = EgtAddRawPart(b3PrintSolid.Min, b3PrintSolid.DimX, b3PrintSolid.DimY, b3PrintSolid.DimZ, New Color3d(128, 128, 128, 30))
''EgtAddPartToRawPart(nPartId, b3PrintSolid.Min, nRawId)
''EgtMoveToCornerRawPart(nRawId, New Point3d(dPosX, dPosY, 0), MCH_CR.BL)
''EgtResetCurrMachGroup()
'' seleziono ultimo pezzo aggiunto
'Map.refTopPanelVM.SelLastPart()
'' elimino vecchio pezzo d'importazione
'EgtErase(m_nImportedPartId)
'EgtDraw()
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Ok
#Region "Cancel"
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Cancel()
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Cancel
#End Region ' COMMANDS
End Class
-435
View File
@@ -1,435 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class ModifyEntity
Inherits VMBase
' layer sotto cui e' questa entita'
Private m_OrigLayer As ModifyLayer
Friend ReadOnly Property OrigLayer As ModifyLayer
Get
Return m_OrigLayer
End Get
End Property
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
' seleziono in scena
EgtDeselectAll()
If Not IsNothing(value) Then
EgtSelectObj(m_nId)
End If
EgtDraw()
' segno come elemento selezionato in treeview
Map.refModifyPartPanelVM.SetSelModifyEntity(Me)
End Set
End Property
Private m_nId As Integer = GDB_ID.NULL
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Public ReadOnly Property ghName As String
Get
Return m_nId
End Get
End Property
Private m_MenuList As New List(Of MenuItemVm)
Public Property MenuList As List(Of MenuItemVm)
Get
Return m_MenuList
End Get
Set(value As List(Of MenuItemVm))
m_MenuList = value
End Set
End Property
Sub New(nId As Integer, sName As String, OrigLayer As ModifyLayer)
m_nId = nId
m_sName = sName
m_OrigLayer = OrigLayer
' aggiungo voci layer a contextmenu
CreateContextMenu(OrigLayer)
End Sub
Friend Sub UpdateContextMenu(OrigLayer As ModifyLayer)
m_MenuList.Clear()
' aggiungo voci layer a contextmenu
CreateContextMenu(OrigLayer)
End Sub
Friend Sub CreateContextMenu(OrigLayer As ModifyLayer)
For Each ProjectPart In Map.refTopPanelVM.PartList
' verifico in quali layer puo' andare questo elemento
Dim EntityType As GDB_TY = EgtGetType(nId)
Select Case EntityType
Case GDB_TY.GEO_POINT, GDB_TY.CRV_COMPO, GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_LINE
' recupero i layer
If OrigLayer.Type <> ModifyLayer.LayerType.MACH_START Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.MACH_START, ProjectPart))
If OrigLayer.Type <> ModifyLayer.LayerType.OTHERS Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.OTHERS, ProjectPart))
Case GDB_TY.SRF_MESH
' verifico se volume chiuso
If OrigLayer.Type <> ModifyLayer.LayerType.PRINT_SOLID Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.PRINT_SOLID, ProjectPart))
If OrigLayer.Type <> ModifyLayer.LayerType.SHELL_NUMBER Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.SHELL_NUMBER, ProjectPart))
If OrigLayer.Type <> ModifyLayer.LayerType.AUX_SOLIDS Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.AUX_SOLIDS, ProjectPart))
If OrigLayer.Type <> ModifyLayer.LayerType.RIBS Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.RIBS, ProjectPart))
If OrigLayer.Type <> ModifyLayer.LayerType.OTHERS Then m_MenuList.Add(New MenuItemVm(Me, OrigLayer, ModifyLayer.LayerType.OTHERS, ProjectPart))
End Select
Next
End Sub
Friend Sub UpdateOrigLayer(NewLayer As ModifyLayer)
m_OrigLayer = NewLayer
End Sub
End Class
Public Class ModifyPart
Inherits VMBase
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
Map.refModifyPartPanelVM.SetSelModifyPart(Me)
End Set
End Property
Private m_PrintPart As Print3dPartVM
Public ReadOnly Property PrintPart As Print3dPartVM
Get
Return m_PrintPart
End Get
End Property
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Public ReadOnly Property ghName As String
Get
Return m_PrintPart.sImportedFileName
End Get
End Property
Private m_LayerList As New ObservableCollection(Of ModifyLayer)
Public ReadOnly Property LayerList As ObservableCollection(Of ModifyLayer)
Get
Return m_LayerList
End Get
End Property
Sub New(PrintPart As Print3dPartVM)
m_PrintPart = PrintPart
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.PRINT_SOLID, "Print", PrintPart))
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.MACH_START, "Layer Start", PrintPart))
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.RIBS, "Ribs", PrintPart))
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.SHELL_NUMBER, "Reduce Shell Number", PrintPart))
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.AUX_SOLIDS, "Filled Solids", PrintPart))
m_LayerList.Add(New ModifyLayer(ModifyLayer.LayerType.OTHERS, "Others", PrintPart))
End Sub
End Class
Public Class ModifyLayer
Inherits VMBase
Public Enum LayerType As Integer
PRINT_SOLID = 1
MACH_START = 2
RIBS = 3
SHELL_NUMBER = 4
AUX_SOLIDS = 5
OTHERS = 6
End Enum
Private m_nLayerId As Integer
Private m_bIsSelected As Boolean
Public Property bIsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
m_bIsSelected = value
Map.refModifyPartPanelVM.SetSelModifyLayer(Me)
End Set
End Property
Private m_Type As LayerType
Public Property Type As LayerType
Get
Return m_Type
End Get
Set(value As LayerType)
m_Type = value
End Set
End Property
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_EntityList As New ObservableCollection(Of ModifyEntity)
Public Property EntityList As ObservableCollection(Of ModifyEntity)
Get
Return m_EntityList
End Get
Set(value As ObservableCollection(Of ModifyEntity))
m_EntityList = value
End Set
End Property
Sub New(Type As LayerType, sName As String)
m_Type = Type
m_sName = sName
End Sub
Sub New(Type As LayerType, sName As String, PrintPart As Print3dPartVM)
m_Type = Type
m_sName = sName
Select Case Type
Case LayerType.PRINT_SOLID
m_nLayerId = PrintPart.nPrintSolidLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
Case LayerType.MACH_START
m_nLayerId = PrintPart.nMachStartLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
While nEntityId <> GDB_ID.NULL
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
nEntityId = EgtGetNext(nEntityId)
EgtGetName(nEntityId, sEntitytName)
End While
Case LayerType.RIBS
m_nLayerId = PrintPart.nRibsLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
While nEntityId <> GDB_ID.NULL
Dim RibType As Integer = RibEntity.RibTypes.FROMDRAW
EgtGetInfo(nEntityId, KEY_RIB_TYPE, RibType)
If RibType = RibEntity.RibTypes.FROMIMPORT Then
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
End If
nEntityId = EgtGetNext(nEntityId)
EgtGetName(nEntityId, sEntitytName)
End While
Case LayerType.SHELL_NUMBER
m_nLayerId = PrintPart.nShellNumberLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
While nEntityId <> GDB_ID.NULL
Dim ShellType As Integer = ShellNumberEntity.ShellNumberTypes.FROMDRAW
EgtGetInfo(nEntityId, KEY_SHELLNBR_TYPE, ShellType)
If ShellType = ShellNumberEntity.ShellNumberTypes.FROMIMPORT Then
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
End If
nEntityId = EgtGetNext(nEntityId)
EgtGetName(nEntityId, sEntitytName)
End While
Case LayerType.AUX_SOLIDS
m_nLayerId = PrintPart.nAuxSolidsLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
While nEntityId <> GDB_ID.NULL
'Dim ShellType As Integer = ShellNumberEntity.ShellNumberTypes.FROMDRAW
'EgtGetInfo(nEntityId, KEY_SHELLNBR_TYPE, ShellType)
'If ShellType = ShellNumberEntity.ShellNumberTypes.FROMIMPORT Then
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
'End If
nEntityId = EgtGetNext(nEntityId)
EgtGetName(nEntityId, sEntitytName)
End While
Case LayerType.OTHERS
m_nLayerId = PrintPart.nOthersLayerId
Dim nEntityId As Integer = EgtGetFirstInGroup(m_nLayerId)
Dim sEntitytName As String = ""
EgtGetName(nEntityId, sEntitytName)
While nEntityId <> GDB_ID.NULL
m_EntityList.Add(New ModifyEntity(nEntityId, sEntitytName, Me))
nEntityId = EgtGetNext(nEntityId)
EgtGetName(nEntityId, sEntitytName)
End While
End Select
End Sub
End Class
Public Class MenuItemVm
Inherits VMBase
' enita' di origine
Private m_OrigEntity As ModifyEntity
Private m_OrigLayer As ModifyLayer
' pezzo in cui spostare
Private m_Part As Print3dPartVM
' tipo del layer indicato
Private m_Type As ModifyLayer.LayerType
Public Property Type As ModifyLayer.LayerType
Get
Return m_Type
End Get
Set(value As ModifyLayer.LayerType)
m_Type = value
End Set
End Property
Public ReadOnly Property sMsg As String
Get
Dim sType As String = ""
Select Case m_Type
Case ModifyLayer.LayerType.PRINT_SOLID
sType = "Print"
Case ModifyLayer.LayerType.MACH_START
sType = "Layer Start"
Case ModifyLayer.LayerType.RIBS
sType = "Ribs"
Case ModifyLayer.LayerType.SHELL_NUMBER
sType = "Reduce shell number"
Case ModifyLayer.LayerType.AUX_SOLIDS
sType = "Filled Solids"
Case ModifyLayer.LayerType.OTHERS
sType = "Others"
End Select
Return "Move to " & sType
End Get
End Property
' Definizione comando
Private m_cmdCommand As ICommand
Sub New(OrigEntity As ModifyEntity, OrigLayer As ModifyLayer, Type As ModifyLayer.LayerType, Part As Print3dPartVM)
m_OrigEntity = OrigEntity
m_OrigLayer = OrigLayer
m_Type = Type
m_Part = Part
End Sub
#Region "Command"
Public ReadOnly Property MenuItem_Command As ICommand
Get
If m_cmdCommand Is Nothing Then
m_cmdCommand = New Command(AddressOf Command)
End If
Return m_cmdCommand
End Get
End Property
Public Sub Command()
' recupero layer da pezzo
Dim nLayerId As Integer = GDB_ID.NULL
Select Case m_Type
Case ModifyLayer.LayerType.PRINT_SOLID
nLayerId = m_Part.nPrintSolidLayerId
Case ModifyLayer.LayerType.MACH_START
nLayerId = m_Part.nMachStartLayerId
Case ModifyLayer.LayerType.RIBS
nLayerId = m_Part.nRibsLayerId
Case ModifyLayer.LayerType.SHELL_NUMBER
nLayerId = m_Part.nShellNumberLayerId
Case ModifyLayer.LayerType.AUX_SOLIDS
nLayerId = m_Part.nAuxSolidsLayerId
Case ModifyLayer.LayerType.OTHERS
nLayerId = m_Part.nOthersLayerId
End Select
' sposto entita'
If EgtRelocateGlob(m_OrigEntity.nId, nLayerId) Then
' elimino info vecchio layer
Select Case m_OrigLayer.Type
Case ModifyLayer.LayerType.PRINT_SOLID
EgtResetMark(m_OrigEntity.nId)
Case ModifyLayer.LayerType.MACH_START
Case ModifyLayer.LayerType.RIBS
EgtRemoveInfo(m_OrigEntity.nId, KEY_RIB_TYPE)
Case ModifyLayer.LayerType.SHELL_NUMBER
EgtRemoveInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE)
Case ModifyLayer.LayerType.AUX_SOLIDS
EgtRemoveInfo(m_OrigEntity.nId, KEY_AUXSOLID_TYPE)
Case ModifyLayer.LayerType.OTHERS
End Select
' sposto in lista
m_OrigLayer.EntityList.Remove(m_OrigEntity)
Dim NewPart As ModifyPart = Map.refModifyPartPanelVM.ModifyPartList.FirstOrDefault(Function(x) x.PrintPart.nPartId = m_Part.nPartId)
If Not IsNothing(NewPart) Then
Dim NewLayer As ModifyLayer = NewPart.LayerList.FirstOrDefault(Function(x) x.Type = m_Type)
If Not IsNothing(NewLayer) Then
NewLayer.EntityList.Add(m_OrigEntity)
' aggiorno riferimenti nell'entita'
m_OrigEntity.UpdateOrigLayer(NewLayer)
End If
End If
' aggiungo info nuovo layer
Select Case m_Type
Case ModifyLayer.LayerType.PRINT_SOLID
EgtSetName(m_OrigEntity.nId, PRINT_SOLID)
EgtSetColor(m_OrigEntity.nId, c3Print)
Case ModifyLayer.LayerType.MACH_START
EgtSetName(m_OrigEntity.nId, LAY_MACH_START)
EgtSetColor(m_OrigEntity.nId, c3MachStart)
Case ModifyLayer.LayerType.RIBS
EgtSetName(m_OrigEntity.nId, LAY_RIBS)
EgtSetInfo(m_OrigEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetColor(m_OrigEntity.nId, c3Rib)
Case ModifyLayer.LayerType.SHELL_NUMBER
EgtSetName(m_OrigEntity.nId, LAY_SHELL_NBR)
EgtSetInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
EgtSetColor(m_OrigEntity.nId, c3ShellNumber)
Case ModifyLayer.LayerType.AUX_SOLIDS
EgtSetName(m_OrigEntity.nId, LAY_AUX_SOLIDS)
EgtSetInfo(m_OrigEntity.nId, KEY_AUXSOLID_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetColor(m_OrigEntity.nId, c3AuxSolids)
Case ModifyLayer.LayerType.OTHERS
EgtSetName(m_OrigEntity.nId, LAY_OTHERS)
EgtSetColor(m_OrigEntity.nId, c3Others)
End Select
EgtDraw()
' aggiorno riferimenti nel context menu item
m_OrigEntity.UpdateContextMenu(m_OrigEntity.OrigLayer)
End If
End Sub
#End Region ' Command
End Class
+3 -3
View File
@@ -30,7 +30,7 @@ Imports System.Windows
#End If
<Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("Icarus")>
<Assembly: AssemblyCopyright("Copyright © 2022 by Egalware s.r.l.")>
<Assembly: AssemblyCopyright("Copyright © 2022-2023 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.12.3")>
<Assembly: AssemblyFileVersion("2.4.12.3")>
<Assembly: AssemblyVersion("2.5.1.1")>
<Assembly: AssemblyFileVersion("2.5.1.1")>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 541 B

+1 -1
View File
@@ -69,7 +69,7 @@ Public Class MySceneHostVM
' Inizializzazione Scena
PreInitializeScene()
' Se tutto bene
If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT._3DPRINT) Then
If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.BASE) Then
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
+2 -2
View File
@@ -587,7 +587,7 @@ Public Class SliceManagerVM
If String.IsNullOrWhiteSpace(sExtension) Then
sExtension = ".cnc"
End If
If bShiftPressed Then
If bCtrlPressed Then
Dim sCurrFilePath As String = ""
Dim sInitialDirectory As String = ""
EgtGetCurrFilePath(sCurrFilePath)
@@ -625,7 +625,7 @@ Public Class SliceManagerVM
End If
' eseguo calcoli
CalcSlice(True, True)
If bCtrlPressed Then
If bShiftPressed Then
' Se esiste ne lancio l'editing
If File.Exists(sIsoFilePath) Then
Process.Start("Notepad.exe", sIsoFilePath)
+1 -1
View File
@@ -30,7 +30,7 @@
Height="180"
Width="92"
Stretch="UniformToFill"/>
<TextBlock Text="2022"
<TextBlock Text="2022-2023"
FontSize="12"
FontFamily="/Resources/Fonts/#Roboto"
HorizontalAlignment="Center"
-19
View File
@@ -1,19 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Icarus">
<Style TargetType="{x:Type local:AirspacePopup}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:AirspacePopup}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>