From ea551e25e583fbd88a8aaa28bdd010a712cf5e42 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Mon, 23 Jan 2023 09:53:22 +0100 Subject: [PATCH] - aggiunta gestione spostamenti limitati nella tavola o meno a seconda del tipo di entita' --- Icarus/DispositionPanel/DispositionPanelVM.vb | 65 +++++++++++++++++-- Icarus/ReferencePanel/ReferencePanelVM.vb | 1 + Icarus/RibPanel/RibPanelVM.vb | 28 ++++++-- Icarus/ShellNumberPanel/ShellNumberPanelVM.vb | 6 +- Icarus/StartMachPanel/StartMachPanelVM.vb | 2 +- 5 files changed, 90 insertions(+), 12 deletions(-) diff --git a/Icarus/DispositionPanel/DispositionPanelVM.vb b/Icarus/DispositionPanel/DispositionPanelVM.vb index 0d006a1..93028f6 100644 --- a/Icarus/DispositionPanel/DispositionPanelVM.vb +++ b/Icarus/DispositionPanel/DispositionPanelVM.vb @@ -20,7 +20,34 @@ Public Class DispositionPanelVM EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference) Dim dNewXPos As Double = ptReference.x StringToLen(value, dNewXPos) - If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then + Dim b3Print As New BBox3d + EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print) + If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then + Dim b3Ribs As New BBox3d() + Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId) + While nRibId <> GDB_ID.NULL + Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL + EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType) + If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then + Dim b3Rib As New BBox3d + EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib) + b3Ribs.Add(b3Rib) + End If + nRibId = EgtGetNext(nRibId) + End While + If b3Ribs.Min.x <> INFINITO Then + b3Print.Add(b3Ribs) + End If + End If + Dim dMin As Double = 0 + Dim dMax As Double = CurrentMachine.b3Tab.DimX + If b3Print.Max.x > ptReference.x Then + dMax -= b3Print.Max.x - ptReference.x + End If + If b3Print.Min.x < ptReference.x Then + dMin += ptReference.x - b3Print.Min.x + End If + If dNewXPos >= dMin AndAlso dNewXPos <= dMax Then EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB) Map.refReferencePanelVM.UpdateFramePosition() EgtDraw() @@ -45,7 +72,34 @@ Public Class DispositionPanelVM EgtStartPoint(Map.refTopPanelVM.SelPart.nReferenceId, GDB_ID.ROOT, ptReference) Dim dNewYPos As Double = ptReference.y StringToLen(value, dNewYPos) - If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then + Dim b3Print As New BBox3d + EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPrintSolidId, GDB_BB.EXACT, b3Print) + If EgtGetGroupObjs(Map.refTopPanelVM.SelPart.nRibsLayerId) > 0 Then + Dim b3Ribs As New BBox3d() + Dim nRibId As Integer = EgtGetFirstInGroup(Map.refTopPanelVM.SelPart.nRibsLayerId) + While nRibId <> GDB_ID.NULL + Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL + EgtGetInfo(nRibId, MAC_RIBSTYPE, nRibType) + If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then + Dim b3Rib As New BBox3d + EgtGetBBoxGlob(nRibId, GDB_BB.EXACT, b3Rib) + b3Ribs.Add(b3Rib) + End If + nRibId = EgtGetNext(nRibId) + End While + If b3Ribs.Min.x <> INFINITO Then + b3Print.Add(b3Ribs) + End If + End If + Dim dMin As Double = 0 + Dim dMax As Double = CurrentMachine.b3Tab.DimY + If b3Print.Max.y > ptReference.y Then + dMax -= b3Print.Max.y - ptReference.y + End If + If b3Print.Min.y < ptReference.y Then + dMin += ptReference.y - b3Print.Min.y + End If + If dNewYPos >= dMin AndAlso dNewYPos <= dMax Then EgtMove(Map.refTopPanelVM.SelPart.nPartId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB) Map.refReferencePanelVM.UpdateFramePosition() EgtDraw() @@ -221,6 +275,7 @@ Public Class DispositionPanelVM ' seleziono percorso corrente EgtDeselectAll() EgtSelectObj(Map.refTopPanelVM.SelPart.nPartId) + EgtDraw() End Sub Friend Sub UpdateUI() @@ -229,8 +284,9 @@ Public Class DispositionPanelVM m_bRotating = False ' ripristino griglia EgtSetGridFrame(m_PrevGridOrigin) - EgtDraw() End If + EgtDeselectAll() + EgtDraw() End Sub Friend Sub OnKeyDown(Key As Forms.Keys) @@ -239,8 +295,9 @@ Public Class DispositionPanelVM m_bRotating = False ' ripristino griglia EgtSetGridFrame(m_PrevGridOrigin) - EgtDraw() End If + EgtDeselectAll() + EgtDraw() End If End Sub diff --git a/Icarus/ReferencePanel/ReferencePanelVM.vb b/Icarus/ReferencePanel/ReferencePanelVM.vb index c8f596f..9804950 100644 --- a/Icarus/ReferencePanel/ReferencePanelVM.vb +++ b/Icarus/ReferencePanel/ReferencePanelVM.vb @@ -116,6 +116,7 @@ Public Class ReferencePanelVM SelPart.UpdateReferenceId(nFrameId) End If EgtSetInfo(SelPart.nReferenceLayerId, KEY_REFERENCE, m_SelReference) + Map.refDispositionPanelVM.RefreshPos() EgtDraw() End Sub diff --git a/Icarus/RibPanel/RibPanelVM.vb b/Icarus/RibPanel/RibPanelVM.vb index 54fa670..46e2ef2 100644 --- a/Icarus/RibPanel/RibPanelVM.vb +++ b/Icarus/RibPanel/RibPanelVM.vb @@ -1,8 +1,10 @@ Imports System.Collections.ObjectModel Imports System.Collections.Specialized Imports System.Globalization +Imports System.Windows.Markup Imports EgtUILib Imports EgtWPFLib5 +Imports Icarus.RibEntity Public Class RibPanelVM Inherits VMBase @@ -73,7 +75,16 @@ Public Class RibPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewXPos As Double = b3Reference.Min.x StringToLen(value, dNewXPos) - If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then + Dim dMin As Double = 0 + Dim dMax As Double = CurrentMachine.b3Tab.DimX + Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL + EgtGetInfo(m_SelRib.nExtrusionId, MAC_RIBSTYPE, nRibType) + If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then + dMax -= b3Reference.DimX + Else + dMin -= b3Reference.DimX + End If + If dNewXPos >= dMin AndAlso dNewXPos <= dMax Then EgtMove(m_SelRib.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelRib.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() @@ -102,7 +113,16 @@ Public Class RibPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewYPos As Double = b3Reference.Min.y StringToLen(value, dNewYPos) - If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then + Dim dMin As Double = 0 + Dim dMax As Double = CurrentMachine.b3Tab.DimY + Dim nRibType As Integer = Machining.MPAR_RIBSTYPE.INTERNAL + EgtGetInfo(m_SelRib.nExtrusionId, MAC_RIBSTYPE, nRibType) + If nRibType = Machining.MPAR_RIBSTYPE.EXTERNAL OrElse nRibType = Machining.MPAR_RIBSTYPE.UNBOUNDED Then + dMax -= b3Reference.DimY + Else + dMin -= b3Reference.DimY + End If + If dNewYPos >= dMin AndAlso dNewYPos <= dMax Then EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() @@ -131,7 +151,7 @@ Public Class RibPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewZPos As Double = b3Reference.Min.y StringToLen(value, dNewZPos) - If dNewZPos >= 0 Then + If dNewZPos >= -1000 Then EgtMove(m_SelRib.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelRib.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() @@ -1201,7 +1221,7 @@ Public Class RibPanelVM End While EgtDeselectAll() m_bCPlaneObj_IsActive = True - ' Map.refControllerInputPanelVM.PrepareInputBox("Grid from Selection", "Select the face of the object where to place the grid", "", False, False) + ' Map.refControllerInputPanelVM.PrepareInputBox("Grid from Selection", "Select the face of the object where to place the grid", "", False, False) End Sub #End Region ' CPlaneObj diff --git a/Icarus/ShellNumberPanel/ShellNumberPanelVM.vb b/Icarus/ShellNumberPanel/ShellNumberPanelVM.vb index c727e82..f9caf2f 100644 --- a/Icarus/ShellNumberPanel/ShellNumberPanelVM.vb +++ b/Icarus/ShellNumberPanel/ShellNumberPanelVM.vb @@ -73,7 +73,7 @@ Public Class ShellNumberPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewXPos As Double = b3Reference.Min.x StringToLen(value, dNewXPos) - If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then + If dNewXPos >= -b3Reference.DimX AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX - b3Reference.DimX Then EgtMove(m_SelShellNumber.nCurveId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(dNewXPos, b3Reference.Min.y, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() @@ -102,7 +102,7 @@ Public Class ShellNumberPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewYPos As Double = b3Reference.Min.y StringToLen(value, dNewYPos) - If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then + If dNewYPos >= -b3Reference.DimY AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY - b3Reference.DimY Then EgtMove(m_SelShellNumber.nCurveId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(b3Reference.Min.x, dNewYPos, b3Reference.Min.z) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() @@ -131,7 +131,7 @@ Public Class ShellNumberPanelVM EgtGetBBoxGlob(nId, GDB_BB.STANDARD, b3Reference) Dim dNewZPos As Double = b3Reference.Min.y StringToLen(value, dNewZPos) - If dNewZPos >= 0 Then + If dNewZPos >= -1000 Then EgtMove(m_SelShellNumber.nCurveId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB) EgtMove(m_SelShellNumber.nExtrusionId, New Point3d(b3Reference.Min.x, b3Reference.Min.y, dNewZPos) - b3Reference.Min, GDB_RT.GLOB) EgtDraw() diff --git a/Icarus/StartMachPanel/StartMachPanelVM.vb b/Icarus/StartMachPanel/StartMachPanelVM.vb index dded71e..eacae1a 100644 --- a/Icarus/StartMachPanel/StartMachPanelVM.vb +++ b/Icarus/StartMachPanel/StartMachPanelVM.vb @@ -117,7 +117,7 @@ Public Class StartMachPanelVM EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Dim dNewZPos As Double = ptReference.z StringToLen(value, dNewZPos) - If dNewZPos >= 0 Then + If dNewZPos >= -1000 Then EgtMove(m_SelStart.nId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB) EgtDraw() Else