From 0e540997f2ea2f590e0a0aaa1ca272ddee7a0ef3 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 2 Feb 2018 15:30:40 +0000 Subject: [PATCH] OmagCUT 1.9a4 : - corretta gestione nomi utensili in lavorazione dopo cambio del nome stesso in utensile - migliorata gestione dialogo import file - migliorata visualizzazione angoli dei profili dei lati sui pezzi. --- AlarmsPageUC.xaml.vb | 12 +++- CamAuto.vb | 4 +- ConstGen.vb | 3 + FrameCutPageUC.xaml.vb | 16 ++++-- ImportPageUC.xaml.vb | 22 +------- MachiningDbPageUC.xaml.vb | 1 - My Project/AssemblyInfo.vb | 4 +- SideAngleUc.xaml.vb | 113 ++++++++++++++++++++++--------------- 8 files changed, 96 insertions(+), 79 deletions(-) diff --git a/AlarmsPageUC.xaml.vb b/AlarmsPageUC.xaml.vb index 0e1a056..31c22bb 100644 --- a/AlarmsPageUC.xaml.vb +++ b/AlarmsPageUC.xaml.vb @@ -291,9 +291,11 @@ Public Class AlarmsPageUC ' Assegno m_CurrentMachine.sCurrSaw = CurrSawCmBx.SelectedItem.ToString() ' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima + Dim sMchTuuid As String = String.Empty Dim sMchTool As String = String.Empty If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawing) Or - Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or + Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or + Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or String.Compare(sMchTool, m_CurrentMachine.sCurrSaw, True) <> 0 Then m_CurrentMachine.sCurrSawing = String.Empty End If @@ -316,9 +318,11 @@ Public Class AlarmsPageUC m_CurrentMachine.sCurrMilling = String.Empty End If ' Se nuovo foretto incompatibile con foratura corrente, resetto quest'ultima + Dim sMchTuuid As String = String.Empty Dim sMchTool As String = String.Empty If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrDrilling) Or - Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or + Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or + Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or String.Compare(sMchTool, m_CurrentMachine.sCurrDrill, True) <> 0 Then m_CurrentMachine.sCurrDrilling = String.Empty End If @@ -342,9 +346,11 @@ Public Class AlarmsPageUC m_CurrentMachine.sCurrDrilling = String.Empty End If ' Se nuova fresa incompatibile con fresatura corrente, resetto quest'ultima + Dim sMchTuuid As String = String.Empty Dim sMchTool As String = String.Empty If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrMilling) Or - Not EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMchTool) Or + Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or + Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or String.Compare(sMchTool, m_CurrentMachine.sCurrMill, True) <> 0 Then m_CurrentMachine.sCurrMilling = String.Empty End If diff --git a/CamAuto.vb b/CamAuto.vb index 481cd55..c3fa6d4 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -220,8 +220,10 @@ Friend Module CamAuto If IsValidMachining(nId) Then Dim nType As Integer = MCH_OY.NONE EgtGetMachiningParam(MCH_MP.TYPE, nType) + Dim sTuuid As String = String.Empty Dim sTool As String = String.Empty - EgtGetMachiningParam(MCH_MP.TOOL, sTool) + EgtGetMachiningParam(MCH_MP.TUUID, sTuuid) + EgtTdbGetToolFromUUID(sTuuid, sTool) If nType = MCH_OY.SAWING Or nType = MCH_OY.SAWROUGHING Or nType = MCH_OY.SAWFINISHING Then If bIsMultiCut Then ' L'utensile sulla seconda testa ha lo stesso nome di quello sulla prima con suffisso "-2" diff --git a/ConstGen.vb b/ConstGen.vb index 78371dc..a3894eb 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -152,6 +152,9 @@ Module ConstGen Public Const INFO_STRICT As String = "Strict" ' Info in entità da tagliare per angolo di lato Public Const INFO_SIDE_ANGLE As String = "SideAng" + Public Const INFO_OFFSET As String = "Offset" + Public Const INFO_SIDE_ANGLE2 As String = "SideAng2" + Public Const INFO_OFFSET2 As String = "Offset2" ' Info in entità da tagliare per gocciolatoio Public Const INFO_HAVE_DRIP As String = "HaveDrip" ' Info in entità da tagliare per direzione che varia a seconda del tipo (una via o zigzag) diff --git a/FrameCutPageUC.xaml.vb b/FrameCutPageUC.xaml.vb index e14f4ea..d96735d 100644 --- a/FrameCutPageUC.xaml.vb +++ b/FrameCutPageUC.xaml.vb @@ -155,9 +155,11 @@ Public Class FrameCutPageUC Dim bFound As Boolean = EgtMdbGetFirstMachining(MachiningType, MachiningName) While bFound EgtMdbSetCurrMachining(MachiningName) - Dim Tool As String = String.Empty - EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, Tool) - If Tool = CurrTool And VerifyMatThickCompatibility() Then + Dim sTuuid As String = String.Empty + Dim sTool As String = String.Empty + EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid) + EgtTdbGetToolFromUUID(sTuuid, sTool) + If sTool = CurrTool And VerifyMatThickCompatibility() Then MachiningList.Add(MachiningName) End If bFound = EgtMdbGetNextMachining(MachiningType, MachiningName) @@ -176,9 +178,11 @@ Public Class FrameCutPageUC EgtMdbSetCurrMachining(MachiningName) Dim SubType As Integer EgtMdbGetCurrMachiningParam(MCH_MP.SUBTYPE, SubType) - Dim Tool As String = String.Empty - EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, Tool) - If Tool = CurrTool And SubType = MachiningSubType And VerifyMatThickCompatibility() Then + Dim sTuuid As String = String.Empty + Dim sTool As String = String.Empty + EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid) + EgtTdbGetToolFromUUID(sTuuid, sTool) + If sTool = CurrTool And SubType = MachiningSubType And VerifyMatThickCompatibility() Then MachiningList.Add(MachiningName) End If bFound = EgtMdbGetNextMachining(MachiningType, MachiningName) diff --git a/ImportPageUC.xaml.vb b/ImportPageUC.xaml.vb index 0e4bfac..4182b5a 100644 --- a/ImportPageUC.xaml.vb +++ b/ImportPageUC.xaml.vb @@ -245,13 +245,10 @@ Public Class ImportPageUC Return True End Function - Private Sub FileListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles FileListBox.PreviewMouseUp + Private Sub FileListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles FileListBox.SelectionChanged ' Recupero item selezionato - If FileListBox.SelectedItems.Count() = 0 Then - Return - End If + If FileListBox.SelectedItems.Count() = 0 Then Return Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0) - ' A seconda del tipo Select Case vItems.PictureID Case 0 ' Vai nel direttorio padre @@ -270,21 +267,6 @@ Public Class ImportPageUC m_sCurrFile = vItems.Name LoadCurrFile() End Select - - End Sub - - Private Sub FileListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles FileListBox.SelectionChanged - ' Recupero item selezionato - If FileListBox.SelectedItems.Count() = 0 Then - Return - End If - Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0) - - ' Gestisco solo aggiornamento visualizzazione file - If vItems.PictureID = 3 Then - m_sCurrFile = vItems.Name - LoadCurrFile() - End If End Sub Private Function ClearView() As Boolean diff --git a/MachiningDbPageUC.xaml.vb b/MachiningDbPageUC.xaml.vb index 724a579..54303e6 100644 --- a/MachiningDbPageUC.xaml.vb +++ b/MachiningDbPageUC.xaml.vb @@ -391,7 +391,6 @@ Public Class MachiningDbPageUC Dim sTuuid As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sTuuid) EgtTdbGetToolFromUUID(sTuuid, ToolString) - 'EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, ToolString) Dim bToolExist As Boolean = False For Each CurrTool In ToolCmBx.ItemsSource If CurrTool.ToString() = ToolString Then diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 378f969..7e572d7 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -62,5 +62,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/SideAngleUc.xaml.vb b/SideAngleUc.xaml.vb index 8fb4b0b..872fa95 100644 --- a/SideAngleUc.xaml.vb +++ b/SideAngleUc.xaml.vb @@ -584,69 +584,86 @@ Public Class SideAngleUC End If End Sub - ' Funzione che dato un segmento e una distanza, scrive il testo centrato alla sua destra - Friend Shared Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, dBBoxRad As Double, bTextExt As Boolean) As Integer + ' Funzione che dato un segmento e una distanza, scrive il testo centrato alla sua sinistra (destra se bTextExt) + Friend Shared Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, + dBBoxRad As Double, bTextExt As Boolean, Optional bRot As Boolean = False) As Integer ' Calcolo altezza testo - Dim dH As Double = 0.075 * dBBoxRad + Dim dH As Double = 0.05 * dBBoxRad ' Creo testo - Dim nText As Integer = EgtCreateTextAdv(TextLayer, New Point3d(0, 0, 0), 0, sText, "", 500, False, dH, 1, 0, INS_POS.MC) - ' Calcolo punto in cui posizionare il testo - ' calcolo BBox del testo + Dim nText As Integer = EgtCreateTextAdv(TextLayer, Point3d.ORIG(), 0, sText, "", 500, False, dH, 1, 0, INS_POS.MC) + ' Calcolo posizionamento + ' BBox del testo e suo centro Dim ptMinBBox As Point3d Dim ptMaxBBox As Point3d EgtGetBBox(nText, GDB_BB.STANDARD, ptMinBBox, ptMaxBBox) - ' calcolo centro del BBox Dim ptMidBBox As Point3d ptMidBBox = Point3d.Media(ptMinBBox, ptMaxBBox) - ' calcolo vettore della CurrLine + ' estremi della CurrLine Dim ptLineStart As Point3d EgtStartPoint(CurrLine, nText, ptLineStart) Dim ptLineEnd As Point3d EgtEndPoint(CurrLine, nText, ptLineEnd) + ' versore della CurrLine Dim vtCurrLine As Vector3d = ptLineEnd - ptLineStart - ' lo normalizzo per ottenerne il versore vtCurrLine.Normalize() - ' calcolo vettore dal centro del BBox all'estremo più vicino se testo esterno alla figura - Dim vtptExtptMC As Vector3d + ' versore perpendicolare alla CurrLine che punta verso il testo + Dim vtOrtoLine As New Vector3d(vtCurrLine) If bTextExt Then - If vtCurrLine.x > 0 Then - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) - Else - vtptExtptMC = ptMidBBox - ptMaxBBox - End If - Else - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - ptMinBBox - Else - vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) - End If - End If + vtOrtoLine.Rotate(Vector3d.Z_AX(), -90) Else - If vtCurrLine.x > 0 Then - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) - Else - vtptExtptMC = ptMidBBox - ptMinBBox - End If - Else - If vtCurrLine.y > 0 Then - vtptExtptMC = ptMidBBox - ptMaxBBox - Else - vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) - End If - End If - + vtOrtoLine.Rotate(Vector3d.Z_AX(), 90) End If - ' ruoto il vettore della CurrLine per ottenerne il perpendicolare - If bTextExt Then - vtCurrLine.Rotate(Vector3d.Z_AX, -90) + ' eventuale rotazione del testo + Dim dRotAng As Double = 0 + If bRot Then + dRotAng = Math.Atan2(vtCurrLine.y, vtCurrLine.x) * 180 / Math.PI + Dim dSpecRotAng = dRotAng + If dSpecRotAng > 91 Then + dSpecRotAng -= 180 + ElseIf dSpecRotAng < -89 Then + dSpecRotAng += 180 + End If + EgtRotate(nText, Point3d.ORIG(), Vector3d.Z_AX(), dSpecRotAng) + End If + ' vettore dal centro del BBox all'estremo più vicino + Dim vtptExtptMC As Vector3d + If bRot Then + vtptExtptMC = New Vector3d(0, ptMidBBox.y - ptMinBBox.y, 0) + vtptExtptMC.Rotate(Vector3d.Z_AX(), dRotAng) Else - vtCurrLine.Rotate(Vector3d.Z_AX, 90) + If bTextExt Then + If vtCurrLine.x > 0 Then + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMaxBBox + End If + Else + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - ptMinBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + End If + End If + Else + If vtCurrLine.x > 0 Then + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMinBBox + End If + Else + If vtCurrLine.y > 0 Then + vtptExtptMC = ptMidBBox - ptMaxBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + End If + End If + End If End If ' Calcolo il centro del testo - Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtCurrLine * (dDistance + (vtCurrLine * vtptExtptMC)) - EgtMove(nText, (ptTextMC - Point3d.ORIG)) + Dim ptTextMC As Point3d = Point3d.Media(ptLineStart, ptLineEnd) + vtOrtoLine * (dDistance + (vtOrtoLine * vtptExtptMC)) + EgtMove(nText, (ptTextMC - Point3d.ORIG())) Return nText End Function @@ -911,15 +928,19 @@ Public Class SideAngleUC ' Creo layer per testi nesting Dim TextLayer As Integer = EgtCreateGroup(CurrPart) EgtSetName(TextLayer, SIDE_ANGLE_LAYER) - EgtSetColor(TextLayer, New Color3d(0, 0, 0)) + EgtSetColor(TextLayer, New Color3d(0, 0, 128)) ' Ciclo sulle linee di contorno, se hanno info con inclinazione aggiungo testo con angolo Dim CurrLine As Integer = EgtGetFirstInGroup(OutLoop) While CurrLine <> GDB_ID.NULL Dim dSideAngle As Double = 0 EgtGetInfo(CurrLine, INFO_SIDE_ANGLE, dSideAngle) + Dim dSideAngle2 As Double = 0 + EgtGetInfo(CurrLine, INFO_SIDE_ANGLE2, dSideAngle2) If Math.Abs(dSideAngle) > EPS_ANG_SMALL Then ' Creo testo con angolo di inclinazione - AddTextToLine(DoubleToString(dSideAngle, 1) & "°", TextLayer, CurrLine, 20, dBBoxRad, False) + Dim sText As String = DoubleToString(dSideAngle, 1) & "°" + If Math.Abs(dSideAngle2) > EPS_ANG_SMALL Then sText &= "; " & DoubleToString(dSideAngle2, 1) & "°" + AddTextToLine(sText, TextLayer, CurrLine, 15, dBBoxRad, False, True) End If CurrLine = EgtGetNext(CurrLine) End While