- creato nuova pagina aggiungi nuova feature,

-creato macro con relativi template
This commit is contained in:
Demetrio Cassarino
2024-02-09 17:12:30 +01:00
parent 827c955d1d
commit 4fead794f3
13 changed files with 337 additions and 138 deletions
@@ -5,7 +5,7 @@
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
WindowState="Maximized"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
@@ -27,7 +27,6 @@
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center"
Grid.Row="0"
Margin="0,0,0,5">
@@ -51,8 +50,8 @@
<TextBlock Text="Macro"
Grid.Row="1"
Margin="0,5,0,0"
Style="{StaticResource ListTextBlock}"/>
<!--<ComboBox ItemsSource="{Binding MacroList}"
Style="{StaticResource OptionTextBlock}"/>
<ComboBox ItemsSource="{Binding MacroList}"
SelectedIndex="{Binding nSelMacro}"
Grid.Row="1"
Grid.Column="1"
@@ -60,45 +59,13 @@
IsEnabled="{Binding MacroList_IsEnabled}"
Width="200"
Margin="0,5,0,0"
Style="{StaticResource FeatureComboBox}"/>-->
<ListBox ItemsSource="{Binding NewMacroList}"
SelectedItem="{Binding sSelMacroItem}"
Grid.Row="1"
Grid.Column="1"
IsEnabled="{Binding MacroList_IsEnabled}"
BorderBrush="Transparent"
Width="800"
Height="585"
Margin="0,5,0,0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sMacroName}"/>
<Image Source="{Binding sMacroDrawPath}"
Grid.Row="1"
Width="300"
Margin="5,0,5,5"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Style="{StaticResource FeatureComboBox}"/>
</Grid>
<Image Source="{Binding sDrawPath}"
Grid.Row="1"
Height="300"
Width="300"
Margin="5,0,5,5"/>
<!--<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
Grid.Row="2"
@@ -116,7 +83,6 @@
<TextBlock Text="{Binding sName}"
Style="{StaticResource OptionTextBlock}"/>
</StackPanel>-->
<Grid Grid.Row="2" Margin="0,0,0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
@@ -135,9 +101,7 @@
Grid.Column="3"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</Grid>
</Grid>
</Border>
</StackPanel>
</EgtWPFLib5:EgtCustomWindow>
@@ -37,8 +37,8 @@ Public Class AddFeatureWndVM
ElseIf m_SelGRPType = GRPType.T Then
nSelPRC = PRCList(m_PrevSelPRCIndex_T)
End If
NotifyPropertyChanged("PRCList")
NotifyPropertyChanged("nSelPRC")
NotifyPropertyChanged(NameOf(PRCList))
NotifyPropertyChanged(NameOf(nSelPRC))
End Set
End Property
@@ -49,6 +49,14 @@ Public Class AddFeatureWndVM
End Get
End Property
Private m_PRCListView As New List(Of PRC)
Public ReadOnly Property PRCListView As List(Of PRC)
Get
Return m_PRCListView
End Get
End Property
Private m_NewMacroList As New ObservableCollection(Of NewMacro)
Public ReadOnly Property NewMacroList As ObservableCollection(Of NewMacro)
Get
@@ -82,10 +90,10 @@ Public Class AddFeatureWndVM
m_PrevSelPRCIndex_T = PRCList.IndexOf(m_nSelPRC)
End If
End If
NotifyPropertyChanged("sDrawPath")
NotifyPropertyChanged(NameOf(sDrawPath))
' carico eventuali file Macro
MacroList.Clear()
NewMacroList.Clear()
If Core.Configuration.bOnlyProd Then NewMacroList.Clear()
m_MacroFilePathList = New List(Of String)
If Not IsNothing(nSelPRC) Then
Dim nGRPFromFileName As Integer = 0
@@ -109,28 +117,36 @@ Public Class AddFeatureWndVM
sMacroNameFromFileName = DataFromFileName(1)
End If
If nGRPFromFileName = CalcBeamPrivateProfileGRP(nSelPRC.nGRP) AndAlso nPRCFromFileName = nSelPRC.nPRC Then
'MacroList.Add(New IdNameStruct(nIdMacroName, sMacroNameFromFileName))
NewMacroList.Add(New NewMacro(nIdMacroName, sMacroNameFromFileName, Map.refMainWindowVM.MainWindowM.sMacroDir & "\Templete\" & sMacroNameFromFileName & ".png"))
MacroList.Add(New IdNameStruct(nIdMacroName, sMacroNameFromFileName))
If Core.Configuration.bOnlyProd Then NewMacroList.Add(New NewMacro(nIdMacroName, sMacroNameFromFileName, Map.refMainWindowVM.MainWindowM.sMacroDir & "\Template\" & sMacroNameFromFileName & ".png"))
m_MacroFilePathList.Add(File)
nIdMacroName = nIdMacroName + 1
nIdMacroName += 1
End If
End If
End If
End If
Next
'If MacroList.Count > 0 Then
' MacroList_IsEnabled = True
'Else
' MacroList_IsEnabled = False
'End If
If NewMacroList.Count > 0 Then
If Core.Configuration.bOnlyProd Then
Dim sGRP As String = m_nSelPRC.ghDesc.ToCharArray(0, 1)
If sGRP = "L" Then
sDrawMacro = Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Features\" & "L" & m_nSelPRC.nPRC.ToString("000") & ".png"
Else
sDrawMacro = Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Features\" & "T" & m_nSelPRC.nPRC.ToString("000") & ".png"
End If
If NewMacroList.Count > 0 Then
MacroList_IsEnabled = True
Else
MacroList_IsEnabled = False
End If
End If
If MacroList.Count > 0 Then
MacroList_IsEnabled = True
Else
MacroList_IsEnabled = False
End If
End If
End If
NotifyPropertyChanged(NameOf(nSelPRC))
End Set
End Property
@@ -142,7 +158,7 @@ Public Class AddFeatureWndVM
Set(value As Boolean)
If value <> m_MacroList_IsEnabled Then
m_MacroList_IsEnabled = value
NotifyPropertyChanged("MacroList_IsEnabled")
NotifyPropertyChanged(NameOf(MacroList_IsEnabled))
End If
End Set
End Property
@@ -180,40 +196,75 @@ Public Class AddFeatureWndVM
End Get
End Property
Private m_sDrawMacro As String
Public Property sDrawMacro As String
Get
Return m_sDrawMacro
End Get
Set(value As String)
m_sDrawMacro = value
NotifyPropertyChanged(NameOf(sDrawMacro))
End Set
End Property
' Definizione comandi
Private m_cmdOk As ICommand
#Region "Messages"
Public ReadOnly Property Process_Msg As String
Get
Return EgtMsg(61805).ToUpper()
End Get
End Property
Public ReadOnly Property Macro_Msg As String
Get
Return EgtMsg(61899).ToUpper()
End Get
End Property
#End Region
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
SelGRPType = 0
'nSelPRC = PRCList(0)
' carico lista process
Dim TempPRCList As New ObservableCollection(Of Integer)
Dim TempPRCLList As New ObservableCollection(Of Integer)
Dim TempPRCLTist As New ObservableCollection(Of Integer)
GetBeamPrivateProfileProcessList(0, TempPRCLList)
GetBeamPrivateProfileProcessList(1, TempPRCLTist)
For Each PRCL In TempPRCLList
TempPRCList.Add(PRCL)
Next
For Each PRCT In TempPRCLTist
TempPRCList.Add(PRCT)
Next
m_PRCList.Clear()
For Each PRC In TempPRCList
' leggo gruppi
Dim GRPList As New ObservableCollection(Of Integer)
GetBeamPrivateProfileGRPList(0, PRC, GRPList)
Dim x = GRPList.Count
GetBeamPrivateProfileGRPList(1, PRC, GRPList)
m_PRCList.Add(New PRC(GRPList(0), PRC, GetBeamPrivateProfileName(0, PRC)))
m_PRCList.Add(New PRC(GRPList(0), PRC, GetBeamPrivateProfileName(1, PRC)))
Next
If Core.Configuration.bOnlyProd Then
' carico lista process
Dim TempPRCList As New ObservableCollection(Of Integer)
Dim TempPRCLList As New ObservableCollection(Of Integer)
Dim TempPRCLTist As New ObservableCollection(Of Integer)
GetBeamPrivateProfileProcessList(0, TempPRCLList)
GetBeamPrivateProfileProcessList(1, TempPRCLTist)
' riporto le liste process in un unica lista
For Each PRCL In TempPRCLList
TempPRCList.Add(PRCL)
Next
For Each PRCT In TempPRCLTist
TempPRCList.Add(PRCT)
Next
m_PRCList.Clear()
' ciclo sulla lista process eliminado i doppi
For Each PRC In TempPRCList.Distinct()
' leggo gruppi
Dim GRPLList As New ObservableCollection(Of Integer)
Dim GRPTList As New ObservableCollection(Of Integer)
GetBeamPrivateProfileGRPList(0, PRC, GRPLList)
GetBeamPrivateProfileGRPList(1, PRC, GRPTList)
If GRPLList.Count > 0 Then m_PRCList.Add(New PRC(GRPLList(0), PRC, GetBeamPrivateProfileName(0, PRC)))
If GRPTList.Count > 0 Then m_PRCList.Add(New PRC(GRPTList(0), PRC, GetBeamPrivateProfileName(1, PRC)))
Next
m_PRCListView = m_PRCList.OrderBy(Function(x) x.nPRC).ToList()
nSelPRC = m_PRCList(0)
NotifyPropertyChanged(NameOf(PRCListView))
NotifyPropertyChanged(NameOf(PRCList))
Else
SelGRPType = 0
nSelPRC = PRCList(0)
End If
End Sub
#End Region ' CONSTRUCTOR
@@ -325,7 +376,7 @@ Public Class NewMacro
Private m_sMacroName As String
Public ReadOnly Property sMacroName As String
Get
Return m_sMacroName
Return m_sMacroName.ToUpper()
End Get
End Property
@@ -0,0 +1,123 @@
<EgtWPFLib5:EgtCustomWindow x:Class="AddNewFeatureWndV"
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:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
Title="AddProcess">
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
Height="50">
<TextBlock Text="{Binding Process_Msg}"
Style="{StaticResource ListTextBlock}"/>
<Image Source="{Binding sDrawMacro}"
Width="80"
Margin="5,0,5,5"/>
</StackPanel>
<ListBox ItemsSource="{Binding PRCListView}"
SelectedItem="{Binding nSelPRC}"
Grid.Row="1"
BorderBrush="Transparent"
Height="585"
Width="260"
HorizontalAlignment="Left"
Margin="5">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Name="Border" Padding="2" SnapsToDevicePixels="True">
<ContentPresenter/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="15"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ghDesc}"
ToolTip="{Binding ghDesc}"
HorizontalAlignment="Left"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"
Style="{StaticResource OptionTextBlock}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="{Binding Macro_Msg}"
Grid.Column="1"
Style="{StaticResource ListTextBlock}"/>
<ListBox ItemsSource="{Binding NewMacroList}"
SelectedItem="{Binding sSelMacroItem}"
Grid.Row="1"
Grid.Column="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
IsEnabled="{Binding MacroList_IsEnabled}"
BorderBrush="Transparent"
Width="1000"
Height="610"
Margin="5">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sMacroName}"
Margin="5"
FontSize="14"
Style="{StaticResource OptionTextBlock}"/>
<Image Source="{Binding sMacroDrawPath}"
Grid.Row="1"
Width="300"
Margin="5,0,5,5"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Columns="2"
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="5">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsDefault="True"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
<Button Content="Cancel"
IsCancel="True"
Style="{StaticResource EgtWPFLib5_InputButton}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,17 @@
Public Class AddNewFeatureWndV
Private WithEvents m_AddFeatureWndVM As AddFeatureWndVM
Sub New(Owner As Window, AddFeatureWndVM As AddFeatureWndVM)
' La chiamata è richiesta dalla finestra di progettazione.
InitializeComponent()
Me.DataContext = AddFeatureWndVM
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
m_AddFeatureWndVM = AddFeatureWndVM
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_AddFeatureWndVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -147,7 +147,6 @@ Public Class BTLParamVM
' controllo se i pezzi sono lavorati se si messaggio di warning altrimenti messaggio informativo
If nDoneCnt > 0 Then
MessageBox.Show("Pezzo " & nPartId & " non modificato in " & INPROD & " barra/e perche' settata/e come da produrre", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Warning)
dNewValue = m_BTLParamM.dValue
ElseIf INPROD > 0 Then
MessageBox.Show("Pezzo " & nPartId & " modificato in " & INPROD & " barra/e grezza/e", EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Information)
End If
@@ -256,6 +256,9 @@
<Compile Include="AboutBoxWindow\AboutBoxV.xaml.vb">
<DependentUpon>AboutBoxV.xaml</DependentUpon>
</Compile>
<Compile Include="AddFeatureWnd\AddNewFeatureWndV.xaml.vb">
<DependentUpon>AddNewFeatureWndV.xaml</DependentUpon>
</Compile>
<Compile Include="BTLPartManager\BTLPartManagerV.xaml.vb">
<DependentUpon>BTLPartManagerV.xaml</DependentUpon>
</Compile>
@@ -532,6 +535,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="AddFeatureWnd\AddNewFeatureWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="BTLPartManager\BTLPartManagerV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -209,60 +209,98 @@ Public Class FeatureListManagerVM
If IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then Return
' apro finestra di definizione nuova feature
Dim AddFeatureWndVM As New AddFeatureWndVM()
Dim AddFeatureWnd As New AddFeatureWndV(Application.Current.MainWindow, AddFeatureWndVM)
If AddFeatureWnd.ShowDialog() Then
Dim NewFeat As BTLFeatureM
Dim nNewFeatureId As Integer = 0
Dim bMacroFlag As Boolean = False
' verifico se una Macro è selezionata
'If AddFeatureWndVM.MacroList.Count > 0 AndAlso AddFeatureWndVM.nSelMacro >= 0 Then
If AddFeatureWndVM.NewMacroList.Count > 0 AndAlso AddFeatureWndVM.sSelMacroItem.nIndexMacro >= 0 Then
' Creo nuova feature sulla base della Macro selezionata
' Creo table e setto variabili
EgtLuaCreateGlobTable("MACRO")
EgtLuaSetGlobNumVar("MACRO.L", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlL)
EgtLuaSetGlobNumVar("MACRO.W", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlW)
EgtLuaSetGlobNumVar("MACRO.H", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlH)
EgtLuaSetGlobIntVar("MACRO.PROCID", Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.NewProcId())
'Dim bOk = EgtLuaExecFile(AddFeatureWndVM.m_MacroFilePathList(AddFeatureWndVM.nSelMacro))
Dim bOk = EgtLuaExecFile(AddFeatureWndVM.m_MacroFilePathList(AddFeatureWndVM.sSelMacroItem.nIndexMacro))
' Leggo variabili
EgtLuaGetGlobIntVar("MACRO.FEATUREID", nNewFeatureId)
' Reset lua
EgtLuaResetGlobVar("MACRO")
If Not bOk Then
MessageBox.Show(EgtMsg(61869), EgtMsg(30007))
Return
Dim NewFeat As BTLFeatureM = Nothing
Dim nNewFeatureId As Integer = 0
Dim bMacroFlag As Boolean = False
If bOnlyProd Then
Dim AddNewFeatureWnd As New AddNewFeatureWndV(Application.Current.MainWindow, AddFeatureWndVM)
If AddNewFeatureWnd.ShowDialog() Then
' verifico se una Macro è selezionata
If AddFeatureWndVM.NewMacroList.Count > 0 AndAlso Not IsNothing(AddFeatureWndVM.sSelMacroItem) AndAlso AddFeatureWndVM.sSelMacroItem.nIndexMacro >= 0 Then
' Creo nuova feature sulla base della Macro selezionata
' Creo table e setto variabili
CreateMacroTable()
Dim bOk = EgtLuaExecFile(AddFeatureWndVM.m_MacroFilePathList(AddFeatureWndVM.sSelMacroItem.nIndexMacro))
' Leggo variabili
EgtLuaGetGlobIntVar("MACRO.FEATUREID", nNewFeatureId)
' Reset lua
EgtLuaResetGlobVar("MACRO")
If Not bOk Then
MessageBox.Show(EgtMsg(61869), EgtMsg(30007))
Return
End If
bMacroFlag = True
Else
' Creo nuova feature (Macro non selezionata)
CreateFeatureUnselectedMacro(AddFeatureWndVM, NewFeat, nNewFeatureId, bMacroFlag)
End If
bMacroFlag = True
Else
' Creo nuova feature (Macro non selezionata)
NewFeat = BTLFeatureM.CreateBTLFeature(AddFeatureWndVM.nSelPRC.nPRC, AddFeatureWndVM.nSelPRC.nGRP, AddFeatureWndVM.nSelPRC.nSIDE)
NewFeat.SetDefaultValues()
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
Dim vParQ() As String = Nothing
NewFeat.CalcParamArray(vPar, sPar, vParQ)
' aggiorno la feature con nuovo valore
EgtBeamSetPart(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId)
nNewFeatureId = EgtBeamAddProcess(NewFeat.nSelGRP, NewFeat.nPRC, NewFeat.nSelSIDE, "",
Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.NewProcId(),
New Frame3d(), vPar, sPar, vParQ, GDB_ID.NULL, GDB_ID.NULL)
bMacroFlag = False
' se è stata creata
NewFeat = AddFeatureToBTL(NewFeat, nNewFeatureId, bMacroFlag)
End If
' se è stata creata
If nNewFeatureId <> GDB_ID.NULL Then
MyMachGroupPanelM.SetDuploModified(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId)
' la aggiungo a struttura BTL corrente
NewFeat = BTLFeatureM.CreateBTLFeature(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM, nNewFeatureId)
If Not bMacroFlag Then NewFeat.SetDefaultValues()
Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.AddBTLFeature(NewFeat)
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM = Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLFeatureVMList.FirstOrDefault(Function(x) x.BTLFeatureM Is NewFeat)
Map.refProjectVM.BTLStructureVM.SelBTLPart.ResetCalcPart()
Else
Dim AddFeatureWnd As New AddFeatureWndV(Application.Current.MainWindow, AddFeatureWndVM)
If AddFeatureWnd.ShowDialog() Then
' verifico se una Macro è selezionata
If AddFeatureWndVM.MacroList.Count > 0 AndAlso AddFeatureWndVM.nSelMacro >= 0 Then
' Creo nuova feature sulla base della Macro selezionata
' Creo table e setto variabili
CreateMacroTable()
Dim bOk = EgtLuaExecFile(AddFeatureWndVM.m_MacroFilePathList(AddFeatureWndVM.nSelMacro))
' Leggo variabili
EgtLuaGetGlobIntVar("MACRO.FEATUREID", nNewFeatureId)
' Reset lua
EgtLuaResetGlobVar("MACRO")
If Not bOk Then
MessageBox.Show(EgtMsg(61869), EgtMsg(30007))
Return
End If
bMacroFlag = True
Else
' Creo nuova feature (Macro non selezionata)
CreateFeatureUnselectedMacro(AddFeatureWndVM, NewFeat, nNewFeatureId, bMacroFlag)
End If
' se è stata creata
NewFeat = AddFeatureToBTL(NewFeat, nNewFeatureId, bMacroFlag)
End If
End If
End Sub
Private Shared Function AddFeatureToBTL(NewFeat As BTLFeatureM, nNewFeatureId As Integer, bMacroFlag As Boolean) As BTLFeatureM
If nNewFeatureId <> GDB_ID.NULL Then
MyMachGroupPanelM.SetDuploModified(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId)
' la aggiungo a struttura BTL corrente
NewFeat = BTLFeatureM.CreateBTLFeature(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM, nNewFeatureId)
If Not bMacroFlag Then NewFeat.SetDefaultValues()
Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.AddBTLFeature(NewFeat)
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM = Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLFeatureVMList.FirstOrDefault(Function(x) x.BTLFeatureM Is NewFeat)
Map.refProjectVM.BTLStructureVM.SelBTLPart.ResetCalcPart()
End If
Return NewFeat
End Function
Private Shared Sub CreateMacroTable()
EgtLuaCreateGlobTable("MACRO")
EgtLuaSetGlobNumVar("MACRO.L", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlL)
EgtLuaSetGlobNumVar("MACRO.W", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlW)
EgtLuaSetGlobNumVar("MACRO.H", Map.refProjectVM.BTLStructureVM.SelBTLPart.dBtlH)
EgtLuaSetGlobIntVar("MACRO.PROCID", Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.NewProcId())
End Sub
Private Shared Sub CreateFeatureUnselectedMacro(AddFeatureWndVM As AddFeatureWndVM, ByRef NewFeat As BTLFeatureM, ByRef nNewFeatureId As Integer, ByRef bMacroFlag As Boolean)
NewFeat = BTLFeatureM.CreateBTLFeature(AddFeatureWndVM.nSelPRC.nPRC, AddFeatureWndVM.nSelPRC.nGRP, AddFeatureWndVM.nSelPRC.nSIDE)
NewFeat.SetDefaultValues()
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
Dim vParQ() As String = Nothing
NewFeat.CalcParamArray(vPar, sPar, vParQ)
' aggiorno la feature con nuovo valore
EgtBeamSetPart(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId)
nNewFeatureId = EgtBeamAddProcess(NewFeat.nSelGRP, NewFeat.nPRC, NewFeat.nSelSIDE, "",
Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.NewProcId(),
New Frame3d(), vPar, sPar, vParQ, GDB_ID.NULL, GDB_ID.NULL)
bMacroFlag = False
End Sub
#End Region ' AddFeature
#Region "RemoveFeature"
@@ -15,7 +15,7 @@
</Style>
</StackPanel.Style>
<TextBlock Text="{Binding Message}"
Visibility="{Binding Message_Visibility}"
Visibility="{Binding Message_Visibility}"
Style="{StaticResource OptionTextBlock}"/>
<TextBox Text="{Binding Text, UpdateSourceTrigger=PropertyChanged}"
Width="200"
@@ -442,7 +442,6 @@ Public Class FreeContourManagerVM
Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProdProjManagerVM.PartManager_Visibility))
' attivo pannello
Map.refProjectVM.SetFreeContourManager_Visibility(True)
Map.refProjWndVM.SetFreeContourManager_Visibility(True)
EgtDraw()
End Sub
@@ -531,7 +530,6 @@ Public Class FreeContourManagerVM
End If
' disattivo pannello
Map.refProjectVM.SetFreeContourManager_Visibility(False)
Map.refProjWndVM.SetFreeContourManager_Visibility(False)
' attivo bottone edit
SelFeature.RefreshFCMBtnVisibility()
' resetto tutte le variabili correnti
@@ -20,7 +20,7 @@ Public Class ProdProjManagerVM
Public ReadOnly Property PartManager_Visibility As Visibility
Get
Return If((Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.SelectionType = BTLStructureVM.SelectionTypes.SELECT_ AndAlso Not Map.refFreeContourManagerVM.bIsActive, Visibility.Visible, Visibility.Collapsed)
Return Map.refProjectVM.PartManager_Visibility
End Get
End Property
@@ -101,7 +101,7 @@ Public Class ProjectVM
Private m_PartManager_Visibility As Boolean = True
Public ReadOnly Property PartManager_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.SelectionType = BTLStructureVM.SelectionTypes.SELECT_ AndAlso Not Map.refFreeContourManagerVM.bIsActive, Visibility.Visible, Visibility.Collapsed)
Return If(Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.SelectionType = BTLStructureVM.SelectionTypes.SELECT_ AndAlso Not Map.refFreeContourManagerVM.bIsActive, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
@@ -9,10 +9,10 @@
</Grid.RowDefinitions>
<EgtBEAMWALL:FreeContourInputV DataContext="{StaticResource FreeContourInputVM}"
Visibility="{Binding DataContext.FreeContourManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjWndV}}}"/>
Visibility="{Binding Tag.FreeContourManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjWndV}}}"/>
<EgtBEAMWALL:PartManagerV DataContext="{StaticResource PartManagerVM}"
Tag="{Binding Tag.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjWndV}}}"
Visibility="{Binding DataContext.PartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjWndV}}}"/>
Visibility="{Binding Tag.PartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjWndV}}}"/>
<Grid Grid.Row="1">
@@ -357,12 +357,14 @@
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="10,0,10,0"/>
</Style>
<Style x:Key="ListTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="10,0,10,0"/>
<Setter Property="FontSize" Value="20"/>
</Style>
<Style x:Key="MachParamTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">