diff --git a/EgtStoneLib/EstCalc.vb b/EgtStoneLib/EstCalc.vb index 00634e1..e6ebb34 100644 --- a/EgtStoneLib/EstCalc.vb +++ b/EgtStoneLib/EstCalc.vb @@ -366,7 +366,7 @@ Module EstCalc Dim nRawGrpId As Integer = EgtGetFirstRawPart() While nRawGrpId <> GDB_ID.NULL Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawGrpId, NAME_RAW_SOLID) - If nRawSolidId <> GDB_ID.NULL Then EgtSetTextureName(nRawSolidId, PHOTO_NAME) + If nRawSolidId <> GDB_ID.NULL Then EgtSetTextureName(nRawSolidId, GetPhotoName()) nRawGrpId = EgtGetNextRawPart(nRawGrpId) End While End If diff --git a/EgtStoneLib/EstPhoto.vb b/EgtStoneLib/EstPhoto.vb index adeb976..b5fb938 100644 --- a/EgtStoneLib/EstPhoto.vb +++ b/EgtStoneLib/EstPhoto.vb @@ -428,7 +428,9 @@ Module EstPhoto Dim nNewPhotoId As Integer = EgtAddPhoto2(GetPhotoName(), sPath, ptOri, ptCen, dDimX, dDimY, nPhGrpId, ptMin, ptMax) If nNewPhotoId = GDB_ID.NULL Then Return False ' Eseguo eventuale rotazione attorno all'origine - EgtRotatePhoto(nNewPhotoId, ptOri, Vector3d.Z_AX(), dRot) + If Math.Abs( dRot) > EPS_ANG_ZERO then + EgtRotatePhoto(nNewPhotoId, ptOri, Vector3d.Z_AX(), dRot) + End If ' Salvo gli offset EgtSetInfo(nNewPhotoId, "OffsX", dOffsetX) EgtSetInfo(nNewPhotoId, "OffsY", dOffsetY) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 544ff89..1affea6 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -69,6 +69,6 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/MyMachGroupPanel/MyMachGroupPanelVM.vb b/MyMachGroupPanel/MyMachGroupPanelVM.vb index da18de7..cfaab19 100644 --- a/MyMachGroupPanel/MyMachGroupPanelVM.vb +++ b/MyMachGroupPanel/MyMachGroupPanelVM.vb @@ -117,8 +117,8 @@ Public Class MyMachGroupPanelVM ' Se macchina con più tavole, chiedo quale usare Dim nTabInd As Integer = 1 Dim nTabCnt As Integer = CamAuto.GetTableCount() - If nTabCnt > 1 And nTabCnt <= 3 Then - Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(DirectCast(nTabCnt, SelectTableWindowVM.TableNumOpt))) + If nTabCnt > 1 And nTabCnt <= 4 Then + Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(nTabCnt)) dlg.ShowDialog() nTabInd = dlg.m_SelTable End If diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb index f8e3d30..0e8b58e 100644 --- a/OptionPanel/NestingTab/NestingTabVM.vb +++ b/OptionPanel/NestingTab/NestingTabVM.vb @@ -1,5 +1,6 @@ -Imports EgtWPFLib5 +Imports System.Drawing Imports EgtUILib +Imports EgtWPFLib5 Imports OmagOFFICE.ChangeTableVM Public Class NestingTabVM @@ -585,9 +586,7 @@ Public Class NestingTabVM m_bStartRot = False End Sub - Friend Function RotateAllRawParts(dAngDeg As Double, Optional bIsReg As Boolean = True) As Boolean - ' Recupero rotazione totale - Dim dRegRot As Double = CamAuto.GetRegistrationRotation() + Friend Function RotateAllRawParts(dAngDeg As Double) As Boolean ' Recupero il centro del grezzo iniziale per usarlo come centro della rotazione Dim ptCen As New Point3d GetRawCenter(ptCen) @@ -641,7 +640,7 @@ Public Class NestingTabVM End While nRevPhase += 1 End While - ' Altrimenti eseguo sistemazioni + ' Altrimenti eseguo sistemazioni Else ' Origine della tavola Dim ptOri As Point3d @@ -704,17 +703,20 @@ Public Class NestingTabVM End If nOpeId = EgtGetNextActiveOperation(nOpeId) End While - ' Se non è registrazione, ruoto anche l'eventuale foto della lastra - 'If Not bIsReg Then - ' Dim nPhotoId = m_CurrProjPage.GetPhoto() - ' If nPhotoId <> GDB_ID.NULL then EgtRotatePhoto(nPhotoId, ptCen, Vector3d.Z_AX(), dAngDeg) - 'End If - ' Aggiorno rotazione totale - If bIsReg Then - CamAuto.SetRegistrationRotation(dRegRot + dAngDeg) - Else - CamAuto.SetRegistrationRotation(0) + ' Ruoto anche l'eventuale foto della lastra e sistemo il riferimento sul grezzo + Dim nPhotoId = EstPhoto.GetPhoto() + If nPhotoId <> GDB_ID.NULL then + Dim dOldRot As Double = 0 + EgtGetInfo(nPhotoId, "Rot", dOldRot) + EgtRotatePhoto(nPhotoId, ptCen, Vector3d.Z_AX(), dAngDeg) + EgtSetInfo(nPhotoId, "Rot", dOldRot + dAngDeg) + Dim refTxr As New Frame3d + GetPhotoTextureRef(refTxr) + Dim nSolidId = EgtGetFirstNameInGroup(EgtGetFirstRawPart(), NAME_RAW_SOLID) + EgtSetTextureFrame(nSolidId, refTxr, GDB_RT.GLOB) End If + ' Aggiorno rotazione totale + CamAuto.SetRegistrationRotation(0) ' Dichiaro grezzo per punti EgtSetInfo(GetCurrentRaw(), KEY_RAWBYPOINTS, 1) End If @@ -778,8 +780,11 @@ Public Class NestingTabVM nRevPhase += 1 End While End If - ' Muovo i punti SpotReg generati nel programma OFFICE If bMoveOk Then + ' Traslo anche l'eventuale foto della lastra + Dim nPhotoId = EstPhoto.GetPhoto() + If nPhotoId <> GDB_ID.NULL then EgtMovePhoto(nPhotoId, vtMove) + ' Muovo i punti SpotReg generati nel programma OFFICE OmagOFFICEMap.refRawPartTabVM.MoveAllSpotRegistration(vtMove) End If ' Ripristino lo stato iniziale @@ -2414,7 +2419,7 @@ Public Class NestingTabVM Dim nStat As Integer = GDB_ST.ON_ EgtGetStatus(nPartId, nStat) - ' verifico se l'lemento selezionato è il numero di pezzi + ' verifico se l'elemento selezionato è il numero di pezzi If EgtGetType(nId) = GDB_TY.EXT_TEXT Then Dim NameLayer As String = String.Empty EgtGetName(EgtGetParent(nId), NameLayer) @@ -2463,10 +2468,21 @@ Public Class NestingTabVM ' se non è stata eseguita nessuna scelta esco dal ciclo If ChgTbVM.MyDialogResult = EnumDialogResult.CANCEL Or ChgTbVM.nSelectedTable = 0 Then Exit While - ' recupero il nome della tavola corrente + ' salvo l'origine della precente tavola + Dim ptOldTabOri As Point3d + EgtGetTableRef( 1, ptOldTabOri) + + ' recupero il nome della nuova tavola corrente Dim sOtherTab As String = GetTableName(ChgTbVM.nSelectedTable) EgtChangeTable(sOtherTab, True) + ' Traslo anche l'eventuale foto della lastra + Dim nPhotoId = EstPhoto.GetPhoto() + If nPhotoId <> GDB_ID.NULL then + Dim ptTabOri As Point3d + EgtGetTableRef( 1, ptTabOri) + EgtMovePhoto(nPhotoId, ptTabOri - ptOldTabOri) + End If EstCalc.AdjustAdditionalTable(True) EgtSetMachineLook(MCH_LOOK.TAB) ' aggiorno le lavorazioni @@ -2509,10 +2525,10 @@ Public Class NestingTabVM EgtSetCurrPhase(1) ' Rotazione Dim dAngRot As Double = If(sOtherTab = SECOND_TAB, 180, -180) - If Not RotateAllRawParts(dAngRot, False) Then + If Not RotateAllRawParts(dAngRot) Then 'm_CurrProjPage.SetWarningMessage(EgtMsg(90339)) 'Rotazione impossibile End If - ' Traslazione per riportare la lastra nella stessa posizione rispetto all'angolo BL che diveta TR e viceversa + ' Traslazione per riportare la lastra nella stessa posizione rispetto all'angolo BL che diventa TR e viceversa Dim b3Raw As New BBox3d GetRawBox(b3Raw) Dim vtMove As Vector3d @@ -2538,7 +2554,7 @@ Public Class NestingTabVM ' visualizzazione EgtZoom(ZM.ALL) - ' Elimino il datacontext della finsetra per la selezione della tavola + ' Elimino il datacontext della finestra per la selezione della tavola ChgTbVM = Nothing Exit While End If diff --git a/SelectTableWindow/SelectTableWindowV.xaml b/SelectTableWindow/SelectTableWindowV.xaml index 4ef9b0f..87a298c 100644 --- a/SelectTableWindow/SelectTableWindowV.xaml +++ b/SelectTableWindow/SelectTableWindowV.xaml @@ -17,6 +17,7 @@ + @@ -26,21 +27,21 @@ + Margin="0,0,0,10" Foreground="#FFE0E0E0"/> + diff --git a/SelectTableWindow/SelectTableWindowVM.vb b/SelectTableWindow/SelectTableWindowVM.vb index f72c1c4..9b08cc6 100644 --- a/SelectTableWindow/SelectTableWindowVM.vb +++ b/SelectTableWindow/SelectTableWindowVM.vb @@ -6,11 +6,6 @@ Public Class SelectTableWindowVM #Region "FIELDS & PROPERTIES" - Public Enum TableNumOpt As Integer - TWO = 2 - THREE = 3 - End Enum - Friend Event m_CloseWindow(DialogResult As Integer) Private m_Table3_Visibility As Visibility @@ -23,6 +18,16 @@ Public Class SelectTableWindowVM End Set End Property + Private m_Table4_Visibility As Visibility + Public Property Table4_Visibility As Visibility + Get + Return m_Table4_Visibility + End Get + Set(value As Visibility) + m_Table4_Visibility = value + End Set + End Property + #Region "Messages" Public ReadOnly Property Title As String @@ -46,13 +51,20 @@ Public Class SelectTableWindowVM #Region "CONSTRUCTOR" - Sub New(nTableNum As TableNumOpt) - If nTableNum = TableNumOpt.TWO Then - m_Table3_Visibility = Visibility.Collapsed - Else - m_Table3_Visibility = Visibility.Visible - End If + Sub New(nTableNum As Integer) + Select nTableNum + Case 2 + m_Table3_Visibility = Visibility.Collapsed + m_Table4_Visibility = Visibility.Collapsed + Case 3 + m_Table3_Visibility = Visibility.Visible + m_Table4_Visibility = Visibility.Collapsed + Case 4 + m_Table3_Visibility = Visibility.Visible + m_Table4_Visibility = Visibility.Visible + End Select NotifyPropertyChanged("Table3_Visibility") + NotifyPropertyChanged("Table4_Visibility") End Sub #End Region ' CONSTRUCTOR