OmagCUT :
- Cambiata gestione variabili all'interno della DrawPage: Ora ci sono due pagine una per le misure ed una per le inclinazioni. - Aggiunta gestione inclinazioni nei componenti.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<UserControl x:Class="CompoDimensionUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="597.1" d:DesignWidth="255.9">
|
||||
|
||||
<!-- Definizione della Grid Laterale -->
|
||||
<Grid Name="VariablesCompoGrid" Grid.RowSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Name="Label1" Grid.Row="0"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox1" Grid.Column="1" Grid.Row="0" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label2" Grid.Row="1"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox2" Grid.Column="1" Grid.Row="1" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label3" Grid.Row="2"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox3" Grid.Column="1" Grid.Row="2" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label4" Grid.Row="3"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox4" Grid.Column="1" Grid.Row="3" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label5" Grid.Row="4"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox5" Grid.Column="1" Grid.Row="4" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label6" Grid.Row="5"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox6" Grid.Column="1" Grid.Row="5" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label7" Grid.Row="6"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox7" Grid.Column="1" Grid.Row="6" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label8" Grid.Row="7"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox8" Grid.Column="1" Grid.Row="7" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label9" Grid.Row="8"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox9" Grid.Column="1" Grid.Row="8" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
<TextBlock Name="Label10" Grid.Row="9"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox10" Grid.Column="1" Grid.Row="9" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
|
||||
<Button Name="InternComponentBtn" Grid.Row="10" Grid.ColumnSpan="2" FontSize="15" />
|
||||
|
||||
<Button Name="AddBtn" Grid.Row="11" FontSize="15" />
|
||||
<Button Name="CancelBtn" Grid.Column="1" Grid.Row="11" FontSize="15" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,138 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class CompoDimensionUC
|
||||
|
||||
' Constants
|
||||
Private Const NUM_VAR As Integer = 10
|
||||
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
' Riferimento alla pagina Draw
|
||||
Private m_DrawPage As DrawPageUC
|
||||
|
||||
Private Sub CompoDimensionUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
' Riferimento alla drawPage
|
||||
m_DrawPage = m_MainWindow.m_DrawPageUC
|
||||
|
||||
' Imposto questa come pagina correntemente visualizzata nella drawpage
|
||||
m_DrawPage.m_ActiveComponentPage = DrawPageUC.Pages.CompoDimension
|
||||
|
||||
' Nascondo bottoni per componenti interni
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
' Imposto contesto corrente e faccio uno ZoomAll della scena con il componente
|
||||
EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx())
|
||||
EgtZoom(ZM.ALL)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CompoDimensionUC_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
||||
|
||||
End Sub
|
||||
|
||||
Friend Function ShowInternalBtn() As Boolean
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Visible
|
||||
AddBtn.Visibility = Windows.Visibility.Visible
|
||||
CancelBtn.Visibility = Windows.Visibility.Visible
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function GetNameEdit(ByVal nInd As Integer) As TextBlock
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return Label1
|
||||
Case 2
|
||||
Return Label2
|
||||
Case 3
|
||||
Return Label3
|
||||
Case 4
|
||||
Return Label4
|
||||
Case 5
|
||||
Return Label5
|
||||
Case 6
|
||||
Return Label6
|
||||
Case 7
|
||||
Return Label7
|
||||
Case 8
|
||||
Return Label8
|
||||
Case 9
|
||||
Return Label9
|
||||
Case Else
|
||||
Return Label10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Friend Function GetValueEdit(ByVal nInd As Integer) As TextBox
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return TextBox1
|
||||
Case 2
|
||||
Return TextBox2
|
||||
Case 3
|
||||
Return TextBox3
|
||||
Case 4
|
||||
Return TextBox4
|
||||
Case 5
|
||||
Return TextBox5
|
||||
Case 6
|
||||
Return TextBox6
|
||||
Case 7
|
||||
Return TextBox7
|
||||
Case 8
|
||||
Return TextBox8
|
||||
Case 9
|
||||
Return TextBox9
|
||||
Case Else
|
||||
Return TextBox10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub EgtTextBox_EgtOpening(sender As Object, e As RoutedEventArgs) Handles TextBox9.EgtOpening, TextBox10.EgtOpening
|
||||
Dim SelectedTextBox As TextBox = e.Source
|
||||
Select Case SelectedTextBox.Name
|
||||
Case "TextBox9"
|
||||
' Indice variabile associata al bottone
|
||||
Dim nI As Integer = m_DrawPage.GetDefinedVarCount() - (NUM_VAR - 9) - 1
|
||||
' Recupero tipo della variabile associata
|
||||
If m_DrawPage.CVars(nI).m_nType = 1 Then
|
||||
TextBox9.IsReadOnly = True
|
||||
If TextBox9.Text = "False" Then
|
||||
TextBox9.Text = "True"
|
||||
Else
|
||||
TextBox9.Text = "False"
|
||||
End If
|
||||
TextBox9.ActivateCalculator = False
|
||||
m_DrawPage.UpdateView()
|
||||
Else
|
||||
TextBox9.ActivateCalculator = True
|
||||
TextBox9.IsReadOnly = False
|
||||
End If
|
||||
Case "TextBox10"
|
||||
' Indice variabile associata al bottone
|
||||
Dim nI As Integer = m_DrawPage.GetDefinedVarCount() - (NUM_VAR - 10) - 1
|
||||
' Recupero tipo della variabile associata
|
||||
If m_DrawPage.CVars(nI).m_nType = 1 Then
|
||||
TextBox10.IsReadOnly = True
|
||||
If TextBox10.Text = "False" Then
|
||||
TextBox10.Text = "True"
|
||||
Else
|
||||
TextBox10.Text = "False"
|
||||
End If
|
||||
TextBox10.ActivateCalculator = False
|
||||
m_DrawPage.UpdateView()
|
||||
Else
|
||||
TextBox10.ActivateCalculator = True
|
||||
TextBox10.IsReadOnly = False
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub EgtCalculator_EgtClosed(sender As Object, e As EventArgs) Handles TextBox1.EgtClosed, TextBox2.EgtClosed, TextBox3.EgtClosed, TextBox4.EgtClosed, TextBox5.EgtClosed, TextBox6.EgtClosed, TextBox7.EgtClosed, TextBox8.EgtClosed,
|
||||
TextBox9.EgtClosed, TextBox10.EgtClosed
|
||||
m_DrawPage.UpdateView()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -31,8 +31,10 @@
|
||||
<ColumnDefinition Width="7*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="MachViewModeBtn" Grid.Column="1" Content="MHT"
|
||||
Style="{StaticResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||
<Button Name="MachViewModeBtn" Grid.Column="1"
|
||||
Style="{StaticResource OmagCut_RightGrayGradientYellowButton}">
|
||||
<Image Source="Resources/MHT.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Public Class DirectCutPageUC
|
||||
SingleCutBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 2)
|
||||
MultipleCutBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 3)
|
||||
GridCutBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 4)
|
||||
MachViewModeBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 5)
|
||||
'MachViewModeBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 5)
|
||||
SawTestBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 7)
|
||||
SawProbingBtn.Content = EgtMsg(MSG_DIRECTCUTPAGEUC + 8)
|
||||
End Sub
|
||||
|
||||
+15
-12
@@ -14,7 +14,7 @@
|
||||
|
||||
<!-- Definizione della DrawPage -->
|
||||
<Border Background="{StaticResource OmagCut_Gray}">
|
||||
<Grid Name="LeftButtonGrid" >
|
||||
<Grid Name="DrawPageGrd" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="12*"/>
|
||||
@@ -25,14 +25,15 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione della Grid Laterale -->
|
||||
<Grid Name="VariablesCompoGrid" Grid.RowSpan="2">
|
||||
<Grid Name="LeftButtonGrd" Grid.RowSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<!--<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
@@ -43,7 +44,7 @@
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>-->
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -54,15 +55,17 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Name="MeasureBtn" Grid.Column="0" Style="{StaticResource OmagCut_YellowIconButton}"
|
||||
Content="Misure" Visibility="Hidden"/>
|
||||
<Button Name="InclinationBtn" Grid.Column="1" Style="{StaticResource OmagCut_YellowIconButton}"
|
||||
Content="Inclinazioni" Visibility="Hidden"/>
|
||||
<ToggleButton Name="DimensionBtn" Grid.Column="0" Style="{StaticResource OmagCut_YellowToggleButton}"
|
||||
Content="Misure"/>
|
||||
<ToggleButton Name="SideAngleBtn" Grid.Column="1" Style="{StaticResource OmagCut_YellowToggleButton}"
|
||||
Content="Inclinazioni"/>
|
||||
<Button Name="DripstoneBtn" Grid.Column="2" Style="{StaticResource OmagCut_YellowIconButton}"
|
||||
Content="Gocciolatoio" Visibility="Hidden"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Name="Label1" Grid.Row="1"
|
||||
<Grid Name="VariablesGrd" Grid.Row="1" Grid.ColumnSpan="2"/>
|
||||
|
||||
<!--<TextBlock Name="Label1" Grid.Row="1"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="TextBox1" Grid.Column="1" Grid.Row="1" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
@@ -106,13 +109,13 @@
|
||||
<Button Name="InternComponentBtn" Grid.Row="11" Grid.ColumnSpan="2" FontSize="15" />
|
||||
|
||||
<Button Name="AddBtn" Grid.Row="12" FontSize="15" />
|
||||
<Button Name="CancelBtn" Grid.Column="1" Grid.Row="12" FontSize="15" />
|
||||
<Button Name="CancelBtn" Grid.Column="1" Grid.Row="12" FontSize="15" />-->
|
||||
|
||||
<Grid Name="MessageGrid" Grid.Row="13" Grid.ColumnSpan="2">
|
||||
<Grid Name="MessageGrid" Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<TextBlock Name="MessageTxBl" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
</Grid>
|
||||
|
||||
<Button Name="BackBtn" Grid.Column="1" Grid.Row="14"
|
||||
<Button Name="BackBtn" Grid.Column="1" Grid.Row="14"
|
||||
Style="{StaticResource OmagCut_YellowIconButton}">
|
||||
<Image Source="Resources/NumericKeyboardArrow.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
+103
-140
@@ -15,14 +15,25 @@ Public Class DrawPageUC
|
||||
|
||||
'Dichiarazione delle Page UserControl
|
||||
Friend m_MainComponentPage As MainComponentPageUC
|
||||
Friend m_CompoDimension As CompoDimensionUC
|
||||
Friend m_SideAngle As SideAngleUC
|
||||
|
||||
' Properties
|
||||
' Properties
|
||||
Private m_sCompoDir As String = String.Empty
|
||||
Private m_sCompoName As String = String.Empty
|
||||
Private m_CVars(NUM_VAR - 1) As CompoVar
|
||||
Private m_bDrawOk As Boolean = False
|
||||
Private m_bFirst As Boolean = True
|
||||
|
||||
' Lista di tutte le entità inclinabili presenti nel progetto
|
||||
Friend m_SideAngleEntityList As New List(Of SideAngleEntity)
|
||||
|
||||
Friend ReadOnly Property CVars
|
||||
Get
|
||||
Return m_CVars
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents DrawScene As New Scene
|
||||
Dim DrawSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
@@ -37,33 +48,28 @@ Public Class DrawPageUC
|
||||
MainComponent
|
||||
SecondaryComponent
|
||||
Draw
|
||||
CompoDimension
|
||||
SideAngle
|
||||
End Enum
|
||||
|
||||
Private Sub DrawPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
'Creazione delle Page UserControl
|
||||
m_MainComponentPage = New MainComponentPageUC
|
||||
m_CompoDimension = New CompoDimensionUC
|
||||
m_SideAngle = New SideAngleUC
|
||||
'Posizionemento nella griglia delle Page UserControl
|
||||
m_MainComponentPage.SetValue(Grid.ColumnProperty, 0)
|
||||
m_MainComponentPage.SetValue(Grid.RowSpanProperty, 2)
|
||||
m_MainComponentPage.SetValue(Grid.ColumnSpanProperty, 2)
|
||||
m_MainComponentPage.SetValue(Grid.RowSpanProperty, 4)
|
||||
m_CompoDimension.SetValue(Grid.ColumnSpanProperty, 2)
|
||||
m_CompoDimension.SetValue(Grid.RowSpanProperty, 4)
|
||||
m_SideAngle.SetValue(Grid.RowSpanProperty, 1)
|
||||
|
||||
'Assegnazione scena all'host e posizionamento nella ImportPageGrid
|
||||
DrawSceneHost.Child = DrawScene
|
||||
DrawSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
DrawSceneHost.SetValue(Grid.RowProperty, 0)
|
||||
Me.LeftButtonGrid.Children.Add(DrawSceneHost)
|
||||
|
||||
'Associazione tag textbox e label per visualizzare nome nella calcolatrice
|
||||
TextBox1.Tag = Label1
|
||||
TextBox2.Tag = Label2
|
||||
TextBox3.Tag = Label3
|
||||
TextBox4.Tag = Label4
|
||||
TextBox5.Tag = Label5
|
||||
TextBox6.Tag = Label6
|
||||
TextBox7.Tag = Label7
|
||||
TextBox8.Tag = Label8
|
||||
TextBox9.Tag = Label9
|
||||
TextBox10.Tag = Label10
|
||||
Me.DrawPageGrd.Children.Add(DrawSceneHost)
|
||||
|
||||
'Imposto i messaggi letti dal file dei messaggi
|
||||
PartNumTxBl.Text = EgtMsg(MSG_DRAWPAGEUC + 1) 'Part Number - Numero pezzi
|
||||
@@ -124,12 +130,11 @@ Public Class DrawPageUC
|
||||
EgtDraw()
|
||||
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
LeftButtonGrd.Children.Remove(m_CompoDimension)
|
||||
LeftButtonGrd.Children.Add(m_MainComponentPage)
|
||||
m_ActiveComponentPage = Pages.MainComponent
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
VariablesCompoGrid.Visibility = Windows.Visibility.Hidden
|
||||
MessageGrid.Visibility = Windows.Visibility.Hidden
|
||||
BackBtn.Visibility = Windows.Visibility.Hidden
|
||||
PartNumberGrd.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
'Valore di default del numero pezzi
|
||||
@@ -178,7 +183,7 @@ Public Class DrawPageUC
|
||||
DrawScene.ZoomAll()
|
||||
' se componenti con buchi interni visualizzo bottoni appositi
|
||||
If sCompo = "Pianocucina.lua" Or sCompo = "Pianobagno.lua" Then
|
||||
ShowInternalBtn()
|
||||
m_CompoDimension.ShowInternalBtn()
|
||||
End If
|
||||
' leggo variabili e aggiorno griglia
|
||||
ReadAndShowVariables()
|
||||
@@ -192,7 +197,8 @@ Public Class DrawPageUC
|
||||
DrawPage_Unloaded(sender, e)
|
||||
' Elimino nome del componente precedente
|
||||
m_sCompoName = String.Empty
|
||||
'
|
||||
' Reset inclinazioni
|
||||
DeleteSideAngle()
|
||||
If String.IsNullOrEmpty(m_MainComponentPage.m_SecondaryComponentPage.m_sCurrCompo) Then
|
||||
DrawPage_Loaded(sender, e)
|
||||
Else
|
||||
@@ -210,12 +216,11 @@ Public Class DrawPageUC
|
||||
EgtDraw()
|
||||
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
LeftButtonGrid.Children.Add(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
LeftButtonGrd.Children.Remove(m_CompoDimension)
|
||||
LeftButtonGrd.Children.Add(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
m_ActiveComponentPage = Pages.MainComponent
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Hidden
|
||||
AddBtn.Visibility = Windows.Visibility.Hidden
|
||||
CancelBtn.Visibility = Windows.Visibility.Hidden
|
||||
VariablesCompoGrid.Visibility = Windows.Visibility.Hidden
|
||||
MessageGrid.Visibility = Windows.Visibility.Hidden
|
||||
BackBtn.Visibility = Windows.Visibility.Hidden
|
||||
PartNumberGrd.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
'Valore di default del numero pezzi
|
||||
@@ -247,13 +252,6 @@ Public Class DrawPageUC
|
||||
Return EgtLuaExecFile(sPath)
|
||||
End Function
|
||||
|
||||
Private Function ShowInternalBtn() As Boolean
|
||||
InternComponentBtn.Visibility = Windows.Visibility.Visible
|
||||
AddBtn.Visibility = Windows.Visibility.Visible
|
||||
CancelBtn.Visibility = Windows.Visibility.Visible
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function ReadAndShowVariables() As Boolean
|
||||
' Recupero nome, tipo e valore delle variabili globali
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
@@ -274,15 +272,15 @@ Public Class DrawPageUC
|
||||
Dim nHide As Integer = NUM_VAR - nShow
|
||||
|
||||
For i As Integer = 1 To nHide
|
||||
GetNameEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
GetValueEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
m_CompoDimension.GetNameEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
m_CompoDimension.GetValueEdit(i).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
GetNameEdit(j).Text = m_CVars(i - 1).m_sName
|
||||
GetNameEdit(j).Visibility = Windows.Visibility.Visible
|
||||
GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
GetValueEdit(j).Visibility = Windows.Visibility.Visible
|
||||
m_CompoDimension.GetNameEdit(j).Text = m_CVars(i - 1).m_sName
|
||||
m_CompoDimension.GetNameEdit(j).Visibility = Windows.Visibility.Visible
|
||||
m_CompoDimension.GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
m_CompoDimension.GetValueEdit(j).Visibility = Windows.Visibility.Visible
|
||||
Next
|
||||
m_bShowVar = False
|
||||
Return True
|
||||
@@ -296,8 +294,8 @@ Public Class DrawPageUC
|
||||
For i As Integer = 1 To nShow
|
||||
Dim j As Integer = nHide + i
|
||||
' interpreto il valore, se non riesco ripristino default
|
||||
If Not m_CVars(i - 1).FromString(GetValueEdit(j).Text) Then
|
||||
GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
If Not m_CVars(i - 1).FromString(m_CompoDimension.GetValueEdit(j).Text) Then
|
||||
m_CompoDimension.GetValueEdit(j).Text = m_CVars(i - 1).ToString()
|
||||
End If
|
||||
' aggiorno la corrispondente variabile lua
|
||||
If Not m_CVars(i - 1).ToLua() Then
|
||||
@@ -309,7 +307,7 @@ Public Class DrawPageUC
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function GetDefinedVarCount() As Integer
|
||||
Friend Function GetDefinedVarCount() As Integer
|
||||
Dim nCount As Integer = 0
|
||||
For i As Integer = 1 To NUM_VAR
|
||||
If m_CVars(i - 1) IsNot Nothing Then
|
||||
@@ -358,6 +356,19 @@ Public Class DrawPageUC
|
||||
End If
|
||||
' Ne recupero l'Id
|
||||
Dim nId2 As Integer = EgtGetLastPart()
|
||||
' Ne recupero il layer OutLoop
|
||||
Dim nOutLoopLayer As Integer = EgtGetFirstNameInGroup(nId2, "OutLoop")
|
||||
' Modifico inclinazione lati
|
||||
For Each Entity In m_SideAngleEntityList
|
||||
Dim nCurrEntityName As Integer = EgtGetFirstNameInGroup(nOutLoopLayer, Entity.sEntityName)
|
||||
If Entity.dSideAngle <> 0 Then
|
||||
' Scrivo nuovo angolo nelle info
|
||||
EgtSetInfo(nCurrEntityName, "SideAng", Entity.dSideAngle)
|
||||
Else
|
||||
' Cancello inclinazione nell'apposito campo info
|
||||
EgtRemoveInfo(nCurrEntityName, "SideAng")
|
||||
End If
|
||||
Next
|
||||
' Muovo la regione in Z per evitare problemi in visualizzazione
|
||||
Dim nRegId = EgtGetFirstNameInGroup(nId2, NAME_REGION)
|
||||
EgtMove(nRegId, New Vector3d(0, 0, DELTAZ_REG), GDB_RT.GLOB)
|
||||
@@ -373,96 +384,6 @@ Public Class DrawPageUC
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function GetNameEdit(ByVal nInd As Integer) As TextBlock
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return Label1
|
||||
Case 2
|
||||
Return Label2
|
||||
Case 3
|
||||
Return Label3
|
||||
Case 4
|
||||
Return Label4
|
||||
Case 5
|
||||
Return Label5
|
||||
Case 6
|
||||
Return Label6
|
||||
Case 7
|
||||
Return Label7
|
||||
Case 8
|
||||
Return Label8
|
||||
Case 9
|
||||
Return Label9
|
||||
Case Else
|
||||
Return Label10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetValueEdit(ByVal nInd As Integer) As TextBox
|
||||
Select Case nInd
|
||||
Case 1
|
||||
Return TextBox1
|
||||
Case 2
|
||||
Return TextBox2
|
||||
Case 3
|
||||
Return TextBox3
|
||||
Case 4
|
||||
Return TextBox4
|
||||
Case 5
|
||||
Return TextBox5
|
||||
Case 6
|
||||
Return TextBox6
|
||||
Case 7
|
||||
Return TextBox7
|
||||
Case 8
|
||||
Return TextBox8
|
||||
Case 9
|
||||
Return TextBox9
|
||||
Case Else
|
||||
Return TextBox10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub EgtTextBox_EgtOpening(sender As Object, e As RoutedEventArgs) Handles TextBox9.EgtOpening, TextBox10.EgtOpening
|
||||
Dim SelectedTextBox As TextBox = e.Source
|
||||
Select Case SelectedTextBox.Name
|
||||
Case "TextBox9"
|
||||
' Indice variabile associata al bottone
|
||||
Dim nI As Integer = GetDefinedVarCount() - (NUM_VAR - 9) - 1
|
||||
' Recupero tipo della variabile associata
|
||||
If m_CVars(nI).m_nType = 1 Then
|
||||
TextBox9.IsReadOnly = True
|
||||
If TextBox9.Text = "False" Then
|
||||
TextBox9.Text = "True"
|
||||
Else
|
||||
TextBox9.Text = "False"
|
||||
End If
|
||||
TextBox9.ActivateCalculator = False
|
||||
UpdateView()
|
||||
Else
|
||||
TextBox9.ActivateCalculator = True
|
||||
TextBox9.IsReadOnly = False
|
||||
End If
|
||||
Case "TextBox10"
|
||||
' Indice variabile associata al bottone
|
||||
Dim nI As Integer = GetDefinedVarCount() - (NUM_VAR - 10) - 1
|
||||
' Recupero tipo della variabile associata
|
||||
If m_CVars(nI).m_nType = 1 Then
|
||||
TextBox10.IsReadOnly = True
|
||||
If TextBox10.Text = "False" Then
|
||||
TextBox10.Text = "True"
|
||||
Else
|
||||
TextBox10.Text = "False"
|
||||
End If
|
||||
TextBox10.ActivateCalculator = False
|
||||
UpdateView()
|
||||
Else
|
||||
TextBox10.ActivateCalculator = True
|
||||
TextBox10.IsReadOnly = False
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
' se errore esco
|
||||
If Not m_bDrawOk Then
|
||||
@@ -476,6 +397,10 @@ Public Class DrawPageUC
|
||||
MakeInsert(InsNbr)
|
||||
' Aggiorno ambiente principale
|
||||
EgtZoom(ZM.ALL)
|
||||
' Elimino nome del componente precedente
|
||||
m_sCompoName = String.Empty
|
||||
' Reset inclinazioni
|
||||
DeleteSideAngle()
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
@@ -484,20 +409,43 @@ Public Class DrawPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
||||
' Elimino nome del componente precedente
|
||||
m_sCompoName = String.Empty
|
||||
' Reset inclinazioni
|
||||
DeleteSideAngle()
|
||||
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
|
||||
End Sub
|
||||
|
||||
Private Sub DeleteSideAngle()
|
||||
' Cancello lista lati inclinati
|
||||
m_SideAngleEntityList.Clear()
|
||||
' Annullo tutti i CheckBox
|
||||
m_SideAngle.L1.IsChecked = False
|
||||
m_SideAngle.L2.IsChecked = False
|
||||
m_SideAngle.L3.IsChecked = False
|
||||
m_SideAngle.L4.IsChecked = False
|
||||
m_SideAngle.L5.IsChecked = False
|
||||
m_SideAngle.L6.IsChecked = False
|
||||
m_SideAngle.L7.IsChecked = False
|
||||
m_SideAngle.L8.IsChecked = False
|
||||
m_SideAngle.L9.IsChecked = False
|
||||
m_SideAngle.L10.IsChecked = False
|
||||
|
||||
End Sub
|
||||
Private Sub DrawPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
||||
'Seleziono la Tab e la Page di apertura
|
||||
Select Case m_ActiveComponentPage
|
||||
Case Pages.MainComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage)
|
||||
LeftButtonGrd.Children.Remove(m_MainComponentPage)
|
||||
Case Pages.SecondaryComponent
|
||||
LeftButtonGrid.Children.Remove(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
Case Else
|
||||
LeftButtonGrd.Children.Remove(m_MainComponentPage.m_SecondaryComponentPage)
|
||||
Case Pages.CompoDimension
|
||||
VariablesGrd.Children.Remove(m_CompoDimension)
|
||||
Case Pages.SideAngle
|
||||
VariablesGrd.Children.Remove(m_SideAngle)
|
||||
End Select
|
||||
|
||||
' Pulisco l'ambiente lua
|
||||
@@ -505,9 +453,24 @@ Public Class DrawPageUC
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub EgtCalculator_EgtClosed(sender As Object, e As EventArgs) Handles TextBox1.EgtClosed, TextBox2.EgtClosed, TextBox3.EgtClosed, TextBox4.EgtClosed, TextBox5.EgtClosed, TextBox6.EgtClosed, TextBox7.EgtClosed, TextBox8.EgtClosed,
|
||||
TextBox9.EgtClosed, TextBox10.EgtClosed
|
||||
UpdateView()
|
||||
Private Sub DimensionBtn_Click(sender As Object, e As RoutedEventArgs) Handles DimensionBtn.Click
|
||||
If DimensionBtn.IsChecked Then
|
||||
VariablesGrd.Children.Remove(m_SideAngle)
|
||||
VariablesGrd.Children.Add(m_CompoDimension)
|
||||
SideAngleBtn.IsChecked = False
|
||||
Else
|
||||
DimensionBtn.IsChecked = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SideAngleBtn_Click(sender As Object, e As RoutedEventArgs) Handles SideAngleBtn.Click
|
||||
If SideAngleBtn.IsChecked Then
|
||||
VariablesGrd.Children.Remove(m_CompoDimension)
|
||||
VariablesGrd.Children.Add(m_SideAngle)
|
||||
DimensionBtn.IsChecked = False
|
||||
Else
|
||||
SideAngleBtn.IsChecked = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Class CompoVar
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="256" Initialized="MainComponentPage_Initialized" Loaded="UserControl_Loaded">
|
||||
d:DesignHeight="768" d:DesignWidth="256">
|
||||
|
||||
<!-- Chiamata al Dictionary -->
|
||||
<UserControl.Resources>
|
||||
|
||||
@@ -16,20 +16,20 @@ Public Class MainComponentPageUC
|
||||
' Variabile che contiene il nome del componente selezionato
|
||||
Friend m_sCurrCompoFam As String = String.Empty
|
||||
|
||||
Private Sub MainComponentPage_Initialized(sender As Object, e As EventArgs)
|
||||
Private Sub MainComponentPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
|
||||
'Creazione delle Page UserControl
|
||||
m_SecondaryComponentPage = New SecondaryComponentPageUC
|
||||
'Posizionemento nella griglia delle Page UserControl
|
||||
m_SecondaryComponentPage.SetValue(Grid.ColumnProperty, 0)
|
||||
m_SecondaryComponentPage.SetValue(Grid.RowSpanProperty, 2)
|
||||
m_SecondaryComponentPage.SetValue(Grid.ColumnSpanProperty, 2)
|
||||
m_SecondaryComponentPage.SetValue(Grid.RowSpanProperty, 4)
|
||||
|
||||
' Leggo messaggi da file ini
|
||||
LabelCompo9.Text = EgtMsg(MSG_COMPONENTPAGEUC + 9)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
Private Sub MainComponentPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
m_bIsFirstPage = True
|
||||
LoadPage()
|
||||
CurrentBtn = Nothing
|
||||
@@ -168,17 +168,21 @@ Public Class MainComponentPageUC
|
||||
m_SecondaryComponentPage.m_sCurrCompo = String.Empty
|
||||
Dim nCount As Integer = GetPrivateProfileInt(CompoName, "Count", 0, m_MainWindow.GetIniFile())
|
||||
If nCount > 1 Then
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.SecondaryComponent
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Add(m_SecondaryComponentPage)
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Add(m_SecondaryComponentPage)
|
||||
Else
|
||||
Dim nCompoName As Integer
|
||||
Dim sCompo As String = String.Empty
|
||||
Dim sCompoImage As String = String.Empty
|
||||
GetPrivateProfileCompo(CompoName, "Compo1", nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.VariablesCompoGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.VariablesGrd.Children.Add(m_MainWindow.m_DrawPageUC.m_CompoDimension)
|
||||
m_MainWindow.m_DrawPageUC.DimensionBtn.IsChecked = True
|
||||
m_MainWindow.m_DrawPageUC.SideAngleBtn.IsChecked = False
|
||||
m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.BackBtn.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.PartNumberGrd.Visibility = Windows.Visibility.Visible
|
||||
' Carico componente
|
||||
m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo)
|
||||
|
||||
@@ -138,6 +138,9 @@
|
||||
<Compile Include="CNCommunication.vb" />
|
||||
<Compile Include="CN_Debug.vb" />
|
||||
<Compile Include="CN_generico.vb" />
|
||||
<Compile Include="CompoDimensionUC.xaml.vb">
|
||||
<DependentUpon>CompoDimensionUC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ConstMachIni.vb" />
|
||||
<Compile Include="ConstMsg.vb" />
|
||||
<Compile Include="CurrentMachine.vb" />
|
||||
@@ -224,6 +227,9 @@
|
||||
<Compile Include="SetUpPage.xaml.vb">
|
||||
<DependentUpon>SetUpPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SideAngleUc.xaml.vb">
|
||||
<DependentUpon>SideAngleUc.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SimulationPageUC.xaml.vb">
|
||||
<DependentUpon>SimulationPageUC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -262,6 +268,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CompoDimensionUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CurrentProjectPageUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -384,6 +394,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SideAngleUc.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SimulationPageUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -547,6 +561,9 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Manual.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\MHT.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -207,19 +207,23 @@ Public Class SecondaryComponentPageUC
|
||||
Dim sCompoImage As String = String.Empty
|
||||
m_MainComponentPage.GetPrivateProfileCompo(m_sMainCompoName, "Compo" & GetButtonNumber(CurrentBtn.Name), nCompoName, sCompo, sCompoImage, m_MainWindow.GetIniFile())
|
||||
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me)
|
||||
' Carico componente
|
||||
m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo)
|
||||
m_sCurrCompo = "Compo" & GetButtonNumber(CurrentBtn.Name)
|
||||
m_MainWindow.m_DrawPageUC.VariablesCompoGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.VariablesGrd.Children.Add(m_MainWindow.m_DrawPageUC.m_CompoDimension)
|
||||
m_MainWindow.m_DrawPageUC.DimensionBtn.IsChecked = True
|
||||
m_MainWindow.m_DrawPageUC.SideAngleBtn.IsChecked = False
|
||||
m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.BackBtn.Visibility = Windows.Visibility.Visible
|
||||
m_MainWindow.m_DrawPageUC.PartNumberGrd.Visibility = Windows.Visibility.Visible
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me)
|
||||
m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.MainComponent
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrid.Children.Add(m_MainComponentPage)
|
||||
m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Add(m_MainComponentPage)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<UserControl x:Class="SideAngleUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="597.1" d:DesignWidth="255.9">
|
||||
|
||||
<!-- Definizione della Grid Laterale -->
|
||||
<Grid Name="VariablesCompoGrid" Grid.RowSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Name="Entity1" Grid.Row="0" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"
|
||||
Text="L1"/>
|
||||
<CheckBox Name="L1" Grid.Column="1" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity2" Grid.Row="1" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L2" Grid.Column="1" Grid.Row="1" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity3" Grid.Row="2" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L3" Grid.Column="1" Grid.Row="2" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity4" Grid.Row="3" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L4" Grid.Column="1" Grid.Row="3" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity5" Grid.Row="4" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L5" Grid.Column="1" Grid.Row="4" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity6" Grid.Row="5" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L6" Grid.Column="1" Grid.Row="5" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity7" Grid.Row="6" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L7" Grid.Column="1" Grid.Row="6" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity8" Grid.Row="7" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L8" Grid.Column="1" Grid.Row="7" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity9" Grid.Row="8" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L9" Grid.Column="1" Grid.Row="8" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="Entity10" Grid.Row="9" Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<CheckBox Name="L10" Grid.Column="1" Grid.Row="9" Height="40" Width="40" HorizontalAlignment="Right"
|
||||
Margin="0,0,11,0"/>
|
||||
|
||||
<TextBlock Name="SideAngleTxBl" Grid.Row="10" Text="Angolo"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="SideAngleTxBx" Grid.Column="1" Grid.Row="10" Width="90"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,433 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class SideAngleUC
|
||||
|
||||
' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
Private m_DrawPage As DrawPageUC
|
||||
|
||||
Private Sub SideAngleUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
' Copio riferimento alla DrawPage
|
||||
m_DrawPage = m_MainWindow.m_DrawPageUC
|
||||
|
||||
' Imposto questa come pagina correntemente visualizzata nella drawpage
|
||||
m_DrawPage.m_ActiveComponentPage = DrawPageUC.Pages.SideAngle
|
||||
|
||||
' Imposto contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx())
|
||||
|
||||
' se la lista non è vuota la leggo e metto le inclinazioni giuste
|
||||
If m_DrawPage.m_SideAngleEntityList.Count > 0 Then
|
||||
' Aggiorno indici che potrebbero essere cambiati se sono state modificate le misure
|
||||
RefreshGeomId()
|
||||
' Aggiorno testi in base alla tabella
|
||||
RefreshSideAngleText()
|
||||
' Aggiorno elenco variabili
|
||||
|
||||
Else
|
||||
' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno)
|
||||
InitSideAngleLine()
|
||||
End If
|
||||
|
||||
' Gestisco Checkbox e nomi in base al numero di lati inclinabili
|
||||
TxBlChBxView()
|
||||
|
||||
' Ricavo nome primo pezzo
|
||||
Dim Part1 As Integer = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
' Nascondo layer delle misure
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "LayAux"), GDB_ST.OFF)
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "Quotature"), GDB_ST.OFF)
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "Etichette"), GDB_ST.OFF)
|
||||
EgtZoom(ZM.ALL)
|
||||
EgtDraw()
|
||||
EgtSaveFile("C:\Temp\qqq.nge", NGE.TEXT)
|
||||
End Sub
|
||||
|
||||
Private Sub TxBlChBxView()
|
||||
For Index As Integer = 1 To 10 - m_DrawPage.m_SideAngleEntityList.Count
|
||||
GetChBxFromIndex(Index).Visibility = Windows.Visibility.Hidden
|
||||
GetTxBlFromIndex(Index).Visibility = Windows.Visibility.Hidden
|
||||
Next
|
||||
' Indice dei nomi per TxBl
|
||||
Dim TxBlIndex As Integer = 1
|
||||
For Index As Integer = 10 - m_DrawPage.m_SideAngleEntityList.Count + 1 To 10
|
||||
GetChBxFromIndex(Index).Visibility = Windows.Visibility.Visible
|
||||
GetTxBlFromIndex(Index).Text = "L " & TxBlIndex
|
||||
GetTxBlFromIndex(Index).Visibility = Windows.Visibility.Visible
|
||||
TxBlIndex += 1
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function GetChBxFromIndex(Index As Integer) As CheckBox
|
||||
Select Case Index
|
||||
Case 1
|
||||
Return L1
|
||||
Case 2
|
||||
Return L2
|
||||
Case 3
|
||||
Return L3
|
||||
Case 4
|
||||
Return L4
|
||||
Case 5
|
||||
Return L5
|
||||
Case 6
|
||||
Return L6
|
||||
Case 7
|
||||
Return L7
|
||||
Case 8
|
||||
Return L8
|
||||
Case 9
|
||||
Return L9
|
||||
Case Else
|
||||
Return L10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Function GetTxBlFromIndex(Index As Integer) As TextBlock
|
||||
Select Case Index
|
||||
Case 1
|
||||
Return Entity1
|
||||
Case 2
|
||||
Return Entity2
|
||||
Case 3
|
||||
Return Entity3
|
||||
Case 4
|
||||
Return Entity4
|
||||
Case 5
|
||||
Return Entity5
|
||||
Case 6
|
||||
Return Entity6
|
||||
Case 7
|
||||
Return Entity7
|
||||
Case 8
|
||||
Return Entity8
|
||||
Case 9
|
||||
Return Entity9
|
||||
Case Else
|
||||
Return Entity10
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub SideAngleUC_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
|
||||
' Ricavo nome primo pezzo
|
||||
Dim Part1 As Integer = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
' Attivo layer delle misure
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "LayAux"), GDB_ST.ON_)
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "Quotature"), GDB_ST.ON_)
|
||||
EgtSetStatus(EgtGetFirstNameInGroup(Part1, "Etichette"), GDB_ST.ON_)
|
||||
' Svuoto layer in cui sono presenti i testi con le inclinazioni dei lati
|
||||
EgtEmptyGroup(EgtGetFirstNameInGroup(Part1, "SideAngle"))
|
||||
EgtDraw()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub RefreshGeomId()
|
||||
' Ricavo nome primo pezzo
|
||||
Dim Part1 As Integer = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
' Ricavo nome layer con geometria esterna pezzo
|
||||
Dim OutLoop As Integer = EgtGetFirstNameInGroup(Part1, "OutLoop")
|
||||
For Each Entity In m_DrawPage.m_SideAngleEntityList
|
||||
Entity.nGeomId = EgtGetFirstNameInGroup(OutLoop, Entity.sEntityName)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub RefreshSideAngleText()
|
||||
' Imposto contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx())
|
||||
|
||||
' Cancello testi già presenti
|
||||
' Ricavo nome primo pezzo
|
||||
Dim Part1 As Integer = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
' Ricavo nome layer con geometria esterna pezzo
|
||||
Dim OutLoop As Integer = EgtGetFirstNameInGroup(Part1, "OutLoop")
|
||||
' Calcolo dimensione ingombro OutLoop
|
||||
Dim ptMin, ptMax As Point3d
|
||||
EgtGetBBoxGlob(OutLoop, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
|
||||
' Ricavo nome layer con testi inclinazioni
|
||||
Dim TextLayer As Integer = EgtGetFirstNameInGroup(Part1, "SideAngle")
|
||||
' Se presente lo svuoto
|
||||
If TextLayer <> GDB_ID.NULL Then
|
||||
EgtEmptyGroup(TextLayer)
|
||||
Else
|
||||
' altrimenti lo creo
|
||||
TextLayer = EgtCreateGroup(Part1)
|
||||
EgtSetName(TextLayer, "SideAngle")
|
||||
End If
|
||||
' Lo svuoto
|
||||
|
||||
For Each Entity In m_DrawPage.m_SideAngleEntityList
|
||||
' Creo testo con angolo di inclinazione
|
||||
AddTextToLine(Entity.sEntityName & " = " & DoubleToString(Entity.dSideAngle, 1) & "°", Entity.nTextId, Entity.nGeomId, 10, dBBoxRad)
|
||||
Next
|
||||
|
||||
'Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub InitSideAngleLine()
|
||||
' Imposto contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx())
|
||||
|
||||
' Ricavo nome primo pezzo
|
||||
Dim Part1 As Integer = EgtGetFirstInGroup(GDB_ID.ROOT)
|
||||
' Ricavo nome layer con geometria esterna pezzo
|
||||
Dim OutLoop As Integer = EgtGetFirstNameInGroup(Part1, "OutLoop")
|
||||
' Calcolo dimensione ingombro OutLoop
|
||||
Dim ptMin, ptMax As Point3d
|
||||
EgtGetBBoxGlob(OutLoop, GDB_BB.STANDARD, ptMin, ptMax)
|
||||
Dim dBBoxRad As Double = 0.5 * Point3d.DistXY(ptMin, ptMax)
|
||||
' Creo layer per testi
|
||||
Dim TextLayer As Integer = EgtCreateGroup(Part1)
|
||||
EgtSetName(TextLayer, "SideAngle")
|
||||
|
||||
Dim LastLine As Integer = EgtGetLastInGroup(OutLoop)
|
||||
Dim CurrLine As Integer = EgtGetFirstInGroup(OutLoop)
|
||||
Dim NextLine As Integer = EgtGetNext(CurrLine)
|
||||
' Ciclo che verifica se possibile inclinare la linea corrente fino alla penultima
|
||||
While NextLine <> GDB_ID.NULL
|
||||
If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then
|
||||
' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione
|
||||
AddSideAngle(CurrLine, TextLayer, dBBoxRad)
|
||||
End If
|
||||
LastLine = CurrLine
|
||||
CurrLine = NextLine
|
||||
NextLine = EgtGetNext(CurrLine)
|
||||
End While
|
||||
' Verifico se possibile inclinare l'ultima linea
|
||||
NextLine = EgtGetFirstInGroup(OutLoop)
|
||||
If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then
|
||||
AddSideAngle(CurrLine, TextLayer, dBBoxRad)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Funzione che verifica se la linea corrente è inclinabile in base al tipo della precedente e successiva
|
||||
Private Function VerifyIsSideAnglePossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean
|
||||
' Verifico se CurrLine è una linea
|
||||
If EgtGetType(CurrLine) <> GDB_TY.CRV_LINE Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
' Verifico se curva precedente mi permette di inclinare
|
||||
Dim bLastOk As Boolean = False
|
||||
If EgtGetType(LastLine) = GDB_TY.CRV_LINE Then
|
||||
bLastOk = True
|
||||
ElseIf EgtGetType(LastLine) = GDB_TY.CRV_ARC Then
|
||||
' Ricavo direzione finale linea precedente
|
||||
Dim vtLastEnd As Vector3d
|
||||
EgtEndVector(LastLine, vtLastEnd)
|
||||
' Ricavo direzione iniziale linea corrente
|
||||
Dim vtCurrStart As Vector3d
|
||||
EgtStartVector(CurrLine, vtCurrStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
' calcolo differenza dei vettori
|
||||
Dim vtDiff As Vector3d = vtLastEnd - vtCurrStart
|
||||
' verifico che sia nulla o quasi
|
||||
bLastOk = Not vtDiff.IsSmall()
|
||||
Else
|
||||
EgtOutLog("Error in Compo Outloop: find an entity that is not a line or a arc")
|
||||
End If
|
||||
|
||||
' Verifico se curva successiva mi permette di inclinare
|
||||
Dim bNextOk As Boolean = False
|
||||
If EgtGetType(NextLine) = GDB_TY.CRV_LINE Then
|
||||
bNextOk = True
|
||||
ElseIf EgtGetType(NextLine) = GDB_TY.CRV_ARC Then
|
||||
' Ricavo direzione finale linea corrente
|
||||
Dim vtCurrEnd As Vector3d
|
||||
EgtEndVector(CurrLine, vtCurrEnd)
|
||||
' Ricavo direzione iniziale linea successiva
|
||||
Dim vtNextStart As Vector3d
|
||||
EgtStartVector(NextLine, vtNextStart)
|
||||
' Confronto direzioni per vedere se sono tangenti
|
||||
' calcolo differenza dei vettori
|
||||
Dim vtDiff As Vector3d = vtCurrEnd - vtNextStart
|
||||
' verifico che sia nulla o quasi
|
||||
bNextOk = Not vtDiff.IsSmall()
|
||||
Else
|
||||
EgtOutLog("Error in Compo Outloop: find an entity that is not a line or a arc")
|
||||
End If
|
||||
|
||||
' Se entrambe me lo permettono restituisco vero
|
||||
If bLastOk And bNextOk Then
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
|
||||
End Function
|
||||
|
||||
' Funzione che gestisce le operazioni sull'entità da inclinare
|
||||
Private Sub AddSideAngle(CurrLine As Integer, TextLayer As Integer, dBBoxRad As Double)
|
||||
' Aggiungo entità all'elenco di quelle inclinabili
|
||||
Dim sEntityName As String = String.Empty
|
||||
EgtGetName(CurrLine, sEntityName)
|
||||
m_MainWindow.m_DrawPageUC.m_SideAngleEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, 0))
|
||||
' Cancello inclinazione nell'apposito campo info
|
||||
EgtRemoveInfo(CurrLine, "SideAng")
|
||||
' Creo testo con angolo di inclinazione 0
|
||||
AddTextToLine(sEntityName & " = 0°", TextLayer, CurrLine, 10, dBBoxRad)
|
||||
End Sub
|
||||
|
||||
' Funzione che dato un segmento e una distanz, scrive il testo centrato alla sua destra
|
||||
Private Sub AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, dBBoxRad As Double)
|
||||
' Calcolo altezza testo
|
||||
Dim dH As Double = 0.1 * dBBoxRad
|
||||
' Creo testo
|
||||
Dim nText As Integer = EgtCreateTextAdv(TextLayer, New Point3d(0, 0, 0), 0, sText, "", 500, False, dH, 1, 0, INS_POS.MC)
|
||||
' Calcolo punto in cui posizionare il testo
|
||||
' calcolo BBox del testo
|
||||
Dim ptMinBBox As Point3d
|
||||
Dim ptMaxBBox As Point3d
|
||||
EgtGetBBox(nText, GDB_BB.STANDARD, ptMinBBox, ptMaxBBox)
|
||||
' calcolo centro del BBox
|
||||
Dim ptMidBBox As Point3d
|
||||
ptMidBBox = Point3d.Media(ptMinBBox, ptMaxBBox)
|
||||
' calcolo vettore della CurrLine
|
||||
Dim ptLineStart As Point3d
|
||||
EgtStartPoint(CurrLine, nText, ptLineStart)
|
||||
Dim ptLineEnd As Point3d
|
||||
EgtEndPoint(CurrLine, nText, ptLineEnd)
|
||||
Dim vtCurrLine As Vector3d = ptLineEnd - ptLineStart
|
||||
' lo normalizzo per ottenerne il versore
|
||||
vtCurrLine.Normalize()
|
||||
' calcolo vettore dal centro del BBox all'estremo più vicino
|
||||
Dim vtptExtptMC As Vector3d
|
||||
If vtCurrLine.x > 0 Then
|
||||
If vtCurrLine.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0)
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - ptMaxBBox
|
||||
End If
|
||||
Else
|
||||
If vtCurrLine.y > 0 Then
|
||||
vtptExtptMC = ptMidBBox - ptMinBBox
|
||||
Else
|
||||
vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0)
|
||||
End If
|
||||
End If
|
||||
' ruoto il vettore della CurrLine per ottenerne il perpendicolare
|
||||
vtCurrLine.Rotate(Vector3d.Z_AX, -90)
|
||||
' Calcolo il centro del testo
|
||||
Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtCurrLine * (dDistance + (vtCurrLine * vtptExtptMC))
|
||||
EgtMove(nText, (ptTextMC - Point3d.ORIG))
|
||||
End Sub
|
||||
|
||||
Private Sub SideAng_Click(sender As Object, e As RoutedEventArgs) Handles L1.Click, L2.Click, L3.Click, L4.Click, L5.Click, L6.Click, L7.Click, L8.Click, L9.Click, L10.Click
|
||||
Dim CurrCheckBox As CheckBox = e.Source
|
||||
' Nuovo angolo di inclinazione
|
||||
Dim dSideAngle As Double
|
||||
' Se checked lo imposto al valore letto dalla TxBx
|
||||
If CurrCheckBox.IsChecked Then
|
||||
StringToDouble(SideAngleTxBx.Text, dSideAngle)
|
||||
Else
|
||||
' altrimenti lo imposto a zero
|
||||
dSideAngle = 0
|
||||
End If
|
||||
'Converto nome checkbox in nome elemento tenendo conto dello slittamento verso il basso
|
||||
Dim CurrSideAng As String = "L" & m_DrawPage.m_SideAngleEntityList.Count - (10 - CurrCheckBox.Name.Substring(1))
|
||||
' Lo modifico nella geometria e nella lista inclinazioni
|
||||
ModifySideAngle(CurrSideAng, dSideAngle)
|
||||
'Aggiorno tutti i testi
|
||||
RefreshSideAngleText()
|
||||
End Sub
|
||||
|
||||
' Funzione che modifica l'inclinazione di un lato
|
||||
Friend Function ModifySideAngle(sEntityName As String, dSideAngle As Double) As Boolean
|
||||
' Ricavo CurrEntity dal nome
|
||||
Dim CurrEntity As SideAngleEntity = SideAngleEntity.FindEntity(sEntityName)
|
||||
If IsNothing(CurrEntity) Then
|
||||
EgtOutLog("Error in side angle definition: selected line not found in SideAngleList")
|
||||
Return False
|
||||
End If
|
||||
' Scrivo nuovo angolo nelle info
|
||||
If dSideAngle <> 0 Then
|
||||
EgtSetInfo(CurrEntity.nGeomId, "SideAng", dSideAngle)
|
||||
Else
|
||||
' Cancello inclinazione nell'apposito campo info
|
||||
EgtRemoveInfo(CurrEntity.nGeomId, "SideAng")
|
||||
End If
|
||||
' Aggiorno lista entità con nuova inclinazione
|
||||
CurrEntity.dSideAngle = dSideAngle
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub SideAngleTxBx_EgtClosed(sender As Object, e As EventArgs) Handles SideAngleTxBx.EgtClosed
|
||||
' ciclo sui checkbox calcolati sul numero di lati inclinabili presenti
|
||||
For Index As Integer = 10 - m_DrawPage.m_SideAngleEntityList.Count + 1 To 10
|
||||
' Nuovo angolo di inclinazione
|
||||
Dim dSideAngle As Double
|
||||
' Se checked lo imposto al valore letto dalla TxBx
|
||||
If GetChBxFromIndex(Index).IsChecked Then
|
||||
StringToDouble(SideAngleTxBx.Text, dSideAngle)
|
||||
Else
|
||||
' altrimenti lo imposto a zero
|
||||
dSideAngle = 0
|
||||
End If
|
||||
'Converto nome checkbox in nome elemento tenendo conto dello slittamento verso il basso
|
||||
Dim CurrSideAng As String = "L" & m_DrawPage.m_SideAngleEntityList.Count - (10 - GetChBxFromIndex(Index).Name.Substring(1))
|
||||
' Lo modifico nella geometria e nella lista inclinazioni
|
||||
ModifySideAngle(CurrSideAng, dSideAngle)
|
||||
'Aggiorno tutti i testi
|
||||
RefreshSideAngleText()
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Friend Class SideAngleEntity
|
||||
|
||||
Private Shared m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
Private m_nGeomId As Integer
|
||||
Private m_sEntityName As String
|
||||
Private m_nTextId As Integer
|
||||
Private m_dSideAngle As Double
|
||||
|
||||
Public Property nGeomId As Integer
|
||||
Get
|
||||
Return m_nGeomId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nGeomId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sEntityName As String
|
||||
Get
|
||||
Return m_sEntityName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property nTextId As Integer
|
||||
Get
|
||||
Return m_nTextId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property dSideAngle As Double
|
||||
Get
|
||||
Return m_dSideAngle
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dSideAngle = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double)
|
||||
m_nGeomId = nId
|
||||
m_sEntityName = sEntityName
|
||||
m_nTextId = nTextId
|
||||
m_dSideAngle = dSideAngle
|
||||
End Sub
|
||||
|
||||
Friend Shared Function FindEntity(sEntityName As String) As SideAngleEntity
|
||||
For Each Entity In m_MainWindow.m_DrawPageUC.m_SideAngleEntityList
|
||||
If Entity.m_sEntityName = sEntityName Then
|
||||
Return Entity
|
||||
End If
|
||||
Next
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user