- correzione salvataggio parametri CurrMachining

- modifica gestione OrderedMachining Param
- gestione spostamento riferimento e pezzo su cambio tipo Ribs
This commit is contained in:
Emmanuele Sassi
2023-02-02 17:40:22 +01:00
parent b3d50be2f9
commit 99bcefcfe8
12 changed files with 211 additions and 261 deletions
+15 -6
View File
@@ -163,6 +163,21 @@ Public Class CurrMachining
End Select
End Sub
Friend Overrides Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
' resetto stato di modificata
UpdateIsModified()
End If
End Sub
Protected Overrides Sub SaveParams()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub WriteCurrParamInPart(nPartId As Integer)
EgtSetInfo(nPartId, MAC_GUID, m_sCurrGUID.ToString())
For Each Cathegory As CurrMachiningCathegory In m_CathegoryList
@@ -253,12 +268,6 @@ Public Class CurrMachiningCathegory
End Select
End Sub
Friend Sub SaveCurrParams()
For Each Param In m_MachiningParamList
Param.SaveParam()
Next
End Sub
Friend Sub ResetCurrParams()
For Each Param In m_MachiningParamList
Param.ResetParam()
@@ -120,39 +120,39 @@
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sName}"/>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<ListBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="2"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="0"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
<ListBox Grid.ColumnSpan="2"
Grid.Row="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -59,8 +59,23 @@ Public Class CurrMachiningPanelVM
End Property
Public Sub Ok()
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsCathegory As MachiningCathegory = CurrMachining.CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.RIBS)
If Not IsNothing(RibsCathegory) Then
Dim RibsTypeParam As MachiningParam = RibsCathegory.MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
End If
' scrivo i parametri modificati
m_CurrMachining.WriteCurrParamInPart(Map.refTopPanelVM.SelPart.nPartId)
m_CurrMachining.Save()
' se modificata tipologia Ribs, aggiorno posizione riferimento
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
@@ -28,12 +28,6 @@
Content="Move"
IsChecked="{Binding bMove_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Red"
Grid.Column="1"
Grid.Row="1"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"/>-->
<Border x:Name="PopupBrd"
Grid.Column="1"
@@ -97,77 +91,12 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=MoveBtn}"
PlacementTarget="{Binding ElementName=MoveBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border x:Name="PopupBrd" Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,0,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="X"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sXPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="1"
Margin="0,2.5,0,2.5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Y"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sYPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Z"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding sZPos, UpdateSourceTrigger=Explicit}"
Grid.Column="1"
Margin="5,0,0,0"
Style="{StaticResource LeftPanel_TextBox}"/>
</Grid>
<Grid Grid.Row="3"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragMove_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
<ToggleButton x:Name="RotateBtn"
Grid.Row="4"
Content="Rotate"
IsChecked="{Binding bRotate_IsChecked}"
Style="{StaticResource ToolBar_TextToggleButton}"/>
<!--<Border Background="Blue"
Grid.Column="2"
Grid.Row="2"
Grid.RowSpan="5"
Width="50"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"/>-->
<Border Grid.Column="1"
Grid.Row="2"
@@ -209,42 +138,4 @@
</Grid>
</Border>
<!--<Popup IsOpen="{Binding IsChecked, ElementName=RotateBtn}"
Grid.Column="1"
PlacementTarget="{Binding ElementName=RotateBtn}"
Style="{StaticResource LeftPanel_Popup}">
<Border Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Columns="3">
<RadioButton Content="X"
GroupName="Axes"
IsChecked="{Binding RotAxes[0]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Y"
GroupName="Axes"
IsChecked="{Binding RotAxes[1]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
<RadioButton Content="Z"
GroupName="Axes"
IsChecked="{Binding RotAxes[2]}"
Style="{StaticResource ToolBar_ToggleButton}"/>
</UniformGrid>
<EgtWPFLib5:EgtTextBox Grid.Row="1"
Text="{Binding sRotAngle, UpdateSourceTrigger=Explicit}"
Margin="0,5,0,0"/>
<Grid Grid.Row="2"
Margin="0,2.5,0,0">
<Button Content="Drag"
Command="{Binding DragRotate_Command}"
Style="{StaticResource LeftPanel_TextButton}"/>
</Grid>
</Grid>
</Border>
</Popup>-->
</Grid>
+76 -56
View File
@@ -20,25 +20,7 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewXPos As Double = ptReference.x
StringToLen(value, dNewXPos)
Dim b3Print As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If b3Ribs.Min.x <> INFINITO Then
b3Print.Add(b3Ribs)
End If
End If
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimX
If b3Print.Max.x > ptReference.x Then
@@ -47,13 +29,16 @@ Public Class DispositionPanelVM
If b3Print.Min.x < ptReference.x Then
dMin += ptReference.x - b3Print.Min.x
End If
If dNewXPos >= dMin AndAlso dNewXPos <= dMax Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sXPos))
' riduco a spostamento massimo
If dNewXPos < dMin Then
dNewXPos = dMin
ElseIf dNewXPos > dMax Then
dNewXPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sXPos))
End Set
End Property
@@ -72,25 +57,7 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewYPos As Double = ptReference.y
StringToLen(value, dNewYPos)
Dim b3Print As New BBox3d
EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType)
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If b3Ribs.Min.x <> INFINITO Then
b3Print.Add(b3Ribs)
End If
End If
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
Dim dMax As Double = CurrentMachine.b3Tab.DimY
If b3Print.Max.y > ptReference.y Then
@@ -99,13 +66,16 @@ Public Class DispositionPanelVM
If b3Print.Min.y < ptReference.y Then
dMin += ptReference.y - b3Print.Min.y
End If
If dNewYPos >= dMin AndAlso dNewYPos <= dMax Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sYPos))
' riduco a spostamento massimo
If dNewYPos < dMin Then
dNewYPos = dMin
ElseIf dNewyPos > dMax Then
dNewYPos = dMax
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sYPos))
End Set
End Property
@@ -124,16 +94,65 @@ Public Class DispositionPanelVM
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
StringToLen(value, dNewZPos)
If dNewZPos >= 0 Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
Else
NotifyPropertyChanged(NameOf(sZPos))
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
' riduco a spostamento massimo
If dNewZPos < dMin Then
dNewZPos = dMin
End If
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB)
Map.refReferencePanelVM.UpdateFramePosition()
EgtDraw()
NotifyPropertyChanged(NameOf(sZPos))
End Set
End Property
Friend Sub UpdateZPos()
Dim ptReference As New Point3d
EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference)
Dim dNewZPos As Double = ptReference.z
Dim b3Print As BBox3d = GetSolidForReferenceBBox(Map.refTopPanelVM.SelPart)
Dim dMin As Double = 0
If b3Print.Min.z < ptReference.z Then
dMin += ptReference.z - b3Print.Min.z
End If
If ptReference.z < dMin Then
EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, ptReference.y, dMin) - ptReference, GDB_RT.GLOB)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End If
NotifyPropertyChanged(NameOf(sZPos))
End Sub
' funzione che calcola il box totale del solido da stampare piu' ribs esterne ed unbounded
Friend Function GetSolidForReferenceBBox(SelPart As Print3dPartVM) As BBox3d
Dim b3Print As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print)
If EgtGetGroupObjs(SelPart.nRibsLayerId) > 0 Then
Dim b3Ribs As New BBox3d()
Dim nRibId As Integer = EgtGetFirstInGroup(SelPart.nRibsLayerId)
While nRibId <> GDB_ID.NULL
Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL
If Not EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType) Then
EgtGetInfo(SelPart.nPartId, MAC_RIBSTYPE, nRibType)
End If
If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then
Dim b3Rib As New BBox3d
EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib)
b3Ribs.Add(b3Rib)
End If
nRibId = EgtGetNext(nRibId)
End While
If b3Ribs.Min.x <> INFINITO Then
b3Print.Add(b3Ribs)
End If
End If
Return b3Print
End Function
Private m_RotAxes As Boolean() = { False, False, False}
Public Property RotX As Boolean
Get
@@ -198,6 +217,7 @@ Public Class DispositionPanelVM
If EgtRotate(Map.refTopPanelVM.SelPart.nPartId, b3PrintSolid.Center, vtSelRotAxes, dNewAngle, GDB_RT.GLOB) Then
m_sRotAngle = 0
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
RefreshPos()
EgtDraw()
NotifyPropertyChanged(NameOf(sRotAngle))
+2 -2
View File
@@ -169,7 +169,7 @@ Public Class Machining
NotifyPropertyChanged(NameOf(ghName))
End Sub
Friend Sub Save()
Friend Overridable Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
@@ -180,7 +180,7 @@ Public Class Machining
End If
End Sub
Private Sub SaveParams()
Protected Overridable Sub SaveParams()
SaveName()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
+27 -26
View File
@@ -11,7 +11,6 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
@@ -72,7 +71,7 @@
<Image Source="/Resources/TopPanel/Edit.png"/>
</Button>
</Grid>
<ScrollViewer Grid.Row="3"
<ScrollViewer Grid.Row="2"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
@@ -188,31 +187,33 @@
<DataTemplate DataType="{x:Type PrintApp:OrderedMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding sName}"/>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
<ListBox Grid.ColumnSpan="2"
Grid.Row="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<TextBlock Text="{Binding sName}"
VerticalAlignment="Center"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"/>
<StackPanel Grid.Column="1"
Orientation="Vertical"
VerticalAlignment="Center"
Margin="5,0,0,0">
<Button Content="˄"
Command="{Binding MoveUpOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="˅"
Command="{Binding MoveDownOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
<Button Content="&lt;>"
Command="{Binding ResetOrder_Command}"
Style="{StaticResource ToolBar_SmallButton}"/>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
@@ -222,7 +223,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<UniformGrid Grid.Row="3" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
IsEnabled="{Binding IsEnabled}"
+3 -9
View File
@@ -433,17 +433,9 @@ Public Class ManagePartPanelVM
End If
End Select
Next
' aggiungo riferimento
' aggiungo layer riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
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, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -455,6 +447,8 @@ Public Class ManagePartPanelVM
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Next
End If
'EgtAddMachGroup("3dPrint")
+16 -12
View File
@@ -684,44 +684,38 @@ Public Class GeomEntity_MenuItem
' creo layer solido di stampa
Dim nPrintPartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nPrintPartLayerId, PRINT_SOLID)
EgtSetColor(nPrintPartLayerId, GeomEntityColors.c3Print)
EgtRelocateGlob(m_OrigEntity.nId, nPrintPartLayerId, GDB_POS.LAST_SON)
' calcolo box superficie per creazione riferimento
EgtGetBBoxGlob(m_OrigEntity.nId, GDB_BB.STANDARD, b3PrintSolid)
' coloro l'entita'
EgtSetColor(m_OrigEntity.nId, GeomEntityColors.c3Print)
' creo layer mach start
Dim nMachStartLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nMachStartLayerId, LAY_MACH_START)
EgtSetColor(nMachStartLayerId, GeomEntityColors.c3MachStart)
Dim nMachStartId As Integer = GDB_ID.NULL
' 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
EgtSetColor(nMachStartId, GeomEntityColors.c3MachStart)
' creo layer ribs
Dim nRibsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nRibsLayerId, LAY_RIBS)
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
' creo layer shell number
Dim nShellNumberLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nShellNumberLayerId, LAY_SHELL_NBR)
EgtSetColor(nShellNumberLayerId, GeomEntityColors.c3ShellNumber)
' creo layer aux
Dim nAuxSolidsLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nAuxSolidsLayerId, LAY_AUX_SOLIDS)
EgtSetColor(nAuxSolidsLayerId, GeomEntityColors.c3AuxSolids)
' creo layer others
Dim nOthersLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nOthersLayerId, LAY_OTHERS)
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
' aggiungo riferimento
Dim nReferenceLayerId As Integer = EgtCreateGroup(nPartId)
EgtSetName(nReferenceLayerId, LAY_REFERENCE)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
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, ReferenceBtn.References.BL)
' appoggio il pezzo sulla tavola
EgtMove(nPartId, New Vector3d(0, 0, -b3PrintSolid.Min.z))
@@ -730,6 +724,8 @@ Public Class GeomEntity_MenuItem
EgtSetInfo(nPartId, "PartOnTable", 1)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nReferenceLayerId, nFrameId, nMachStartLayerId, nRibsLayerId, nShellNumberLayerId, nAuxSolidsLayerId, nOthersLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
' aggiorno riferimento
Map.refReferencePanelVM.UpdateFramePosition(NewPart)
Dim ManagePart_Part As ManagePart_Part = New ManagePart_Part(NewPart)
' elimino da posizione originale
m_OrigEntity.OrigLayer.EntityList.Remove(m_OrigEntity)
@@ -768,6 +764,7 @@ Public Class GeomEntity_MenuItem
' aggiorno riferimenti nel context menu item
m_OrigEntity.UpdateContextMenu()
Case ManagePartPanelVM.ManagePartType.MODIFY
Dim bIsMovedRib As Boolean = False
' recupero layer da pezzo
Dim nLayerId As Integer = GDB_ID.NULL
Select Case m_Type
@@ -802,6 +799,7 @@ Public Class GeomEntity_MenuItem
Case ManagePart_Layer.LayerType.RIBS
EgtRemoveInfo(m_OrigEntity.nId, KEY_RIB_TYPE)
EgtRemoveInfo(m_OrigEntity.nId, RIB_ID)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtRemoveInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE)
Case ManagePart_Layer.LayerType.AUX_SOLIDS
@@ -836,6 +834,7 @@ Public Class GeomEntity_MenuItem
EgtSetInfo(m_OrigEntity.nId, KEY_RIB_TYPE, RibEntity.RibTypes.FROMIMPORT)
EgtSetInfo(m_OrigEntity.nId, RIB_ID, RibPanelVM.GetNextRibIndex())
EgtSetColor(m_OrigEntity.nId, c3Rib)
bIsMovedRib = True
Case ManagePart_Layer.LayerType.SHELL_NUMBER
EgtSetName(m_OrigEntity.nId, LAY_SHELL_NBR)
EgtSetInfo(m_OrigEntity.nId, KEY_SHELLNBR_TYPE, ShellNumberEntity.ShellNumberTypes.FROMIMPORT)
@@ -848,6 +847,11 @@ Public Class GeomEntity_MenuItem
EgtSetName(m_OrigEntity.nId, LAY_OTHERS)
EgtSetColor(m_OrigEntity.nId, c3Others)
End Select
' se spostato un Rib, aggiorno posizione riferimento e pezzo
If bIsMovedRib Then
Map.refReferencePanelVM.UpdateFramePosition(NewPart.PrintPart)
Map.refDispositionPanelVM.UpdateZPos()
End If
EgtDraw()
' aggiorno riferimenti nel context menu item
If bUpdateAllContextMenu Then
+20 -17
View File
@@ -30,6 +30,7 @@ Public Class ReferencePanelVM
End Get
Set(value As ReferenceBtn)
m_SelReference = value.Type
EgtSetInfo(Map.refTopPanelVM.SelPart.nReferenceLayerId, KEY_REFERENCE, value.Type)
UpdateFramePosition()
End Set
End Property
@@ -68,41 +69,44 @@ Public Class ReferencePanelVM
End Sub
Friend Sub UpdateFramePosition(Optional SelPart As Print3dPartVM = Nothing)
If IsNothing(SelPart) Then SelPart = Map.refTopPanelVM.SelPart
Dim SelReference As Integer = ReferenceBtn.References.BL
If IsNothing(SelPart) Then
SelPart = Map.refTopPanelVM.SelPart
End If
EgtGetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, SelReference)
' elimino precedente
EgtEmptyGroup(SelPart.nReferenceLayerId)
' Creo riferimento
Dim frPrintSolid As New Frame3d()
If m_SelReference = ReferenceBtn.References.FROM_IMPORT Then
If SelReference = ReferenceBtn.References.FROM_IMPORT Then
EgtGetGlobFrame(SelPart.nPrintSolidId, frPrintSolid)
frPrintSolid.Setup(New Point3d(frPrintSolid.Orig.x, frPrintSolid.Orig.y, 0))
Else
Dim b3PrintSolid As New BBox3d
EgtGetBBoxGlob(SelPart.nPrintSolidId, GDB_BB.STANDARD, b3PrintSolid)
Dim b3ToBePrintSolid As BBox3d = Map.refDispositionPanelVM.GetSolidForReferenceBBox(SelPart)
' Creo riferimento
Dim ptOrig As New Point3d(b3PrintSolid.Min())
Select Case m_SelReference
Dim ptOrig As New Point3d(b3ToBePrintSolid.Min())
Select Case SelReference
Case ReferenceBtn.References.TL
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX
Case ReferenceBtn.References.TR
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BL
Case ReferenceBtn.References.BR
ptOrig += b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.ML
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.TC
ptOrig += b3PrintSolid.DimY() * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MR
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() * Vector3d.X_AX
Case ReferenceBtn.References.BC
ptOrig += b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
Case ReferenceBtn.References.MC
ptOrig += b3PrintSolid.DimY() / 2 * Vector3d.Y_AX + b3PrintSolid.DimX() / 2 * Vector3d.X_AX
ptOrig += b3ToBePrintSolid.DimY() / 2 * Vector3d.Y_AX + b3ToBePrintSolid.DimX() / 2 * Vector3d.X_AX
End Select
Dim vtMovedPart As Vector3d
EgtGetInfo(SelPart.nPartId, "MovedPart", vtMovedPart)
@@ -115,7 +119,6 @@ Public Class ReferencePanelVM
EgtSetMode(nFrameId, GDB_MD.LOCKED)
SelPart.UpdateReferenceId(nFrameId)
End If
EgtSetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, m_SelReference)
Map.refDispositionPanelVM.RefreshPos()
EgtDraw()
End Sub
+12
View File
@@ -112,6 +112,12 @@ Public Class RibParamPanelVM
Public Sub Ok()
If Not IsNothing(Map.refRibPanelVM.SelRib) Then
' verifico se modificata tipologia Ribs
Dim bIsModifiedRibsType As Boolean = False
Dim RibsTypeParam As MachiningParam = MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.RIBSTYPE)
If Not IsNothing(RibsTypeParam) Then
bIsModifiedRibsType = RibsTypeParam.bIsModified
End If
' scrivo i parametri modificati
Select Case Map.refRibPanelVM.SelRib.Type
Case RibEntity.RibTypes.FROMDRAW
@@ -120,6 +126,12 @@ Public Class RibParamPanelVM
Case RibEntity.RibTypes.FROMIMPORT
WriteParamsInRib(Map.refRibPanelVM.SelRib.nExtrusionId)
End Select
SaveCurrParams()
' se modificata tipologia Ribs, aggiorno posizione riferimento e pezzo
If bIsModifiedRibsType Then
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
End If
End If
' ripristino modalita' standard
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL)
+2 -1
View File
@@ -451,7 +451,8 @@ Public Class MySceneHostVM
' elimino colore entita'
EgtResetColor(nNewEntityId)
' aggiorno riferimento pezzo
Map.refReferencePanelVM.UpdateFramePosition(MenuItem.OrigLayer.OrigPart.PrintPart)
Map.refReferencePanelVM.UpdateFramePosition()
Map.refDispositionPanelVM.UpdateZPos()
' elimino eventuale flag di spostamento a 45 gradi
EgtRemoveInfo(MenuItem.OrigLayer.OrigPart.PrintPart.nPartId, "MovedPart")
' elimino vecchio elemento ed aggiungo nuovo