diff --git a/CamAuto.vb b/CamAuto.vb index e22e962..fb97bd3 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -91,6 +91,41 @@ Friend Module CamAuto Return bOk End Function + Friend Function UpdateVacuumsForDrip() As Boolean + Dim bOk As Boolean = True + ' Salvo fase attualmente corrente + Dim nOriPhase As Integer = EgtGetCurrPhase() + ' Carico le ventose + LoadVacuumCups() + ' Ciclo su tutti i pezzi presenti nei grezzi dell'ultima fase di lavorazione + EgtSetCurrPhase(EgtGetPhaseCount()) + Dim nRawId As Integer = EgtGetFirstRawPart() + While nRawId <> GDB_ID.NULL + Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId) + While nPartId <> GDB_ID.NULL + ' reset eventuali vecchie informazioni + RemoveOneMoveInfo(nPartId) + ' se ci sono tagli da sotto nel pezzo si processa + If EgtGetGroupObjs(EgtGetFirstNameInGroup(nPartId, NAME_DRIPCUT)) > 0 Then + Dim rmData As New RawMoveData + If PutVacuumCupsOnPart(nPartId, rmData) Then + SaveOneMoveInfo(nPartId, rmData) + Else + bOk = False + EgtOutLog("Error on UpdateVacuumsForDrip in Part " & nPartId.ToString()) + End If + End If + nPartId = EgtGetNextPartInRawPart(nPartId) + End While + nRawId = EgtGetNextRawPart(nRawId) + End While + ' Scarico le ventose + RemoveVacuumCups() + ' Ripristino fase corrente originale + EgtSetCurrPhase(nOriPhase) + Return bOk + End Function + Friend Function DeactivateAllMachinings() As Boolean Return EgtSetAllOperationsMode(False) End Function @@ -151,7 +186,8 @@ Friend Module CamAuto sTool = sTool.Remove(sTool.Length() - 2) End If End If - If String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrSaw) <> 0 Then + If String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrSaw) <> 0 And + String.Compare(sTool, m_MainWindow.m_CurrentMachine.sCurrDripSaw) <> 0 Then bOk = False If sMissingTools.IndexOf(sTool) = -1 Then sMissingTools = sMissingTools & sTool & ", " @@ -237,7 +273,7 @@ Friend Module CamAuto End If ' layer di origine Dim sLay As String = String.Empty - EgtGetInfo(nOperId, "Lay", sLay) + EgtGetInfo(nOperId, INFO_MCH_LAYER, sLay) ' verifica interferenza nFlag = FMI_TYPE.NONE If sLay = NAME_OUTLOOP Then @@ -448,6 +484,7 @@ Friend Module CamAuto Dim sSawMch As String = m_MainWindow.m_CurrentMachine.sCurrSawing Dim sMillMch As String = m_MainWindow.m_CurrentMachine.sCurrMilling Dim sDrillMch As String = m_MainWindow.m_CurrentMachine.sCurrDrilling + Dim sDripSawMch As String = m_MainWindow.m_CurrentMachine.sCurrDripSawing Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, m_MainWindow.GetMachIniFile()) Dim dHolesOffset As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OFFSET, 0, m_MainWindow.GetMachIniFile()) Dim dHolesOverlap As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OVERLAP, 0, m_MainWindow.GetMachIniFile()) @@ -458,6 +495,7 @@ Friend Module CamAuto EgtLuaSetGlobStringVar("CAM.SAWMCH", sSawMch) EgtLuaSetGlobStringVar("CAM.MILLMCH", sMillMch) EgtLuaSetGlobStringVar("CAM.DRILLMCH", sDrillMch) + EgtLuaSetGlobStringVar("CAM.DRIPSAWMCH", sDripSawMch) EgtLuaSetGlobNumVar("CAM.REDUCEDDEPTH", dReducedDepth) EgtLuaSetGlobNumVar("CAM.HOLESOFFSET", dHolesOffset) EgtLuaSetGlobNumVar("CAM.HOLESOVERLAP", dHolesOverlap) diff --git a/ConstGen.vb b/ConstGen.vb index 78cda89..cefe456 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -117,6 +117,8 @@ Module ConstGen ' Nome layer delle regioni Public Const NAME_REGION As String = "Region" + ' Nome solido derivato da regione del pezzo per taglio da sotto + Public Const NAME_DRIP_SOLID As String = "DripSolid" ' Delta Z regioni di pezzi per evitare problemi di visualizzazione con grezzi Public Const DELTAZ_REG As Double = 0.1 ' Nome layer contorni esterni @@ -125,10 +127,14 @@ Module ConstGen Public Const NAME_INLOOP As String = "InLoop" ' Nome layer percorsi sul pezzo Public Const NAME_ONPATH As String = "OnPath" + ' Nome layer percorsi di taglio da sotto + Public Const NAME_DRIPCUT As String = "Drip" ' Nome layer preview Public Const NAME_PREVIEW As String = "PV" ' Info in entità da tagliare per affondamento Public Const INFO_DEPTH As String = "Depth" + ' Info in entità da tagliare per taglio ristretto + Public Const INFO_STRICT As String = "Strict" ' Info in entità da tagliare per angolo di lato Public Const INFO_SIDE_ANGLE As String = "SideAng" ' Info in entità da tagliare per gocciolatoio @@ -141,6 +147,8 @@ Module ConstGen 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 in lavorazione con nome layer di provenieneza della geometria lavorata + Public Const INFO_MCH_LAYER As String = "Lay" ' Info lavorazione disabilitata dall'utente Public Const INFO_MCH_USER_OFF As String = "UserOff" ' Info lavorazione disabilitata perchè lavorata in doppio con altra @@ -173,8 +181,6 @@ Module ConstGen Public Const INFO_CSV_PART As String = "CsvPart" ' Nome layer per valori angoli di inclinazione dei lati Public Const SIDE_ANGLE_LAYER As String = "SideAngle" - ' Nome layer per gocciolatoi lungo i lati - Public Const DRIP_LAYER As String = "Drip" ' Nome di pezzo che è una cornice Public Const NAME_FRAME As String = "Frame" @@ -209,6 +215,12 @@ Module ConstGen Public Function COL_MCH_FREE() As Color3d Return New Color3d(0, 0, 255) End Function + Public Function COL_MCH_DRIPCUT() As Color3d + Return New Color3d(255, 165, 0) + End Function + Public Function COL_MCH_DRIPFREE() As Color3d + Return New Color3d(192, 128, 0) + End Function Public Function COL_MCH_INTERF() As Color3d Return New Color3d(255, 0, 0) End Function diff --git a/ConstIni.vb b/ConstIni.vb index 3d3b62b..1955283 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -88,6 +88,12 @@ Module ConstIni Public Const S_FLATPARTS As String = "FlatParts" Public Const K_FLPCURRDIR As String = "CurrDir" + Public Const S_SIDES As String = "Sides" + Public Const K_SIDEANGLE As String = "SideAngle" + Public Const K_DRIPOFFSET As String = "DripOffset" + Public Const K_DRIPDEPTH As String = "DripDepth" + Public Const K_DRIPSHORT As String = "DripShort" + Public Const S_NEST As String = "Nest" Public Const K_DIRECT As String = "Direct" Public Const K_STEP As String = "Step" diff --git a/ConstMachIni.vb b/ConstMachIni.vb index f45e880..8115f5b 100644 --- a/ConstMachIni.vb +++ b/ConstMachIni.vb @@ -125,12 +125,14 @@ Public Const K_CURRSAW As String = "CurrSaw" Public Const K_CURRDRILL As String = "CurrDrill" Public Const K_CURRMILL As String = "CurrMill" + Public Const K_CURRDRIPSAW As String = "CurrDripSaw" Public Const K_CURRSAWING As String = "CurrSawing" Public Const K_CURRDRILLING As String = "CurrDrilling" Public Const K_CURRMILLING As String = "CurrMilling" Public Const K_CURRSAWROUGHING As String = "CurrSawRoughing" Public Const K_CURRSAWFINISHING As String = "CurrSawFinishing" Public Const K_CURRSAWSIDEFINISHING As String = "CurrSawSideFinishing" + Public Const K_CURRDRIPSAWING As String = "CurrDripSawing" Public Const S_MATERIALS As String = "Materials" Public Const K_CURRMATERIAL As String = "CurrMaterial" diff --git a/CurrentMachine.vb b/CurrentMachine.vb index 8749c95..aea0656 100644 --- a/CurrentMachine.vb +++ b/CurrentMachine.vb @@ -59,9 +59,10 @@ Public Class CurrentMachine Private m_bSawFinishing As Boolean = False ' Variabili che contengono il nome degli utensili disponibili per tipo - Private m_sCurrSaw(0) As String - Private m_sCurrDrill(0) As String - Private m_sCurrMill(0) As String + Private m_sCurrSaw As String = String.Empty + Private m_sCurrDrill As String = String.Empty + Private m_sCurrMill As String = String.Empty + Private m_sCurrDripSaw As String = String.Empty ' Variabili che contengono le lavorazioni correntemente attive (utilizzate per definire lavorazioni nel programma) Private m_sCurrSawing As String = String.Empty @@ -70,6 +71,7 @@ Public Class CurrentMachine Private m_sCurrSawRoughing As String = String.Empty Private m_sCurrSawFinishing As String = String.Empty Private m_sCurrSawSideFinishing As String = String.Empty + Private m_sCurrDripSawing As String = String.Empty ' Spessore sottopezzo Private m_dAdditionalTable As Double = 0 @@ -286,11 +288,11 @@ Public Class CurrentMachine Friend Property sCurrSaw As String Get - Return m_sCurrSaw(0) + Return m_sCurrSaw End Get Set(value As String) If WritePrivateProfileString(S_MACH_MACH, K_CURRSAW, value, sMachIniFile) Then - m_sCurrSaw(0) = value + m_sCurrSaw = value m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text = value End If End Set @@ -298,22 +300,33 @@ Public Class CurrentMachine Friend Property sCurrDrill As String Get - Return m_sCurrDrill(0) + Return m_sCurrDrill End Get Set(value As String) If WritePrivateProfileString(S_MACH_MACH, K_CURRDRILL, value, sMachIniFile) Then - m_sCurrDrill(0) = value + m_sCurrDrill = value End If End Set End Property Friend Property sCurrMill As String Get - Return m_sCurrMill(0) + Return m_sCurrMill End Get Set(value As String) If WritePrivateProfileString(S_MACH_MACH, K_CURRMILL, value, sMachIniFile) Then - m_sCurrMill(0) = value + m_sCurrMill = value + End If + End Set + End Property + + Friend Property sCurrDripSaw As String + Get + Return m_sCurrDripSaw + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH_MACH, K_CURRDRIPSAW, value, sMachIniFile) Then + m_sCurrDripSaw = value End If End Set End Property @@ -384,6 +397,17 @@ Public Class CurrentMachine End Set End Property + Friend Property sCurrDripSawing As String + Get + Return m_sCurrDripSawing + End Get + Set(value As String) + If WritePrivateProfileString(S_MACH_MACH, K_CURRDRIPSAWING, value, sMachIniFile) Then + m_sCurrDripSawing = value + End If + End Set + End Property + Friend Property dAdditionalTable As Double Get Return m_dAdditionalTable @@ -627,11 +651,13 @@ Public Class CurrentMachine ' Leggo utensili correnti ' lama - GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, Nothing, m_sCurrSaw(0), sMachIniFile) + GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, Nothing, m_sCurrSaw, sMachIniFile) ' foretto - GetPrivateProfileString(S_MACH_MACH, K_CURRDRILL, Nothing, m_sCurrDrill(0), sMachIniFile) + GetPrivateProfileString(S_MACH_MACH, K_CURRDRILL, Nothing, m_sCurrDrill, sMachIniFile) ' fresa - GetPrivateProfileString(S_MACH_MACH, K_CURRMILL, Nothing, m_sCurrMill(0), sMachIniFile) + GetPrivateProfileString(S_MACH_MACH, K_CURRMILL, Nothing, m_sCurrMill, sMachIniFile) + ' lama da sotto + GetPrivateProfileString(S_MACH_MACH, K_CURRDRIPSAW, Nothing, m_sCurrDripSaw, sMachIniFile) ' Leggo lavorazioni correnti ' lama @@ -646,6 +672,8 @@ Public Class CurrentMachine GetPrivateProfileString(S_MACH_MACH, K_CURRSAWFINISHING, Nothing, m_sCurrSawFinishing, sMachIniFile) ' spatolatura con lama GetPrivateProfileString(S_MACH_MACH, K_CURRSAWSIDEFINISHING, Nothing, m_sCurrSawSideFinishing, sMachIniFile) + ' lama da sotto + GetPrivateProfileString(S_MACH_MACH, K_CURRDRIPSAWING, Nothing, m_sCurrDripSawing, sMachIniFile) ' Leggo numero di portautensili m_ToolChangerNbr = GetPrivateProfileInt(S_TOOLCHANGER, K_NUMBER, 0, sMachIniFile) diff --git a/GeomCalc.vb b/GeomCalc.vb new file mode 100644 index 0000000..5e59f7c --- /dev/null +++ b/GeomCalc.vb @@ -0,0 +1,56 @@ +Imports EgtUILib + +Module GeomCalc + + Public Function GetRegionOutLoop(nRegId As Integer, nDestGrpId As Integer) As Integer + Dim nCount As Integer = 0 + Dim nOutId As Integer = EgtExtractSurfFrChunkLoops(nRegId, 0, nDestGrpId, nCount) + If nOutId <> GDB_ID.NULL Then + For nId As Integer = nOutId + 1 To nOutId + nCount - 1 + EgtErase(nId) + Next + End If + Return nOutId + End Function + + Public Function CreateSolidFromRegion(nRegId As Integer, vtExtr As Vector3d, nDestGrpId As Integer) As Integer + Dim nOutId As Integer = GetRegionOutLoop(nRegId, nDestGrpId) + If nOutId = GDB_ID.NULL Then Return GDB_ID.NULL + Dim nSolId As Integer = EgtCreateSurfTmByRegionExtrusion(nDestGrpId, 1, {nOutId}, vtExtr, + 100 * EPS_SMALL, GDB_RT.GLOB) + EgtErase(nOutId) + Return nSolId + End Function + + Friend Function UpdateSolidForDrip(nPartId As Integer) As Boolean + ' se non ci sono tagli da sotto nel pezzo si esce + If EgtGetGroupObjs(EgtGetFirstNameInGroup(nPartId, NAME_DRIPCUT)) = 0 Then Return True + ' Recupero lo spessore del grezzo + Dim dThick As Double = GetRawHeight() + ' Recupero layer Regione + Dim nGrpRegId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION) + ' Elimino eventuale vecchio solido + EgtErase(EgtGetFirstNameInGroup(nGrpRegId, NAME_DRIP_SOLID)) + ' Recupero la regione del pezzo + Dim nRegId As Integer = EgtGetFirstInGroup(nGrpRegId) + While nRegId <> GDB_ID.NULL + If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then Exit While + nRegId = EgtGetNext(nRegId) + End While + ' Ne derivo il solido di estrusione + Dim nSolId As Integer = CreateSolidFromRegion(nRegId, -dThick * Vector3d.Z_AX(), nGrpRegId) + EgtSetName(nSolId, NAME_DRIP_SOLID) + EgtSetColor(nSolId, New Color3d(0, 255, 255, 25)) + EgtSetStatus(nSolId, GDB_ST.OFF) + Return nSolId <> GDB_ID.NULL + End Function + + Friend Function EraseSolidForDrip(nPartId As Integer) As Boolean + ' Recupero layer Regione + Dim nGrpRegId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION) + ' Elimino eventuale vecchio solido + EgtErase(EgtGetFirstNameInGroup(nGrpRegId, NAME_DRIP_SOLID)) + Return True + End Function + +End Module diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 8517d2e..00be0bf 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -330,25 +330,27 @@ Class MainWindow m_MachineStatusUC.SetValue(Grid.ColumnProperty, 2) m_MachineStatusUC.SetValue(Grid.RowSpanProperty, 3) MainWindowGrid.RowDefinitions.RemoveAt(MainWindowGrid.RowDefinitions.Count - 1) - Application.Current.Resources("FontSize_LowerCaseCharacter") = New FontSizeConverter().ConvertFrom(CStr("17")) - Application.Current.Resources("ComboBox_Height") = New LengthConverter().ConvertFrom(CStr("35")) - Application.Current.Resources("FontSize_GroupBoxHeader") = New LengthConverter().ConvertFrom(CStr("19")) - Application.Current.Resources("CheckBox_Height") = New LengthConverter().ConvertFrom(CStr("35")) - Application.Current.Resources("TextBoxInGroupBox_Margin") = New Thickness(2, 0, 9, 0) - Application.Current.Resources("RightTextBoxInBorder_Margin") = New Thickness(1, 0, 12, 0) - Application.Current.Resources("LeftTextBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) - Application.Current.Resources("LeftTextBoxNoBorder_Margin") = New Thickness(6, 0, 9, 0) - Application.Current.Resources("RightComboBoxInBorder_Margin") = New Thickness(2, 0, 11, 0) - Application.Current.Resources("MachRightTextBoxInBorder_Margin") = New Thickness(2, 0, 11, 0) - Application.Current.Resources("MachLeftTextBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) - Application.Current.Resources("LeftComboBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) - Application.Current.Resources("MachToolLeftTextBoxNoBorder_Margin") = New Thickness(3, 0, 15, 0) - Application.Current.Resources("ArrowImage_Height") = New LengthConverter().ConvertFrom(CStr("52")) - Application.Current.Resources("ScaleImage_Height") = New LengthConverter().ConvertFrom(CStr("60")) - Application.Current.Resources("MachineStatusImage_Height") = New LengthConverter().ConvertFrom(CStr("65")) - Application.Current.Resources("SplitPageBtn_FontSize") = New LengthConverter().ConvertFrom(CStr("14")) End If End If + If m_bIsSiemensPc Then + Application.Current.Resources("FontSize_LowerCaseCharacter") = New FontSizeConverter().ConvertFrom(CStr("17")) + Application.Current.Resources("ComboBox_Height") = New LengthConverter().ConvertFrom(CStr("35")) + Application.Current.Resources("FontSize_GroupBoxHeader") = New LengthConverter().ConvertFrom(CStr("19")) + Application.Current.Resources("CheckBox_Height") = New LengthConverter().ConvertFrom(CStr("35")) + Application.Current.Resources("TextBoxInGroupBox_Margin") = New Thickness(2, 0, 9, 0) + Application.Current.Resources("RightTextBoxInBorder_Margin") = New Thickness(1, 0, 12, 0) + Application.Current.Resources("LeftTextBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) + Application.Current.Resources("LeftTextBoxNoBorder_Margin") = New Thickness(6, 0, 9, 0) + Application.Current.Resources("RightComboBoxInBorder_Margin") = New Thickness(2, 0, 11, 0) + Application.Current.Resources("MachRightTextBoxInBorder_Margin") = New Thickness(2, 0, 11, 0) + Application.Current.Resources("MachLeftTextBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) + Application.Current.Resources("LeftComboBoxInBorder_Margin") = New Thickness(4, 0, 9, 0) + Application.Current.Resources("MachToolLeftTextBoxNoBorder_Margin") = New Thickness(3, 0, 15, 0) + Application.Current.Resources("ArrowImage_Height") = New LengthConverter().ConvertFrom(CStr("52")) + Application.Current.Resources("ScaleImage_Height") = New LengthConverter().ConvertFrom(CStr("60")) + Application.Current.Resources("MachineStatusImage_Height") = New LengthConverter().ConvertFrom(CStr("65")) + Application.Current.Resources("SplitPageBtn_FontSize") = New LengthConverter().ConvertFrom(CStr("14")) + End If ' Posizionemento nella griglia delle Page UserControl m_WorkInProgressPageUC.SetValue(Grid.ColumnProperty, 0) m_WorkInProgressPageUC.SetValue(Grid.RowProperty, 1) @@ -768,6 +770,8 @@ Class MainWindow Me.WindowState = Windows.WindowState.Minimized Return End If + ' Verifico se stato simulazione consente di uscire + If m_SimulationPage.GetSimExecuting() Then Return ' Verifica se progetto corrente da salvare Dim bPrjToSave As Boolean = False EgtSetCurrentContext(m_CurrentProjectPageUC.CurrentProjectScene.GetCtx()) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9d68765..c18aca5 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -60,5 +60,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/NestPageUC.xaml.vb b/NestPageUC.xaml.vb index 6a03ca0..02edbb4 100644 --- a/NestPageUC.xaml.vb +++ b/NestPageUC.xaml.vb @@ -525,6 +525,8 @@ Public Class NestPageUC End If ' Gestione risultato nesting If bFit Then + ' Eventuale aggiunta solido per taglio da sotto + UpdateSolidForDrip(nId) ' Eventuale notifica al VeinMatching VeinMatching.OnInsertPartInRaw(nId) Return True @@ -577,6 +579,8 @@ Public Class NestPageUC EraseMachinings(nId) ' Elimino eventuali modifiche per lati esterni inclinati EgtCalcFlatPartDownRegion(nId, 0) + ' Eventuale cancellazione solido per taglio da sotto + EraseSolidForDrip(nId) ' Parcheggio EgtRemovePartFromRawPart(nId) EgtSetStatus(nId, GDB_ST.ON_) diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index 4b902b1..b2cb319 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -185,6 +185,7 @@ FrameCutPageUC.xaml + GridCut.xaml diff --git a/ProjectMgrUC.xaml.vb b/ProjectMgrUC.xaml.vb index 689c898..7a562b0 100644 --- a/ProjectMgrUC.xaml.vb +++ b/ProjectMgrUC.xaml.vb @@ -248,6 +248,8 @@ Public Class ProjectMgrUC EgtDisableModified() ' Aggiorno le lavorazioni bOk = UpdateAllMachiningsToolpaths() And bOk + ' Aggiorno posizionamento ventose sui pezzi per eventuali tagli da sotto con lama + bOk = UpdateVacuumsForDrip() And bOk ' Costringo ad aggiornare UI UpdateUI() ' Inserisco indice di progetto diff --git a/SideAngleUc.xaml b/SideAngleUc.xaml index d2d886a..71597cc 100644 --- a/SideAngleUc.xaml +++ b/SideAngleUc.xaml @@ -10,8 +10,8 @@ - - + + @@ -71,17 +71,20 @@ Margin="0,0,11,0"/> + Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}" + FontSize="{DynamicResource FontSize_LowerCaseCharacter}"/> + Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}" + FontSize="{DynamicResource FontSize_LowerCaseCharacter}"/> + Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}" + FontSize="{DynamicResource FontSize_LowerCaseCharacter}"/> diff --git a/SideAngleUc.xaml.vb b/SideAngleUc.xaml.vb index 3268d66..defb454 100644 --- a/SideAngleUc.xaml.vb +++ b/SideAngleUc.xaml.vb @@ -29,18 +29,18 @@ Public Class SideAngleUC Friend m_dDripShort As Double = 0 Private Sub SideAngleUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + ' Imposto riferimenti ad altre pagine + m_DrawPage = m_MainWindow.m_DrawPageUC + m_CallingPage = m_MainWindow.m_ActivePage + ' Imposto messaggi If m_Mode = ModeOpt.SIDEANGLE Then Parameter1TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 9) ' Angolo Else Parameter1TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset + Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento + Parameter3TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 12) ' Accorciamento End If - Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento - Parameter3TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 12) ' Accorciamento - ' Copio riferimento alla DrawPage - m_DrawPage = m_MainWindow.m_DrawPageUC - - m_CallingPage = m_MainWindow.m_ActivePage If m_CallingPage = MainWindow.Pages.Draw Then ' Imposto questa come pagina correntemente visualizzata nella drawpage @@ -102,9 +102,14 @@ Public Class SideAngleUC ' Aggiorno valori If m_Mode = ModeOpt.SIDEANGLE Then If String.IsNullOrWhiteSpace(Parameter1TxBx.Text) Then - Parameter1TxBx.Text = "45" + Dim sVal As String = String.Empty + GetPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal, m_MainWindow.GetIniFile()) + Parameter1TxBx.Text = sVal End If Else + m_dDripOffset = GetPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20, m_MainWindow.GetIniFile()) + m_dDripDepth = GetPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10, m_MainWindow.GetIniFile()) + m_dDripShort = GetPrivateProfileDouble(S_SIDES, K_DRIPSHORT, 0, m_MainWindow.GetIniFile()) Parameter1TxBx.Text = LenToString(m_dDripOffset, 3) Parameter2TxBx.Text = LenToString(m_dDripDepth, 3) Parameter3TxBx.Text = LenToString(m_dDripShort, 3) @@ -207,6 +212,15 @@ Public Class SideAngleUC Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_PrevSelPart EgtErase(EgtGetFirstNameInGroup(Part1, SIDE_ANGLE_LAYER)) End If + + If m_Mode = ModeOpt.SIDEANGLE Then + WritePrivateProfileString(S_SIDES, K_SIDEANGLE, Parameter1TxBx.Text, m_MainWindow.GetIniFile()) + Else + WritePrivateProfileString(S_SIDES, K_DRIPOFFSET, DoubleToString(m_dDripOffset, 3), m_MainWindow.GetIniFile()) + WritePrivateProfileString(S_SIDES, K_DRIPDEPTH, DoubleToString(m_dDripDepth, 3), m_MainWindow.GetIniFile()) + WritePrivateProfileString(S_SIDES, K_DRIPSHORT, DoubleToString(m_dDripShort, 3), m_MainWindow.GetIniFile()) + End If + EgtDraw() End Sub @@ -547,30 +561,38 @@ Public Class SideAngleUC ' Recupero Id layer di contorno esterno Dim nOutLoopId = EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP) ' Preparo layer con geometria gocciolatoi (svuotandolo o creandolo) - Dim DripLayer As Integer = EgtGetFirstNameInGroup(nPartId, DRIP_LAYER) + Dim DripLayer As Integer = EgtGetFirstNameInGroup(nPartId, NAME_DRIPCUT) If DripLayer <> GDB_ID.NULL Then EgtEmptyGroup(DripLayer) Else DripLayer = EgtCreateGroup(nPartId) - EgtSetName(DripLayer, DRIP_LAYER) + EgtSetName(DripLayer, NAME_DRIPCUT) End If ' Per ogni entità con gocciolatoio, ne inserisco una copia nel layer + Dim vSelId As New List(Of Integer) For Each Entity In m_DripEntityList If Entity.bHaveDrip Then Dim nSouId As Integer = EgtGetFirstNameInGroup(nOutLoopId, Entity.sEntityName) Dim nNewId As Integer = EgtCopyGlob(nSouId, DripLayer) EgtSetName(nNewId, Entity.sEntityName) + vSelId.Add(nNewId) End If Next ' Concateno le curve - EgtSelectGroupObjs(DripLayer) - EgtCreateCurveCompoByReorder(DripLayer, 1, {GDB_ID.SEL}, New Point3d(), True) - ' Eseguo offset dei risultati + EgtCreateCurveCompoByReorder(DripLayer, vSelId.Count(), vSelId.ToArray(), New Point3d(), True) + ' Eseguo offset dei risultati ed eventuali accorciamenti iniziali e finali Dim nCrvId As Integer = EgtGetFirstInGroup(DripLayer) While nCrvId <> GDB_ID.NULL EgtOffsetCurve(nCrvId, -m_dDripOffset, OFF_TYPE.EXTEND) EgtSetColor(nCrvId, New Color3d(255, 0, 255)) EgtSetInfo(nCrvId, INFO_DEPTH, m_dDripDepth) + If m_dDripShort > EPS_SMALL Then + Dim dLen As Double + EgtCurveLength(nCrvId, dLen) + EgtTrimCurveEndAtLen(nCrvId, dLen - m_dDripShort) + EgtTrimCurveStartAtLen(nCrvId, m_dDripShort) + EgtSetInfo(nCrvId, INFO_STRICT, "1") + End If nCrvId = EgtGetNext(nCrvId) End While End Sub diff --git a/SimulationPageUC.xaml.vb b/SimulationPageUC.xaml.vb index f2bd942..02402fd 100644 --- a/SimulationPageUC.xaml.vb +++ b/SimulationPageUC.xaml.vb @@ -5,6 +5,9 @@ Public Class SimulationPageUC Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) Private m_CurrProjPage As CurrentProjectPageUC + ' Funzioni di callback per output in interfaccia da LUA + Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) + ' Stato di visualizzazione della macchina Private m_nMachLook As Integer = MCH_LOOK.ALL ' Utensile corrente @@ -21,6 +24,11 @@ Public Class SimulationPageUC Private m_bPlay As Boolean = True ' Coefficiente per valore Slider Private m_SliderX As Double = 1 + ' Flag di esecuzione in corso + Private m_bSimExecuting As Boolean = False + Friend Function GetSimExecuting() As Boolean + Return m_bSimExecuting + End Function ' Numero di assi in simulazione Private m_SimulationAxesNum As Integer = 5 @@ -86,6 +94,8 @@ Public Class SimulationPageUC EgtDisableModified() ' Aggiorno le lavorazioni bOk = UpdateAllMachiningsToolpaths() And bOk + ' Aggiorno posizionamento ventose sui pezzi per eventuali tagli da sotto con lama + bOk = UpdateVacuumsForDrip() And bOk ' Se errore in setup, lo segnalo If Not bSetup Then m_CurrProjPage.SetErrorMessage(EgtMsg(90322) & " " & sMissingTools) 'Mancano gli utensili : ... @@ -117,6 +127,8 @@ Public Class SimulationPageUC m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1, m_MainWindow.GetIniFile()) Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10, m_MainWindow.GetIniFile()) SpeedSlider.Value = SliderVal + ' Registro funzione su aggiornamento interfaccia da sotto + EgtSetProcessEvents(m_ProcEventsCallback) ' Porto la testa in home EgtSimStart() EgtSimHome() @@ -200,6 +212,7 @@ Public Class SimulationPageUC End Sub Private Sub ExecSim() + m_bSimExecuting = True EgtSimStart() LoadCurrTools() EgtSimSetStep(SpeedSlider.Value * m_SliderX) @@ -248,6 +261,7 @@ Public Class SimulationPageUC ' Costringo ad aggiornare UI UpdateUI() End While + m_bSimExecuting = False End Sub Private Sub ShowCncData() @@ -353,6 +367,11 @@ Public Class SimulationPageUC Return False End If End If + ' Imposto eventuale lama per taglio da sotto + Dim sDripSaw As String = m_MainWindow.m_CurrentMachine.sCurrDripSaw + If Not String.IsNullOrEmpty(sDripSaw) Then + EgtLoadTool("H105", 1, sDripSaw) + End If Return True End Function @@ -395,6 +414,8 @@ Public Class SimulationPageUC EgtZoom(ZM.ALL) ' Abilito impostazione modificato EgtEnableModified() + ' Reset funzione callback su evento aggiornamento iinterfaccia da sotto + EgtSetProcessEvents(Nothing) ' Esco dalla pagina m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(Me) m_CurrProjPage.CurrProjGrid.Visibility = Windows.Visibility.Visible @@ -408,4 +429,12 @@ Public Class SimulationPageUC End Sub + Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer + ' Visualizzo assi + ShowCncData() + ' Costringo ad aggiornare UI + UpdateUI() + Return 0 + End Function + End Class diff --git a/SplitAuto.vb b/SplitAuto.vb index dc1a2d9..45e03a0 100644 --- a/SplitAuto.vb +++ b/SplitAuto.vb @@ -49,7 +49,7 @@ Public Module SplitAuto ' tipo Mach.m_nType = EgtGetOperationType(nOperId) ' layer di origine - EgtGetInfo(nOperId, "Lay", Mach.m_sLay) + EgtGetInfo(nOperId, INFO_MCH_LAYER, Mach.m_sLay) ' se taglio con lama If Mach.m_nType = MCH_OY.SAWING Then ' verifica interferenza @@ -127,15 +127,17 @@ Public Module SplitAuto Dim bEnabled As Boolean = MachSplit.m_bEnabled Dim nInterf As Integer = If(bReset, FMI_TYPE.NONE, MachSplit.m_nInterf) ' Colore della lavorazione principale - ColorSingleMachining(MachSplit.m_nId, bEnabled, nInterf) + ColorSingleMachining(MachSplit.m_nId, MachSplit.m_sLay, bEnabled, nInterf) ' Colore delle lavorazioni inglobate For Each nId As Integer In MachSplit.m_vOthId - ColorSingleMachining(nId, bEnabled, nInterf) + ColorSingleMachining(nId, MachSplit.m_sLay, bEnabled, nInterf) Next EgtEnableModified() End Sub - Private Sub ColorSingleMachining(nOperId As Integer, bEnabled As Boolean, nInterf As Integer) + Private Sub ColorSingleMachining(nOperId As Integer, sLay As String, bEnabled As Boolean, nInterf As Integer) + ' Verifico se è un taglio da sotto + Dim bDrip As Boolean = (sLay = NAME_DRIPCUT) ' Recupero il preview della lavorazione Dim nPvId As Integer = GDB_ID.NULL EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId) @@ -160,15 +162,22 @@ Public Module SplitAuto EgtSetColor(nPocId, If(bFreeEnd, COL_MCH_DISABLED, COL_MCH_DIS_INTERF)) EgtSetColor(nDwnPocId, If(bFreeEnd, COL_MCH_DISABLED, COL_MCH_DIS_INTERF)) Else - EgtSetColor(nCutId, COL_MCH_CUT) - EgtSetColor(nCut2Id, COL_MCH_CUT) - EgtSetColor(nDwnCutId, COL_MCH_CUT) - Dim bFreeStart As Boolean = (nInterf And FMI_TYPE.LI) <> FMI_TYPE.LI - EgtSetColor(nPrcId, If(bFreeStart, COL_MCH_FREE, COL_MCH_INTERF)) - EgtSetColor(nDwnPrcId, If(bFreeStart, COL_MCH_FREE, COL_MCH_INTERF)) - Dim bFreeEnd As Boolean = (nInterf And FMI_TYPE.LO) <> FMI_TYPE.LO - EgtSetColor(nPocId, If(bFreeEnd, COL_MCH_FREE, COL_MCH_INTERF)) - EgtSetColor(nDwnPocId, If(bFreeEnd, COL_MCH_FREE, COL_MCH_INTERF)) + Dim colCut As Color3d = If(bDrip, COL_MCH_DRIPCUT, COL_MCH_CUT) + EgtSetColor(nCutId, colCut) + EgtSetColor(nCut2Id, colCut) + EgtSetColor(nDwnCutId, colCut) + Dim colStart As Color3d = COL_MCH_INTERF() + If (nInterf And FMI_TYPE.LI) <> FMI_TYPE.LI Then + colStart = If(bDrip, COL_MCH_DRIPFREE, COL_MCH_FREE) + End If + EgtSetColor(nPrcId, colStart) + EgtSetColor(nDwnPrcId, colStart) + Dim colEnd As Color3d = COL_MCH_INTERF() + If (nInterf And FMI_TYPE.LO) <> FMI_TYPE.LO Then + colEnd = If(bDrip, COL_MCH_DRIPFREE, COL_MCH_FREE) + End If + EgtSetColor(nPocId, colEnd) + EgtSetColor(nDwnPocId, colEnd) End If nGrpId = EgtGetNextGroup(nGrpId) End While diff --git a/VacuumCups.vb b/VacuumCups.vb index 7554570..297722a 100644 --- a/VacuumCups.vb +++ b/VacuumCups.vb @@ -153,7 +153,9 @@ Module VacuumCups Dim nRKerfOffsId = EgtCopy(nRKerfId, nRKerfId, GDB_POS.AFTER) If EgtSurfFrOffset(nRKerfOffsId, vOffset(i), OFF_TYPE.FILLET) AndAlso EgtCentroid(nRKerfOffsId, GDB_ID.ROOT, ptKerfCen) Then - bOkFind = FindVacuumCupsOnRaw(nRawId, ptRawCen, b3Kerf, ptKerfCen, nRKerfOffsId, nRKerfId, rmData) + Dim nOutOffsId As Integer = GetRegionOutLoop(nRKerfOffsId, nRawId) + bOkFind = FindVacuumCupsOnRaw(nRawId, ptRawCen, b3Kerf, ptKerfCen, nOutOffsId, nRKerfId, rmData) + EgtErase(nOutOffsId) End If EgtErase(nRKerfOffsId) If bOkFind Then Return True @@ -161,6 +163,53 @@ Module VacuumCups Return False End Function + Friend Function PutVacuumCupsOnPart(nPartId As Integer, ByRef rmData As RawMoveData) As Boolean + ' Ripristino posizione originale ventose + ResetVacuumCups() + ' Verifico sia veramente un pezzo + If EgtGetRawPartFromPart(nPartId) = GDB_ID.NULL Then Return False + ' Recupero la regione del pezzo + Dim nGrpRegId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_REGION) + Dim nRegId As Integer = EgtGetFirstInGroup(nGrpRegId) + While nRegId <> GDB_ID.NULL + If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then Exit While + nRegId = EgtGetNext(nRegId) + End While + If nRegId = GDB_ID.NULL Then Return False + ' Box e baricentro del pezzo (sempre sopra) + Dim b3Part As New BBox3d + EgtGetBBoxGlob(nRegId, GDB_BB.STANDARD, b3Part) + Dim ptPartCen As Point3d + EgtCentroid(nRegId, GDB_ID.ROOT, ptPartCen) + ' Calcolo il contorno esterno del pezzo + Dim nOutId As Integer = GetRegionOutLoop(nRegId, nGrpRegId) + If nOutId = GDB_ID.NULL Then Return False + ' Eseguo ricerca + If FindVacuumCupsOnRaw(nPartId, ptPartCen, b3Part, ptPartCen, nOutId, nRegId, rmData) Then + EgtErase(nOutId) + Return True + Else + EgtErase(nOutId) + End If + ' In caso di fallimento, provo riducendo con offset la regione di kerf + ' (così si simula la proiezione del centro sul MAT - medial axis transform) + Dim bOkFind As Boolean = False + Dim vOffset() As Double = {-450, -350, -250, -150} + For i As Integer = 0 To vOffset.Length() - 1 + Dim nRegOffsId As Integer = EgtCopy(nRegId, nRegId, GDB_POS.AFTER) + Dim ptRegOffsCen As Point3d + If EgtSurfFrOffset(nRegOffsId, vOffset(i), OFF_TYPE.FILLET) AndAlso + EgtCentroid(nRegOffsId, GDB_ID.ROOT, ptRegOffsCen) Then + Dim nOutOffsId As Integer = GetRegionOutLoop(nRegOffsId, nGrpRegId) + bOkFind = FindVacuumCupsOnRaw(nPartId, ptRegOffsCen, b3Part, ptPartCen, nOutOffsId, nRegId, rmData) + EgtErase(nOutOffsId) + End If + EgtErase(nRegOffsId) + If bOkFind Then Return True + Next + Return False + End Function + Private Function FindVacuumCupsOnRaw(nRawId As Integer, ptRawCen As Point3d, b3Kerf As BBox3d, ptKerfCen As Point3d, nOutlineId As Integer, nRKerfId As Integer, ByRef rmData As RawMoveData) As Boolean @@ -333,6 +382,28 @@ Module VacuumCups Return bVacOk End Function + Friend Function SaveOneMoveInfo(nId As Integer, rmData As RawMoveData) As Boolean + ' Assegno le informazioni + EgtSetInfo(nId, "Id", rmData.m_nId) + EgtSetInfo(nId, "Mv", rmData.m_vtMove) + EgtSetInfo(nId, "Dt", rmData.m_vtDelta) + EgtSetInfo(nId, "Ad", rmData.m_dAngRotDeg) + EgtSetInfo(nId, "Vc", rmData.m_sCups) + EgtSetInfo(nId, "Vt", GetVacuumType()) + Return True + End Function + + Friend Function RemoveOneMoveInfo(nId As Integer) As Boolean + ' Assegno le informazioni + EgtRemoveInfo(nId, "Id") + EgtRemoveInfo(nId, "Mv") + EgtRemoveInfo(nId, "Dt") + EgtRemoveInfo(nId, "Ad") + EgtRemoveInfo(nId, "Vc") + EgtRemoveInfo(nId, "Vt") + Return True + End Function + Friend Function SaveOneMoveInfoInDisposition(nDispId As Integer, rmData As RawMoveData) As Boolean ' Se movimento trascurabile, inutile salvare If rmData.m_vtMove.IsSmall() Then Return True @@ -341,12 +412,7 @@ Module VacuumCups If nRpmId = GDB_ID.NULL Then Return False EgtSetName(nRpmId, "Rpm" & rmData.m_nId.ToString()) ' Assegno le informazioni - EgtSetInfo(nRpmId, "Id", rmData.m_nId) - EgtSetInfo(nRpmId, "Mv", rmData.m_vtMove) - EgtSetInfo(nRpmId, "Dt", rmData.m_vtDelta) - EgtSetInfo(nRpmId, "Ad", rmData.m_dAngRotDeg) - EgtSetInfo(nRpmId, "Vc", rmData.m_sCups) - EgtSetInfo(nRpmId, "Vt", GetVacuumType()) + SaveOneMoveInfo(nRpmId, rmData) Return True End Function