From 2a490601273f65a50e5e377f042cc2d2e711be2a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 25 Apr 2015 20:44:21 +0000 Subject: [PATCH] TestEIn 1.6d7 : - in import si registra anche EgtNewFile - migliorata gestione Copy Part Layer Obj (su Esc si annulla anche la copia) - merge di superfici velocizzata quando molte, operando sui triangoli. --- Controller.vb | 149 +++++++++++++++++++++++-------------- EgtInterface.vb | 16 +++- My Project/AssemblyInfo.vb | 4 +- 3 files changed, 109 insertions(+), 60 deletions(-) diff --git a/Controller.vb b/Controller.vb index 17eca94..52a3af0 100644 --- a/Controller.vb +++ b/Controller.vb @@ -360,13 +360,13 @@ Public Class Controller End If 'Pulizia GeomDB m_Scene.Cursor = Cursors.WaitCursor - Dim bOk As Boolean = EgtNewFile() 'Importazione EnableCommandLog() + Dim bOk As Boolean = EgtNewFile() If nFileType = FT.DXF Then - bOk = bOk And EgtImportDxf(sFile) + bOk = bOk And EgtImportDxf(sFile, 1) ElseIf nFileType = FT.STL Then - bOk = bOk And EgtImportStl(sFile) + bOk = bOk And EgtImportStl(sFile, 1) ElseIf nFileType = FT.CNC Then bOk = bOk And EgtImportCnc(sFile) End If @@ -1052,6 +1052,8 @@ Public Class Controller DragGridRotate() Case CMD.GRID_ROTATE3D DragGridRotate3D() + Case CMD.COPYPARTLAYEROBJ + DragCopyPartLayerObj() Case CMD.LINE2P DragLine2P() Case CMD.LINEPDL @@ -1719,69 +1721,100 @@ Public Class Controller Return True End Function - Private Function ProcessCopyPartLayerObj() As Boolean - If m_nStep <> 0 Then - Return False + Private Function DoCopyPartLayerObj(ByVal nId As Integer) As Integer + Dim nNewId As Integer = GDB_ID.NULL + ' se pezzo + If EgtIsPart(m_nLast) Then + nNewId = EgtCopyGlob(m_nLast, GDB_ID.ROOT) + ' se layer + ElseIf EgtIsLayer(m_nLast) Then + nNewId = EgtCopyGlob(m_nLast, EgtGetCurrPart()) + ' se entità + ElseIf EgtGetType(m_nLast) <> GDB_TY.GROUP Then + nNewId = EgtCopyGlob(m_nLast, EgtGetCurrLayer()) End If - EgtDeselectAll() - Dim nNewId = GDB_ID.NULL - Dim bOk As Boolean = True - ' se gruppo - If EgtGetType(m_nLast) = GDB_TY.GROUP Then + Return nNewId + End Function + + Private Function ProcessCopyPartLayerObj() As Boolean + Select Case m_nStep + Case 0 + EnableCommandLog() + EgtDeselectAll() + DisableCommandLog() + Dim bOk As Boolean = True ' se pezzo - If EgtGetParent(m_nLast) = GDB_ID.ROOT Then - EnableCommandLog() - ' eseguo copia - nNewId = EgtCopyGlob(m_nLast, GDB_ID.ROOT) + If EgtIsPart(m_nLast) Then ' seleziono tutti gli oggetti del pezzo - bOk = EgtSelectPartObjs(nNewId) - DisableCommandLog() + bOk = EgtSelectPartObjs(m_nLast) ' se layer - ElseIf EgtGetParent(EgtGetParent(m_nLast)) = GDB_ID.ROOT Then - EnableCommandLog() - ' eseguo copia - nNewId = EgtCopyGlob(m_nLast, EgtGetCurrPart()) + ElseIf EgtIsLayer(m_nLast) Then ' seleziono tutti gli oggetti del layer - bOk = EgtSelectLayerObjs(nNewId) - DisableCommandLog() - ' altrimenti errore - Else - bOk = False + bOk = EgtSelectLayerObjs(m_nLast) + ' altrimenti entità + ElseIf EgtGetType(m_nLast) <> GDB_TY.GROUP Then + ' la seleziono + bOk = EgtSelectObj(m_nLast) End If - ' altrimenti entità - Else + ' in caso di errore, esco + If Not bOk Then + Return False + End If + ' se non ci sono oggetti selezionati copio ed esco subito + If EgtGetSelectedObjNbr() = 0 Then + EnableCommandLog() + Dim nNewId = DoCopyPartLayerObj(m_nLast) + DisableCommandLog() + RaiseEvent UpdateUI(Me, True) + Return True + End If + ' preparo per il drag + If Not PrepareTransform() Then + Return False + End If + m_Scene.SetStatusSelPoint() + m_nStep = 1 + ' abilito dialogo "COPY", "Insert Base Point" + RaiseEvent PrepareInputBox(EgtMsg(2401), EgtMsg(2403), "", False, False) + m_nInpType = IBT.TY_POINT3D + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + ' abilito dialogo "COPY", "Insert Target Point" + RaiseEvent PrepareInputBox(EgtMsg(2401), EgtMsg(2404), "", False, True) + m_nInpType = IBT.TY_POINT3D + Case 2 + m_Scene.ResetStatus(False) + EgtDeselectAll() EnableCommandLog() ' eseguo copia - nNewId = EgtCopyGlob(m_nLast, EgtGetCurrLayer()) - ' la seleziono - bOk = EgtSelectObj(nNewId) + Dim nNewId = DoCopyPartLayerObj(m_nLast) + ' eseguo movimento + EgtMove(nNewId, (m_ptLast - m_ptP1).Loc(GDB_ID.GRID), GDB_RT.GRID) DisableCommandLog() - End If - ' in caso di errore, esco - If Not bOk Then + EgtDraw() + ' aggiorno stato + m_nStep = 0 + RaiseEvent UpdateUI(Me, True) + Case Else + m_nStep = 0 Return False - End If - ' aggiorno - RaiseEvent UpdateUI(Me, True) - ' se non ci sono oggetti selezionati esco subito - If EgtGetSelectedObjNbr() = 0 Then - Return True - End If - ' preparo per il drag - If Not PrepareTransform() Then - Return False - End If - m_Scene.SetStatusSelPoint() - ' imposto stato a primo punto per Move - m_nLastCmd = CMD.MOVE - m_bLast = False - m_nStep = 1 - ' abilito dialogo - RaiseEvent PrepareInputBox("MOVE", "Insert Base Point", "", False, False) - m_nInpType = IBT.TY_POINT3D + End Select Return True End Function + Private Sub DragCopyPartLayerObj() + If m_nStep = 2 Then + ' ripristino lo stato iniziale + EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) + ' eseguo tutto il movimento + EgtMove(m_Scene.GetDragGroup(), (m_ptLast - m_ptP1), GDB_RT.GLOB) + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + End If + End Sub + Private Function ProcessShow() As Boolean If m_nStep <> 0 Then Return False @@ -3470,7 +3503,11 @@ Public Class Controller nId = EgtGetNextSelectedObj() End While ' lancio la combinazione delle superfici EnableCommandLog() - EgtCreateSurfTmBySewing(GetCurrLayer(), nSurfNum, nSurfIds, True) + If nSurfNum <= 10 Then + EgtCreateSurfTmBySewing(GetCurrLayer(), nSurfNum, nSurfIds, True) + Else + EgtCreateSurfTmByTriangles(GetCurrLayer(), nSurfNum, nSurfIds, True) + End If DisableCommandLog() ' reset stato scena m_Scene.ResetStatus() @@ -3981,7 +4018,7 @@ Public Class Controller ' imposto stato a primo punto per Move m_nStep = 1 ' abilito dialogo "MOVE", "Insert Base Point", "Copy" - RaiseEvent PrepareInputBox(EgtMsg(2401), EgtMsg(2402), EgtMsg(2001), False, False) + RaiseEvent PrepareInputBox(EgtMsg(2402), EgtMsg(2403), EgtMsg(2001), False, False) m_nInpType = IBT.TY_POINT3D RaiseEvent SetInputBoxCheck(False) Case 1 @@ -3989,7 +4026,7 @@ Public Class Controller m_nStep = 2 m_Scene.EnableDrag() ' abilito dialogo "MOVE", "Insert Target Point", "Copy" - RaiseEvent PrepareInputBox(EgtMsg(2401), EgtMsg(2403), EgtMsg(2001), False, True) + RaiseEvent PrepareInputBox(EgtMsg(2402), EgtMsg(2404), EgtMsg(2001), False, True) m_nInpType = IBT.TY_POINT3D Case 2 m_Scene.ResetStatus(False) diff --git a/EgtInterface.vb b/EgtInterface.vb index 4f3371f..79789fa 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -804,11 +804,11 @@ Public Function EgtGetFileType(ByVal sFilePath As String) As Integer End Function -Public Function EgtImportDxf(ByVal sFilePath As String) As Boolean +Public Function EgtImportDxf(ByVal sFilePath As String, ByVal dScaleFactor As Double) As Boolean End Function -Public Function EgtImportStl(ByVal sFilePath As String) As Boolean +Public Function EgtImportStl(ByVal sFilePath As String, ByVal dScaleFactor As Double) As Boolean End Function @@ -1053,6 +1053,10 @@ End Function Public Function EgtCreateSurfTmRuled(ByVal nParentId As Integer, ByVal nCrvId1 As Integer, ByVal nCrvId2 As Integer, ByVal dLinTol As Double) As Integer End Function + +Public Function EgtCreateSurfTmByTriangles(ByVal nParentId As Integer, ByVal nNumSrf As Integer, ByVal nSrfId() As Integer, ByVal bSrfErase As Boolean) As Integer +End Function + Public Function EgtCreateSurfTmBySewing(ByVal nParentId As Integer, ByVal nNumSrf As Integer, ByVal nSrfId() As Integer, ByVal bSrfErase As Boolean) As Integer End Function @@ -1181,6 +1185,14 @@ End Function '---------- GeomDb Parts & Layers ---------------------------------------------- + +Public Function EgtIsPart(ByVal nPartId As Integer) As Boolean +End Function + + +Public Function EgtIsLayer(ByVal nLayerId As Integer) As Boolean +End Function + Public Function EgtGetCurrPart() As Integer End Function diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 56c1ca7..7d774c9 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + +