diff --git a/Controller.vb b/Controller.vb index ae2161e..8be87b4 100644 --- a/Controller.vb +++ b/Controller.vb @@ -1648,7 +1648,7 @@ Public Class Controller Return False End If Dim nRefId As Integer = GDB_ID.NULL - Dim nPos As GDB_POS = GDB_POS.SON + Dim nPos As GDB_POS = GDB_POS.LAST_SON ' se gruppo If EgtGetType(m_nLast) = GDB_TY.GROUP Then ' se pezzo @@ -2029,7 +2029,9 @@ Public Class Controller m_nInpType = IBT.TY_DIRECTION m_dLast = GridAngFromGlobDir(m_vtLast) SetInputBoxDouble(m_dLast) + EgtDisableModified() DragLinePDL() + EgtEnableModified() Case 2 m_dPrev = m_dLast m_vtLast = GlobDirFromGridAng(m_dPrev) @@ -2040,7 +2042,9 @@ Public Class Controller RaiseEvent PrepareInputBox("LINE PDL", "Insert Length", "", False, True) m_nInpType = IBT.TY_LENGTH SetInputBoxDouble(m_dLast) + EgtDisableModified() DragLinePDL() + EgtEnableModified() Case 3 ' reset scena m_Scene.ResetStatus(False) @@ -2118,7 +2122,9 @@ Public Class Controller RaiseEvent PrepareInputBox("LINE PVL", "Insert Direction Vector", "", False, True) m_nInpType = IBT.TY_VECTOR3D SetInputBoxVector3d(m_vtLast) + EgtDisableModified() DragLinePVL() + EgtEnableModified() Case 2 m_dLast = m_dAux m_nStep = 3 @@ -2127,7 +2133,9 @@ Public Class Controller RaiseEvent PrepareInputBox("LINE PVL", "Insert Length", "", False, True) m_nInpType = IBT.TY_LENGTH SetInputBoxDouble(m_dLast) + EgtDisableModified() DragLinePVL() + EgtEnableModified() Case 3 ' reset scena m_Scene.ResetStatus(False) @@ -2254,7 +2262,9 @@ Public Class Controller RaiseEvent PrepareInputBox("CIRCLE CD", "Insert Diameter", "", False, True) m_nInpType = IBT.TY_DOUBLE SetInputBoxDouble(m_dLast) + EgtDisableModified() DragCircleCD() + EgtEnableModified() Case 2 ' reset scena m_Scene.ResetStatus(False) @@ -2473,7 +2483,9 @@ Public Class Controller m_nInpType = IBT.TY_DIRECTION m_dLast = GridAngFromGlobDir(m_vtLast) SetInputBoxDouble(m_dLast) + EgtDisableModified() DragArcPDP() + EgtEnableModified() Case 2 m_nStep = 3 m_Scene.EnableDrag() @@ -2594,7 +2606,9 @@ Public Class Controller RaiseEvent PrepareInputBox("ARC PVP", "Insert Direction Vector", "", False, True) m_nInpType = IBT.TY_VECTOR3D SetInputBoxVector3d(m_vtLast) + EgtDisableModified() DragArcPVP() + EgtEnableModified() Case 2 m_nStep = 3 m_Scene.EnableDrag() @@ -3181,7 +3195,9 @@ Public Class Controller RaiseEvent SetInputBoxCheck(False) m_nInpType = IBT.TY_DOUBLE SetInputBoxDouble(m_dLast) + EgtDisableModified() DragExtrude() + EgtEnableModified() Case 1 ' reset scena m_Scene.ResetStatus(False) @@ -3487,7 +3503,7 @@ Public Class Controller ' il riferimento è il layer corrente Dim nRefId As Integer = nCurrLayerId ' la posizione è come figlio - Dim nPos As GDB_POS = GDB_POS.SON + 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 @@ -3653,7 +3669,9 @@ Public Class Controller RaiseEvent PrepareInputBox("EXTEND", "Insert Length", "", False, True) m_nInpType = IBT.TY_SPECIALDOUBLE SetInputBoxDouble(m_dLast) + EgtDisableModified() DragExtendCurve() + EgtEnableModified() Case 1 ' eseguo estensione sull'estremo più vicino al punto di selezione Dim nId As Integer = EgtGetLastSelectedObj() @@ -4456,7 +4474,9 @@ Public Class Controller RaiseEvent AddInputBoxCombo("Fillet", True) RaiseEvent AddInputBoxCombo("Chamfer", False) RaiseEvent AddInputBoxCombo("Extend", False) + EgtDisableModified() DragOffset() + EgtEnableModified() Case 1 ' reset stato scena m_Scene.ResetStatus(False) diff --git a/EgtInterface.vb b/EgtInterface.vb index 36699d2..1557896 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -1304,19 +1304,19 @@ Public Function EgtGetBBoxGlob(ByVal nId As Integer, ByVal nFlag As Integer, End Function -Public Function EgtCopy(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer +Public Function EgtCopy(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.LAST_SON) As Integer End Function -Public Function EgtCopyGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer +Public Function EgtCopyGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.LAST_SON) As Integer End Function -Public Function EgtRelocate(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer +Public Function EgtRelocate(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.LAST_SON) As Integer End Function -Public Function EgtRelocateGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer +Public Function EgtRelocateGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.LAST_SON) As Integer End Function @@ -1810,6 +1810,10 @@ End Function Private Function EgtVectorToIdLoc(ByRef VtV As Vector3d, ByVal nId As Integer) As Boolean End Function +'---------- Machinings --------------------------------------------------------- + +Public Function EgtInitMachMgr() As Boolean +End Function '---------- Scene -------------------------------------------------------------- @@ -2253,9 +2257,10 @@ Public Enum REF_TY As Integer End Enum 'Costanti : POSIZIONE DI COPIA DI UN OGGETTO Public Enum GDB_POS As Integer - BEFORE = -1 - SON = 0 - AFTER = 1 + FIRST_SON = 0 + LAST_SON = 1 + BEFORE = 2 + AFTER = 3 End Enum 'Costanti : LIVELLO DI UN OGGETTO Public Enum GDB_LV As Integer diff --git a/Form1.vb b/Form1.vb index 94b4a7f..a081218 100644 --- a/Form1.vb +++ b/Form1.vb @@ -132,8 +132,10 @@ Public Class Form1 Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_sIniFile) Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_sIniFile) Scene1.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) - ' inizializzo scena + ' inizializzo scena (DB geometrico + visualizzazione) Scene1.Init() + ' inizializzo gestore lavorazioni + EgtInitMachMgr() ' imposto visualizzazione riferimento globale Dim bShowGlobFrame As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWGFRAME, 1, m_sIniFile) <> 0) EgtSetGlobFrameShow(bShowGlobFrame) @@ -1265,7 +1267,7 @@ Public Class Form1 Public Sub LoadObjTree() Dim nOldId As Integer = ClearObjTree() TreeView1.BeginUpdate() - AddGroupInObjTree(GDB_ID.ROOT, 0, TreeView1.Nodes) + AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, TreeView1.Nodes) TreeView1.EndUpdate() If nOldId <> GDB_ID.NULL Then SelectIdInObjTree(nOldId) @@ -1279,33 +1281,47 @@ Public Class Form1 Return nOldId End Function - Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLev As Integer, ByRef PrevNodColl As TreeNodeCollection) + Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As TreeNodeCollection) Dim CurrNodColl As TreeNodeCollection If nGroupId = GDB_ID.ROOT Then CurrNodColl = PrevNodColl Else + ' livello + Dim nObjLev As Integer = GDB_LV.USER + EgtGetLevel(nGroupId, nObjLev) + If nObjLev = GDB_LV.TEMP Then + nLevel = GDB_LV.TEMP + ElseIf nLevel = GDB_LV.USER Then + nLevel = nObjLev + End If + ' tipo + Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer + If nLevel = GDB_LV.USER Then + nGroupType = nDepth + End If + ' nome Dim sName As String = String.Empty Dim sText As String = String.Empty If EgtGetName(nGroupId, sName) Then - If nLev = 1 Then + If nGroupType = 1 Then sText = sName + " (Part " + nGroupId.ToString + ")" - ElseIf nLev = 2 Then + ElseIf nGroupType = 2 Then sText = sName + " (Layer " + nGroupId.ToString + ")" Else sText = sName + " (Group " + nGroupId.ToString + ")" End If Else - If nLev = 1 Then + If nGroupType = 1 Then sText = "Part " + nGroupId.ToString - ElseIf nLev = 2 Then + ElseIf nGroupType = 2 Then sText = "Layer " + nGroupId.ToString Else sText = "Group " + nGroupId.ToString End If End If - Dim nImage As Integer = TypeToImageInObjTree(GDB_TY.GROUP, nLev) + Dim nImage As Integer = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType) Dim CurrNod As TreeNode = PrevNodColl.Add(nGroupId.ToString(), sText, nImage, nImage) CurrNodColl = CurrNod.Nodes Dim nStat As GDB_ST = GDB_ST.ON_ @@ -1326,7 +1342,7 @@ Public Class Form1 Dim nType As Integer = EgtGetType(nId) 'se gruppo If nType = GDB_TY.GROUP Then - AddGroupInObjTree(nId, nLev + 1, CurrNodColl) + AddGroupInObjTree(nId, nLevel, nDepth + 1, CurrNodColl) 'se oggetto geometrico ElseIf nType >= GDB_TY.GEO_VECTOR Then Dim sTitle As String = String.Empty @@ -1338,7 +1354,7 @@ Public Class Form1 Else sText = sTitle + " " + nId.ToString End If - Dim nImage As Integer = TypeToImageInObjTree(nType, nLev) + Dim nImage As Integer = TypeToImageInObjTree(nType, nDepth) Dim CurrNod As TreeNode = CurrNodColl.Add(nId.ToString, sText, nImage, nImage) Dim nStat As GDB_ST = GDB_ST.ON_ EgtGetStatus(nId, nStat) @@ -1357,12 +1373,12 @@ Public Class Form1 End If End Sub - Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nLev As Integer) As Integer + Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nSubType As Integer) As Integer Select Case nType Case GDB_TY.GROUP - If nLev = 1 Then + If nSubType = 1 Then Return 3 - ElseIf nLev = 2 Then + ElseIf nSubType = 2 Then Return 4 Else Return 2 diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index bf76868..89352c5 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: ' - - + + diff --git a/Scene.Designer.vb b/Scene.Designer.vb index c93c559..6864354 100644 --- a/Scene.Designer.vb +++ b/Scene.Designer.vb @@ -57,7 +57,7 @@ Partial Class Scene Me.MenuScene.Name = "ContextMenuStrip1" Me.MenuScene.ShowCheckMargin = True Me.MenuScene.ShowImageMargin = False - Me.MenuScene.Size = New System.Drawing.Size(193, 484) + Me.MenuScene.Size = New System.Drawing.Size(193, 506) ' 'cmdSelectAll ' @@ -79,6 +79,7 @@ Partial Class Scene 'cmdWinSelect ' Me.cmdWinSelect.Name = "cmdWinSelect" + Me.cmdWinSelect.ShortcutKeyDisplayString = "Shift" Me.cmdWinSelect.Size = New System.Drawing.Size(192, 22) Me.cmdWinSelect.Text = "Select Window" ' @@ -97,6 +98,7 @@ Partial Class Scene 'cmdSelectPath ' Me.cmdSelectPath.Name = "cmdSelectPath" + Me.cmdSelectPath.ShortcutKeyDisplayString = "Ctrl" Me.cmdSelectPath.Size = New System.Drawing.Size(192, 22) Me.cmdSelectPath.Text = "Select Path" ' diff --git a/Scene.vb b/Scene.vb index 6114aff..7dee4cd 100644 --- a/Scene.vb +++ b/Scene.vb @@ -223,6 +223,20 @@ Public Class Scene m_nStatus = ST.WINSEL End If m_PrevPoint = e.Location + ' se stato SELPATH, SELPATHAUTO oppure SEL e premuto CONTROL + ElseIf m_nStatus = ST.SELPATH Or m_nStatus = ST.SELPATHAUTO Or + (m_nStatus = ST.SEL And (ModifierKeys And Keys.Control) = Keys.Control) Then + EgtSetObjFilterForSelect(False, True, False, False, False) ' abilito solo le curve + Dim nId As Integer = ChooseOneSelectedObj(e.Location) + If nId <> GDB_ID.NULL Then + RaiseEvent OnMouseSelectedPath(Me, nId, (m_nStatus <> ST.SELPATHAUTO)) + Dim PtTemp As Point3d + Dim nAux As Integer + If EgtGetPointFromSelect(nId, e.Location, PtTemp, nAux) Then + RaiseEvent OnMousePointFromSelection(Me, nId, PtTemp, nAux) + End If + m_nStatus = ST.SEL + End If ' se stato SEL, SELPART, SELLAYER ElseIf m_nStatus = ST.SEL Or m_nStatus = ST.SELPART Or m_nStatus = ST.SELLAYER Then EgtSetObjFilterForSelect(True, True, True, True, True) @@ -245,19 +259,6 @@ Public Class Scene End If m_nStatus = ST.SEL End If - ' se stato SELPATH, SELPATHAUTO - ElseIf m_nStatus = ST.SELPATH Or m_nStatus = ST.SELPATHAUTO Then - EgtSetObjFilterForSelect(False, True, False, False, False) ' abilito solo le curve - Dim nId As Integer = ChooseOneSelectedObj(e.Location) - If nId <> GDB_ID.NULL Then - RaiseEvent OnMouseSelectedPath(Me, nId, (m_nStatus = ST.SELPATH)) - Dim PtTemp As Point3d - Dim nAux As Integer - If EgtGetPointFromSelect(nId, e.Location, PtTemp, nAux) Then - RaiseEvent OnMousePointFromSelection(Me, nId, PtTemp, nAux) - End If - m_nStatus = ST.SEL - End If ' se stato ANALYZE ElseIf m_nStatus = ST.ANALYZE Then EgtSetObjFilterForSelect(True, True, True, True, True) @@ -1132,7 +1133,7 @@ Public Class Scene ' le azioni successive sono temporanee -> non devono cambiare lo stato di modifica del progetto EgtDisableModified() ' copio entità - Dim nNewId As Integer = EgtCopyGlob(nId, m_nDragGroup, GDB_POS.SON) + Dim nNewId As Integer = EgtCopyGlob(nId, m_nDragGroup, GDB_POS.LAST_SON) If nNewId <> GDB_ID.NULL Then ' assegno il colore (potrebbe essere da layer, quindi va fatto) Dim ColObj As Color3d