From 158f21e941b72a3f6c302a46cbf8e1248a269f39 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 26 Oct 2016 16:09:35 +0000 Subject: [PATCH] TestEIn 1.6v6 : - aggiornamento. --- Controller.vb | 66 +++++----- EgtInterface.vb | 239 ++++++++++++++++++++++++++++++++++--- Form1.vb | 11 +- My Project/AssemblyInfo.vb | 4 +- 4 files changed, 273 insertions(+), 47 deletions(-) diff --git a/Controller.vb b/Controller.vb index 2f1e597..137b25d 100644 --- a/Controller.vb +++ b/Controller.vb @@ -26,7 +26,7 @@ Public Class Controller Public Event OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Public Event OnSavingObject(ByVal sender As Object) Public Event OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) - Public Event OnImportingProject(ByVal sender As Object, ByVal bOkType As Boolean) + Public Event OnImportingProject(ByVal sender As Object, ByVal nType As Integer, ByRef nFlag As Integer) Public Event OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Public Event OnExportingProject(ByVal sender As Object) Public Event OnExportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) @@ -102,6 +102,7 @@ Public Class Controller INVERTSURF DELETE CHANGELAYER + CHANGELAYERGLOB CHANGECOLOR RESETCOLOR CHANGEALPHA @@ -432,7 +433,8 @@ Public Class Controller Dim bOkType = (nFileType = FT.DXF Or nFileType = FT.STL Or nFileType = FT.CNC Or nFileType = FT.CSF Or nFileType = FT.BTL) 'Prima del caricamento - RaiseEvent OnImportingProject(Me, bOkType) + Dim nFlag As Integer = 0 + RaiseEvent OnImportingProject(Me, nFileType, nFlag) If Not bOkType Then Return False End If @@ -446,7 +448,7 @@ Public Class Controller ElseIf nFileType = FT.STL Then bOk = bOk And EgtImportStl(sFile, 1) ElseIf nFileType = FT.CNC Then - bOk = bOk And EgtImportCnc(sFile) + bOk = bOk And EgtImportCnc(sFile, nFlag) ElseIf nFileType = FT.CSF Then bOk = bOk And EgtImportCsf(sFile) ElseIf nFileType = FT.BTL Then @@ -617,8 +619,8 @@ Public Class Controller Public Sub MouseSelectedPath(ByVal nId As Integer, ByVal bHaltOnFork As Boolean) ' verifico sia parte di un layer - Dim nLayerId = EgtGetParent(nId) - If EgtGetParent(EgtGetParent(nLayerId)) <> GDB_ID.ROOT Then + Dim nPartId = EgtGetParent(EgtGetParent(nId)) + If Not (EgtIsPart(nPartId) OrElse EgtGetRawPartFromPart(nPartId) <> GDB_ID.NULL) Then Return End If ' eseguo la selezione ed aggiorno @@ -1108,7 +1110,10 @@ Public Class Controller Return ProcessDelete() ' Change Layer Case CMD.CHANGELAYER - Return ProcessChangeLayer() + Return ProcessChangeLayer(False) + ' Change Layer Glob + Case CMD.CHANGELAYERGLOB + Return ProcessChangeLayer(True) ' Change Color Case CMD.CHANGECOLOR Return ProcessChangeColor() @@ -3892,34 +3897,28 @@ Public Class Controller Return True End Function - Private Function ProcessChangeLayer() As Boolean + Private Function ProcessChangeLayer(bGlob As Boolean) As Boolean If m_nStep <> 0 Then Return False End If ' verifico ci sia qualcosa di selezionato Dim nId As Integer = EgtGetFirstSelectedObj() - If nId = GDB_ID.NULL Then - Return False - End If + If nId = GDB_ID.NULL Then Return False ' verifico ci sia un layer corrente Dim nCurrLayerId As Integer = EgtGetCurrLayer() - If nCurrLayerId = GDB_ID.NULL Then - Return False - End If + If nCurrLayerId = GDB_ID.NULL Then Return False + ' il riferimento è il layer corrente + Dim nRefId As Integer = nCurrLayerId + ' la posizione è come ultimo figlio + Dim nPos As GDB_POS = GDB_POS.LAST_SON ' ciclo di cambiamento layer (rilocazione) While nId <> GDB_ID.NULL - ' il riferimento è il layer corrente - Dim nRefId As Integer = nCurrLayerId - ' la posizione è come figlio - Dim nPos As GDB_POS = GDB_POS.LAST_SON - ' se il layer sorgente è il corrente - If EgtGetParent(nId) = nCurrLayerId Then - ' il riferimento è dopo l'ultimo sotto il layer - nRefId = EgtGetLastInGroup(nCurrLayerId) - nPos = GDB_POS.AFTER - End If EnableCommandLog() - EgtRelocateGlob(nId, nRefId, nPos) + If bGlob Then + EgtRelocateGlob(nId, nRefId, nPos) + Else + EgtRelocate(nId, nRefId, nPos) + End If DisableCommandLog() nId = EgtGetNextSelectedObj() End While @@ -4028,9 +4027,22 @@ Public Class Controller If m_nStep <> 0 Then Return False End If - ' lancio l'inversione delle curve + ' lancio l'inversione delle curve e dei vettori EnableCommandLog() - EgtInvertCurve(GDB_ID.SEL) + Dim vCrvId As New List(Of Integer) + Dim vVecId As New List(Of Integer) + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Select Case EgtGetType(nId) + Case GDB_TY.CRV_LINE, GDB_TY.CRV_ARC, GDB_TY.CRV_BEZ, GDB_TY.CRV_COMPO + vCrvId.Add(nId) + Case GDB_TY.GEO_VECTOR + vVecId.Add(nId) + End Select + nId = EgtGetNextSelectedObj() + End While + If vCrvId.Count() > 0 Then EgtInvertCurve(vCrvId.ToArray()) + If vVecId.Count() > 0 Then EgtInvertVector(vVecId.ToArray()) DisableCommandLog() ' reset stato scena m_Scene.ResetStatus() @@ -4071,7 +4083,7 @@ Public Class Controller m_vtCont = m_vtCont.Glob(nId) End If ' abilito dialogo - RaiseEvent PrepareInputBox("EXTEND", "Insert Length", "", False, True) + RaiseEvent PrepareInputBox("TRIM-EXTEND", "Insert Length", "", False, True) m_nInpType = IBT.TY_SPECIALDOUBLE SetInputBoxDouble(m_dLast, True) EgtDisableModified() diff --git a/EgtInterface.vb b/EgtInterface.vb index c79833f..e59d376 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -1608,16 +1608,16 @@ Public Function EgtImportStl(sFilePath As String, dScaleFactor As Double) As Boo End Function -Private Function EgtImportCnc_32(sFilePath As String) As Boolean +Private Function EgtImportCnc_32(sFilePath As String, nFlag As Integer) As Boolean End Function -Private Function EgtImportCnc_64(sFilePath As String) As Boolean +Private Function EgtImportCnc_64(sFilePath As String, nFlag As Integer) As Boolean End Function -Public Function EgtImportCnc(sFilePath As String) As Boolean +Public Function EgtImportCnc(sFilePath As String, Optional nFlag As Integer = EIC_FL.NONE) As Boolean If IntPtr.Size = 4 Then - Return EgtImportCnc_32(sFilePath) + Return EgtImportCnc_32(sFilePath, nFlag) Else - Return EgtImportCnc_64(sFilePath) + Return EgtImportCnc_64(sFilePath, nFlag) End If End Function @@ -2783,6 +2783,28 @@ Public Function EgtChangeVectorBase(nId As Integer, ByRef PtBase As Point3d, Opt End If End Function + +Private Function EgtInvertVector_32(nNumVec As Integer, nVecId() As Integer) As Boolean +End Function + +Private Function EgtInvertVector_64(nNumVec As Integer, nVecId() As Integer) As Boolean +End Function +Public Function EgtInvertVector(nVecId() As Integer) As Boolean + If IntPtr.Size = 4 Then + Return EgtInvertVector_32(nVecId.Count(), nVecId) + Else + Return EgtInvertVector_64(nVecId.Count(), nVecId) + End If +End Function +Public Function EgtInvertVector(nVecId As Integer) As Boolean + Dim vVecId() As Integer = {nVecId} + If IntPtr.Size = 4 Then + Return EgtInvertVector_32(1, vVecId) + Else + Return EgtInvertVector_64(1, vVecId) + End If +End Function + Private Function EgtFlipText_32(nId As Integer) As Boolean End Function @@ -2828,16 +2850,24 @@ End Function '---------- GeomDb Curves Modify ----------------------------------------------- -Private Function EgtInvertCurve_32(nId As Integer) As Boolean +Private Function EgtInvertCurve_32(nNumCrv As Integer, nCrvId() As Integer) As Boolean End Function -Private Function EgtInvertCurve_64(nId As Integer) As Boolean +Private Function EgtInvertCurve_64(nNumCrv As Integer, nCrvId() As Integer) As Boolean End Function -Public Function EgtInvertCurve(nId As Integer) As Boolean +Public Function EgtInvertCurve(nCrvId() As Integer) As Boolean If IntPtr.Size = 4 Then - Return EgtInvertCurve_32(nId) + Return EgtInvertCurve_32(nCrvId.Count(), nCrvId) Else - Return EgtInvertCurve_64(nId) + Return EgtInvertCurve_64(nCrvId.Count(), nCrvId) + End If +End Function +Public Function EgtInvertCurve(nCrvId As Integer) As Boolean + Dim vCrvId() As Integer = {nCrvId} + If IntPtr.Size = 4 Then + Return EgtInvertCurve_32(1, vCrvId) + Else + Return EgtInvertCurve_64(1, vCrvId) End If End Function @@ -6360,6 +6390,7 @@ Public Function EgtInitMachMgr(sMachinesDir As String) As Boolean End If End Function +' Machines Private Function EgtSetCurrMachine_32(sMachineName As String) As Boolean End Function @@ -6397,6 +6428,7 @@ Public Function EgtGetCurrMachineName(ByRef sMachineName As String) As Boolean Return bOk End Function +' Machining Groups Private Function EgtGetMachGroupCount_32() As Integer End Function @@ -6569,6 +6601,7 @@ Public Function EgtGetCurrMachGroup() As Integer End If End Function +' Phases Private Function EgtAddPhase_32() As Integer End Function @@ -6639,6 +6672,7 @@ Public Function EgtGetPhaseCount() As Integer End If End Function +' RawParts & Parts Private Function EgtGetRawPartCount_32() As Integer End Function @@ -6761,16 +6795,16 @@ Public Function EgtModifyRawPartHeight(nRawId As Integer, dHeight As Double) As End Function -Private Function EgtKeepRawPart_32(nRawId As Integer) As Boolean +Private Function EgtKeepRawPart_32(nRawId As Integer, nSouPhase As Integer) As Boolean End Function -Private Function EgtKeepRawPart_64(nRawId As Integer) As Boolean +Private Function EgtKeepRawPart_64(nRawId As Integer, nSouPhase As Integer) As Boolean End Function -Public Function EgtKeepRawPart(nRawId As Integer) As Boolean +Public Function EgtKeepRawPart(nRawId As Integer, Optional nSouPhase As Integer = 0) As Boolean If IntPtr.Size = 4 Then - Return EgtKeepRawPart_32(nRawId) + Return EgtKeepRawPart_32(nRawId, nSouPhase) Else - Return EgtKeepRawPart_64(nRawId) + Return EgtKeepRawPart_64(nRawId, nSouPhase) End If End Function @@ -6914,6 +6948,20 @@ Public Function EgtAddPartToRawPart(nPartId As Integer, ByRef ptPos As Point3d, End If End Function + +Private Function EgtGetRawPartFromPart_32(nPartId As Integer) As Integer +End Function + +Private Function EgtGetRawPartFromPart_64(nPartId As Integer) As Integer +End Function +Public Function EgtGetRawPartFromPart(nPartId As Integer) As Integer + If IntPtr.Size = 4 Then + Return EgtGetRawPartFromPart_32(nPartId) + Else + Return EgtGetRawPartFromPart_64(nPartId) + End If +End Function + Private Function EgtRemovePartFromRawPart_32(nPartId As Integer) As Boolean End Function @@ -6928,6 +6976,7 @@ Public Function EgtRemovePartFromRawPart(nPartId As Integer) As Boolean End If End Function +' Table & Fixtures Private Function EgtSetTable_32(sTable As String) As Boolean End Function @@ -7019,6 +7068,118 @@ Public Function EgtShowOnlyTable(bVal As Boolean) As Boolean End If End Function + +Private Function EgtAddFixture_32(sName As String, ByRef ptPos As Point3d, dAngRotDeg As Double, dMov As Double) As Integer +End Function + +Private Function EgtAddFixture_64(sName As String, ByRef ptPos As Point3d, dAngRotDeg As Double, dMov As Double) As Integer +End Function +Public Function EgtAddFixture(sName As String, ByRef ptPos As Point3d, dAngRotDeg As Double, dMov As Double) As Integer + If IntPtr.Size = 4 Then + Return EgtAddFixture_32(sName, ptPos, dAngRotDeg, dMov) + Else + Return EgtAddFixture_64(sName, ptPos, dAngRotDeg, dMov) + End If +End Function + + +Private Function EgtKeepFixture_32(nFixtId As Integer, nSouPhase As Integer) As Boolean +End Function + +Private Function EgtKeepFixture_64(nFixtId As Integer, nSouPhase As Integer) As Boolean +End Function +Public Function EgtKeepFixture(nFixtId As Integer, Optional nSouPhase As Integer = 0) As Boolean + If IntPtr.Size = 4 Then + Return EgtKeepFixture_32(nFixtId, nSouPhase) + Else + Return EgtKeepFixture_64(nFixtId, nSouPhase) + End If +End Function + + +Private Function EgtRemoveFixture_32(nFixtId As Integer) As Boolean +End Function + +Private Function EgtRemoveFixture_64(nFixtId As Integer) As Boolean +End Function +Public Function EgtRemoveFixture(nFixtId As Integer) As Boolean + If IntPtr.Size = 4 Then + Return EgtRemoveFixture_32(nFixtId) + Else + Return EgtRemoveFixture_64(nFixtId) + End If +End Function + + +Private Function EgtGetFirstFixture_32() As Integer +End Function + +Private Function EgtGetFirstFixture_64() As Integer +End Function +Public Function EgtGetFirstFixture() As Integer + If IntPtr.Size = 4 Then + Return EgtGetFirstFixture_32() + Else + Return EgtGetFirstFixture_64() + End If +End Function + + +Private Function EgtGetNextFixture_32(nFixtId As Integer) As Integer +End Function + +Private Function EgtGetNextFixture_64(nFixtId As Integer) As Integer +End Function +Public Function EgtGetNextFixture(nFixtId As Integer) As Integer + If IntPtr.Size = 4 Then + Return EgtGetNextFixture_32(nFixtId) + Else + Return EgtGetNextFixture_64(nFixtId) + End If +End Function + + +Private Function EgtMoveFixture_32(nFixtId As Integer, ByRef vtMove As Vector3d) As Boolean +End Function + +Private Function EgtMoveFixture_64(nFixtId As Integer, ByRef vtMove As Vector3d) As Boolean +End Function +Public Function EgtMoveFixture(nFixtId As Integer, ByRef vtMove As Vector3d) As Boolean + If IntPtr.Size = 4 Then + Return EgtMoveFixture_32(nFixtId, vtMove) + Else + Return EgtMoveFixture_64(nFixtId, vtMove) + End If +End Function + + +Private Function EgtRotateFixture_32(nFixtId As Integer, dDeltaAngDeg As Double) As Boolean +End Function + +Private Function EgtRotateFixture_64(nFixtId As Integer, dDeltaAngDeg As Double) As Boolean +End Function +Public Function EgtRotateFixture(nFixtId As Integer, dDeltaAngDeg As Double) As Boolean + If IntPtr.Size = 4 Then + Return EgtRotateFixture_32(nFixtId, dDeltaAngDeg) + Else + Return EgtRotateFixture_64(nFixtId, dDeltaAngDeg) + End If +End Function + + +Private Function EgtMoveFixtureMobile_32(nFixtId As Integer, dDeltaMov As Double) As Boolean +End Function + +Private Function EgtMoveFixtureMobile_64(nFixtId As Integer, dDeltaMov As Double) As Boolean +End Function +Public Function EgtMoveFixtureMobile(nFixtId As Integer, dDeltaMov As Double) As Boolean + If IntPtr.Size = 4 Then + Return EgtMoveFixtureMobile_32(nFixtId, dDeltaMov) + Else + Return EgtMoveFixtureMobile_64(nFixtId, dDeltaMov) + End If +End Function + ' Tools Database Private Function EgtTdbGetToolNewName_32(sName As String, ByRef psNewName As IntPtr) As Boolean @@ -7317,6 +7478,20 @@ Public Function EgtTdbGetCurrToolParam(nType As Integer, ByRef sVal As String) A Return bOk End Function + +Private Function EgtTdbReload_32() As Boolean +End Function + +Private Function EgtTdbReload_64() As Boolean +End Function +Public Function EgtTdbReload() As Boolean + If IntPtr.Size = 4 Then + Return EgtTdbReload_32() + Else + Return EgtTdbReload_64() + End If +End Function + Private Function EgtTdbSave_32() As Boolean End Function @@ -7703,6 +7878,20 @@ Public Function EgtMdbGetGeneralParam(nType As Integer, ByRef dVal As Double) As End If End Function + +Private Function EgtMdbReload_32() As Boolean +End Function + +Private Function EgtMdbReload_64() As Boolean +End Function +Public Function EgtMdbReload() As Boolean + If IntPtr.Size = 4 Then + Return EgtMdbReload_32() + Else + Return EgtMdbReload_64() + End If +End Function + Private Function EgtMdbSave_32() As Boolean End Function @@ -8058,6 +8247,20 @@ Public Function EgtChangeOperationPhase(nId As Integer, nNewPhase As Integer) As End If End Function + +Private Function EgtGetPhaseLastOperation_32(nPhase As Integer) As Integer +End Function + +Private Function EgtGetPhaseLastOperation_64(nPhase As Integer) As Integer +End Function +Public Function EgtGetPhaseLastOperation(nPhase As Integer) As Integer + If IntPtr.Size = 4 Then + Return EgtGetPhaseLastOperation_32(nPhase) + Else + Return EgtGetPhaseLastOperation_64(nPhase) + End If +End Function + Private Function EgtRemoveOperationHome_32(nId As Integer) As Boolean End Function @@ -10394,6 +10597,12 @@ Public Enum REGC As Integer OUT = 4 INTERS = 5 End Enum +'Costanti : flag per import CNC +Public Enum EIC_FL As Integer + NONE = 0 + CHAIN = 1 + SKIP_RAPID = 2 +End Enum 'Costanti : interruzione di riga Public Const LINE_BREAK As String = "
" 'Costanti : tipo creazione pezzo piatto diff --git a/Form1.vb b/Form1.vb index 611f465..06f91de 100644 --- a/Form1.vb +++ b/Form1.vb @@ -587,9 +587,10 @@ Public Class Form1 End If End Sub - Private Sub OnImportingProject(ByVal sender As Object, ByVal bOkType As Boolean) Handles m_Controller.OnImportingProject - If bOkType Then + Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) Handles m_Controller.OnImportingProject + If nType <> FT.NULL Then ClearObjTree() + nFlag = 0 Else MessageBox.Show(EgtMsg(10005), EgtMsg(10001), MessageBoxButtons.OK, MessageBoxIcon.Error) ' File type unknown - Error End If @@ -1208,7 +1209,11 @@ Public Class Form1 End Sub Private Sub btnChangeLayer_Click(sender As System.Object, e As System.EventArgs) Handles btnChangeLayer.Click - m_Controller.ExecuteCommand(CMD.CHANGELAYER) + If (ModifierKeys And Keys.Shift) = Keys.Shift Then + m_Controller.ExecuteCommand(CMD.CHANGELAYER) + Else + m_Controller.ExecuteCommand(CMD.CHANGELAYERGLOB) + End If End Sub Private Sub btnChangeColor_Click(sender As System.Object, e As System.EventArgs) Handles btnChangeColor.Click diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9d8c31d..607c71b 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: ' - - + +