Compare commits

..

20 Commits

Author SHA1 Message Date
NicolaP 753ff7b4f1 Recupero dimensione corrente orgetto per stampa 2023-02-09 09:49:04 +01:00
NicolaP 1edfe486cb Migliorato rapporto di stsampa immagini 2023-02-08 19:36:09 +01:00
NicolaP 7190993f11 Aggiunto bottone per stampa layout corrente 2023-02-08 18:13:12 +01:00
NicolaP 249289144f Merge branch 'master' into develop 2023-02-08 14:51:06 +01:00
NicolaP 36ee5e4352 Cambio versione 2.5b1 2023-02-03 16:32:25 +01:00
NicolaP 147099b702 Merge branch 'develop' 2023-02-03 16:29:01 +01:00
NicolaP dd81384bb8 Migliorata gestione rotazione in park 2023-01-30 15:38:13 +01:00
NicolaP 9cf61d691d Gestione rotazione pezzi con Drag 2023-01-20 12:24:10 +01:00
NicolaP 358c5df390 Merge remote-tracking branch 'origin/HEAD' 2023-01-18 18:09:32 +01:00
NicolaP ccaec9af5a Merge branch 'develop' 2023-01-18 18:04:12 +01:00
NicolaP 1dbecd0083 Gestione allungamento tagli curvi 2023-01-18 18:03:57 +01:00
DarioS 11c6f95378 OmagOFFICE :
- aggiornamento info programma.
2023-01-18 09:17:16 +01:00
NicolaP 3604a85cc1 Merge branch 'develop' 2023-01-05 18:58:40 +01:00
NicolaP 3aaaa0fcb6 Lettura StarEndModifyOnIntCorner da file macchina, ver 2.5a1 2023-01-05 18:58:04 +01:00
NicolaP 52da2bc2c9 Merge branch 'develop' 2022-12-07 19:55:29 +01:00
NicolaP 4de476907f Migliorata gestione ventose 2022-12-07 19:55:06 +01:00
NicolaP 07bcb7479b Merge branch 'master' into develop 2022-11-09 10:32:11 +01:00
NicolaP 92818aafd4 Cambio versione 2.4k1 2022-11-09 10:31:37 +01:00
NicolaP f4326b27b7 Merge branch 'develop' 2022-11-09 10:29:46 +01:00
NicolaP 1f4a0afd75 Merge commit '565ba3c7564c5c4610b99ac1b6460b627f3a7708' into develop 2022-11-07 18:19:27 +01:00
16 changed files with 477 additions and 184 deletions
+6 -5
View File
@@ -92,11 +92,12 @@ Public Module SplitAuto
Mach.m_dStartFreeLen = FREELEN_INF + 1 Mach.m_dStartFreeLen = FREELEN_INF + 1
Mach.m_dEndFreeLen = FREELEN_INF + 1 Mach.m_dEndFreeLen = FREELEN_INF + 1
Dim nEntId, nSub As Integer Dim nEntId, nSub As Integer
If EgtGetMachiningGeometry( 0, nEntId, nSub) Then If EgtGetMachiningGeometry(0, nEntId, nSub) Then
If EgtGetType( nEntId) = GDB_TY.CRV_ARC OrElse EgtGetType( nEntId) = GDB_TY.CRV_COMPO Then Mach.m_bIsLine = False ' EgtGetType( nEntId) = GDB_TY.CRV_ARC OrElse
EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_PREVANG, INFO_NEXTANG), Mach.m_dPrevAng) If EgtGetType(nEntId) = GDB_TY.CRV_COMPO Then Mach.m_bIsLine = False
EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_NEXTANG, INFO_PREVANG), Mach.m_dNextAng) EgtGetInfo(nEntId, If(Not Mach.m_bInvert, INFO_PREVANG, INFO_NEXTANG), Mach.m_dPrevAng)
EgtGetInfo( nEntId, If( Not Mach.m_bInvert, INFO_START_FREELEN, INFO_END_FREELEN), Mach.m_dStartFreeLen) EgtGetInfo(nEntId, If(Not Mach.m_bInvert, INFO_NEXTANG, INFO_PREVANG), Mach.m_dNextAng)
EgtGetInfo(nEntId, If(Not Mach.m_bInvert, INFO_START_FREELEN, INFO_END_FREELEN), Mach.m_dStartFreeLen)
EgtGetInfo(nEntId, If(Not Mach.m_bInvert, INFO_END_FREELEN, INFO_START_FREELEN), Mach.m_dEndFreeLen) EgtGetInfo(nEntId, If(Not Mach.m_bInvert, INFO_END_FREELEN, INFO_START_FREELEN), Mach.m_dEndFreeLen)
Mach.m_bEnableInvert = GetEnableInvert(nEntId) Mach.m_bEnableInvert = GetEnableInvert(nEntId)
EgtMidVector(nEntId, GDB_ID.ROOT, Mach.m_vtDir) EgtMidVector(nEntId, GDB_ID.ROOT, Mach.m_vtDir)
+10 -3
View File
@@ -444,15 +444,14 @@ Module VacuumCups
Dim dLen, dAngVertDeg, dAngOrizzDeg As Double Dim dLen, dAngVertDeg, dAngOrizzDeg As Double
frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg) frMinRect.VersX().ToSpherical(dLen, dAngVertDeg, dAngOrizzDeg)
dRotAngDeg = dAngOrizzDeg dRotAngDeg = dAngOrizzDeg
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
Dim dPreferredRot As Double = m_dPreferredRot Dim dPreferredRot As Double = m_dPreferredRot
If bRotateVacuumNearExtraStrokeX And (Math.Abs(dRotAngDeg - 90) < 45 Or Math.Abs(dRotAngDeg - 270) < 45) Then If bRotateVacuumNearExtraStrokeX And Not IsHorizontal(dAngOrizzDeg) Then
If frMinRect.Orig().x < b3Tab.Center().x Then If frMinRect.Orig().x < b3Tab.Center().x Then
dPreferredRot = m_dPrefVertRotXMinus dPreferredRot = m_dPrefVertRotXMinus
Else Else
dPreferredRot = m_dPrefVertRotXPlus dPreferredRot = m_dPrefVertRotXPlus
End If End If
ElseIf bRotateVacuumNearExtraStrokeY And (Math.Abs(dRotAngDeg - 90) > 45 Or Math.Abs(dRotAngDeg - 270) > 45) Then ElseIf bRotateVacuumNearExtraStrokeY And IsHorizontal(dAngOrizzDeg) Then
' se l'orientemanto è orizzontale e la macchina è stata abilitata ' se l'orientemanto è orizzontale e la macchina è stata abilitata
If frMinRect.Orig().y < b3Tab.Center().y Then If frMinRect.Orig().y < b3Tab.Center().y Then
dPreferredRot = m_dPrefVertRotYPlus dPreferredRot = m_dPrefVertRotYPlus
@@ -460,6 +459,7 @@ Module VacuumCups
dPreferredRot = m_dPrefVertRotYMinus dPreferredRot = m_dPrefVertRotYMinus
End If End If
End If End If
If b3Vac.DimY() > b3Vac.DimX() + EPS_SMALL Then dRotAngDeg -= 90
Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180) Dim dAngDelta As Double = If( Math.Abs( b3Vac.DimY() - b3Vac.DimX()) < 10 * EPS_SMALL, 90, 180)
While dRotAngDeg - dPreferredRot >= dAngDelta / 2 While dRotAngDeg - dPreferredRot >= dAngDelta / 2
dRotAngDeg -= dAngDelta dRotAngDeg -= dAngDelta
@@ -530,6 +530,13 @@ Module VacuumCups
Return dDist Return dDist
End Function End Function
Private Function IsHorizontal(dDegAng As Double) As Boolean
If (Math.Abs(dDegAng) > 45 And Math.Abs(dDegAng) < 135) Or (Math.Abs(dDegAng) > 225 And Math.Abs(dDegAng) < 315) Then
Return False
End If
Return True
End Function
' assegante le posizioni del centro delle ventose e l'angolo di posizionamento orizzontale verifica che la posizione sia raggiungibile ' assegante le posizioni del centro delle ventose e l'angolo di posizionamento orizzontale verifica che la posizione sia raggiungibile
Public Function VerifyOutOfStrokes(ptRef As Point3d, dRotAngDeg As Double) As Integer Public Function VerifyOutOfStrokes(ptRef As Point3d, dRotAngDeg As Double) As Integer
Dim dX, dY, dZ As Double Dim dX, dY, dZ As Double
+7
View File
@@ -29,6 +29,13 @@ Public Class VeinMatchingWindow
Private m_locPrev As System.Drawing.Point Private m_locPrev As System.Drawing.Point
Private m_ptPrev As Point3d Private m_ptPrev As Point3d
Private m_ptCen As Point3d Private m_ptCen As Point3d
' Gestione rotazione pezzi in fase di Drag
Private m_bKeyCtrlPressed As Boolean = False
Private m_bKeyLeftShiftPressed As Boolean = False
Private m_dAngTotal As Double = 0
Private m_dStartAng As Double = 0
Private m_bStartRot As Boolean = False
Private m_bStartMove As Boolean = False
Private Sub Window_Initialized(sender As Object, e As EventArgs) Private Sub Window_Initialized(sender As Object, e As EventArgs)
' Assegnazione scena all'host e posizionamento nella PlacePageGrid ' Assegnazione scena all'host e posizionamento nella PlacePageGrid
+14
View File
@@ -0,0 +1,14 @@
<EgtFloating:EgtFloatingPanel x:Class="PrintPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
IsRightDockable="False" Style="{StaticResource ToolBar_EgtFloatingPanel}">
<Button ToolTip="{Binding PrintToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding PrintCommand}">
<Image Source="/Resources/InstrumentPanel/Print.png" Stretch="Uniform"/>
</Button>
</EgtFloating:EgtFloatingPanel>
+3
View File
@@ -0,0 +1,3 @@
Public Class PrintPanelV
End Class
+84
View File
@@ -0,0 +1,84 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class PrintPanelVM
' Definizione comandi
Private m_cmdPrint As ICommand
Public ReadOnly Property PrintToolTip As String
Get
Return "Print shading" & vbCrLf & "Print hidden line (Shift)"
End Get
End Property
#Region "PrintCommand"
Public ReadOnly Property PrintCommand As ICommand
Get
If m_cmdPrint Is Nothing Then
m_cmdPrint = New Command(AddressOf Print)
End If
Return m_cmdPrint
End Get
End Property
Public Sub Print(ByVal param As Object)
Dim SM_Select As SM = SM.SHADING
If (Keyboard.Modifiers And ModifierKeys.Shift) > 0 Then
SM_Select = SM.HIDDENLINE
EgtSetLineAttribs(3)
End If
Dim printDlg As New PrintDialog
Dim sPath = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\Image.png"
If printDlg.ShowDialog() Then
' Recupero le dimensioni dell'area di stampa
Dim dW As Double = printDlg.PrintableAreaWidth
Dim dH As Double = printDlg.PrintableAreaHeight
Try
' Creo l'immagine da allegare
' EgtZoom(ZM.ALL, True)
' Prendo l'immagine per la stampa
Dim colWhite As New Color3d(255, 255, 255)
Dim nImgW As Integer = GetWidthDimProjectV()
Dim nImgH As Integer = GetHeightDimProjectV()
If Not EgtGetImage(SM_Select, colWhite, colWhite, nImgW, nImgH, sPath) Then
' Error in creating the print image
EgtOutLog(EgtMsg(50181))
EgtSetLineAttribs(1)
Return
End If
EgtSetLineAttribs(1)
'Metodo complesso di stampa che permette di rilasciare il file :
'carico la bitmap e la metto in uno stream in memoria
Dim stream As System.IO.Stream = New System.IO.MemoryStream()
Dim bitmap As System.Drawing.Bitmap = New System.Drawing.Bitmap(sPath)
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
bitmap.Dispose()
' la sposto in una BitmapImage
Dim bitImage As New System.Windows.Media.Imaging.BitmapImage()
bitImage.BeginInit()
bitImage.StreamSource = stream
bitImage.EndInit()
' la sposto in un Visual Control
Dim tmpImg As New Image
tmpImg.BeginInit()
tmpImg.Source = bitImage
'tmpImg.Margin = New Thickness(-100)
tmpImg.Stretch = Stretch.Uniform
' ruoto a seconda dell'aspetto della pagina
'If (dH > dW And nImgH < nImgW) Or (dH < dW And nImgH > nImgW) Then
' tmpImg.LayoutTransform = New RotateTransform(-90)
'End If
tmpImg.EndInit()
' eseguo la stampa
printDlg.PrintVisual(tmpImg, "Parts Layout")
Catch
' Rrror in executing print
EgtOutLog(EgtMsg(50182))
End Try
End If
End Sub
#End Region ' PrintCommand
End Class
+2 -2
View File
@@ -223,8 +223,8 @@ Public Class MainWindowM
' Verifico abilitazione nesting automatico ' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey) m_bAutoNestOption = Not String.IsNullOrWhiteSpace( sNestKey)
' Recupero livello e opzioni della chiave ' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2410, 1, m_nKeyLevel) And Dim bKey As Boolean = EgtGetKeyLevel(9423, 2502, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2410, 1, m_nKeyOptions) EgtGetKeyOptions(9423, 2502, 1, m_nKeyOptions)
' Verifico abilitazione prodotto ' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE) Dim bProd As Boolean = GetKeyOption(KEY_OPT.OFFICE_BASE)
' Inizializzazione generale di EgtInterface ' Inizializzazione generale di EgtInterface
+3 -3
View File
@@ -30,7 +30,7 @@ Imports System.Windows
#End If #End If
<Assembly: AssemblyCompany("Egalware s.r.l.")> <Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("OmagOFFICE")> <Assembly: AssemblyProduct("OmagOFFICE")>
<Assembly: AssemblyCopyright("Copyright © 2017-2022 by Egalware s.r.l.")> <Assembly: AssemblyCopyright("Copyright © 2017-2023 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)> <Assembly: ComVisible(false)>
'In order to begin building localizable applications, set 'In order to begin building localizable applications, set
@@ -69,6 +69,6 @@ Imports System.Windows
' by using the '*' as shown below: ' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.10.1")> <Assembly: AssemblyVersion("2.5.2.1")>
<Assembly: AssemblyFileVersion("2.4.10.1")> <Assembly: AssemblyFileVersion("2.5.2.1")>
+11
View File
@@ -213,7 +213,11 @@
<Compile Include="EgtStoneLib\VeinMatchingWindow.xaml.vb"> <Compile Include="EgtStoneLib\VeinMatchingWindow.xaml.vb">
<DependentUpon>VeinMatchingWindow.xaml</DependentUpon> <DependentUpon>VeinMatchingWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="InstrumentPanel\PrintPanelV.xaml.vb">
<DependentUpon>PrintPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="InstrumentPanel\MyInstrumentPanelVM.vb" /> <Compile Include="InstrumentPanel\MyInstrumentPanelVM.vb" />
<Compile Include="InstrumentPanel\PrintPanelVM.vb" />
<Compile Include="MachinePanel\MyMachinePanelVM.vb" /> <Compile Include="MachinePanel\MyMachinePanelVM.vb" />
<Compile Include="MyMachGroupPanel\MyMachGroupPanelVM.vb" /> <Compile Include="MyMachGroupPanel\MyMachGroupPanelVM.vb" />
<Compile Include="MachinePanel\MachinePanelV.xaml.vb"> <Compile Include="MachinePanel\MachinePanelV.xaml.vb">
@@ -389,6 +393,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="InstrumentPanel\PrintPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MachinePanel\MachinePanelV.xaml"> <Page Include="MachinePanel\MachinePanelV.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -691,6 +699,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\TopCommandBar\DxfOut.png" /> <Resource Include="Resources\TopCommandBar\DxfOut.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\InstrumentPanel\Print.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagOFFICE\OmagOFFICER32.exe <PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagOFFICE\OmagOFFICER32.exe
+1 -1
View File
@@ -450,7 +450,7 @@ Public Class SplitModeVM
m_nDragInd = -1 m_nDragInd = -1
m_nDragType = 0 m_nDragType = 0
' verifico se è abilitata la possibiltà di allungare i lati interni ' verifico se è abilitata la possibiltà di allungare i lati interni
m_StartEndModifyOnIntCorner = (GetMainPrivateProfileInt(S_NEST, K_STARTENDMODIFYONINTCORNER, 0) <> 0) m_StartEndModifyOnIntCorner = (GetPrivateProfileInt(S_NEST, K_STARTENDMODIFYONINTCORNER, 0, sMachIniFile) <> 0)
' Nascondo eventuali pezzi in parcheggio ' Nascondo eventuali pezzi in parcheggio
EstCalc.HideParkedParts() EstCalc.HideParkedParts()
' Nascondo eventuale contorno da foto ' Nascondo eventuale contorno da foto
+289 -167
View File
@@ -31,6 +31,13 @@ Public Class NestingTabVM
Private m_ptPrev As Point3d Private m_ptPrev As Point3d
Private m_vtTotMove As Vector3d Private m_vtTotMove As Vector3d
Private m_dSnapDist As Double = 0 Private m_dSnapDist As Double = 0
' Gestione rotazione pezzi in fase di Drag
Private m_bKeyCtrlPressed As Boolean = False
Private m_bKeyLeftShiftPressed As Boolean = False
Private m_dAngTotal As Double = 0
Private m_dStartAng As Double = 0
Private m_bStartRot As Boolean = False
Private m_bStartMove As Boolean = False
' Abilitazioni TrfData e CsvData ' Abilitazioni TrfData e CsvData
Private m_bTrfData As Boolean = False Private m_bTrfData As Boolean = False
Private m_bCsvData As Boolean = False Private m_bCsvData As Boolean = False
@@ -151,7 +158,7 @@ Public Class NestingTabVM
End Get End Get
Set(value As Visibility) Set(value As Visibility)
m_CsvData_Visibility = value m_CsvData_Visibility = value
NotifyPropertyChanged( "CsvData_Visibility") NotifyPropertyChanged("CsvData_Visibility")
End Set End Set
End Property End Property
@@ -270,7 +277,7 @@ Public Class NestingTabVM
Friend Function InitNesting() As Boolean Friend Function InitNesting() As Boolean
' Se previsto, abilito bottone VeinMatching ' Se previsto, abilito bottone VeinMatching
If Not IsNothing( OmagOFFICEMap.refMainWindowVM.VeinMatchingWnd) Then If Not IsNothing(OmagOFFICEMap.refMainWindowVM.VeinMatchingWnd) Then
OmagOFFICEMap.refVeinMatchPanelVM.VeinMatchIsEnabled = True OmagOFFICEMap.refVeinMatchPanelVM.VeinMatchIsEnabled = True
End If End If
' Abilitazione TrfData ' Abilitazione TrfData
@@ -280,7 +287,7 @@ Public Class NestingTabVM
m_bCsvData = Not m_bTrfData And m_bCsvData = Not m_bTrfData And
(GetMainPrivateProfileInt(S_COMPO, K_CSVDATA, 0) <> 0) (GetMainPrivateProfileInt(S_COMPO, K_CSVDATA, 0) <> 0)
' Se previsto, abilito bottone CsvData ' Se previsto, abilito bottone CsvData
CsvData_Visibility = If( m_bCsvData, Visibility.Visible, Visibility.Collapsed) CsvData_Visibility = If(m_bCsvData, Visibility.Visible, Visibility.Collapsed)
' Imposto il corretto contesto ' Imposto il corretto contesto
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
' aggiorno dati del grezzo ' aggiorno dati del grezzo
@@ -358,7 +365,7 @@ Public Class NestingTabVM
Private Sub AutomaticInsert() Private Sub AutomaticInsert()
EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
OmagOFFICEMap.refStatusBarVM.SetOutputMessage( EgtMsg( 90340)) ' Nesting Automatico in corso OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90340)) ' Nesting Automatico in corso
Dim bWrongTrf As Boolean = False Dim bWrongTrf As Boolean = False
Dim vParts As New List(Of Integer) Dim vParts As New List(Of Integer)
' Ciclo di pre-inserimento in tavola dei pezzi selezionati ' Ciclo di pre-inserimento in tavola dei pezzi selezionati
@@ -376,7 +383,7 @@ Public Class NestingTabVM
End If End If
' Lo preparo in tavola, se possibile ' Lo preparo in tavola, se possibile
If PreInsertOnePart(nId) Then If PreInsertOnePart(nId) Then
vParts.Add( nId) vParts.Add(nId)
Else Else
EgtSetStatus(nId, GDB_ST.ON_) EgtSetStatus(nId, GDB_ST.ON_)
VeinMatching.OnDeselectPart(nId) VeinMatching.OnDeselectPart(nId)
@@ -391,12 +398,12 @@ Public Class NestingTabVM
Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, CurrentMachine.sMachIniFile) <> 0) Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, CurrentMachine.sMachIniFile) <> 0)
EnableReferenceRegion(bAligned) EnableReferenceRegion(bAligned)
' Eseguo nesting automatico ' Eseguo nesting automatico
Dim bOpimizeOnX As Boolean = ( GetMainPrivateProfileInt( S_NEST, K_AUTOMATICOPTIMIZE, 2) = 1) Dim bOpimizeOnX As Boolean = (GetMainPrivateProfileInt(S_NEST, K_AUTOMATICOPTIMIZE, 2) = 1)
Dim bGuillotineMode As Boolean = bAligned Dim bGuillotineMode As Boolean = bAligned
Dim nAutomaticMaxTime As Integer = GetMainPrivateProfileInt( S_NEST, K_AUTOMATICMAXTIME, 20) Dim nAutomaticMaxTime As Integer = GetMainPrivateProfileInt(S_NEST, K_AUTOMATICMAXTIME, 20)
Dim dPartTime As Double = If( bGuillotineMode, 1.0, 0.5) Dim dPartTime As Double = If(bGuillotineMode, 1.0, 0.5)
Dim nMaxTime As Integer = Math.Min( CInt( 2 + dPartTime * vParts.Count()), nAutomaticMaxTime) Dim nMaxTime As Integer = Math.Min(CInt(2 + dPartTime * vParts.Count()), nAutomaticMaxTime)
EgtAutomaticPackParts( vParts, bOpimizeOnX, CurrentMachine.bReducedCut, bGuillotineMode, nMaxTime) EgtAutomaticPackParts(vParts, bOpimizeOnX, CurrentMachine.bReducedCut, bGuillotineMode, nMaxTime)
' Sistemo i pezzi ' Sistemo i pezzi
For Each nPartId As Integer In vParts For Each nPartId As Integer In vParts
' se pezzo inserito ' se pezzo inserito
@@ -404,11 +411,11 @@ Public Class NestingTabVM
VeinMatching.OnInsertPartInRaw(nPartId) VeinMatching.OnInsertPartInRaw(nPartId)
' Eventuale aggiunta solido per taglio da sotto ' Eventuale aggiunta solido per taglio da sotto
UpdateSolidForDrip(nPartId) UpdateSolidForDrip(nPartId)
' altrimenti rifiutato ' altrimenti rifiutato
else Else
' Ripristino lo stato originale ' Ripristino lo stato originale
PreRemoveOnePart( Math.Abs( nPartId)) PreRemoveOnePart(Math.Abs(nPartId))
VeinMatching.OnDeselectPart( Math.Abs( nPartId)) VeinMatching.OnDeselectPart(Math.Abs(nPartId))
End If End If
Next Next
' Aggiorno flag selezionati ' Aggiorno flag selezionati
@@ -423,6 +430,93 @@ Public Class NestingTabVM
End If End If
End Sub End Sub
Private Sub VerifyMove()
If m_bVerify Then
' Determino cosa verificare
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
' Eseguo verifica
If VerifyTrfData(nMoveId) And EgtVerifyPart(nMoveId, CurrentMachine.bReducedCut) Then
EstCalc.ResetOrderMachiningFlag()
' Non superata riporto alla posizione iniziale
Else
If m_bFromParking Then
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage()
PreRemoveOnePart(nMoveId)
VeinMatching.OnRemovePartFromRaw(nMoveId)
Else
EgtMove(nMoveId, -m_vtTotMove)
' Eventuale notifica al VeinMatching
If nMoveId = GDB_ID.SEL Then
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
VeinMatching.OnMovePartInRaw(nId)
nId = EgtGetNextSelectedObj()
End While
Else
VeinMatching.OnMovePartInRaw(nMoveId)
End If
End If
'---------------------- COUNTER PART ----------------------
' solo se pezzo disposto in tavola
If m_bFromParking Then
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' accendo il layer che contiene il contatore (spento in fase di Drag)
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
End If
'---------------------- COUNTER PART ----------------------
End If
m_bFromParking = False
End If
End Sub
Private Sub VerifyRot()
' se comando Shift è stato attivato
If m_bKeyLeftShiftPressed Then
' Determino cosa verificare
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
If Not EgtVerifyPart(nMoveId, CurrentMachine.bReducedCut) Then
Dim ptCen As Point3d
If Not EgtGetPartPartClusterCenterGlob(nMoveId, ptCen) Then Return
EgtRotate(nMoveId, ptCen, Vector3d.Z_AX(), -m_dAngTotal, GDB_RT.GLOB)
End If
End If
' resetto i valori
m_dStartAng = 0
m_dAngTotal = 0
m_bStartRot = False
End Sub
' verifica che la rotazione sia ammessa
Private Function RotatePartInsideBond(dAngRotDeg As Double, nIdMove As Integer) As Boolean
' Verifico se ci sono dei pezzi bloccati in rotazione
Dim bLockedRot As Boolean = GetLockOnRotation(nIdMove)
' Se tutti i pezzi possono ruotare
If Not bLockedRot Then
' Calcolo il centro di rotazione come centro del cluster
Dim ptCen As Point3d
If Not EgtGetPartPartClusterCenterGlob(nIdMove, ptCen) Then Return False
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
' Verifico rotazione complessiva
EgtRotate(nIdMove, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
If EgtVerifyPart(nIdMove, CurrentMachine.bReducedCut) Then Return True
' Provo rotazione parziale (dopo aver annullato la complessiva)
EgtRotate(nIdMove, ptCen, Vector3d.Z_AX(), -dAngRotDeg, GDB_RT.GLOB)
Return EgtRotatePart(nIdMove, CurrentMachine.bReducedCut, ptCen, dAngRotDeg)
Else
Return False
End If
End Function
Private Function RotateCluster(ByVal dAngRotDeg As Double) As Boolean Private Function RotateCluster(ByVal dAngRotDeg As Double) As Boolean
' Se non ci sono pezzi selezionati, esco ' Se non ci sono pezzi selezionati, esco
If EgtGetSelectedObjCount() = 0 Then Return True If EgtGetSelectedObjCount() = 0 Then Return True
@@ -432,7 +526,7 @@ Public Class NestingTabVM
Dim nId As Integer = EgtGetFirstSelectedObj() Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL While nId <> GDB_ID.NULL
' Se pezzo con rotazione libera ' Se pezzo con rotazione libera
If Not EgtExistsInfo( nId, INFO_PARTROT) Then If Not EgtExistsInfo(nId, INFO_PARTROT) Then
' Calcolo il centro di rotazione come centro del pezzo ' Calcolo il centro di rotazione come centro del pezzo
Dim ptCen As Point3d Dim ptCen As Point3d
If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
@@ -466,40 +560,22 @@ Public Class NestingTabVM
nId = EgtGetNextSelectedObj() nId = EgtGetNextSelectedObj()
End While End While
Return True Return True
' Altrimenti li ruoto tenendo conto delle collisioni ' Altrimenti li ruoto tenendo conto delle collisioni
Else Else
' Verifico se ci sono dei pezzi bloccati in rotazione Return RotatePartInsideBond(dAngRotDeg, GDB_ID.SEL)
Dim bLockedRot As Boolean = GetLockOnRotation( GDB_ID.SEL)
' Se tutti i pezzi possono ruotare
If Not bLockedRot Then
' Calcolo il centro di rotazione come centro del cluster
Dim ptCen As Point3d
If Not EgtGetPartPartClusterCenterGlob(GDB_ID.SEL, ptCen) Then Return False
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
' Verifico rotazione complessiva
EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
If EgtVerifyPart(GDB_ID.SEL, CurrentMachine.bReducedCut) Then Return True
' Provo rotazione parziale (dopo aver annullato la complessiva)
EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), -dAngRotDeg, GDB_RT.GLOB)
Return EgtRotatePart(GDB_ID.SEL, CurrentMachine.bReducedCut, ptCen, dAngRotDeg)
Else
Return False
End If
End If End If
End Function End Function
Private Function GetLockOnRotation( nPartId As Integer) As Boolean Private Function GetLockOnRotation(nPartId As Integer) As Boolean
' Se singolo pezzo ' Se singolo pezzo
If nPartId <> GDB_ID.SEL Then If nPartId <> GDB_ID.SEL Then
Return EgtExistsInfo( nPartId, INFO_PARTROT) Return EgtExistsInfo(nPartId, INFO_PARTROT)
' Altrimenti tutti i selezionati ' Altrimenti tutti i selezionati
Else Else
Dim bLockedRot As Boolean = False Dim bLockedRot As Boolean = False
Dim nId As Integer = EgtGetFirstSelectedObj() Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL While nId <> GDB_ID.NULL
If EgtExistsInfo( nId, INFO_PARTROT) Then If EgtExistsInfo(nId, INFO_PARTROT) Then
bLockedRot = True bLockedRot = True
Exit While Exit While
End If End If
@@ -564,13 +640,13 @@ Public Class NestingTabVM
Return True Return True
End Function End Function
Friend Function ExitNesting( bChange As Boolean) As Boolean Friend Function ExitNesting(bChange As Boolean) As Boolean
If m_CsvImport_IsChecked Then If m_CsvImport_IsChecked Then
m_CsvImportWindow.Close() m_CsvImportWindow.Close()
m_CsvImportWindow = Nothing m_CsvImportWindow = Nothing
End If End If
If bChange Then If bChange Then
OmagOFFICEMap.refVeinMatchPanelVM.SetVeinMatchIsChecked( False) OmagOFFICEMap.refVeinMatchPanelVM.SetVeinMatchIsChecked(False)
OmagOFFICEMap.refVeinMatchPanelVM.VeinMatchIsEnabled = False OmagOFFICEMap.refVeinMatchPanelVM.VeinMatchIsEnabled = False
End If End If
Return True Return True
@@ -1343,20 +1419,20 @@ Public Class NestingTabVM
Dim nId As Integer = EgtGetFirstSelectedObj() Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL While nId <> GDB_ID.NULL
' Se rotazione bloccata, tolgo blocco e aggiorno info ' Se rotazione bloccata, tolgo blocco e aggiorno info
If EgtExistsInfo( nId, INFO_PARTROT) Then If EgtExistsInfo(nId, INFO_PARTROT) Then
' Rimuovo flag di rotazione bloccata ' Rimuovo flag di rotazione bloccata
EgtRemoveInfo( nId, INFO_PARTROT) EgtRemoveInfo(nId, INFO_PARTROT)
' Tolgo da info sul pezzo Codice ' Tolgo da info sul pezzo Codice
Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION)) Dim nTextId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(nId, NAME_REGION))
While nTextId <> GDB_ID.NULL While nTextId <> GDB_ID.NULL
If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = "" Dim sText As String = ""
EgtTextGetContent( nTextId, sText) EgtTextGetContent(nTextId, sText)
sText = sText.Replace( "<br/>(X)", "") sText = sText.Replace("<br/>(X)", "")
EgtModifyText( nTextId, sText) EgtModifyText(nTextId, sText)
Exit While Exit While
End If End If
nTextId = EgtGetNext( nTextId) nTextId = EgtGetNext(nTextId)
End While End While
End If End If
' Passo al successivo selezionato ' Passo al successivo selezionato
@@ -1387,20 +1463,20 @@ Public Class NestingTabVM
Dim nId As Integer = EgtGetFirstSelectedObj() Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL While nId <> GDB_ID.NULL
' Se rotazione libera, applico blocco e aggiorno info ' Se rotazione libera, applico blocco e aggiorno info
If Not EgtExistsInfo( nId, INFO_PARTROT) Then If Not EgtExistsInfo(nId, INFO_PARTROT) Then
' Imposto flag di rotazione bloccata ' Imposto flag di rotazione bloccata
EgtSetInfo( nId, INFO_PARTROT, 0) EgtSetInfo(nId, INFO_PARTROT, 0)
' Inserisco in info sul pezzo Codice ' Inserisco in info sul pezzo Codice
Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION)) Dim nTextId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(nId, NAME_REGION))
While nTextId <> GDB_ID.NULL While nTextId <> GDB_ID.NULL
If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = "" Dim sText As String = ""
EgtTextGetContent( nTextId, sText) EgtTextGetContent(nTextId, sText)
sText &= "<br/>(X)" sText &= "<br/>(X)"
EgtModifyText( nTextId, sText) EgtModifyText(nTextId, sText)
Exit While Exit While
End If End If
nTextId = EgtGetNext( nTextId) nTextId = EgtGetNext(nTextId)
End While End While
End If End If
' Passo al successivo selezionato ' Passo al successivo selezionato
@@ -1436,7 +1512,7 @@ Public Class NestingTabVM
Dim bAlignMoved As Boolean = False Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False Dim bSnapMoved As Boolean = False
If m_bMagnetic Then If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved) EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved)
End If End If
If m_dSnapDist > EPS_SMALL Then If m_dSnapDist > EPS_SMALL Then
@@ -1480,7 +1556,7 @@ Public Class NestingTabVM
Dim bAlignMoved As Boolean = False Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False Dim bSnapMoved As Boolean = False
If m_bMagnetic Then If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved) EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved)
End If End If
If m_dSnapDist > EPS_SMALL Then If m_dSnapDist > EPS_SMALL Then
@@ -1524,7 +1600,7 @@ Public Class NestingTabVM
Dim bAlignMoved As Boolean = False Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False Dim bSnapMoved As Boolean = False
If m_bMagnetic Then If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved) EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved)
End If End If
If m_dSnapDist > EPS_SMALL Then If m_dSnapDist > EPS_SMALL Then
@@ -1568,7 +1644,7 @@ Public Class NestingTabVM
Dim bAlignMoved As Boolean = False Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False Dim bSnapMoved As Boolean = False
If m_bMagnetic Then If m_bMagnetic Then
If Not GetLockOnRotation( GDB_ID.SEL) Then If Not GetLockOnRotation(GDB_ID.SEL) Then
EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved) EgtAlignPartOnCollision(GDB_ID.SEL, CurrentMachine.bReducedCut, bAlignMoved)
End If End If
If m_dSnapDist > EPS_SMALL Then If m_dSnapDist > EPS_SMALL Then
@@ -1656,7 +1732,7 @@ Public Class NestingTabVM
If CurrentMachine.bAutomatic And If CurrentMachine.bAutomatic And
OmagOFFICEMap.refMainWindowVM.MainWindowM.AutoNestOption() Then OmagOFFICEMap.refMainWindowVM.MainWindowM.AutoNestOption() Then
AutomaticInsert() AutomaticInsert()
' altrimenti inserimento standard ' altrimenti inserimento standard
Else Else
StandardInsert() StandardInsert()
End If End If
@@ -1949,44 +2025,44 @@ Public Class NestingTabVM
' Deseleziono eventuali altri ' Deseleziono eventuali altri
If EgtGetNextSelectedObj() <> GDB_ID.NULL Then If EgtGetNextSelectedObj() <> GDB_ID.NULL Then
EgtDeselectAll() EgtDeselectAll()
EgtSelectObj( nPartId) EgtSelectObj(nPartId)
EgtDraw() EgtDraw()
End If End If
' Recupero dati del pezzo ' Recupero dati del pezzo
Dim sCsvOrder As String = "" : EgtGetInfo( nPartId, INFO_CSV_ORD, sCsvOrder) Dim sCsvOrder As String = "" : EgtGetInfo(nPartId, INFO_CSV_ORD, sCsvOrder)
Dim sCsvList As String = "" : EgtGetInfo( nPartId, INFO_CSV_DIST, sCsvList) Dim sCsvList As String = "" : EgtGetInfo(nPartId, INFO_CSV_DIST, sCsvList)
Dim sCsvName As String = "" : EgtGetInfo( nPartId, INFO_CSV_PART, sCsvName) Dim sCsvName As String = "" : EgtGetInfo(nPartId, INFO_CSV_PART, sCsvName)
' Avvio dialogo modifica ' Avvio dialogo modifica
Dim DlgCsvDataVM As New CompoCsvDataWindowVM() Dim DlgCsvDataVM As New CompoCsvDataWindowVM()
Dim DlgCsvDataV As New CompoCsvDataWindowV(Application.Current.MainWindow, DlgCsvDataVM) Dim DlgCsvDataV As New CompoCsvDataWindowV(Application.Current.MainWindow, DlgCsvDataVM)
DlgCsvDataVM.SetData( sCsvOrder, sCsvList, sCsvName) DlgCsvDataVM.SetData(sCsvOrder, sCsvList, sCsvName)
If DlgCsvDataV.ShowDialog() Then If DlgCsvDataV.ShowDialog() Then
' Recupero i nuovi dati ' Recupero i nuovi dati
Dim sNewOrder As String = "" Dim sNewOrder As String = ""
Dim sNewList As String = "" Dim sNewList As String = ""
Dim sNewName As String = "" Dim sNewName As String = ""
DlgCsvDataVM.GetData( sNewOrder, sNewList, sNewName) DlgCsvDataVM.GetData(sNewOrder, sNewList, sNewName)
' Assegno i nuovi dati ' Assegno i nuovi dati
EgtSetInfo( nPartId, INFO_CSV_ORD, sNewOrder) EgtSetInfo(nPartId, INFO_CSV_ORD, sNewOrder)
EgtSetInfo( nPartId, INFO_CSV_DIST, sNewList) EgtSetInfo(nPartId, INFO_CSV_DIST, sNewList)
EgtSetInfo( nPartId, INFO_CSV_PART, sNewName) EgtSetInfo(nPartId, INFO_CSV_PART, sNewName)
' Se necessario, modifico la scritta ' Se necessario, modifico la scritta
If sNewName <> sCsvName Then If sNewName <> sCsvName Then
Dim nRegLayId As Integer = EgtGetFirstNameInGroup( nPartId, NAME_REGION) Dim nRegLayId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION)
Dim nTextId = EgtGetFirstInGroup(nRegLayId) Dim nTextId = EgtGetFirstInGroup(nRegLayId)
While nTextId <> GDB_ID.NULL While nTextId <> GDB_ID.NULL
If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then If EgtGetType(nTextId) = GDB_TY.EXT_TEXT Then
Dim sText As String = String.Empty Dim sText As String = String.Empty
EgtTextGetContent( nTextId, sText) EgtTextGetContent(nTextId, sText)
Dim nPos As Integer = sText.IndexOf( sCsvName) Dim nPos As Integer = sText.IndexOf(sCsvName)
Dim sNewText As String Dim sNewText As String
If nPos <0 Then If nPos < 0 Then
sNewText= sNewName & "<br/>" & sText sNewText = sNewName & "<br/>" & sText
Else Else
sNewText = sText.Remove( nPos, sCsvName.Length()).Insert( nPos, sNewName) sNewText = sText.Remove(nPos, sCsvName.Length()).Insert(nPos, sNewName)
End If End If
EgtModifyText( nTextId, sNewText) EgtModifyText(nTextId, sNewText)
VeinMatching.ModifyPartText( nPartId, sNewText) VeinMatching.ModifyPartText(nPartId, sNewText)
Exit While Exit While
End If End If
nTextId = EgtGetNext(nTextId) nTextId = EgtGetNext(nTextId)
@@ -2081,6 +2157,7 @@ Public Class NestingTabVM
m_bDrag = m_bDrag AndAlso EgtUnProjectPoint(e.Location, m_ptPrev) m_bDrag = m_bDrag AndAlso EgtUnProjectPoint(e.Location, m_ptPrev)
m_bDragToStart = m_bDrag m_bDragToStart = m_bDrag
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0 m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
m_bKeyLeftShiftPressed = m_bVerify
m_vtTotMove = Vector3d.NULL() m_vtTotMove = Vector3d.NULL()
End Sub End Sub
@@ -2089,7 +2166,7 @@ Public Class NestingTabVM
If Not m_bDrag Or m_bDragging Then Return If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) <m_nRestRadius And If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return Return
End If End If
@@ -2115,12 +2192,12 @@ Public Class NestingTabVM
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_NESTPAGEUC + 7), MSG_TYPE.WARNING) OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(MSG_NESTPAGEUC + 7), MSG_TYPE.WARNING)
End If End If
' Applico le lavorazioni al pezzo ' Applico le lavorazioni al pezzo
Dim b3Curr As new BBox3d Dim b3Curr As New BBox3d
EgtGetBBoxGlob( EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Curr) EgtGetBBoxGlob(EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Curr)
if Not EstCalc.PreInsertOnePart( nTestId) Then Return If Not EstCalc.PreInsertOnePart(nTestId) Then Return
Dim b3Ins As new BBox3d Dim b3Ins As New BBox3d
EgtGetBBoxGlob( EgtGetFirstNameInGroup( nTestId, NAME_REGION), BBFLAG, b3Ins) EgtGetBBoxGlob(EgtGetFirstNameInGroup(nTestId, NAME_REGION), BBFLAG, b3Ins)
Dim vtDiff As new Vector3d( b3Curr.Min().x - b3Ins.Min().x, b3Curr.Min().y - b3Ins.Min().y, 0) Dim vtDiff As New Vector3d(b3Curr.Min().x - b3Ins.Min().x, b3Curr.Min().y - b3Ins.Min().y, 0)
EgtMove(nMoveId, vtDiff) EgtMove(nMoveId, vtDiff)
'---------------------- COUNTER PART ---------------------- '---------------------- COUNTER PART ----------------------
@@ -2136,7 +2213,7 @@ Public Class NestingTabVM
'---------------------- COUNTER PART ---------------------- '---------------------- COUNTER PART ----------------------
' Gestione VeinMatching ' Gestione VeinMatching
VeinMatching.OnInsertPartInRaw( nMoveId) VeinMatching.OnInsertPartInRaw(nMoveId)
' Imposto stato ' Imposto stato
m_bVerify = True m_bVerify = True
m_bFromParking = True m_bFromParking = True
@@ -2146,46 +2223,108 @@ Public Class NestingTabVM
' Ricavo il punto corrente in coordinate mondo ' Ricavo il punto corrente in coordinate mondo
Dim ptCurr As Point3d Dim ptCurr As Point3d
EgtUnProjectPoint(e.Location, ptCurr) EgtUnProjectPoint(e.Location, ptCurr)
' Ricavo il vettore di movimento
Dim vtMove As Vector3d = ptCurr - m_ptPrev ' la rotazione è attivabile solo se premuto il tasto Ctrl (e non sono in parheggio)
' Muovo i pezzi selezionati di quanto possibile m_bKeyCtrlPressed = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Control) > 0
If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
' Se movimento con sola verifica finale '-------------Inizio ROTAZIONE ----------------
If m_bVerify Then If m_bKeyCtrlPressed AndAlso (Not m_bFromParking OrElse m_bKeyLeftShiftPressed) Then
EgtMove(nMoveId, vtMove) ' Calcolo il centro di rotazione come centro del cluster
m_vtTotMove += vtMove Dim ptCen As Point3d
' altrimenti caso con verifica durante il movimento If Not EgtGetPartPartClusterCenterGlob(nMoveId, ptCen) Then Return
Else ' definisco il vettore dal centro del pezzo alla posizione del cursore
' Aggiorno regioni per nesting Dim vtCurr As Vector3d = ptCurr - ptCen
UpdateNestRegions() Dim dLen, dHAng, dVAng As Double
EnableReferenceRegion(False) ' recupero l'angolo orizzontale del vettore
' muovo il pezzo vtCurr.ToSpherical(dLen, dHAng, dVAng)
EgtMovePart(nMoveId, CurrentMachine.bReducedCut, vtMove) If Not m_bStartRot Then
EgtSaveCollInfo() m_dAngTotal = 0
' se movimento risultante nullo, provo con movimento tangente ' notifico una rotazione
Dim bTgMoved As Boolean = False m_bStartRot = True
If vtMove.IsSmall() Then m_dStartAng = dVAng
' riprovo con movimento tangente
Dim vtTgMove As Vector3d = ptCurr - m_ptPrev
EgtTgMovePartOnCollision(nMoveId, CurrentMachine.bReducedCut, vtTgMove)
bTgMoved = (Not vtTgMove.IsSmall())
End If
' se abilitato magnetico (allineamento + snap), lo provo
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation( nMoveId) Then
EgtAlignPartOnCollision(nMoveId, CurrentMachine.bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(nMoveId, CurrentMachine.bReducedCut, m_dSnapDist, bSnapMoved)
End If
End If
EstCalc.ResetOrderMachiningFlag()
End If End If
EgtDraw() Dim dDeltaAng As Double = dVAng - m_dStartAng
' Eventuale notifica al VeinMatching ' gestione del passaggio da 0° → 360° evitando mantenendo la visualizzazione fluida
If Math.Abs(dDeltaAng) > 90 Then
If m_dStartAng < 180 And dVAng > 180 Then
dDeltaAng = dVAng - 360 - m_dStartAng
ElseIf m_dStartAng > 180 And dVAng < 180 Then
dDeltaAng = dVAng - m_dStartAng + 360
End If
End If
' Rotazione del pezzo attorno al suo centro
If Math.Abs(dDeltaAng) > EPS_ANG_SMALL Then
' se il tasto Shift è premuto (disabilitato il controllo collisioni durante il Drag)
If m_bKeyLeftShiftPressed Then
EgtRotate(nMoveId, ptCen, Vector3d.Z_AX(), dDeltaAng, GDB_RT.GLOB)
m_dAngTotal += dDeltaAng
Else
' esegue la rotazione fino ad incontrare un altro pezzo
RotatePartInsideBond(dDeltaAng, nMoveId)
EstCalc.ResetOrderMachiningFlag()
' Eventuale notifica al VeinMatching
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
VeinMatching.OnMovePartInRaw(nId)
nId = EgtGetNextSelectedObj()
End While
End If
m_dStartAng = dVAng
End If
'-------------Fine ROTAZIONE ----------------
Else
' -------------Inizio TRASLAZIONE ---------------
' Ricavo il vettore di movimento
Dim vtMove As Vector3d = ptCurr - m_ptPrev
' Muovo i pezzi selezionati di quanto possibile
If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
' notifico una traslazione
If Not m_bStartMove Then
m_bStartMove = True
End If
' Se movimento con sola verifica finale (disabilitato il controllo collisioni durante il Drag)
If m_bVerify Then
EgtMove(nMoveId, vtMove)
m_vtTotMove += vtMove
' altrimenti caso con verifica durante il movimento
Else
' Aggiorno regioni per nesting
UpdateNestRegions()
EnableReferenceRegion(False)
' muovo il pezzo
EgtMovePart(nMoveId, CurrentMachine.bReducedCut, vtMove)
EgtSaveCollInfo()
' se movimento risultante nullo, provo con movimento tangente
Dim bTgMoved As Boolean = False
If vtMove.IsSmall() Then
' riprovo con movimento tangente
Dim vtTgMove As Vector3d = ptCurr - m_ptPrev
EgtTgMovePartOnCollision(nMoveId, CurrentMachine.bReducedCut, vtTgMove)
bTgMoved = (Not vtTgMove.IsSmall())
End If
' se abilitato magnetico (allineamento + snap), lo provo
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
If Not GetLockOnRotation(nMoveId) Then
EgtAlignPartOnCollision(nMoveId, CurrentMachine.bReducedCut, bAlignMoved)
End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(nMoveId, CurrentMachine.bReducedCut, m_dSnapDist, bSnapMoved)
End If
End If
EstCalc.ResetOrderMachiningFlag()
End If
' -------------Fine TRASLAZIONE ---------------
End If
End If
EgtDraw()
' Eventuale notifica al VeinMatching
If m_bStartMove OrElse m_bStartRot Then
If nMoveId = GDB_ID.SEL Then If nMoveId = GDB_ID.SEL Then
Dim nId As Integer = EgtGetFirstSelectedObj() Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL While nId <> GDB_ID.NULL
@@ -2225,48 +2364,31 @@ Public Class NestingTabVM
' Se eseguito drag ' Se eseguito drag
If Not m_bDragToStart Then If Not m_bDragToStart Then
' Se movimento con sola verifica finale ' Se movimento con sola verifica finale ----- TRASLAZIONE
If m_bVerify Then If Not m_bStartRot And m_bStartMove Then
' Determino cosa verificare VerifyMove()
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL) ' Se movimento con sola verifica finale ----- TRASLAZIONE + ROTAZIONE
' Aggiorno regioni per nesting ElseIf m_bStartRot And m_bStartMove Then
UpdateNestRegions() If Not m_bFromParking Then
EnableReferenceRegion(False) VerifyRot()
' Eseguo verifica
If VerifyTrfData(nMoveId) And EgtVerifyPart(nMoveId, CurrentMachine.bReducedCut) Then
EstCalc.ResetOrderMachiningFlag()
' Non superata riporto alla posizione iniziale
Else Else
If m_bFromParking Then ' forzo il reset delle info di rotazione
OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() m_dStartAng = 0
PreRemoveOnePart(nMoveId) m_dAngTotal = 0
VeinMatching.OnRemovePartFromRaw(nMoveId) m_bStartRot = False
Else End If
EgtMove(nMoveId, -m_vtTotMove) VerifyMove()
' Eventuale notifica al VeinMatching ' verifico se la posizione finale della rotazione è corretta ----- ROTAZIONE
If nMoveId = GDB_ID.SEL Then ElseIf m_bStartRot And Not m_bStartMove Then
Dim nId As Integer = EgtGetFirstSelectedObj() If m_bFromParking Then
While nId <> GDB_ID.NULL VerifyMove()
VeinMatching.OnMovePartInRaw(nId) ' forzo il reset delle info di rotazione
nId = EgtGetNextSelectedObj() m_dStartAng = 0
End While m_dAngTotal = 0
Else m_bStartRot = False
VeinMatching.OnMovePartInRaw(nMoveId) Else
End If VerifyRot()
End If
'---------------------- COUNTER PART ----------------------
Dim sRefGroup As String = String.Empty
If EgtGetInfo(nMoveId, INFO_REFGROUP, sRefGroup) Then
' accendo il layer che contiene il contatore (spento in fase di Drag)
Dim nCounterLayer As Integer = EgtGetFirstNameInGroup(nMoveId, INFO_COUNTERLY)
EgtSetStatus(nCounterLayer, GDB_ST.ON_)
' aggiorno il layer che indica il numero di pezzi in parcheggio
CountPartInFamily(sRefGroup)
End If
'---------------------- COUNTER PART ----------------------
End If End If
m_bFromParking = False
' altrimenti caso con verifica durante il movimento
Else Else
' Basta reset alla fine ' Basta reset alla fine
End If End If
@@ -2320,7 +2442,7 @@ Public Class NestingTabVM
' Con CANC cancello i pezzi selezionati ' Con CANC cancello i pezzi selezionati
If e.KeyData = System.Windows.Forms.Keys.Delete Then If e.KeyData = System.Windows.Forms.Keys.Delete Then
RemovePart() RemovePart()
' Con INS eseguo inserimento dei pezzi selezionati in VeinMatching ' Con INS eseguo inserimento dei pezzi selezionati in VeinMatching
ElseIf e.KeyData = System.Windows.Forms.Keys.Insert Then ElseIf e.KeyData = System.Windows.Forms.Keys.Insert Then
' Vettore dei pezzi selezionati (l'inserimento di un pezzo in VM cancella la selezione) ' Vettore dei pezzi selezionati (l'inserimento di un pezzo in VM cancella la selezione)
Dim vSel As New List(Of Integer) Dim vSel As New List(Of Integer)
+1
View File
@@ -14,6 +14,7 @@
<OmagOFFICE:ShowPanelV DataContext="{StaticResource ShowPanelVM}"/> <OmagOFFICE:ShowPanelV DataContext="{StaticResource ShowPanelVM}"/>
<OmagOFFICE:ViewPanelV DataContext="{StaticResource ViewPanelVM}"/> <OmagOFFICE:ViewPanelV DataContext="{StaticResource ViewPanelVM}"/>
<OmagOFFICE:InstrumentPanelV DataContext="{StaticResource InstrumentPanelVM}"/> <OmagOFFICE:InstrumentPanelV DataContext="{StaticResource InstrumentPanelVM}"/>
<OmagOFFICE:PrintPanelV DataContext="{StaticResource PrintPanelVM}"/>
<OmagOFFICE:VeinMatchPanelV DataContext="{StaticResource VeinMatchPanelVM}"/> <OmagOFFICE:VeinMatchPanelV DataContext="{StaticResource VeinMatchPanelVM}"/>
<OmagOFFICE:MachinePanelV DataContext="{StaticResource MachinePanelVM}"/> <OmagOFFICE:MachinePanelV DataContext="{StaticResource MachinePanelVM}"/>
</EgtFloating:EgtFloatingTray> </EgtFloating:EgtFloatingTray>
+4
View File
@@ -1,3 +1,7 @@
Public Class ProjectV Public Class ProjectV
Private Sub LoadPage() Handles Me.Loaded
OmagOFFICEMap.SetRefProjectV(Me)
End Sub
End Class End Class
Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

+1
View File
@@ -18,6 +18,7 @@
<EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/> <EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/>
<EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/> <EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/>
<EgtWPFLib5:InstrumentPanelVM x:Key="InstrumentPanelVM"/> <EgtWPFLib5:InstrumentPanelVM x:Key="InstrumentPanelVM"/>
<OmagOFFICE:PrintPanelVM x:Key="PrintPanelVM"/>
<OmagOFFICE:MyMachinePanelVM x:Key="MachinePanelVM"/> <OmagOFFICE:MyMachinePanelVM x:Key="MachinePanelVM"/>
<OmagOFFICE:VeinMatchPanelVM x:Key="VeinMatchPanelVM"/> <OmagOFFICE:VeinMatchPanelVM x:Key="VeinMatchPanelVM"/>
<OmagOFFICE:OptionPanelVM x:Key="OptionPanelVM"/> <OmagOFFICE:OptionPanelVM x:Key="OptionPanelVM"/>
+38
View File
@@ -1,5 +1,6 @@
Imports EgtWPFLib5 Imports EgtWPFLib5
Imports EgtPHOTOLib Imports EgtPHOTOLib
Imports EgtUILib
Module OmagOFFICEMap Module OmagOFFICEMap
@@ -229,6 +230,43 @@ Module OmagOFFICEMap
Return Not IsNothing(m_refSimulTabVM) Return Not IsNothing(m_refSimulTabVM)
End Function End Function
Private m_refProjectV As ProjectV
Friend Sub SetRefProjectV(ProjectV As ProjectV)
m_refProjectV = ProjectV
End Sub
Private m_WidthProjectV As Integer = 2000
Friend Sub SetWidthDimProjectV(Width As Integer)
m_WidthProjectV = Width
End Sub
Friend Function GetWidthDimProjectV() As Integer
If Not IsNothing(m_refProjectV) Then
Try
m_WidthProjectV = CInt(m_refProjectV.ActualWidth)
Catch ex As Exception
EgtOutLog(ex.Message)
End Try
End If
Return m_WidthProjectV
End Function
Private m_HeightProjectV As Integer = 1000
Friend Sub SetHeightDimProjectV(Eight As Integer)
m_HeightProjectV = Eight
End Sub
Friend Function GetHeightDimProjectV() As Integer
If Not IsNothing(m_refProjectV) Then
Try
m_HeightProjectV = CInt(m_refProjectV.ActualHeight)
Catch ex As Exception
EgtOutLog(ex.Message)
End Try
End If
Return m_HeightProjectV
End Function
#End Region ' Set #End Region ' Set
#Region "Init" #Region "Init"