From edd79b8d93508440461007acdc6811e16ada6abe Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 29 Jan 2016 19:57:05 +0000 Subject: [PATCH] OmagCUT 1.6l10 : - migliorie varie. --- CadCutPageUC.xaml.vb | 6 + CamAuto.vb | 124 +++++++++++++ ConstGen.vb | 32 +++- MainWindow.xaml.vb | 2 +- My Project/AssemblyInfo.vb | 4 +- NestPageUC.xaml | 182 ++++++++++-------- NestPageUC.xaml.vb | 12 ++ SimulationPageUC.xaml.vb | 4 + SplitPageUC.xaml | 134 ++++++++----- SplitPageUC.xaml.vb | 372 ++++++++++++++++++++++++++----------- 10 files changed, 632 insertions(+), 240 deletions(-) diff --git a/CadCutPageUC.xaml.vb b/CadCutPageUC.xaml.vb index 1378b75..7718c40 100644 --- a/CadCutPageUC.xaml.vb +++ b/CadCutPageUC.xaml.vb @@ -36,7 +36,9 @@ Public Class CadCutPageUC ' Posizionamento nella griglia delle Page UserControl m_NestPage.SetValue(Grid.RowSpanProperty, 3) + m_NestPage.SetValue(Grid.ColumnSpanProperty, 2) m_SplitPage.SetValue(Grid.RowSpanProperty, 3) + m_SplitPage.SetValue(Grid.ColumnSpanProperty, 3) m_MoveRawPartPage.SetValue(Grid.RowSpanProperty, 3) ' Nascondo progress e label per messaggi @@ -192,6 +194,10 @@ Public Class CadCutPageUC bOk = SortAllMachinings() If bOk Then m_CurrProjPage.SetOrderMachiningFlag() + Dim bModif As Boolean = TestAllMachiningsForStrict() + If bModif Then + m_CurrProjPage.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze + End If End If End If ' Disabilito impostazione modificato diff --git a/CamAuto.vb b/CamAuto.vb index 4c40d9f..2949cae 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -77,6 +77,130 @@ Public Module CamAuto Return EgtSetAllOperationsMode(True) End Function + Public Function TestAllMachiningsForStrict() As Boolean + Dim bModified As Boolean = False + ' Identificativo grezzo corrente + Dim nRawId As Integer = EgtGetFirstRawPart() + ' Ciclo sulle lavorazioni + Dim nOperId As Integer = EgtGetFirstOperation() + While nOperId <> GDB_ID.NULL + ' verifico sia una lavorazione valida + If IsValidMachining(nOperId) Then + ' eventuali lavorazioni inglobate + Dim vOthId As New List(Of Integer) + Dim sInfo As String = String.Empty + If EgtGetInfo(nOperId, INFO_MCH_OTHMID, sInfo) Then + Dim sItems() As String = sInfo.Split(",".ToCharArray) + For Each sId In sItems + vOthId.Add(CInt(sId)) + Next + End If + ' layer di origine + Dim sLay As String = String.Empty + EgtGetInfo(nOperId, "Lay", sLay) + ' verifica interferenza + Dim bFree As Boolean = True + If sLay = "OutLoop" Then + bFree = EgtVerifyMachining(nOperId, False, nRawId) + For Each nId As Integer In vOthId + If Not EgtVerifyMachining(nId, False, nRawId) Then + bFree = False + End If + Next + Else + bFree = True + End If + ' abilitazione + Dim bEnabled As Boolean = Not EgtExistsInfo(nOperId, INFO_MCH_USER_OFF) + ' Restringo lavorazione abilitata ma con interferenza + If bEnabled And Not bFree Then + SetStrictMachining(nOperId, True, True) + bModified = True + End If + End If + nOperId = EgtGetNextOperation(nOperId) + End While + Return bModified + End Function + + Public Function SetStrictMachining(nMchId As Integer, bStart As Boolean, bEnd As Boolean) As Boolean + ' Imposto la lavorazione corrente + If Not EgtSetCurrMachining(nMchId) Then Return False + Dim bModif As Boolean = False + ' Se richiesto, restringo l'attacco + If bStart Then + ' Recupero tipo attacco originale e lo salvo se non già fatto + Dim nOriLeadIn As Integer = MCH_SAW_LI.CENT + EgtGetMachiningParamInt(MCH_MP.LEADINTYPE, nOriLeadIn) + If Not EgtExistsInfo(nMchId, INFO_MCH_ORILEADIN) Then + EgtSetInfo(nMchId, INFO_MCH_ORILEADIN, nOriLeadIn) + End If + ' Se attacco cambiato, aggiorno + If nOriLeadIn <> MCH_SAW_LI.STRICT Then + EgtSetMachiningParamInt(MCH_MP.LEADINTYPE, MCH_SAW_LI.STRICT) + bModif = True + End If + End If + ' Se richiesto, restringo l'uscita + If bEnd Then + ' Recupero tipo uscita originale e lo salvo se non già fatto + Dim nOriLeadOut As Integer = MCH_SAW_LO.CENT + EgtGetMachiningParamInt(MCH_MP.LEADOUTTYPE, nOriLeadOut) + If Not EgtExistsInfo(nMchId, INFO_MCH_ORILEADOUT) Then + EgtSetInfo(nMchId, INFO_MCH_ORILEADOUT, nOriLeadOut) + End If + ' Se uscita cambiata, aggiorno + If nOriLeadOut <> MCH_SAW_LO.STRICT Then + EgtSetMachiningParamInt(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.STRICT) + bModif = True + End If + End If + ' Se modificato, ricalcolo il preview + If bModif Then + ' Indice gruppo di preview nella lavorazione + Dim nMchPvId As Integer = EgtGetFirstNameInGroup(nMchId, NAME_PREVIEW) + ' Indice gruppo di preview nel pezzo + Dim nPartPvId As Integer = GDB_ID.NULL + EgtGetInfo(nMchPvId, INFO_PV_ONPART_ID, nPartPvId) + ' Svuoto il preview nel pezzo + EgtEmptyGroup(nPartPvId) + ' Rimuovo anche il preview di lavorazioni inglobate + Dim sInfo As String = String.Empty + If EgtGetInfo(nMchId, INFO_MCH_OTHMID, sInfo) Then + Dim sItems() As String = sInfo.Split(",".ToCharArray) + For Each sId In sItems + ' Indice gruppo di preview nella lavorazione + Dim nMchPvId2 As Integer = EgtGetFirstNameInGroup(CInt(sId), NAME_PREVIEW) + ' Indice gruppo di preview nel pezzo + Dim nPartPvId2 As Integer = GDB_ID.NULL + EgtGetInfo(nMchPvId2, INFO_PV_ONPART_ID, nPartPvId2) + ' Svuoto il preview nel pezzo + EgtEmptyGroup(nPartPvId2) + Next + End If + ' Ricalcolo il preview + EgtPreviewMachining(False) + ' Lo sposto dalla lavorazione al pezzo + Dim nId As Integer = EgtGetFirstInGroup(nMchPvId) + While nId <> GDB_ID.NULL + EgtRelocateGlob(nId, nPartPvId) + nId = EgtGetFirstInGroup(nMchPvId) + End While + End If + Return True + End Function + + Public Function IsValidMachining(nOperId As Integer) As Boolean + ' Deve essere una lavorazione + If Not EgtSetCurrMachining(nOperId) Then Return False + ' Deve contenere qualcosa + If Not EgtIsMachiningNotEmpty() Then Return False + ' Deve essere abilitata oppure disabilitata direttamente dall'utente + If Not EgtGetOperationMode(nOperId) And Not EgtExistsInfo(nOperId, INFO_MCH_USER_OFF) Then Return False + ' E' valida + Return True + End Function + Private Function SetLuaStandardCamParams() As Boolean Dim sSawMch As String = String.Empty GetPrivateProfileString(S_MACH, K_CURRSAWING, "", sSawMch, m_MainWindow.GetIniFile()) diff --git a/ConstGen.vb b/ConstGen.vb index 763fa9a..fc95ec3 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -81,8 +81,38 @@ Module ConstGen Public Const NAME_ONPATH As String = "OnPath" ' Nome layer preview Public Const NAME_PREVIEW As String = "PV" + ' Info in preview lavorazione con identificativo layer preview spostato nel pezzo + Public Const INFO_PV_ONPART_ID As String = "PvId" + ' Info in lavorazione con identificativo lavorazioni inglobate + Public Const INFO_MCH_OTHMID As String = "OthMIds" + ' Info lavorazione disabilitata dall'utente + Public Const INFO_MCH_USER_OFF As String = "UserOff" + ' Nome contorno taglio + Public Const NAME_PV_CUT As String = "CUT" + ' Nome contorno pre-taglio + Public Const NAME_PV_PRECUT As String = "PRC" + ' Nome contorno post-taglio + Public Const NAME_PV_POSTCUT As String = "POC" + ' Info in lavorazione taglio per attacco originale + Public Const INFO_MCH_ORILEADIN As String = "OriLI" + ' Info in lavorazione taglio per uscita originale + Public Const INFO_MCH_ORILEADOUT As String = "OriLO" ' Costante per flag di BBox - Dim BBFLAG As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM + Public Const BBFLAG As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM + + ' Colori per lavorazioni + Public Function COL_MCH_CUT() As Color3d + Return New Color3d(0, 255, 0) + End Function + Public Function COL_MCH_DISABLED() As Color3d + Return New Color3d(128, 128, 128) + End Function + Public Function COL_MCH_FREE() As Color3d + Return New Color3d(0, 0, 255) + End Function + Public Function COL_MCH_INTERF() As Color3d + Return New Color3d(255, 0, 0) + End Function End Module diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 4505866..55e81d9 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -679,7 +679,7 @@ Class MainWindow Return True End If ' Mi assicuro di terminare correttamente lo split - m_CadCutPageUC.m_SplitPage.ResetSplit() + m_CadCutPageUC.m_SplitPage.ExitSplit() Return True End Function diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 0d96049..8f2f12d 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -55,5 +55,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/NestPageUC.xaml b/NestPageUC.xaml index decbb83..1286ee5 100644 --- a/NestPageUC.xaml +++ b/NestPageUC.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" - d:DesignHeight="853.3" d:DesignWidth="256" Initialized="NestPage_Initialized" Loaded="NestPage_Loaded" Unloaded="NestPage_Unloaded"> + d:DesignHeight="853.3" d:DesignWidth="1280" Initialized="NestPage_Initialized" Loaded="NestPage_Loaded" Unloaded="NestPage_Unloaded"> @@ -13,95 +13,123 @@ - + - - - + + - - - - - - - + - -