From c2d150b40201d0644e16fdf54b0cbcfd5960f765 Mon Sep 17 00:00:00 2001 From: NicolaP Date: Mon, 20 Sep 2021 14:57:36 +0200 Subject: [PATCH] Gestione oggetti per 3D VeinMatching --- DrawImport/AlzFrontUC.xaml.vb | 7 ++ VeinMatching/VeinMatchingWindow.xaml.vb | 121 +++++++++++++++++++++++- 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/DrawImport/AlzFrontUC.xaml.vb b/DrawImport/AlzFrontUC.xaml.vb index 844a488..1247304 100644 --- a/DrawImport/AlzFrontUC.xaml.vb +++ b/DrawImport/AlzFrontUC.xaml.vb @@ -157,6 +157,13 @@ Public Class AlzFrontUC Else AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine)) End If + ' inserisco riferimento univoco al lato (solo se non esiste) + Dim sInfoRef As String = String.Empty + EgtGetInfo(CurrLine, "RefAF", sInfoRef) + If String.IsNullOrEmpty(sInfoRef) Then + Dim sRefGUID As String = System.Guid.NewGuid().ToString() + EgtSetInfo(CurrLine, "RefAF", sRefGUID) + End If nEntityIndex += 1 Else EgtSetName(CurrLine, "B" & nOtherIndex.ToString) diff --git a/VeinMatching/VeinMatchingWindow.xaml.vb b/VeinMatching/VeinMatchingWindow.xaml.vb index 29b6eac..9cdd6ef 100644 --- a/VeinMatching/VeinMatchingWindow.xaml.vb +++ b/VeinMatching/VeinMatchingWindow.xaml.vb @@ -1,5 +1,6 @@ Imports System.IO Imports System.Windows.Interop +Imports System.Collections.ObjectModel Imports System.Runtime.InteropServices Imports EgtUILib Imports EgtWPFLib @@ -201,6 +202,8 @@ Public Class VeinMatchingWindow End Class Friend Module VeinMatching + ' creo la lista delle alzatine, ad ogni alzatina associo anche il lato del piano cucina (e non solo) a cui si riferisce + Private m_ListALZFront As New ObservableCollection(Of Aletta) ' Riferimento alla MainWindow Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) @@ -279,6 +282,60 @@ Friend Module VeinMatching Return True End Function + ' ------------------- ELENCO FUNZIONI PER GESTIONE ALZATINE E FRONTALINI ------------------- + ' genero la lista delle alzatine dei frontalini + Friend Function CreateListAlzAndFront() As Boolean + Dim nId As Integer = EgtGetFirstPart() + While nId <> GDB_ID.NULL + ' verifico che il pezzo sia una alzatina + Dim sInfoName As String = String.Empty + EgtGetInfo(nId, "CMP", sInfoName) + If sInfoName = "AlzFront" Then + Dim AlzFront As New Aletta(nId) + m_ListALZFront.Add(AlzFront) + End If + ' Passo al pezzo successivo + nId = EgtGetNextPart(nId) + End While + Return True + End Function + + ' genero la lista dei piani cucina + Friend Function LinkReferencesOnAlette() As Boolean + Dim nId As Integer = EgtGetFirstPart() + While nId <> GDB_ID.NULL + ' escludo dalla ricerca le alette + Dim sCMP As String = String.Empty + EgtGetInfo(nId, "CMP", sCMP) + If sCMP = "AlzFront" Then + ' Passo al pezzo successivo + nId = EgtGetNextPart(nId) + Continue While + End If + ' Recupero gruppo regione + Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP) + ' Entità lato + Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId) + While nSideId <> GDB_ID.NULL + Dim sInfoGUID As String = String.Empty + EgtGetInfo(nSideId, "RefAF", sInfoGUID) + If Not String.IsNullOrEmpty(sInfoGUID) Then + Dim Item As Aletta + For Each Item In m_ListALZFront + If Item.RefGUID = sInfoGUID Then + Item.IdSideRef = nSideId + End If + Next + ' ricerco nella lista delle alette il suo + End If + nSideId = EgtGetNext(nSideId) + End While + ' Passo al pezzo successivo + nId = EgtGetNextPart(nId) + End While + Return True + End Function + ' ------------------- ELENCO FUNZIONI PER GESTIONE ALZATINE E FRONTALINI ------------------- Friend Function Clear() As Boolean ' Verifico esista il contesto del VeinMatching @@ -541,7 +598,14 @@ Friend Module VeinMatching End Function Friend Function AssemblyParts() As Boolean - ' Inserire codice per gestire la visualizzazione dei Assemblato delle alzatine dei frontalini + CreateListAlzAndFront() + LinkReferencesOnAlette() + Dim Item As Aletta + For Each Item In m_ListALZFront + ' inizio a posizionare i pezzi nel piano nella posizione corretta pronti per essere ruotati + + ' ruoto i pezzi + Next Return True End Function @@ -790,3 +854,58 @@ Friend Module VeinMatching End Function End Module + + +Public Class Aletta + + Private m_PartId As Integer = -1 + Public ReadOnly Property PartId As Integer + Get + Return m_PartId + End Get + End Property + + Private m_SideId As Integer = -1 + Public ReadOnly Property SideId As Integer + Get + Return m_SideId + End Get + End Property + + Private m_RefGUID As String = String.Empty + Public ReadOnly Property RefGUID As String + Get + Return m_RefGUID + End Get + End Property + + Private m_IdSideRef As Integer = -1 + Public Property IdSideRef As Integer + Get + Return m_IdSideRef + End Get + Set(value As Integer) + m_IdSideRef = value + End Set + End Property + + Sub New(nId As Integer) + m_PartId = nId + + ' Recupero l'info legata al lato che contiene iil riferiemnto + Dim nOutLoopLayId As Integer = EgtGetFirstNameInGroup(nId, NAME_OUTLOOP) + ' Entità lato + Dim nSideId As Integer = EgtGetFirstInGroup(nOutLoopLayId) + While nSideId <> GDB_ID.NULL + Dim sInfoGUID As String = String.Empty + EgtGetInfo(nSideId, "RefAF", sInfoGUID) + If Not String.IsNullOrEmpty(sInfoGUID) Then + m_RefGUID = sInfoGUID + m_SideId = nSideId + Exit While + End If + nSideId = EgtGetNext(nSideId) + End While + End Sub + +End Class