From fb8be27836ccd6c90a783b094c160a93de6f6d6f Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 16 Jan 2024 10:52:20 +0100 Subject: [PATCH] Lettura spessore grezzo --- EgtStoneLib/CamAuto.vb | 21 +++++++++++++++++++++ MyVeinMatch/VeinMatchingWindow.xaml.vb | 24 +++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/EgtStoneLib/CamAuto.vb b/EgtStoneLib/CamAuto.vb index 4d51930..efbe283 100644 --- a/EgtStoneLib/CamAuto.vb +++ b/EgtStoneLib/CamAuto.vb @@ -952,6 +952,27 @@ Friend Module CamAuto End If End Function + Friend Function GetRawHeightFromPart(CurrIdPart As Integer, VeinCtx As Integer, MachCtx As Integer) As Double + Dim H As Double = 5 + EgtSetCurrentContext(MachCtx) + Dim IdRaw As Integer = EgtGetFirstRawPart() + While IdRaw <> GDB_ID.NULL + Dim IdPart As Integer = EgtGetFirstPartInRawPart(IdRaw) + While IdPart <> GDB_ID.NULL + If IdPart = CurrIdPart Then + Dim ptRawMin, ptRawMax As Point3d + EgtGetRawPartBBox(GetCurrentRaw(), ptRawMin, ptRawMax) + EgtSetCurrentContext(VeinCtx) + Return ptRawMax.z - ptRawMin.z + End If + IdPart = EgtGetNextPartInRawPart(IdPart) + End While + IdRaw = EgtGetNextRawPart(IdRaw) + End While + EgtSetCurrentContext(VeinCtx) + Return H + End Function + Friend Function UpdateAllRawsZ(dDeltaZ As Double) As Boolean For i As Integer = 1 To EgtGetPhaseCount() EgtSetCurrPhase(i) diff --git a/MyVeinMatch/VeinMatchingWindow.xaml.vb b/MyVeinMatch/VeinMatchingWindow.xaml.vb index 5f7324b..ac49734 100644 --- a/MyVeinMatch/VeinMatchingWindow.xaml.vb +++ b/MyVeinMatch/VeinMatchingWindow.xaml.vb @@ -542,7 +542,8 @@ Public Class VeinMatchingWindow Dim vInters As ObservableCollection(Of PartSolid) = CalcInters(PartSolidSel.PartSolidId) If vInters.Count() <> 1 Then m_bDrag = False - PartSolidSel.RemoveLastTrasf() + 'PartSolidSel.RemoveLastTrasf() + PartSolidSel.UndoTempTrasf() End If End If ' attivo il bottone Undo @@ -946,6 +947,7 @@ Public Class VeinMatchingWindow Public Sub UpdateTreeViewPart() If m_PartSolidList.Count = 0 Then Return Dim TempList As New List(Of String) + Dim IndexGroup As Integer = 1 ' Ripulisco la TreeView m_TreeView.PartInScene.Items.Clear() EgtSetCurrentContext(m_nVeinCtx) @@ -970,10 +972,11 @@ Public Class VeinMatchingWindow ' Insersico il "codice" del gruppo (elenco degli indici Part che costituicono l'insieme) TempList.Add(PartSolidSel.sGroupCode) ' Nella lista deve essere presente anche il pezzo stesso (quindi almeno 2 elementi per avere un accoppiamento) ---!!!! vPair.Count > 1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - If PartSolidSel.vPair.Count > 0 Then + If PartSolidSel.vPairSolid.Count > 1 Then ' Creo il padre - Dim Gruppo As TreeViewItem = CreateTreeViewItem("Gruppo " & (TempList.Count + 1).ToString, "C:\EgtDev\OmagOFFICE\Resources\TreeView\Import.png") - For Each Item In PartSolidSel.vPair + Dim Gruppo As TreeViewItem = CreateTreeViewItem("Gruppo " & (IndexGroup).ToString, "C:\EgtDev\OmagOFFICE\Resources\TreeView\Import.png") + IndexGroup += 1 + For Each Item In PartSolidSel.vPairSolid ' Aggiuno al padre un eventuale figlio Gruppo.Items.Add(CreateTreeViewItem("Part " & Item.PartId.ToString, "C:\EgtDev\OmagOFFICE\Resources\TreeView\PartSolid.png", True)) Next @@ -1175,6 +1178,9 @@ Public Class VeinMatchingWindow Dim IdFP As Integer = EgtGetFirstPart() Dim sName As String = String.Empty While IdFP <> GDB_ID.NULL And sName <> "SOLID" + Dim nOriId As Integer = GDB_ID.NULL + EgtGetInfo(IdFP, KEY_ORI_ID, nOriId) + dThick = GetRawHeightFromPart(nOriId, m_nVeinCtx, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) CreateSolid(IdFP, dThick, False) IdFP = EgtGetNextPart(IdFP) EgtGetName(IdFP, sName) @@ -1215,8 +1221,16 @@ Public Class VeinMatchingWindow ResetAllSolids() End Sub - Private Sub TgBtn_Rotation_Click(sender As Object, e As RoutedEventArgs) Handles TgBtn_Rotation.Click + Private Sub TgBtn_Rotation_Click(sender As Object, e As RoutedEventArgs) Handles TgBtn_Rotation.Checked ' ? boh non lo so, attiva la modalità rotazione + If m_nIdPart = GDB_ID.NULL Then Return + Dim PartSolidSel = GetPartSolid(m_nIdPart) + Dim PtMin As Point3d + Dim PtMax As Point3d + EgtGetPartBBoxGlob(PartSolidSel.PartId, PtMin, PtMax) + Dim MaxLen As Double = Math.Max(PartSolidSel.bbSolid.DimX, PartSolidSel.bbSolid.DimY) + MaxLen = Math.Max(MaxLen, PartSolidSel.bbSolid.DimZ) + ' procedo a disegnare gli assi.. End Sub Private Sub RotatePart(dAng As Double)