From fd08c36938b5eca65421f7e290ae8b33fa564b6a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 18 Nov 2014 16:20:10 +0000 Subject: [PATCH] TestEIn 1.5k2 : - miglioramenti vari. --- Controller.vb | 2436 +++++++++++++++++++++++++----------- EgtInterface.vb | 81 ++ Form1.Designer.vb | 358 ++++-- Form1.resx | 111 +- Form1.vb | 346 +++-- My Project/AssemblyInfo.vb | 4 +- Scene.Designer.vb | 58 +- Scene.vb | 74 +- 8 files changed, 2501 insertions(+), 967 deletions(-) diff --git a/Controller.vb b/Controller.vb index 82c14b4..cfa0c0d 100644 --- a/Controller.vb +++ b/Controller.vb @@ -20,16 +20,24 @@ Public Class Controller ' Events Public Enum IBT As Integer TY_NULL = 0 + TY_STRING TY_DOUBLE + TY_3DOUBLE TY_POINT3D End Enum Public Event SetInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal nType As IBT) + Public Event AddInputCheck(ByVal sLabel As String) + Public Event AddButtonShow() + Public Event SetInputBoxString(ByVal sText As String) + Public Event SetInputBoxDouble(ByVal dVal As Double) + Public Event SetInputBoxPoint3d(ByVal ptP As Point3d) + Public Event SetInputBoxVector3d(ByVal vtV As Vector3d) Public Event UpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) - ' Documento e vista + ' Documento e Vista Private m_Scene As Scene - ' Stato e comandi + ' Comandi e Stati Public Enum CMD As Integer NULL = 0 GRID @@ -42,28 +50,38 @@ Public Class Controller SETCURRPARTLAYER RESETCURRPARTLAYER LAYERCOLOR + SELECTPARTLAYEROBJ + DESELECTPARTLAYEROBJ + RELOCATEPARTLAYEROBJ + COPYPARTLAYEROBJ SHOW HIDE + SETNAME + SETINFO POINT LINE2P + CIRCLECR ARCCSE ARC3P - CIRCLECR PLANE EXTRUDE REVOLVE + REVOLVEPLUS + RULED DELETE CHANGECOLOR RESETCOLOR INVERTCRVSURF + EXTENDCURVE BREAKCURVE JOINCURVE - SEPARATECURVE + EXPLODECURVE MOVE - COPY ROTATE ROTATE3D MIRROR + SCALE + SCALE3D End Enum Public Enum GRID_TYPE As Integer NONE = 0 @@ -75,51 +93,19 @@ Public Class Controller BOTTOM End Enum Private m_nLastCmd As CMD = CMD.NULL - Private Enum EST As Integer - NULL = 0 - GRID_ELEVATION_1 - GRID_ORIGIN_1 - GRID_ROTATE_1 - GRID_ROTATE_2 - GRID_ROTATE_3 - GRID_3P_1 - GRID_3P_2 - GRID_3P_3 - POINT_1 - LINE2P_1 - LINE2P_2 - CIRCLECR_1 - CIRCLECR_2 - ARCCSE_1 - ARCCSE_2 - ARCCSE_3 - ARC3P_1 - ARC3P_2 - ARC3P_3 - EXTRUDE_1 - REVOLVE_1 - REVOLVE_2 - BREAKCURVE_1 - MOVE_1 - MOVE_2 - COPY_1 - COPY_2 - ROTATE_1 - ROTATE_2 - ROTATE_3 - ROTATE3D_1 - ROTATE3D_2 - ROTATE3D_3 - MIRROR_1 - MIRROR_2 - End Enum - Private m_nStatus As EST = EST.NULL + Private m_nStep As Integer = 0 Private m_ptP1 As Point3d Private m_ptP2 As Point3d Private m_ptLast As Point3d + Private m_ptCont As Point3d Private m_dLast As Double = 0 + Private m_dPrev As Double = 0 + Private m_d3Last() As Double = {0, 0, 0} + Private m_d3Prev() As Double = {0, 0, 0} Private m_nLast1 As Integer = 0 Private m_nLast2 As Integer = 0 + Private m_sLast As String = String.Empty + Private m_bLast As Boolean = False ' Metodi Public Sub SetScene(ByRef scene As Scene) @@ -134,11 +120,31 @@ Public Class Controller m_dLast = dVal End Sub + Public Sub SetLast3Double(ByVal d3Val() As Double) + If d3Val.Length >= 1 Then + m_d3Last(0) = d3Val(0) + If d3Val.Length >= 2 Then + m_d3Last(1) = d3Val(1) + If d3Val.Length >= 3 Then + m_d3Last(2) = d3Val(2) + End If + End If + End If + End Sub + Public Sub SetLastIntegers(ByVal nVal1 As Integer, ByVal nVal2 As Integer) m_nLast1 = nVal1 m_nLast2 = nVal2 End Sub + Public Sub SetLastString(ByRef sVal As String) + m_sLast = sVal + End Sub + + Public Sub SetLastBoolean(ByVal bVal As Boolean) + m_bLast = bVal + End Sub + Private Function GetDoubleFromString(ByRef sText As String, ByRef dVal As Double) As Boolean Return Double.TryParse(sText, NumberStyles.Float, CultureInfo.InvariantCulture, dVal) End Function @@ -160,7 +166,7 @@ Public Class Controller End Function Public Sub ResetStatus() - m_nStatus = EST.NULL + m_nStep = 0 m_Scene.ResetStatus() End Sub @@ -170,396 +176,1785 @@ Public Class Controller Public Function ExecuteCommand(ByVal nCmd As CMD) As Boolean ' posso partire solo con stato libero - If m_nStatus <> EST.NULL Then + If m_nStep <> 0 Then Return False End If - ' eseguo il comando - Select Case nCmd + ' salvo ed eseguo il comando + m_nLastCmd = nCmd + ProcessStatus() + Return True + End Function + + Public Function ProcessStatus() As Boolean + Select Case m_nLastCmd + ' Grid Case CMD.GRID - Dim frNew As New Frame3d - Select Case m_nLast1 - Case GRID_TYPE.TOP - frNew.Setup(Point3d.ORIG, Vector3d.X_AX, Vector3d.Y_AX, Vector3d.Z_AX) - Case GRID_TYPE.FRONT - frNew.Setup(Point3d.ORIG, Vector3d.X_AX, Vector3d.Z_AX, -Vector3d.Y_AX) - Case GRID_TYPE.RIGHT - frNew.Setup(Point3d.ORIG, Vector3d.Y_AX, Vector3d.Z_AX, Vector3d.X_AX) - Case GRID_TYPE.BACK - frNew.Setup(Point3d.ORIG, -Vector3d.X_AX, Vector3d.Z_AX, Vector3d.Y_AX) - Case GRID_TYPE.LEFT - frNew.Setup(Point3d.ORIG, -Vector3d.Y_AX, Vector3d.Z_AX, -Vector3d.X_AX) - Case GRID_TYPE.BOTTOM - frNew.Setup(Point3d.ORIG, -Vector3d.X_AX, Vector3d.Y_AX, -Vector3d.Z_AX) - Case Else - Return False - End Select - EgtSetGridFrame(frNew) - EgtDraw() + Return ProcessGrid() + ' Grid origin Case CMD.GRID_ELEVATION + Return ProcessGridElevation() + Case CMD.GRID_ORIGIN + Return ProcessGridOrigin() + ' rotazione Griglia/Cplane + Case CMD.GRID_ROTATE + Return ProcessGridRotate() + ' Griglia/Cplane dati 3 punti + Case CMD.GRID_3P + Return ProcessGrid3P() + ' Nuovo Pezzo + Case CMD.NEWPART + Return ProcessNewPart() + ' Nuovo Layer + Case CMD.NEWLAYER + Return ProcessNewLayer() + ' Imposto pezzo e layer correnti + Case CMD.SETCURRPARTLAYER + Return ProcessSetCurrPartLayer() + ' Cancello pezzo e layer correnti + Case CMD.RESETCURRPARTLAYER + Return ProcessResetCurrPartLayer() + ' Imposto colore del layer + Case CMD.LAYERCOLOR + Return ProcessLayerColor() + ' Seleziono Pezzo/Layer/Oggetto + Case CMD.SELECTPARTLAYEROBJ + Return ProcessSelectPartLayerObj() + ' Deseleziono Pezzo/Layer/Oggetto + Case CMD.DESELECTPARTLAYEROBJ + Return ProcessDeselectPartLayerObj() + ' Riloco Pezzo/Layer/Oggetto + Case CMD.RELOCATEPARTLAYEROBJ + Return ProcessRelocatePartLayerObj() + ' Copio Pezzo/Layer/Oggetto + Case CMD.COPYPARTLAYEROBJ + Return ProcessCopyPartLayerObj() + ' Visualizza + Case CMD.SHOW + Return ProcessShow() + ' Nascondi + Case CMD.HIDE + Return ProcessHide() + ' Name + Case CMD.SETNAME + Return ProcessSetName() + ' Info + Case CMD.SETINFO + Return ProcessSetInfo() + ' Point + Case CMD.POINT + Return ProcessPoint() + ' Line2P + Case CMD.LINE2P + Return ProcessLine2P() + ' CircleCR + Case CMD.CIRCLECR + Return ProcessCircleCR() + ' ArcCSE + Case CMD.ARCCSE + Return ProcessArcCSE() + ' Arc3P + Case CMD.ARC3P + Return ProcessArc3P() + ' Plane + Case CMD.PLANE + Return ProcessPlane() + ' Extrude + Case CMD.EXTRUDE + Return ProcessExtrude() + ' Revolve + Case CMD.REVOLVE + Return ProcessRevolve() + ' Revolve Plus + Case CMD.REVOLVEPLUS + Return ProcessRevolvePlus() + ' Ruled + Case CMD.RULED + Return ProcessRuled() + ' Delete + Case CMD.DELETE + Return ProcessDelete() + ' Change Color + Case CMD.CHANGECOLOR + Return ProcessChangeColor() + ' Reset Color + Case CMD.RESETCOLOR + Return ProcessResetColor() + ' Invert Curve or Surface + Case CMD.INVERTCRVSURF + Return ProcessInvertCurveSurf() + ' Extend Curve + Case CMD.EXTENDCURVE + Return ProcessExtendCurve() + ' Break Curve + Case CMD.BREAKCURVE + Return ProcessBreakCurve() + ' Join Curve + Case CMD.JOINCURVE + Return ProcessJoinCurve() + ' Separate Curve + Case CMD.EXPLODECURVE + Return ProcessExplodeCurve() + ' Move + Case CMD.MOVE + Return ProcessMove() + ' Rotate + Case CMD.ROTATE + ProcessRotate() + ' Rotate 3d + Case CMD.ROTATE3D + ProcessRotate3D() + ' Mirror + Case CMD.MIRROR + ProcessMirror() + ' Scale + Case CMD.SCALE + ProcessScale() + ' Scale 3d + Case CMD.SCALE3D + ProcessScale3D() + Case Else + Return False + End Select + Return True + End Function + + Public Function ExecuteDrag() As Boolean + Select Case m_nLastCmd + Case CMD.GRID_ROTATE + DragGridRotate() + Case CMD.LINE2P + DragLine2P() + Case CMD.CIRCLECR + DragCircleCR() + Case CMD.ARCCSE + DragArcCSE() + Case CMD.ARC3P + DragArc3P() + Case CMD.EXTRUDE + DragExtrude() + Case CMD.REVOLVE + DragRevolve() + Case CMD.REVOLVEPLUS + DragRevolvePlus() + Case CMD.MOVE + DragMove() + Case CMD.ROTATE + DragRotate() + Case CMD.ROTATE3D + DragRotate3D() + Case CMD.MIRROR + DragMirror() + Case CMD.SCALE + DragScale() + Case CMD.SCALE3D + DragScale3D() + Case Else + Return False + End Select + Return True + End Function + + Private Function ProcessGrid() As Boolean + If m_nStep <> 0 Then + Return False + End If + Dim frNew As New Frame3d + Select Case m_nLast1 + Case GRID_TYPE.TOP + frNew.Setup(Point3d.ORIG, Vector3d.X_AX, Vector3d.Y_AX, Vector3d.Z_AX) + Case GRID_TYPE.FRONT + frNew.Setup(Point3d.ORIG, Vector3d.X_AX, Vector3d.Z_AX, -Vector3d.Y_AX) + Case GRID_TYPE.RIGHT + frNew.Setup(Point3d.ORIG, Vector3d.Y_AX, Vector3d.Z_AX, Vector3d.X_AX) + Case GRID_TYPE.BACK + frNew.Setup(Point3d.ORIG, -Vector3d.X_AX, Vector3d.Z_AX, Vector3d.Y_AX) + Case GRID_TYPE.LEFT + frNew.Setup(Point3d.ORIG, -Vector3d.Y_AX, Vector3d.Z_AX, -Vector3d.X_AX) + Case GRID_TYPE.BOTTOM + frNew.Setup(Point3d.ORIG, -Vector3d.X_AX, Vector3d.Y_AX, -Vector3d.Z_AX) + Case Else + Return False + End Select + EgtSetGridFrame(frNew) + EgtDraw() + Return True + End Function + + Private Function ProcessGridElevation() As Boolean + Select Case m_nStep + Case 0 ' non serve il gruppo di drag m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per elevazione griglia - m_nStatus = EST.GRID_ELEVATION_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("GRID", "Insert Elevation", IBT.TY_DOUBLE) - Case CMD.GRID_ORIGIN + Case 1 + ' recupero il piano di griglia corrente + Dim frCurr As New Frame3d + EgtGetGridFrame(frCurr) + ' cambio l'elevazione dell'origine + frCurr.Move(EgtGetGridVersZ() * m_dLast) + ' imposto nuova griglia + EgtSetGridFrame(frCurr) + ' reset stato scena + m_Scene.ResetStatus() + ' aggiorno stato + m_nStep = 0 + RaiseEvent UpdateUI(Me, False) + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessGridOrigin() As Boolean + Select Case m_nStep + Case 0 ' non serve il gruppo di drag m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per origine griglia - m_nStatus = EST.GRID_ORIGIN_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("GRID", "Insert Origin", IBT.TY_POINT3D) - Case CMD.GRID_ROTATE + Case 1 + ' recupero il piano di griglia corrente + Dim frCurr As New Frame3d + EgtGetGridFrame(frCurr) + ' ne modifico l'origine + frCurr.Move(m_ptLast - frCurr.Orig()) + ' imposto nuova griglia + EgtSetGridFrame(frCurr) + ' reset stato scena + m_Scene.ResetStatus() + ' aggiorno stato + m_nStep = 0 + RaiseEvent UpdateUI(Me, False) + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessGridRotate() As Boolean + Select Case m_nStep + Case 0 ' non serve il gruppo di drag m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per rotazione griglia - m_nStatus = EST.GRID_ROTATE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("GRID ROTATE", "Insert First Point on Axis", IBT.TY_POINT3D) - Case CMD.GRID_3P + Case 1 + m_ptP1 = m_ptLast + m_ptP2 = m_ptP1 + m_nStep = 2 + RaiseEvent SetInputBox("GRID ROTATE", "Insert Second Point on Axis", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + RaiseEvent SetInputBox("GRID ROTATE", "Insert angle", IBT.TY_DOUBLE) + Case 3 + ' eseguo rotazione + Dim VtAx As Vector3d = m_ptP2 - m_ptP1 + Dim frCurr As New Frame3d + EgtGetGridFrame(frCurr) + frCurr.Rotate(m_ptP1, VtAx, m_dLast) + EgtSetGridFrame(frCurr) + ' reset + m_Scene.ResetStatus() + m_nStep = 0 + RaiseEvent UpdateUI(Me, False) + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragGridRotate() + If m_nStep = 2 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + ElseIf m_nStep = 3 Then + EgtSetGeoLine(m_ptP1, m_ptP2) + EgtDraw() + End If + End Sub + + Private Function ProcessGrid3P() As Boolean + Select Case m_nStep + Case 0 ' non serve il gruppo di drag m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per rotazione griglia - m_nStatus = EST.GRID_3P_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("GRID 3 POINTS", "Insert Origin", IBT.TY_POINT3D) - Case CMD.NEWPART - ' inserisco un nuovo gruppo (piece) sotto la radice - Dim nIdNewPart As Integer = EgtCreateGroup(GDB_ID.ROOT) - ' inserisco un nuovo gruppo (layer) sotto quello appena creato - Dim nIdNewLayer As Integer = EgtCreateGroup(nIdNewPart) - ' se ok, salvo nuova situazione - If nIdNewPart <> GDB_ID.NULL And nIdNewLayer <> GDB_ID.NULL Then - m_nCurrPart = nIdNewPart - m_nCurrLayer = nIdNewLayer - SetModified() + Case 1 + m_ptP1 = m_ptLast + m_ptP2 = m_ptP1 + m_nStep = 2 + RaiseEvent SetInputBox("GRID 3 POINTS", "Insert Point on X Axis", IBT.TY_POINT3D) + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + RaiseEvent SetInputBox("GRID 3 POINTS", "Insert Point Near Y Axis", IBT.TY_POINT3D) + Case 3 + ' calcolo griglia per 3 punti + Dim frCurr As New Frame3d + If Not frCurr.Setup(m_ptP1, m_ptP2, m_ptLast) Then + m_Scene.ResetStatus() + m_nStep = 0 + Return False End If - Case CMD.NEWLAYER - ' inserisco un nuovo gruppo (layer) sotto il pezzo corrente - Dim nIdNewLayer As Integer = EgtCreateGroup(m_nCurrPart) - ' se ok, salvo nuova situazione - If nIdNewLayer <> GDB_ID.NULL Then - m_nCurrLayer = nIdNewLayer - SetModified() + EgtSetGridFrame(frCurr) + ' reset + m_Scene.ResetStatus() + m_nStep = 0 + RaiseEvent UpdateUI(Me, False) + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessNewPart() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' inserisco un nuovo gruppo (piece) sotto la radice + Dim nIdNewPart As Integer = EgtCreateGroup(GDB_ID.ROOT) + ' inserisco un nuovo gruppo (layer) sotto quello appena creato + Dim nIdNewLayer As Integer = EgtCreateGroup(nIdNewPart) + ' se ok, salvo nuova situazione + If nIdNewPart <> GDB_ID.NULL And nIdNewLayer <> GDB_ID.NULL Then + m_nCurrPart = nIdNewPart + m_nCurrLayer = nIdNewLayer + SetModified() + End If + Return True + End Function + + Private Function ProcessNewLayer() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' inserisco un nuovo gruppo (layer) sotto il pezzo corrente + Dim nIdNewLayer As Integer = EgtCreateGroup(m_nCurrPart) + ' se ok, salvo nuova situazione + If nIdNewLayer <> GDB_ID.NULL Then + m_nCurrLayer = nIdNewLayer + SetModified() + End If + Return True + End Function + + Private Function ProcessSetCurrPartLayer() As Boolean + If m_nStep <> 0 Then + Return False + End If + SetCurrPartLayer(m_nLast1, m_nLast2) + Return True + End Function + + Private Function ProcessResetCurrPartLayer() As Boolean + If m_nStep <> 0 Then + Return False + End If + ResetCurrPartLayer() + Return True + End Function + + Private Function ProcessLayerColor() As Boolean + If m_nStep <> 0 Then + Return False + End If + Dim nCurrId As Integer + If m_nCurrPart <> GDB_ID.NULL Then + nCurrId = m_nCurrPart + If m_nCurrLayer <> GDB_ID.NULL Then + nCurrId = m_nCurrLayer End If - Case CMD.SETCURRPARTLAYER - SetCurrPartLayer(m_nLast1, m_nLast2) - Case CMD.RESETCURRPARTLAYER - ResetCurrPartLayer() - Case CMD.LAYERCOLOR - Dim nCurrId As Integer - If m_nCurrPart <> GDB_ID.NULL Then - nCurrId = m_nCurrPart - If m_nCurrLayer <> GDB_ID.NULL Then - nCurrId = m_nCurrLayer + Else + Return False + End If + Dim ColDlg As New ColorDialog + ColDlg.AnyColor = True + Dim colObj As Color3d + EgtGetCalcColor(nCurrId, colObj) + ColDlg.Color = colObj.ToColor() + ColDlg.FullOpen = True + If ColDlg.ShowDialog() = Windows.Forms.DialogResult.OK Then + colObj.FromColor(ColDlg.Color) + EgtSetColor(nCurrId, colObj) + SetModified() + EgtDraw() + End If + Return True + End Function + + Private Function ProcessSelectPartLayerObj() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' se gruppo + If EgtGetType(m_nLast1) = GDB_TY.GROUP Then + ' se pezzo + If EgtGetParent(m_nLast1) = GDB_ID.ROOT Then + ' seleziono tutti gli oggetti del pezzo + If Not EgtSelectPartObjs(m_nLast1) Then + Return False End If + ' se layer + ElseIf EgtGetParent(EgtGetParent(m_nLast1)) = GDB_ID.ROOT Then + ' seleziono tutti gli oggetti del layer + If Not EgtSelectLayerObjs(m_nLast1) Then + Return False + End If + ' altrimenti errore Else Return False End If - Dim ColDlg As New ColorDialog - ColDlg.AnyColor = True - Dim colObj As Color3d - EgtGetCalcColor(nCurrId, colObj) - ColDlg.Color = colObj.ToColor() - ColDlg.FullOpen = True - If ColDlg.ShowDialog() = Windows.Forms.DialogResult.OK Then - colObj.FromColor(ColDlg.Color) - EgtSetColor(nCurrId, colObj) - SetModified() + ' altrimenti entità + Else + ' la seleziono + If Not EgtSelectObj(m_nLast1) Then + Return False + End If + End If + SetModified() + EgtDraw() + Return True + End Function + + Private Function ProcessDeselectPartLayerObj() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' se gruppo + If EgtGetType(m_nLast1) = GDB_TY.GROUP Then + ' se pezzo + If EgtGetParent(m_nLast1) = GDB_ID.ROOT Then + ' deseleziono tutti gli oggetti del pezzo + If Not EgtDeselectPartObjs(m_nLast1) Then + Return False + End If + ' se layer + ElseIf EgtGetParent(EgtGetParent(m_nLast1)) = GDB_ID.ROOT Then + ' deseleziono tutti gli oggetti del layer + If Not EgtDeselectLayerObjs(m_nLast1) Then + Return False + End If + ' altrimenti errore + Else + Return False + End If + ' altrimenti entità + Else + ' la deseleziono + If Not EgtDeselectObj(m_nLast1) Then + Return False + End If + End If + SetModified() + EgtDraw() + Return True + End Function + + Private Function ProcessRelocatePartLayerObj() As Boolean + If m_nStep <> 0 Then + Return False + End If + Dim nRefId As Integer = GDB_ID.NULL + Dim nPos As GDB_POS = GDB_POS.SON + ' se gruppo + If EgtGetType(m_nLast1) = GDB_TY.GROUP Then + ' se pezzo + If EgtGetParent(m_nLast1) = GDB_ID.ROOT Then + ' il riferimento è dopo l'ultimo sotto la radice + nRefId = EgtGetLastInGroup(GDB_ID.ROOT) + nPos = GDB_POS.AFTER + ' se layer + ElseIf EgtGetParent(EgtGetParent(m_nLast1)) = GDB_ID.ROOT Then + ' il riferimento è il pezzo corrente + nRefId = m_nCurrPart + ' se il pezzo sorgente è il corrente + If EgtGetParent(m_nLast1) = m_nCurrPart Then + ' il riferimento è dopo l'ultimo sotto il pezzo + nRefId = EgtGetLastInGroup(m_nCurrPart) + nPos = GDB_POS.AFTER + End If + ' altrimenti errore + Else + Return False + End If + ' altrimenti entità + Else + ' il riferimento è il layer corrente + nRefId = m_nCurrLayer + ' se il layer sorgente è il corrente + If EgtGetParent(m_nLast1) = m_nCurrLayer Then + ' il riferimento è dopo l'ultimo sotto il layer + nRefId = EgtGetLastInGroup(m_nCurrLayer) + nPos = GDB_POS.AFTER + End If + End If + EgtRelocateGlob(m_nLast1, nRefId, nPos) + SetModified() + EgtDraw() + Return True + End Function + + Private Function ProcessCopyPartLayerObj() As Boolean + If m_nStep <> 0 Then + Return False + End If + EgtDeselectAll() + Dim nNewId = GDB_ID.NULL + ' se gruppo + If EgtGetType(m_nLast1) = GDB_TY.GROUP Then + ' se pezzo + If EgtGetParent(m_nLast1) = GDB_ID.ROOT Then + ' eseguo copia + nNewId = EgtCopyGlob(m_nLast1, GDB_ID.ROOT) + ' seleziono tutti gli oggetti del pezzo + If Not EgtSelectPartObjs(nNewId) Then + Return False + End If + ' se layer + ElseIf EgtGetParent(EgtGetParent(m_nLast1)) = GDB_ID.ROOT Then + ' eseguo copia + nNewId = EgtCopyGlob(m_nLast1, m_nCurrPart) + ' seleziono tutti gli oggetti del layer + If Not EgtSelectLayerObjs(nNewId) Then + Return False + End If + ' altrimenti errore + Else + Return False + End If + ' altrimenti entità + Else + ' eseguo copia + nNewId = EgtCopyGlob(m_nLast1, m_nCurrLayer) + ' la seleziono + If Not EgtSelectObj(nNewId) Then + Return False + End If + End If + ' dichiaro modifica + SetModified() + ' 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_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("MOVE", "Insert Base Point", IBT.TY_POINT3D) + Return True + End Function + + Private Function ProcessShow() As Boolean + If m_nStep <> 0 Then + Return False + End If + If m_nLast1 <> GDB_ID.NULL Then + Dim nStat As GDB_ST = GDB_ST.ON_ + EgtGetStatus(m_nLast1, nStat) + If nStat = GDB_ST.OFF Then + EgtSetStatus(m_nLast1, GDB_ST.ON_) + SetModified(False) EgtDraw() End If - Case CMD.SHOW - If m_nLast1 <> GDB_ID.NULL Then - Dim nStat As GDB_ST = GDB_ST.ON_ - EgtGetStatus(m_nLast1, nStat) - If nStat = GDB_ST.OFF Then - EgtSetStatus(m_nLast1, GDB_ST.ON_) - SetModified(False) - EgtDraw() + End If + Return True + End Function + + Private Function ProcessHide() As Boolean + If m_nStep <> 0 Then + Return False + End If + If m_nLast1 <> GDB_ID.NULL Then + Dim nStat As GDB_ST = GDB_ST.ON_ + EgtGetStatus(m_nLast1, nStat) + If nStat <> GDB_ST.OFF Then + EgtSetStatus(m_nLast1, GDB_ST.OFF) + SetModified(False) + EgtDraw() + End If + End If + Return True + End Function + + Private Function ProcessSetName() As Boolean + Select Case m_nStep + Case 0 + ' posso partire solo se esiste una entità riferita + If m_nLast1 = GDB_ID.NULL Then + Return False + End If + ' recupero e imposto eventuale nome già assegnato + m_sLast = String.Empty + EgtGetName(m_nLast1, m_sLast) + ' imposto stato a prima stringa per nome + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("NAME", "Insert Name", IBT.TY_STRING) + RaiseEvent SetInputBoxString(m_sLast) + Case 1 + ' assegno il nome + If Not String.IsNullOrWhiteSpace(m_sLast) Then + EgtSetName(m_nLast1, m_sLast) + Else + EgtRemoveName(m_nLast1) + End If + ' reset stato scena + m_Scene.ResetStatus() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessSetInfo() As Boolean + Select Case m_nStep + Case 0 + ' posso partire solo se esiste una entità riferita + If m_nLast1 = GDB_ID.NULL Then + Return False + End If + ' imposto stato a prima stringa per info + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("INFO", "Insert Info (Key=Val)", IBT.TY_STRING) + Case 1 + ' divido la stringa in chiave e valore + Dim sItems() As String = m_sLast.Split("=".ToCharArray) + If sItems.Count() = 2 Then + ' assegno l'info + If Not String.IsNullOrWhiteSpace(sItems(1)) Then + EgtSetInfo(m_nLast1, sItems(0), sItems(1)) + ' rimuovo l'info + Else + EgtRemoveInfo(m_nLast1, sItems(0)) End If End If - Case CMD.HIDE - If m_nLast1 <> GDB_ID.NULL Then - Dim nStat As GDB_ST = GDB_ST.ON_ - EgtGetStatus(m_nLast1, nStat) - If nStat <> GDB_ST.OFF Then - EgtSetStatus(m_nLast1, GDB_ST.OFF) - SetModified(False) - EgtDraw() - End If - End If - Case CMD.POINT - ' posso partire solo se esiste un gruppo corrente + ' reset stato scena + m_Scene.ResetStatus() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessPoint() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente If GetCurrLayer() = GDB_ID.NULL Then Return False End If ' non serve il gruppo di drag - m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per point - m_nStatus = EST.POINT_1 - ' abilito dialogo - RaiseEvent SetInputBox("POINT", "Insert Point ", IBT.TY_POINT3D) - Case CMD.LINE2P - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then - Return False - End If - ' creo il gruppo di drag - If Not m_Scene.CreateDragGroup() Then - Return False - End If m_Scene.SetStatusSelPoint() - ' imposto stato a primo punto per Line2P - m_nStatus = EST.LINE2P_1 + m_nStep = 1 ' abilito dialogo - RaiseEvent SetInputBox("LINE", "Insert Start Point ", IBT.TY_POINT3D) - Case CMD.CIRCLECR - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then + RaiseEvent SetInputBox("POINT", "Insert Point", IBT.TY_POINT3D) + RaiseEvent SetInputBoxPoint3d(m_ptCont) + Case 1 + ' creo il punto (i dati sono in globale) + If EgtCreateGeoPoint(GetCurrLayer(), m_ptLast.Loc(GetCurrLayer())) Then + m_ptCont = m_ptLast + End If + ' reset stato scena + m_Scene.ResetStatus() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessLine2P() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If - ' creo il gruppo di drag - If Not m_Scene.CreateDragGroup() Then + ' imposto stato a primo punto per Line2P + m_Scene.SetStatusSelPoint() + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("LINE", "Insert Start Point", IBT.TY_POINT3D) + RaiseEvent SetInputBoxPoint3d(m_ptCont) + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("LINE", "Insert End Point ", IBT.TY_POINT3D) + RaiseEvent SetInputBoxPoint3d(m_ptLast.Loc(GetCurrLayer())) + RaiseEvent AddButtonShow() + Case 2 + ' reset scena + m_Scene.ResetStatus(False) + ' creo la linea (i punti sono in globale) + If EgtCreateCurveLine(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer())) Then + m_ptCont = m_ptLast + End If + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragLine2P() + If m_nStep = 2 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If nId = GDB_ID.NULL Then + EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) + Else + EgtModifyCurveEndPoint(nId, m_ptLast) + End If + EgtDraw() + End If + End Sub + + Private Function ProcessCircleCR() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per CircleCR - m_nStatus = EST.CIRCLECR_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("CIRCLE", "Insert Center", IBT.TY_POINT3D) - Case CMD.ARCCSE - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("CIRCLE", "Insert Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + ' reset scena + m_Scene.ResetStatus(False) + ' creo la circonferenza (i punti sono in globale) + EgtCreateCurveCircleCPN(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), EgtGetGridVersZ()) + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragCircleCR() + If m_nStep = 2 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If nId = GDB_ID.NULL Then + EgtCreateCurveCircleCPN(m_Scene.GetDragGroup(), m_ptP1, m_ptLast, EgtGetGridVersZ()) + Else + EgtModifyCurveCircleCPN(nId, m_ptLast) + End If + EgtDraw() + End If + End Sub + + Private Function ProcessArcCSE() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If - ' creo il gruppo di drag - If Not m_Scene.CreateDragGroup() Then - Return False - End If - m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per ArcCSE - m_nStatus = EST.ARCCSE_1 + m_Scene.SetStatusSelPoint() + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("ARC", "Insert Center", IBT.TY_POINT3D) - Case CMD.ARC3P - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ARC", "Insert Start Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ARC", "Insert Point Near End", IBT.TY_POINT3D) + Case 3 + ' reset scena + m_Scene.ResetStatus(False) + ' creo l'arco (i punti sono in globale) + Dim nId = EgtCreateCurveArcC2PN(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptP2.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), EgtGetGridVersZ()) + If nId <> GDB_ID.NULL Then + Dim PtP As Point3d + EgtEndPoint(nId, PtP) + m_ptCont = PtP.Glob(GetCurrLayer()) + End If + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragArcCSE() + If m_nStep = 2 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If nId = GDB_ID.NULL Then + EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) + Else + EgtModifyCurveEndPoint(nId, m_ptLast) + End If + EgtDraw() + ElseIf m_nStep = 3 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If EgtGetType(nId) <> GDB_TY.CRV_ARC Then + EgtErase(nId) + nId = GDB_ID.NULL + End If + If nId = GDB_ID.NULL Then + EgtCreateCurveArcC2PN(m_Scene.GetDragGroup(), m_ptP1, m_ptP2, m_ptLast, EgtGetGridVersZ()) + Else + EgtModifyCurveArcC2PN(nId, m_ptLast) + End If + EgtDraw() + End If + End Sub + + Private Function ProcessArc3P() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If - ' creo il gruppo di drag - If Not m_Scene.CreateDragGroup() Then - Return False - End If - m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per Arc3P - m_nStatus = EST.ARC3P_1 + m_Scene.SetStatusSelPoint() + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("ARC", "Insert Start Point", IBT.TY_POINT3D) - Case CMD.PLANE - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then - Return False + RaiseEvent SetInputBoxPoint3d(m_ptCont) + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ARC", "Insert End Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ARC", "Insert Mid Point", IBT.TY_POINT3D) + Case 3 + ' reset scena + m_Scene.ResetStatus(False) + ' creo l'arco (i punti sono in globale) + If EgtCreateCurveArc3P(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), m_ptP2.Loc(GetCurrLayer())) Then + m_ptCont = m_ptP2 End If - ' creo la superficie piana (a partire da un contorno selezionato) - EgtCreateSurfTriMeshByContour(GetCurrLayer(), EgtGetFirstSelectedObj(), EPS_STM) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL + EgtDraw() + ' aggiorno stato + m_nStep = 0 SetModified() - Case CMD.EXTRUDE - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then - Return False + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragArc3P() + If m_nStep = 2 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If nId = GDB_ID.NULL Then + EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) + Else + EgtModifyCurveEndPoint(nId, m_ptLast) End If - ' creo il gruppo di drag - If Not m_Scene.CreateDragGroup() Then + EgtDraw() + ElseIf m_nStep = 3 Then + ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If EgtGetType(nId) <> GDB_TY.CRV_ARC Then + EgtErase(nId) + nId = GDB_ID.NULL + End If + If nId = GDB_ID.NULL Then + EgtCreateCurveArc3P(m_Scene.GetDragGroup(), m_ptP1, m_ptLast, m_ptP2) + Else + EgtModifyCurveArc3P(nId, m_ptLast) + End If + EgtDraw() + End If + End Sub + + Private Function ProcessPlane() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' posso partire solo se esiste un gruppo corrente + If GetCurrLayer() = GDB_ID.NULL Then + Return False + End If + ' creo la superficie piana (a partire da un contorno selezionato) + EgtCreateSurfTriMeshByContour(GetCurrLayer(), EgtGetLastSelectedObj(), EPS_STM) + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessExtrude() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If ' imposto stato a lunghezza di estrusione - m_nStatus = EST.EXTRUDE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("EXTRUSION", "Insert length", IBT.TY_DOUBLE) - Case CMD.REVOLVE - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then + RaiseEvent AddButtonShow() + Case 1 + ' reset scena + m_Scene.ResetStatus(False) + ' creo la superficie di estrusione (a partire da un contorno selezionato) + Dim VtExtr As Vector3d = EgtGetGridVersZ().Loc(GetCurrLayer()) * m_dLast + EgtCreateSurfTriMeshByExtrusion(GetCurrLayer(), EgtGetLastSelectedObj(), VtExtr, EPS_STM) + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragExtrude() + If m_nStep = 1 Then + ' cancello eventuale vecchia superficie di estrusione + EgtErase(EgtGetFirstInGroup(m_Scene.GetDragGroup())) + ' creo la superficie di estrusione (a partire da un contorno selezionato) + Dim VtExtr As New Vector3d(0, 0, m_dLast) + EgtCreateSurfTriMeshByExtrusion(m_Scene.GetDragGroup(), EgtGetLastSelectedObj(), VtExtr, EPS_STM) + EgtDraw() + End If + End Sub + + Private Function ProcessRevolve() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If + ' imposto stato a primo punto m_Scene.SetStatusSelPoint() - ' imposto stato a primo punto per Revolve - m_nStatus = EST.REVOLVE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("REVOLVE", "Insert First Point on Axis", IBT.TY_POINT3D) - Case CMD.DELETE - If m_nLast1 <> GDB_ID.NULL Then - EgtErase(m_nLast1) - If m_nLast1 = m_nCurrPart Then - ResetCurrPartLayer() - ElseIf m_nLast1 = m_nCurrLayer Then - SetCurrPartLayer(m_nCurrPart, EgtGetFirstGroupInGroup(m_nCurrPart)) - End If - ' reset - m_Scene.ResetStatus() - m_nStatus = EST.NULL - SetModified() - End If - Case CMD.CHANGECOLOR - ' verifico ci sia qualcosa di selezionato - Dim nId As Integer = EgtGetFirstSelectedObj() - If nId = GDB_ID.NULL Then + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("REVOLVE", "Insert Second Point on Axis", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + ' reset scena + m_Scene.ResetStatus(False) + ' creo la superficie di rivoluzione (i punti sono in globale) + Dim vtAx As Vector3d = m_ptLast - m_ptP1 + EgtCreateSurfTriMeshByScrewing(GetCurrLayer(), EgtGetLastSelectedObj(), + m_ptP1.Loc(GetCurrLayer()), vtAx.Loc(GetCurrLayer()), + 360, 0, EPS_STM) + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragRevolve() + If m_nStep = 2 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + End If + End Sub + + Private Function ProcessRevolvePlus() As Boolean + Select Case m_nStep + Case 0 + ' deve esistere un gruppo corrente e devo poter creare il gruppo di drag + If GetCurrLayer() = GDB_ID.NULL Or Not m_Scene.CreateDragGroup() Then Return False End If - ' lancio dialogo scelta colore - Dim ColDlg As New ColorDialog() - ColDlg.AnyColor = True - Dim colObj As Color3d - EgtGetCalcColor(nId, colObj) - ColDlg.Color = colObj.ToColor() - ColDlg.FullOpen = True - If ColDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then - Return False + ' imposto stato a primo punto + m_Scene.SetStatusSelPoint() + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("REVOLVE+", "Insert First Point on Axis", IBT.TY_POINT3D) + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("REVOLVE+", "Insert Second Point on Axis", IBT.TY_POINT3D) + Case 2 + m_ptP2 = m_ptLast + m_dLast = 360 + m_nStep = 3 + m_Scene.DisableDrag() + RaiseEvent SetInputBox("REVOLVE+", "Insert Angle", IBT.TY_DOUBLE) + RaiseEvent SetInputBoxString("360") + RaiseEvent AddButtonShow() + Case 3 + m_ptP2 = m_ptLast + m_dPrev = m_dLast + m_dLast = 0 + m_nStep = 4 + m_Scene.DisableDrag() + RaiseEvent SetInputBox("REVOLVE+", "Insert Move", IBT.TY_DOUBLE) + RaiseEvent SetInputBoxString("0") + Case 4 + ' reset scena + m_Scene.ResetStatus(False) + ' creo la superficie di rivoluzione (i punti sono in globale) + Dim vtAx As Vector3d = m_ptP2 - m_ptP1 + EgtCreateSurfTriMeshByScrewing(GetCurrLayer(), EgtGetLastSelectedObj(), + m_ptP1.Loc(GetCurrLayer()), vtAx.Loc(GetCurrLayer()), + m_dPrev, m_dLast, EPS_STM) + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragRevolvePlus() + If m_nStep = 2 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + ElseIf m_nStep = 3 Then + EgtSetGeoLine(m_ptP1, m_ptP2) + ' cancello eventuale vecchia superficie + EgtErase(EgtGetFirstInGroup(m_Scene.GetDragGroup())) + ' creo la superficie di rivoluzione (i punti sono in globale) + Dim vtAx As Vector3d = m_ptP2 - m_ptP1 + EgtCreateSurfTriMeshByScrewing(m_Scene.GetDragGroup(), EgtGetLastSelectedObj(), + m_ptP1, vtAx, m_dLast, 0, EPS_STM) + EgtDraw() + ElseIf m_nStep = 4 Then + EgtSetGeoLine(m_ptP1, m_ptP2) + ' cancello eventuale vecchia superficie + EgtErase(EgtGetFirstInGroup(m_Scene.GetDragGroup())) + ' creo la superficie di rivoluzione (i punti sono in globale) + Dim vtAx As Vector3d = m_ptP2 - m_ptP1 + EgtCreateSurfTriMeshByScrewing(m_Scene.GetDragGroup(), EgtGetLastSelectedObj(), + m_ptP1, vtAx, m_dPrev, m_dLast, EPS_STM) + EgtDraw() + End If + End Sub + + Private Function ProcessRuled() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' posso partire solo se esiste un gruppo corrente + If GetCurrLayer() = GDB_ID.NULL Then + Return False + End If + ' creo la superficie rigata (a partire da due contorni selezionati) + Dim nLastId As Integer = EgtGetLastSelectedObj() + Dim nPrevId As Integer = EgtGetPrevSelectedObj() + EgtCreateSurfTriMeshRuled(GetCurrLayer(), nPrevId, nLastId, EPS_STM) + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessDelete() As Boolean + If m_nStep <> 0 Then + Return False + End If + If m_nLast1 <> GDB_ID.NULL Then + EgtErase(m_nLast1) + If m_nLast1 = m_nCurrPart Then + ResetCurrPartLayer() + ElseIf m_nLast1 = m_nCurrLayer Then + SetCurrPartLayer(m_nCurrPart, EgtGetFirstGroupInGroup(m_nCurrPart)) End If - ' assegno nuovo colore - colObj.FromColor(ColDlg.Color) - EgtSetColor(GDB_ID.SEL, colObj) + ' reset + m_Scene.ResetStatus() + m_nStep = 0 + SetModified() + End If + Return True + End Function + + Private Function ProcessChangeColor() 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 + ' lancio dialogo scelta colore + Dim ColDlg As New ColorDialog() + ColDlg.AnyColor = True + Dim colObj As Color3d + EgtGetCalcColor(nId, colObj) + ColDlg.Color = colObj.ToColor() + ColDlg.FullOpen = True + If ColDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then + Return False + End If + ' assegno nuovo colore + colObj.FromColor(ColDlg.Color) + EgtSetColor(GDB_ID.SEL, colObj) + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessResetColor() 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 + ' reset colore + EgtResetColor(GDB_ID.SEL) + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessInvertCurveSurf() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' lancio l'inversione delle curve/superfici + 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 + EgtInvertCurve(nId) + Case GDB_TY.SRF_MESH + EgtInvertSurface(nId) + End Select + nId = EgtGetNextSelectedObj() + End While + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessExtendCurve() As Boolean + Select Case m_nStep + Case 0 + ' imposto stato a lunghezza di estensione + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("EXTEND", "Insert Length", IBT.TY_DOUBLE) + Case 1 + ' eseguo estensione sull'estremo più vicino al punto di selezione + Dim nId As Integer = EgtGetLastSelectedObj() + EgtExtendCurveByLen(nId, m_dLast, m_ptLast.Loc(nId)) EgtDeselectAll() ' reset stato scena m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL + ' aggiorno stato + m_nStep = 0 SetModified() - Case CMD.RESETCOLOR - ' verifico ci sia qualcosa di selezionato - Dim nId As Integer = EgtGetFirstSelectedObj() - If nId = GDB_ID.NULL Then - Return False - End If - ' reset colore - EgtResetColor(GDB_ID.SEL) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL - SetModified() - Case CMD.INVERTCRVSURF - ' lancio l'inversione delle curve/superfici - 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 - EgtInvertCurve(nId) - Case GDB_TY.SRF_MESH - EgtInvertSurface(nId) - End Select - nId = EgtGetNextSelectedObj() - End While - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL - SetModified() - Case CMD.BREAKCURVE + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessBreakCurve() As Boolean + Select Case m_nStep + Case 0 m_Scene.SetStatusSelPoint() ' imposto stato a punto per BreakCurve - m_nStatus = EST.BREAKCURVE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("BREAK", "Insert Point on Curve", IBT.TY_POINT3D) - Case CMD.JOINCURVE - ' posso partire solo se esiste un gruppo corrente - If GetCurrLayer() = GDB_ID.NULL Then - Return False - End If - ' creo vettore di entità selezionate - Dim nCrvNum As Integer = 0 - Dim nCrvIds(EgtGetSelectedObjNbr() - 1) As Integer - Dim nId As Integer = EgtGetFirstSelectedObj() - While nId <> GDB_ID.NULL - nCrvIds(nCrvNum) = nId - nCrvNum = nCrvNum + 1 - nId = EgtGetNextSelectedObj() - End While - ' creo la curva composita (concatenando le curve selezionate) - EgtCreateCurveCompoByChain(GetCurrLayer(), nCrvNum, nCrvIds, New Point3d, True) + Case 1 + ' eseguo spezzatura + EgtSplitCurveAtPoint(EgtGetLastSelectedObj(), m_ptLast) EgtDeselectAll() ' reset stato scena m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL + ' aggiorno stato + m_nStep = 0 SetModified() - Case CMD.SEPARATECURVE - ' divido la curva composita nelle curve componenti - EgtSeparateCurveCompo(EgtGetFirstSelectedObj()) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' reset stato - m_nStatus = EST.NULL - SetModified() - Case CMD.MOVE + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Function ProcessJoinCurve() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' posso partire solo se esiste un gruppo corrente + If GetCurrLayer() = GDB_ID.NULL Then + Return False + End If + ' creo vettore di entità selezionate + Dim nCrvNum As Integer = 0 + Dim nCrvIds(EgtGetSelectedObjNbr() - 1) As Integer + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + nCrvIds(nCrvNum) = nId + nCrvNum = nCrvNum + 1 + nId = EgtGetNextSelectedObj() + End While + ' creo la curva composita (concatenando le curve selezionate) + EgtCreateCurveCompoByChain(GetCurrLayer(), nCrvNum, nCrvIds, New Point3d, True) + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessExplodeCurve() As Boolean + If m_nStep <> 0 Then + Return False + End If + ' opero su tutti gli oggetti selezionati + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + ' recupero il successivo, perchè il corrente verrà cancellato + Dim nNextId = EgtGetNextSelectedObj() + ' eseguo esplosione + Select Case EgtGetType(nId) + Case GDB_TY.CRV_COMPO + ' separo la curva composita nelle curve componenti + EgtSeparateCurveCompo(nId) + Case GDB_TY.CRV_BEZ + ' approssimo la curva di Bezier con archi + EgtExplodeCurveBezier(nId, 10 * EPS_SMALL, True) + Case GDB_TY.EXT_TEXT + ' esplodo il testo nei suoi contorni + EgtExplodeText(nId) + End Select + ' passo al successivo + nId = nNextId + End While + EgtDeselectAll() + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + SetModified() + Return True + End Function + + Private Function ProcessMove() As Boolean + Select Case m_nStep + Case 0 ' verifico condizioni e preparo per il drag If Not PrepareTransform() Then Return False End If m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per Move - m_nStatus = EST.MOVE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("MOVE", "Insert Base Point", IBT.TY_POINT3D) - Case CMD.COPY - ' verifico condizioni e preparo per il drag - If Not PrepareTransform() Then - Return False + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("MOVE", "Insert Target Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_Scene.ResetStatus(False) + ' eseguo copia e movimento + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtMoveGlob(nCopyId, (m_ptLast - m_ptP1)) + nId = EgtGetNextSelectedObj() + End While + ' eseguo movimento + Else + EgtMoveGlob(GDB_ID.SEL, (m_ptLast - m_ptP1)) End If - m_Scene.SetStatusSelPoint() - ' imposto stato a primo punto per Move - m_nStatus = EST.COPY_1 - ' abilito dialogo - RaiseEvent SetInputBox("COPY", "Insert Base Point", IBT.TY_POINT3D) - Case CMD.ROTATE + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragMove() + If m_nStep = 2 Then + ' ripristino lo stato iniziale + EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) + ' eseguo tutto il movimento + EgtMoveGlob(m_Scene.GetDragGroup(), (m_ptLast - m_ptP1)) + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + End If + End Sub + + Private Function ProcessRotate() As Boolean + Select Case m_nStep + Case 0 ' verifico condizioni e preparo per il drag If Not PrepareTransform() Then Return False End If m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per Rotate - m_nStatus = EST.ROTATE_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("ROTATE", "Insert Center", IBT.TY_POINT3D) - Case CMD.ROTATE3D + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ROTATE", "Insert Base Point", IBT.TY_POINT3D) + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + m_Scene.EnableDrag() + EgtSetGeoLine(m_ptP1, m_ptLast) + RaiseEvent SetInputBox("ROTATE", "Insert Rotation Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 3 + m_Scene.ResetStatus(False) + ' calcolo parametri di rotazione + Dim dAngRotDeg As Double = 0 + Dim bDet As Boolean = True + EgtGetVectorRotation((m_ptP2 - m_ptP1), (m_ptLast - m_ptP1), EgtGetGridVersZ(), dAngRotDeg, bDet) + ' eseguo copia e rotazione + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtRotateGlob(nCopyId, m_ptP1, EgtGetGridVersZ(), dAngRotDeg) + nId = EgtGetNextSelectedObj() + End While + ' eseguo rotazione + Else + EgtRotateGlob(GDB_ID.SEL, m_ptP1, EgtGetGridVersZ(), dAngRotDeg) + End If + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragRotate() + If m_nStep = 2 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + ElseIf m_nStep = 3 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + ' ripristino lo stato iniziale + EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) + ' eseguo rotazione + Dim dAngRotDeg As Double = 0 + Dim bDet As Boolean = True + EgtGetVectorRotation((m_ptP2 - m_ptP1), (m_ptLast - m_ptP1), EgtGetGridVersZ(), dAngRotDeg, bDet) + EgtRotateGlob(m_Scene.GetDragGroup(), m_ptP1, EgtGetGridVersZ(), dAngRotDeg) + EgtDraw() + End If + End Sub + + Private Function ProcessRotate3D() As Boolean + Select Case m_nStep + Case 0 ' verifico condizioni e preparo per il drag If Not PrepareTransform() Then Return False End If m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per Rotate3d - m_nStatus = EST.ROTATE3D_1 + m_nStep = 1 ' abilito dialogo - RaiseEvent SetInputBox("ROTATE3D", "Insert First Point on Axis", IBT.TY_POINT3D) - Case CMD.MIRROR + RaiseEvent SetInputBox("ROTATE 3D", "Insert First Point on Axis", IBT.TY_POINT3D) + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_ptP2 = m_ptP1 + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("ROTATE 3D", "Insert Second Point on Axis", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_ptP2 = m_ptLast + m_nStep = 3 + m_dLast = 0 + ' abilito dialogo + RaiseEvent SetInputBox("ROTATE 3D", "Insert angle", IBT.TY_DOUBLE) + Case 3 + m_Scene.ResetStatus(False) + ' calcolo parametri di rotazione + Dim VtAx As Vector3d = m_ptP2 - m_ptP1 + ' eseguo copia e rotazione + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtRotateGlob(nCopyId, m_ptP1, VtAx, m_dLast) + nId = EgtGetNextSelectedObj() + End While + ' eseguo rotazione + Else + EgtRotateGlob(GDB_ID.SEL, m_ptP1, VtAx, m_dLast) + End If + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragRotate3D() + If m_nStep = 2 Then + EgtSetGeoLine(m_ptP1, m_ptLast) + EgtDraw() + ElseIf m_nStep = 3 Then + EgtSetGeoLine(m_ptP1, m_ptP2) + ' ripristino lo stato iniziale + EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) + ' eseguo rotazione + Dim VtAx As Vector3d = m_ptP2 - m_ptP1 + EgtRotateGlob(m_Scene.GetDragGroup(), m_ptP1, VtAx, m_dLast) + EgtDraw() + End If + End Sub + + Private Function ProcessMirror() As Boolean + Select Case m_nStep + Case 0 ' verifico condizioni e preparo per il drag If Not PrepareTransform() Then Return False End If m_Scene.SetStatusSelPoint() ' imposto stato a primo punto per Mirror - m_nStatus = EST.MIRROR_1 + m_nStep = 1 ' abilito dialogo RaiseEvent SetInputBox("MIRROR", "Insert Start Point", IBT.TY_POINT3D) + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_ptP2 = m_ptP1 + m_nStep = 2 + m_Scene.EnableDrag() + RaiseEvent SetInputBox("MIRROR", "Insert End Point", IBT.TY_POINT3D) + RaiseEvent AddButtonShow() + Case 2 + m_Scene.ResetStatus(False) + ' esecuzione + Dim VtNorm As Vector3d = (m_ptLast - m_ptP1) ^ EgtGetGridVersZ() + If VtNorm.Len > EPS_SMALL Then + ' eseguo copia e mirror + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtMirrorGlob(nCopyId, m_ptP1, VtNorm) + nId = EgtGetNextSelectedObj() + End While + ' eseguo rotazione + Else + EgtMirrorGlob(GDB_ID.SEL, m_ptP1, VtNorm) + End If + End If + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() Case Else - m_nLastCmd = CMD.NULL + m_nStep = 0 Return False End Select - ' salvo l'ultimo comando - m_nLastCmd = nCmd Return True End Function + Private Sub DragMirror() + If m_nStep = 2 Then + ' linea di mirror + EgtSetGeoLine(m_ptP1, m_ptLast) + ' ripristino lo stato iniziale, tramite annullo mirror precedente + Dim VtNorm As Vector3d = (m_ptP2 - m_ptP1) ^ EgtGetGridVersZ() + If VtNorm.Len > EPS_SMALL Then + EgtMirrorGlob(m_Scene.GetDragGroup(), m_ptP1, VtNorm) + End If + ' eseguo mirror + VtNorm = (m_ptLast - m_ptP1) ^ EgtGetGridVersZ() + If VtNorm.Len > EPS_SMALL Then + EgtMirrorGlob(m_Scene.GetDragGroup(), m_ptP1, VtNorm) + End If + ' salvo il punto + m_ptP2 = m_ptLast + EgtDraw() + End If + End Sub + + Private Function ProcessScale() As Boolean + Select m_nStep + Case 0 + ' verifico condizioni e preparo per il drag + If Not PrepareTransform() Then + Return False + End If + m_Scene.SetStatusSelPoint() + ' imposto stato a primo punto per Rotate + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("SCALE", "Insert Center", IBT.TY_POINT3D) + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_dPrev = 1 + m_dLast = 1 + m_nStep = 2 + RaiseEvent SetInputBox("SCALE", "Insert Factor", IBT.TY_DOUBLE) + RaiseEvent SetInputBoxString("1") + RaiseEvent AddButtonShow() + Case 2 + m_Scene.ResetStatus(False) + ' calcolo parametri di scalatura + Dim frScale As New Frame3d + EgtGetGridFrame(frScale) + frScale.ChangeOrigin(m_ptP1) + ' eseguo copia e scalatura + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtScaleGlob(nCopyId, frScale, m_dLast, m_dLast, m_dLast) + nId = EgtGetNextSelectedObj() + End While + ' eseguo scalatura + Else + EgtScaleGlob(GDB_ID.SEL, frScale, m_dLast, m_dLast, m_dLast) + End If + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragScale() + If m_nStep = 2 Then + ' il fattore non può essere troppo piccolo o negativo + If m_dLast < EPS_SMALL Then + Return + End If + ' calcolo parametri di scalatura + Dim frScale As New Frame3d + EgtGetGridFrame(frScale) + frScale.ChangeOrigin(m_ptP1) + Dim dScale As Double = m_dLast / m_dPrev + ' eseguo scalatura + EgtScaleGlob(m_Scene.GetDragGroup(), frScale, dScale, dScale, dScale) + m_dPrev = m_dLast + EgtDraw() + End If + End Sub + + Private Function ProcessScale3D() As Boolean + Select Case m_nStep + Case 0 + ' verifico condizioni e preparo per il drag + If Not PrepareTransform() Then + Return False + End If + m_Scene.SetStatusSelPoint() + ' imposto stato a primo punto per Rotate + m_nStep = 1 + ' abilito dialogo + RaiseEvent SetInputBox("SCALE 3D", "Insert Center", IBT.TY_POINT3D) + RaiseEvent AddInputCheck("Copy") + Case 1 + m_ptP1 = m_ptLast + m_d3Prev(0) = 1 + m_d3Prev(1) = 1 + m_d3Prev(2) = 1 + m_d3Last(0) = 1 + m_d3Last(1) = 1 + m_d3Last(2) = 1 + m_nStep = 2 + m_Scene.DisableDrag() + RaiseEvent SetInputBox("SCALE 3D", "Insert Factor", IBT.TY_3DOUBLE) + RaiseEvent SetInputBoxString("1,1,1") + RaiseEvent AddButtonShow() + Case 2 + m_Scene.ResetStatus(False) + ' calcolo parametri di scalatura + Dim frScale As New Frame3d + EgtGetGridFrame(frScale) + frScale.ChangeOrigin(m_ptP1) + ' eseguo copia e scalatura + If m_bLast Then + Dim nId As Integer = EgtGetFirstSelectedObj() + While nId <> GDB_ID.NULL + Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) + EgtScaleGlob(nCopyId, frScale, m_d3Last(0), m_d3Last(1), m_d3Last(2)) + nId = EgtGetNextSelectedObj() + End While + ' eseguo scalatura + Else + EgtScaleGlob(GDB_ID.SEL, frScale, m_d3Last(0), m_d3Last(1), m_d3Last(2)) + End If + EgtDeselectAll() + EgtDraw() + ' aggiorno stato + m_nStep = 0 + SetModified() + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragScale3D() + If m_nStep = 2 Then + ' il fattore non può essere troppo piccolo o negativo + If m_d3Last(0) < EPS_SMALL Or m_d3Last(1) < EPS_SMALL Or m_d3Last(2) < EPS_SMALL Then + Return + End If + ' calcolo parametri di scalatura + Dim frScale As New Frame3d + EgtGetGridFrame(frScale) + frScale.ChangeOrigin(m_ptP1) + Dim d3Scale(3) As Double + d3Scale(0) = m_d3Last(0) / m_d3Prev(0) + d3Scale(1) = m_d3Last(1) / m_d3Prev(1) + d3Scale(2) = m_d3Last(2) / m_d3Prev(2) + ' eseguo scalatura + EgtScaleGlob(m_Scene.GetDragGroup(), frScale, d3Scale(0), d3Scale(1), d3Scale(2)) + m_d3Prev(0) = m_d3Last(0) + m_d3Prev(1) = m_d3Last(1) + m_d3Prev(2) = m_d3Last(2) + EgtDraw() + End If + End Sub + Private Function PrepareTransform() As Boolean ' posso partire solo da stato libero - If m_nStatus <> EST.NULL Then + If m_nStep <> 0 Then Return False End If ' verifico ci sia qualcosa di selezionato @@ -581,431 +1976,6 @@ Public Class Controller Return True End Function - Public Function GoToNextStatus() As Boolean - Select Case m_nStatus - ' Grid origin - Case EST.GRID_ELEVATION_1 - ' recupero il piano di griglia corrente - Dim frCurr As New Frame3d - EgtGetGridFrame(frCurr) - ' cambio l'elevazione dell'origine - frCurr.Move(EgtGetGridVersZ() * m_dLast) - ' imposto nuova griglia - EgtSetGridFrame(frCurr) - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - RaiseEvent UpdateUI(Me, False) - Case EST.GRID_ORIGIN_1 - ' recupero il piano di griglia corrente - Dim frCurr As New Frame3d - EgtGetGridFrame(frCurr) - ' ne modifico l'origine - frCurr.Move(m_ptLast - frCurr.Orig()) - ' imposto nuova griglia - EgtSetGridFrame(frCurr) - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - RaiseEvent UpdateUI(Me, False) - Case EST.GRID_ROTATE_1 - m_ptP1 = m_ptLast - m_ptP2 = m_ptP1 - m_nStatus = EST.GRID_ROTATE_2 - RaiseEvent SetInputBox("GRID ROTATE", "Insert Second Point on Axis", IBT.TY_POINT3D) - Case EST.GRID_ROTATE_2 - m_ptP2 = m_ptLast - m_nStatus = EST.GRID_ROTATE_3 - RaiseEvent SetInputBox("GRID ROTATE", "Insert angle", IBT.TY_DOUBLE) - Case EST.GRID_ROTATE_3 - ' eseguo rotazione - Dim VtAx As Vector3d = m_ptP2 - m_ptP1 - Dim frCurr As New Frame3d - EgtGetGridFrame(frCurr) - frCurr.Rotate(m_ptP1, VtAx, m_dLast) - EgtSetGridFrame(frCurr) - ' reset - m_Scene.ResetStatus() - m_nStatus = EST.NULL - RaiseEvent UpdateUI(Me, False) - Case EST.GRID_3P_1 - m_ptP1 = m_ptLast - m_ptP2 = m_ptP1 - m_nStatus = EST.GRID_3P_2 - RaiseEvent SetInputBox("GRID 3 POINTS", "Insert Point on X Axis", IBT.TY_POINT3D) - Case EST.GRID_3P_2 - m_ptP2 = m_ptLast - m_nStatus = EST.GRID_3P_3 - RaiseEvent SetInputBox("GRID 3 POINTS", "Insert Point Near Y Axis", IBT.TY_POINT3D) - Case EST.GRID_3P_3 - ' calcolo griglia per 3 punti - Dim frCurr As New Frame3d - If Not frCurr.Setup(m_ptP1, m_ptP2, m_ptLast) Then - m_Scene.ResetStatus() - m_nStatus = EST.NULL - Return False - End If - EgtSetGridFrame(frCurr) - ' reset - m_Scene.ResetStatus() - m_nStatus = EST.NULL - RaiseEvent UpdateUI(Me, False) - ' Point - Case EST.POINT_1 - ' creo il punto (i dati sono in globale) - EgtCreateGeoPoint(GetCurrLayer(), m_ptLast.Loc(GetCurrLayer())) - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Line2P - Case EST.LINE2P_1 - m_ptP1 = m_ptLast - m_nStatus = EST.LINE2P_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("LINE", "Insert End Point ", IBT.TY_POINT3D) - Case EST.LINE2P_2 - ' reset scena - m_Scene.ResetStatus(False) - ' creo la linea (i punti sono in globale) - EgtCreateCurveLine(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer())) - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' CircleCR - Case EST.CIRCLECR_1 - m_ptP1 = m_ptLast - m_nStatus = EST.CIRCLECR_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("CIRCLE", "Insert Point", IBT.TY_POINT3D) - Case EST.CIRCLECR_2 - ' reset scena - m_Scene.ResetStatus(False) - ' creo la circonferenza (i punti sono in globale) - EgtCreateCurveCircleCPN(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), EgtGetGridVersZ()) - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' ArcCSE - Case EST.ARCCSE_1 - m_ptP1 = m_ptLast - m_nStatus = EST.ARCCSE_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ARC", "Insert Start Point", IBT.TY_POINT3D) - Case EST.ARCCSE_2 - m_ptP2 = m_ptLast - m_nStatus = EST.ARCCSE_3 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ARC", "Insert Point Near End", IBT.TY_POINT3D) - Case EST.ARCCSE_3 - ' reset scena - m_Scene.ResetStatus(False) - ' creo l'arco (i punti sono in globale) - EgtCreateCurveArcC2PN(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptP2.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), EgtGetGridVersZ()) - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Arc3P - Case EST.ARC3P_1 - m_ptP1 = m_ptLast - m_nStatus = EST.ARC3P_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ARC", "Insert End Point", IBT.TY_POINT3D) - Case EST.ARC3P_2 - m_ptP2 = m_ptLast - m_nStatus = EST.ARC3P_3 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ARC", "Insert Mid Point", IBT.TY_POINT3D) - Case EST.ARC3P_3 - ' reset scena - m_Scene.ResetStatus(False) - ' creo l'arco (i punti sono in globale) - EgtCreateCurveArc3P(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer()), m_ptP2.Loc(GetCurrLayer())) - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Extrude - Case EST.EXTRUDE_1 - ' reset scena - m_Scene.ResetStatus(False) - ' creo la superficie di estrusione (a partire da un contorno selezionato) - Dim VtExtr As Vector3d = EgtGetGridVersZ().Loc(GetCurrLayer()) * m_dLast - EgtCreateSurfTriMeshByExtrusion(GetCurrLayer(), EgtGetFirstSelectedObj(), VtExtr, EPS_STM) - EgtDeselectAll() - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Revolve - Case EST.REVOLVE_1 - m_ptP1 = m_ptLast - m_nStatus = EST.REVOLVE_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("REVOLVE", "Insert Second Point on Axis", IBT.TY_POINT3D) - Case EST.REVOLVE_2 - ' reset scena - m_Scene.ResetStatus(False) - ' creo la superficie di rivoluzione (i punti sono in globale) - Dim vtAx As Vector3d = m_ptLast - m_ptP1 - EgtCreateSurfTriMeshByScrewing(GetCurrLayer(), EgtGetFirstSelectedObj(), - m_ptP1.Loc(GetCurrLayer()), vtAx.Loc(GetCurrLayer()), - 360, 0, EPS_STM) - EgtDeselectAll() - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Break Curve - Case EST.BREAKCURVE_1 - ' eseguo spezzatura - EgtSplitCurveAtPoint(EgtGetFirstSelectedObj(), m_ptLast) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Move - Case EST.MOVE_1 - m_ptP1 = m_ptLast - m_nStatus = EST.MOVE_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("MOVE", "Insert Target Point", IBT.TY_POINT3D) - Case EST.MOVE_2 - ' eseguo movimento - EgtMoveGlob(GDB_ID.SEL, (m_ptLast - m_ptP1)) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Copy - Case EST.COPY_1 - m_ptP1 = m_ptLast - m_nStatus = EST.COPY_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("COPY", "Insert Target Point", IBT.TY_POINT3D) - Case EST.COPY_2 - ' reset scena - m_Scene.ResetStatus(False) - ' eseguo copia e movimento - Dim nId As Integer = EgtGetFirstSelectedObj() - While nId <> GDB_ID.NULL - Dim nCopyId As Integer = EgtCopyGlob(nId, GetCurrLayer()) - EgtMoveGlob(nCopyId, (m_ptLast - m_ptP1)) - nId = EgtGetNextSelectedObj() - End While - EgtDeselectAll() - EgtDraw() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Rotate - Case EST.ROTATE_1 - m_ptP1 = m_ptLast - m_nStatus = EST.ROTATE_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ROTATE", "Insert Base Point", IBT.TY_POINT3D) - Case EST.ROTATE_2 - m_ptP2 = m_ptLast - m_nStatus = EST.ROTATE_3 - m_Scene.EnableDrag() - EgtSetGeoLine(m_ptP1, m_ptLast) - RaiseEvent SetInputBox("ROTATE", "Insert Rotation Point", IBT.TY_POINT3D) - Case EST.ROTATE_3 - ' eseguo rotazione - Dim dAngRotDeg As Double = 0 - Dim bDet As Boolean = True - EgtGetVectorRotation((m_ptP2 - m_ptP1), (m_ptLast - m_ptP1), EgtGetGridVersZ(), dAngRotDeg, bDet) - EgtRotateGlob(GDB_ID.SEL, m_ptP1, EgtGetGridVersZ(), dAngRotDeg) - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - ' Rotate3d - Case EST.ROTATE3D_1 - m_ptP1 = m_ptLast - m_ptP2 = m_ptP1 - m_nStatus = EST.ROTATE3D_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("ROTATE3D", "Insert Second Point on Axis", IBT.TY_POINT3D) - Case EST.ROTATE3D_2 - m_ptP2 = m_ptLast - m_nStatus = EST.ROTATE3D_3 - m_dLast = 0 - ' abilito dialogo - RaiseEvent SetInputBox("ROTATE3D", "Insert angle", IBT.TY_DOUBLE) - Case EST.ROTATE3D_3 - ' eseguo rotazione - Dim VtAx As Vector3d = m_ptP2 - m_ptP1 - EgtRotateGlob(GDB_ID.SEL, m_ptP1, VtAx, m_dLast) - EgtDeselectAll() - ' reset - m_Scene.ResetStatus() - m_nStatus = EST.NULL - SetModified() - ' Mirror - Case EST.MIRROR_1 - m_ptP1 = m_ptLast - m_ptP2 = m_ptP1 - m_nStatus = EST.MIRROR_2 - m_Scene.EnableDrag() - RaiseEvent SetInputBox("MIRROR", "Insert End Point", IBT.TY_POINT3D) - Case EST.MIRROR_2 - ' eseguo mirror - Dim VtNorm As Vector3d = (m_ptLast - m_ptP1) ^ EgtGetGridVersZ() - If VtNorm.Len > EPS_SMALL Then - EgtMirrorGlob(GDB_ID.SEL, m_ptP1, VtNorm) - End If - EgtDeselectAll() - ' reset stato scena - m_Scene.ResetStatus() - ' aggiorno stato - m_nStatus = EST.NULL - SetModified() - Case Else - Return False - End Select - Return True - End Function - - Public Function ExecuteDrag() As Boolean - Select Case m_nStatus - Case EST.GRID_ROTATE_2, EST.GRID_ROTATE_3 - EgtSetGeoLine(m_ptP1, m_ptP2) - EgtDraw() - Case EST.LINE2P_2 - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If nId = GDB_ID.NULL Then - EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) - Else - EgtModifyCurveEndPoint(nId, m_ptLast) - End If - EgtDraw() - Case EST.CIRCLECR_2 - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If nId = GDB_ID.NULL Then - EgtCreateCurveCircleCPN(m_Scene.GetDragGroup(), m_ptP1, m_ptLast, EgtGetGridVersZ()) - Else - EgtModifyCurveCircleCPN(nId, m_ptLast) - End If - EgtDraw() - Case EST.ARCCSE_2, EST.ARC3P_2 - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If nId = GDB_ID.NULL Then - EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) - Else - EgtModifyCurveEndPoint(nId, m_ptLast) - End If - EgtDraw() - Case EST.ARCCSE_3 - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If EgtGetType(nId) <> GDB_TY.CRV_ARC Then - EgtErase(nId) - nId = GDB_ID.NULL - End If - If nId = GDB_ID.NULL Then - EgtCreateCurveArcC2PN(m_Scene.GetDragGroup(), m_ptP1, m_ptP2, m_ptLast, EgtGetGridVersZ()) - Else - EgtModifyCurveArcC2PN(nId, m_ptLast) - End If - EgtDraw() - Case EST.ARC3P_3 - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale - Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If EgtGetType(nId) <> GDB_TY.CRV_ARC Then - EgtErase(nId) - nId = GDB_ID.NULL - End If - If nId = GDB_ID.NULL Then - EgtCreateCurveArc3P(m_Scene.GetDragGroup(), m_ptP1, m_ptLast, m_ptP2) - Else - EgtModifyCurveArc3P(nId, m_ptLast) - End If - EgtDraw() - Case EST.EXTRUDE_1 - ' cancello eventuale vecchia superficie di estrusione - EgtErase(EgtGetFirstInGroup(m_Scene.GetDragGroup())) - ' creo la superficie di estrusione (a partire da un contorno selezionato) - Dim VtExtr As New Vector3d(0, 0, m_dLast) - EgtCreateSurfTriMeshByExtrusion(m_Scene.GetDragGroup(), EgtGetFirstSelectedObj(), VtExtr, EPS_STM) - EgtDraw() - Case EST.REVOLVE_2 - EgtSetGeoLine(m_ptP1, m_ptLast) - EgtDraw() - Case EST.MOVE_2 - ' ripristino lo stato iniziale - EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) - ' eseguo tutto il movimento - EgtMoveGlob(m_Scene.GetDragGroup(), (m_ptLast - m_ptP1)) - EgtSetGeoLine(m_ptP1, m_ptLast) - EgtDraw() - Case EST.COPY_2 - ' ripristino lo stato iniziale - EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) - ' eseguo tutto il movimento - EgtMoveGlob(m_Scene.GetDragGroup(), (m_ptLast - m_ptP1)) - EgtSetGeoLine(m_ptP1, m_ptLast) - EgtDraw() - Case EST.ROTATE_2 - EgtSetGeoLine(m_ptP1, m_ptLast) - EgtDraw() - Case EST.ROTATE_3 - EgtSetGeoLine(m_ptP1, m_ptLast) - ' ripristino lo stato iniziale - EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) - ' eseguo rotazione - Dim dAngRotDeg As Double = 0 - Dim bDet As Boolean = True - EgtGetVectorRotation((m_ptP2 - m_ptP1), (m_ptLast - m_ptP1), EgtGetGridVersZ(), dAngRotDeg, bDet) - EgtRotateGlob(m_Scene.GetDragGroup(), m_ptP1, EgtGetGridVersZ(), dAngRotDeg) - EgtDraw() - Case EST.ROTATE3D_2 - EgtSetGeoLine(m_ptP1, m_ptLast) - EgtDraw() - Case EST.ROTATE3D_3 - EgtSetGeoLine(m_ptP1, m_ptP2) - ' ripristino lo stato iniziale - EgtChangeGroupFrame(m_Scene.GetDragGroup(), Frame3d.GLOB) - ' eseguo rotazione - Dim VtAx As Vector3d = m_ptP2 - m_ptP1 - EgtRotateGlob(m_Scene.GetDragGroup(), m_ptP1, VtAx, m_dLast) - EgtDraw() - Case EST.MIRROR_2 - ' ripristino lo stato iniziale, tramite annullo mirror precedente - Dim VtNorm As Vector3d = (m_ptP2 - m_ptP1) ^ EgtGetGridVersZ() - If VtNorm.Len > EPS_SMALL Then - EgtMirrorGlob(m_Scene.GetDragGroup(), m_ptP1, VtNorm) - End If - ' eseguo mirror - VtNorm = (m_ptLast - m_ptP1) ^ EgtGetGridVersZ() - If VtNorm.Len > EPS_SMALL Then - EgtMirrorGlob(m_Scene.GetDragGroup(), m_ptP1, VtNorm) - End If - ' salvo il punto - m_ptP2 = m_ptLast - EgtDraw() - Case Else - Return False - End Select - Return True - End Function - '-------------------------------- Currente Part and Layer ---------------------------------------- Private m_nCurrPart = GDB_ID.NULL diff --git a/EgtInterface.vb b/EgtInterface.vb index 80bcf68..a4faa1c 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -141,6 +141,11 @@ Structure Vector3d Return Me End If End Function + ' vettore nullo + Shared Function NULL() As Vector3d + Dim vtV As New Vector3d(0, 0, 0) + Return vtV + End Function ' Versore Asse X Shared Function X_AX() As Vector3d Dim vtZ As New Vector3d(1, 0, 0) @@ -315,6 +320,11 @@ Class Frame3d Public Function Setup(ByRef PtOri As Point3d, ByRef PtOnX As Point3d, ByRef PtNearY As Point3d) As Boolean Return EgtFrameFrom3Points(PtOri, PtOnX, PtNearY, PtOrig, VtDirX, VtDirY, VtDirZ) End Function + ' Cambio origine + Public Function ChangeOrigin(ByRef PtOri As Point3d) As Boolean + PtOrig = PtOri + Return True + End Function ' Verifica Private Function Verify() As Boolean ' verifica della ortogonalità dei versori e del senso destrorso @@ -704,6 +714,11 @@ Public Shared Function EgtCreateSurfTriMeshByScrewing(ByVal nParentId As Integer ByVal dAngRotDeg As Double, ByVal dMove As Double, ByVal dLinTol As Double) As Integer End Function + +Public Shared Function EgtCreateSurfTriMeshRuled(ByVal nParentId As Integer, ByVal nCrvId1 As Integer, ByVal nCrvId2 As Integer, ByVal dLinTol As Double) As Integer +End Function + + '---------- GeomDb Objects Modify ---------------------------------------------- Private Shared Function EgtChangeGroupFrame(ByVal nId As Integer, @@ -725,16 +740,36 @@ End Function Public Shared Function EgtMirrorText(ByVal nId As Integer, ByVal bOnL As Boolean) As Boolean End Function + +Public Shared Function EgtExplodeText(ByVal nId As Integer) As Boolean +End Function + '---------- GeomDb Curves Modify ----------------------------------------------- Public Shared Function EgtInvertCurve(ByVal nId As Integer) As Boolean End Function + +Public Shared Function EgtModifyCurveStartPoint(ByVal nId As Integer, ByRef PtStart As Point3d) As Boolean +End Function + Public Shared Function EgtModifyCurveEndPoint(ByVal nId As Integer, ByRef PtEnd As Point3d) As Boolean End Function + +Public Shared Function EgtExtendCurveStartByLen(ByVal nId As Integer, ByVal dLen As Double) As Boolean +End Function + + +Public Shared Function EgtExtendCurveEndByLen(ByVal nId As Integer, ByVal dLen As Double) As Boolean +End Function + + +Public Shared Function EgtExtendCurveByLen(ByVal nId As Integer, ByVal dLen As Double, ByRef PtNear As Point3d) As Boolean +End Function + Public Shared Function EgtSplitCurveAtPoint(ByVal nId As Integer, ByRef PtOn As Point3d) As Boolean End Function @@ -755,6 +790,10 @@ End Function Public Shared Function EgtSeparateCurveCompo(ByVal nId As Integer) As Boolean End Function + +Public Shared Function EgtExplodeCurveBezier(ByVal nId As Integer, ByVal dTolLin As Double, ByVal bArcsVsLines As Boolean) As Boolean +End Function + '---------- GeomDb Objects ----------------------------------------------------- @@ -1020,10 +1059,30 @@ End Function Public Shared Function EgtDeselectObj(ByVal nId As Integer) As Boolean End Function + +Public Shared Function EgtSelectAll(Optional ByVal bOnlyIfVisible As Boolean = False) As Boolean +End Function + Public Shared Function EgtDeselectAll() As Boolean End Function + +Public Shared Function EgtSelectPartObjs(ByVal nPartId As Integer) As Boolean +End Function + + +Public Shared Function EgtDeselectPartObjs(ByVal nPartId As Integer) As Boolean +End Function + + +Public Shared Function EgtSelectLayerObjs(ByVal nLayerId As Integer) As Boolean +End Function + + +Public Shared Function EgtDeselectLayerObjs(ByVal nLayerId As Integer) As Boolean +End Function + Public Shared Function EgtIsSelectedObj(ByVal nId As Integer) As Boolean End Function @@ -1040,6 +1099,14 @@ End Function Public Shared Function EgtGetNextSelectedObj() As Integer End Function + +Public Shared Function EgtGetLastSelectedObj() As Integer +End Function + + +Public Shared Function EgtGetPrevSelectedObj() As Integer +End Function + '---------- GeomDb Obj Transform ----------------------------------------------- @@ -1125,6 +1192,19 @@ End Function '---------- GeomDb Snap Vector/Point/Frame ------------------------------------- + +Public Shared Function EgtStartPoint(ByVal nId As Integer, ByRef PtP As Point3d) As Boolean +End Function + + +Public Shared Function EgtEndPoint(ByVal nId As Integer, ByRef PtP As Point3d) As Boolean +End Function + + +Public Shared Function EgtIntersectionPoint(ByVal nId1 As Integer, ByVal nId2 As Integer, ByRef PtNear As Point3d, + ByRef PtP As Point3d) As Boolean +End Function + Private Shared Function EgtVectorToIdGlob(ByRef VtV As Vector3d, ByVal nId As Integer) As Boolean End Function @@ -1486,6 +1566,7 @@ Public Enum SP As Integer PT_MID = 3 CENTER = 4 PT_NEAR = 5 + PT_INTERS = 6 End Enum 'Costanti : flag per BBOX Public Enum BBF As Integer diff --git a/Form1.Designer.vb b/Form1.Designer.vb index ed22dc0..a5b8bf6 100644 --- a/Form1.Designer.vb +++ b/Form1.Designer.vb @@ -25,12 +25,14 @@ Partial Class Form1 Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.Scene1 = New TestEIn.Scene() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() - Me.ToolStripStatusOnL = New System.Windows.Forms.ToolStripStatusLabel() - Me.ToolStripStatusOutput = New System.Windows.Forms.ToolStripStatusLabel() - Me.ToolStripStatusOnR = New System.Windows.Forms.ToolStripStatusLabel() - Me.ToolStripStatusGrid = New System.Windows.Forms.ToolStripStatusLabel() - Me.ToolStripStatusCursorPos = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusOnL = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusOutput = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusOnR = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusGrid = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusTypePos = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusCursorPos = New System.Windows.Forms.ToolStripStatusLabel() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TabHome = New System.Windows.Forms.TabPage() Me.btnSaveAs = New System.Windows.Forms.Button() @@ -89,6 +91,8 @@ Partial Class Form1 Me.txtPartLay = New System.Windows.Forms.TextBox() Me.btnNewPart = New System.Windows.Forms.Button() Me.InputBox = New System.Windows.Forms.GroupBox() + Me.btnDone = New System.Windows.Forms.Button() + Me.btnShow = New System.Windows.Forms.Button() Me.InputCheck = New System.Windows.Forms.CheckBox() Me.InputText = New System.Windows.Forms.TextBox() Me.InputLabel = New System.Windows.Forms.Label() @@ -100,31 +104,42 @@ Partial Class Form1 Me.btnPoint = New System.Windows.Forms.Button() Me.btnLine2P = New System.Windows.Forms.Button() Me.TabConstruct = New System.Windows.Forms.TabPage() + Me.btnRuled = New System.Windows.Forms.Button() Me.btnRevolve = New System.Windows.Forms.Button() Me.btnExtrude = New System.Windows.Forms.Button() Me.btnPlane = New System.Windows.Forms.Button() Me.TabEdit = New System.Windows.Forms.TabPage() + Me.btnExtendCurve = New System.Windows.Forms.Button() Me.btnBreakCurve = New System.Windows.Forms.Button() Me.btnChangeColor = New System.Windows.Forms.Button() - Me.btnSeparateCurve = New System.Windows.Forms.Button() + Me.btnExplodeCurve = New System.Windows.Forms.Button() Me.btnJoinCurve = New System.Windows.Forms.Button() Me.btnInvertCurve = New System.Windows.Forms.Button() Me.btnDelete = New System.Windows.Forms.Button() Me.TabTransform = New System.Windows.Forms.TabPage() + Me.btnScale = New System.Windows.Forms.Button() Me.btnMirror = New System.Windows.Forms.Button() - Me.btnCopy = New System.Windows.Forms.Button() Me.btnRotate = New System.Windows.Forms.Button() Me.btnMove = New System.Windows.Forms.Button() Me.TabTest = New System.Windows.Forms.TabPage() Me.XbtnRotM90 = New System.Windows.Forms.Button() Me.XbtnRotP90 = New System.Windows.Forms.Button() Me.XbtnMirror = New System.Windows.Forms.Button() + Me.ContextMenuTreeView1 = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.cmdSelectPartLayObj = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdDeselectPartLayObj = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() + Me.cmdSetName = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdSetInfo = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator() + Me.cmdRelocatePartLayObj = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdCopyPartLayObj = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdDeletePartLayObj = New System.Windows.Forms.ToolStripMenuItem() Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() Me.SaveFileDialog = New System.Windows.Forms.SaveFileDialog() Me.btnGetDist = New System.Windows.Forms.CheckBox() Me.ObjTreeTimer = New System.Windows.Forms.Timer(Me.components) Me.ColorDialog1 = New System.Windows.Forms.ColorDialog() - Me.Scene1 = New TestEIn.Scene() Me.TableLayoutPanel1.SuspendLayout() Me.StatusStrip1.SuspendLayout() Me.TabControl1.SuspendLayout() @@ -145,6 +160,7 @@ Partial Class Form1 Me.TabEdit.SuspendLayout() Me.TabTransform.SuspendLayout() Me.TabTest.SuspendLayout() + Me.ContextMenuTreeView1.SuspendLayout() Me.SuspendLayout() ' 'TableLayoutPanel1 @@ -169,13 +185,23 @@ Partial Class Form1 Me.TableLayoutPanel1.Size = New System.Drawing.Size(1096, 533) Me.TableLayoutPanel1.TabIndex = 0 ' + 'Scene1 + ' + Me.Scene1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.Scene1.Cursor = System.Windows.Forms.Cursors.Default + Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill + Me.Scene1.Location = New System.Drawing.Point(92, 83) + Me.Scene1.Name = "Scene1" + Me.Scene1.Size = New System.Drawing.Size(795, 425) + Me.Scene1.TabIndex = 1 + ' 'StatusStrip1 ' Me.StatusStrip1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TableLayoutPanel1.SetColumnSpan(Me.StatusStrip1, 3) Me.StatusStrip1.Dock = System.Windows.Forms.DockStyle.None - Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusOnL, Me.ToolStripStatusOutput, Me.ToolStripStatusOnR, Me.ToolStripStatusGrid, Me.ToolStripStatusCursorPos}) + Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsStatusOnL, Me.tsStatusOutput, Me.tsStatusOnR, Me.tsStatusGrid, Me.tsStatusTypePos, Me.tsStatusCursorPos}) Me.StatusStrip1.Location = New System.Drawing.Point(0, 511) Me.StatusStrip1.MaximumSize = New System.Drawing.Size(0, 22) Me.StatusStrip1.MinimumSize = New System.Drawing.Size(0, 22) @@ -184,51 +210,60 @@ Partial Class Form1 Me.StatusStrip1.TabIndex = 6 Me.StatusStrip1.Text = "StatusStrip1" ' - 'ToolStripStatusOnL + 'tsStatusOnL ' - Me.ToolStripStatusOnL.AutoSize = False - Me.ToolStripStatusOnL.Name = "ToolStripStatusOnL" - Me.ToolStripStatusOnL.Size = New System.Drawing.Size(205, 17) + Me.tsStatusOnL.AutoSize = False + Me.tsStatusOnL.Name = "tsStatusOnL" + Me.tsStatusOnL.Size = New System.Drawing.Size(205, 17) ' - 'ToolStripStatusOutput + 'tsStatusOutput ' - Me.ToolStripStatusOutput.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ + Me.tsStatusOutput.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom), System.Windows.Forms.ToolStripStatusLabelBorderSides) - Me.ToolStripStatusOutput.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text - Me.ToolStripStatusOutput.MergeIndex = 1 - Me.ToolStripStatusOutput.Name = "ToolStripStatusOutput" - Me.ToolStripStatusOutput.Size = New System.Drawing.Size(449, 17) - Me.ToolStripStatusOutput.Spring = True - Me.ToolStripStatusOutput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.tsStatusOutput.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text + Me.tsStatusOutput.MergeIndex = 1 + Me.tsStatusOutput.Name = "tsStatusOutput" + Me.tsStatusOutput.Size = New System.Drawing.Size(373, 17) + Me.tsStatusOutput.Spring = True + Me.tsStatusOutput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' - 'ToolStripStatusOnR + 'tsStatusOnR ' - Me.ToolStripStatusOnR.AutoSize = False - Me.ToolStripStatusOnR.Name = "ToolStripStatusOnR" - Me.ToolStripStatusOnR.Size = New System.Drawing.Size(190, 17) - Me.ToolStripStatusOnR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.tsStatusOnR.AutoSize = False + Me.tsStatusOnR.Name = "tsStatusOnR" + Me.tsStatusOnR.Size = New System.Drawing.Size(190, 17) + Me.tsStatusOnR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' - 'ToolStripStatusGrid + 'tsStatusGrid ' - Me.ToolStripStatusGrid.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ + Me.tsStatusGrid.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom), System.Windows.Forms.ToolStripStatusLabelBorderSides) - Me.ToolStripStatusGrid.Name = "ToolStripStatusGrid" - Me.ToolStripStatusGrid.Size = New System.Drawing.Size(43, 17) - Me.ToolStripStatusGrid.Text = " GRID " + Me.tsStatusGrid.Name = "tsStatusGrid" + Me.tsStatusGrid.Size = New System.Drawing.Size(64, 17) + Me.tsStatusGrid.Text = " GRID ON " ' - 'ToolStripStatusCursorPos + 'tsStatusTypePos ' - Me.ToolStripStatusCursorPos.AutoSize = False - Me.ToolStripStatusCursorPos.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ + Me.tsStatusTypePos.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right) _ Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom), System.Windows.Forms.ToolStripStatusLabelBorderSides) - Me.ToolStripStatusCursorPos.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text - Me.ToolStripStatusCursorPos.MergeIndex = 2 - Me.ToolStripStatusCursorPos.Name = "ToolStripStatusCursorPos" - Me.ToolStripStatusCursorPos.Size = New System.Drawing.Size(194, 17) - Me.ToolStripStatusCursorPos.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.tsStatusTypePos.Name = "tsStatusTypePos" + Me.tsStatusTypePos.Size = New System.Drawing.Size(55, 17) + Me.tsStatusTypePos.Text = "CPLANE" + ' + 'tsStatusCursorPos + ' + Me.tsStatusCursorPos.AutoSize = False + Me.tsStatusCursorPos.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ + Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right) _ + Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom), System.Windows.Forms.ToolStripStatusLabelBorderSides) + Me.tsStatusCursorPos.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text + Me.tsStatusCursorPos.MergeIndex = 2 + Me.tsStatusCursorPos.Name = "tsStatusCursorPos" + Me.tsStatusCursorPos.Size = New System.Drawing.Size(194, 17) + Me.tsStatusCursorPos.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'TabControl1 ' @@ -1145,6 +1180,8 @@ Partial Class Form1 'InputBox ' Me.InputBox.AutoSize = True + Me.InputBox.Controls.Add(Me.btnDone) + Me.InputBox.Controls.Add(Me.btnShow) Me.InputBox.Controls.Add(Me.InputCheck) Me.InputBox.Controls.Add(Me.InputText) Me.InputBox.Controls.Add(Me.InputLabel) @@ -1156,21 +1193,38 @@ Partial Class Form1 Me.InputBox.TabIndex = 26 Me.InputBox.TabStop = False ' + 'btnDone + ' + Me.btnDone.Location = New System.Drawing.Point(112, 104) + Me.btnDone.Name = "btnDone" + Me.btnDone.Size = New System.Drawing.Size(75, 23) + Me.btnDone.TabIndex = 4 + Me.btnDone.Text = "Done" + Me.btnDone.UseVisualStyleBackColor = True + ' + 'btnShow + ' + Me.btnShow.Location = New System.Drawing.Point(10, 104) + Me.btnShow.Name = "btnShow" + Me.btnShow.Size = New System.Drawing.Size(75, 23) + Me.btnShow.TabIndex = 3 + Me.btnShow.Text = "Show" + Me.btnShow.UseVisualStyleBackColor = True + ' 'InputCheck ' Me.InputCheck.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.InputCheck.Location = New System.Drawing.Point(6, 85) + Me.InputCheck.Location = New System.Drawing.Point(12, 74) Me.InputCheck.Name = "InputCheck" - Me.InputCheck.Size = New System.Drawing.Size(184, 26) + Me.InputCheck.Size = New System.Drawing.Size(178, 23) Me.InputCheck.TabIndex = 2 - Me.InputCheck.Text = "CheckBox1" Me.InputCheck.UseVisualStyleBackColor = True Me.InputCheck.Visible = False ' 'InputText ' Me.InputText.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.InputText.Location = New System.Drawing.Point(3, 50) + Me.InputText.Location = New System.Drawing.Point(3, 42) Me.InputText.MinimumSize = New System.Drawing.Size(188, 26) Me.InputText.Name = "InputText" Me.InputText.Size = New System.Drawing.Size(188, 23) @@ -1180,11 +1234,11 @@ Partial Class Form1 'InputLabel ' Me.InputLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.InputLabel.Location = New System.Drawing.Point(4, 19) + Me.InputLabel.Location = New System.Drawing.Point(3, 17) Me.InputLabel.Name = "InputLabel" Me.InputLabel.Size = New System.Drawing.Size(188, 23) Me.InputLabel.TabIndex = 0 - Me.InputLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.InputLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft Me.InputLabel.Visible = False ' 'TabControl2 @@ -1307,6 +1361,7 @@ Partial Class Form1 'TabConstruct ' Me.TabConstruct.BackColor = System.Drawing.SystemColors.Control + Me.TabConstruct.Controls.Add(Me.btnRuled) Me.TabConstruct.Controls.Add(Me.btnRevolve) Me.TabConstruct.Controls.Add(Me.btnExtrude) Me.TabConstruct.Controls.Add(Me.btnPlane) @@ -1316,6 +1371,23 @@ Partial Class Form1 Me.TabConstruct.TabIndex = 4 Me.TabConstruct.Text = "Construct" ' + 'btnRuled + ' + Me.btnRuled.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control + Me.btnRuled.FlatAppearance.BorderSize = 0 + Me.btnRuled.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control + Me.btnRuled.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.btnRuled.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnRuled.Image = CType(resources.GetObject("btnRuled.Image"), System.Drawing.Image) + Me.btnRuled.ImageAlign = System.Drawing.ContentAlignment.TopCenter + Me.btnRuled.Location = New System.Drawing.Point(0, 144) + Me.btnRuled.Name = "btnRuled" + Me.btnRuled.Size = New System.Drawing.Size(56, 48) + Me.btnRuled.TabIndex = 36 + Me.btnRuled.Text = "Ruled" + Me.btnRuled.TextAlign = System.Drawing.ContentAlignment.BottomCenter + Me.btnRuled.UseVisualStyleBackColor = False + ' 'btnRevolve ' Me.btnRevolve.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control @@ -1370,9 +1442,10 @@ Partial Class Form1 'TabEdit ' Me.TabEdit.BackColor = System.Drawing.SystemColors.Control + Me.TabEdit.Controls.Add(Me.btnExtendCurve) Me.TabEdit.Controls.Add(Me.btnBreakCurve) Me.TabEdit.Controls.Add(Me.btnChangeColor) - Me.TabEdit.Controls.Add(Me.btnSeparateCurve) + Me.TabEdit.Controls.Add(Me.btnExplodeCurve) Me.TabEdit.Controls.Add(Me.btnJoinCurve) Me.TabEdit.Controls.Add(Me.btnInvertCurve) Me.TabEdit.Controls.Add(Me.btnDelete) @@ -1382,6 +1455,23 @@ Partial Class Form1 Me.TabEdit.TabIndex = 3 Me.TabEdit.Text = "Edit" ' + 'btnExtendCurve + ' + Me.btnExtendCurve.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control + Me.btnExtendCurve.FlatAppearance.BorderSize = 0 + Me.btnExtendCurve.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control + Me.btnExtendCurve.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.btnExtendCurve.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnExtendCurve.Image = CType(resources.GetObject("btnExtendCurve.Image"), System.Drawing.Image) + Me.btnExtendCurve.ImageAlign = System.Drawing.ContentAlignment.TopCenter + Me.btnExtendCurve.Location = New System.Drawing.Point(0, 144) + Me.btnExtendCurve.Name = "btnExtendCurve" + Me.btnExtendCurve.Size = New System.Drawing.Size(56, 48) + Me.btnExtendCurve.TabIndex = 39 + Me.btnExtendCurve.Text = "Extend" + Me.btnExtendCurve.TextAlign = System.Drawing.ContentAlignment.BottomCenter + Me.btnExtendCurve.UseVisualStyleBackColor = False + ' 'btnBreakCurve ' Me.btnBreakCurve.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control @@ -1391,7 +1481,7 @@ Partial Class Form1 Me.btnBreakCurve.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnBreakCurve.Image = CType(resources.GetObject("btnBreakCurve.Image"), System.Drawing.Image) Me.btnBreakCurve.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnBreakCurve.Location = New System.Drawing.Point(0, 144) + Me.btnBreakCurve.Location = New System.Drawing.Point(0, 192) Me.btnBreakCurve.Name = "btnBreakCurve" Me.btnBreakCurve.Size = New System.Drawing.Size(56, 48) Me.btnBreakCurve.TabIndex = 38 @@ -1416,23 +1506,23 @@ Partial Class Form1 Me.btnChangeColor.TextAlign = System.Drawing.ContentAlignment.BottomCenter Me.btnChangeColor.UseVisualStyleBackColor = False ' - 'btnSeparateCurve + 'btnExplodeCurve ' - Me.btnSeparateCurve.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control - Me.btnSeparateCurve.FlatAppearance.BorderSize = 0 - Me.btnSeparateCurve.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control - Me.btnSeparateCurve.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption - Me.btnSeparateCurve.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.btnSeparateCurve.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnSeparateCurve.Image = CType(resources.GetObject("btnSeparateCurve.Image"), System.Drawing.Image) - Me.btnSeparateCurve.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnSeparateCurve.Location = New System.Drawing.Point(0, 240) - Me.btnSeparateCurve.Name = "btnSeparateCurve" - Me.btnSeparateCurve.Size = New System.Drawing.Size(56, 48) - Me.btnSeparateCurve.TabIndex = 36 - Me.btnSeparateCurve.Text = "Separate" - Me.btnSeparateCurve.TextAlign = System.Drawing.ContentAlignment.BottomCenter - Me.btnSeparateCurve.UseVisualStyleBackColor = False + Me.btnExplodeCurve.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control + Me.btnExplodeCurve.FlatAppearance.BorderSize = 0 + Me.btnExplodeCurve.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control + Me.btnExplodeCurve.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.btnExplodeCurve.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnExplodeCurve.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnExplodeCurve.Image = CType(resources.GetObject("btnExplodeCurve.Image"), System.Drawing.Image) + Me.btnExplodeCurve.ImageAlign = System.Drawing.ContentAlignment.TopCenter + Me.btnExplodeCurve.Location = New System.Drawing.Point(0, 288) + Me.btnExplodeCurve.Name = "btnExplodeCurve" + Me.btnExplodeCurve.Size = New System.Drawing.Size(56, 48) + Me.btnExplodeCurve.TabIndex = 36 + Me.btnExplodeCurve.Text = "Explode" + Me.btnExplodeCurve.TextAlign = System.Drawing.ContentAlignment.BottomCenter + Me.btnExplodeCurve.UseVisualStyleBackColor = False ' 'btnJoinCurve ' @@ -1443,7 +1533,7 @@ Partial Class Form1 Me.btnJoinCurve.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnJoinCurve.Image = CType(resources.GetObject("btnJoinCurve.Image"), System.Drawing.Image) Me.btnJoinCurve.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnJoinCurve.Location = New System.Drawing.Point(0, 192) + Me.btnJoinCurve.Location = New System.Drawing.Point(0, 240) Me.btnJoinCurve.Name = "btnJoinCurve" Me.btnJoinCurve.Size = New System.Drawing.Size(56, 48) Me.btnJoinCurve.TabIndex = 35 @@ -1488,8 +1578,8 @@ Partial Class Form1 'TabTransform ' Me.TabTransform.BackColor = System.Drawing.SystemColors.Control + Me.TabTransform.Controls.Add(Me.btnScale) Me.TabTransform.Controls.Add(Me.btnMirror) - Me.TabTransform.Controls.Add(Me.btnCopy) Me.TabTransform.Controls.Add(Me.btnRotate) Me.TabTransform.Controls.Add(Me.btnMove) Me.TabTransform.Location = New System.Drawing.Point(23, 4) @@ -1498,6 +1588,23 @@ Partial Class Form1 Me.TabTransform.TabIndex = 2 Me.TabTransform.Text = "Transform" ' + 'btnScale + ' + Me.btnScale.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control + Me.btnScale.FlatAppearance.BorderSize = 0 + Me.btnScale.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control + Me.btnScale.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.btnScale.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnScale.Image = CType(resources.GetObject("btnScale.Image"), System.Drawing.Image) + Me.btnScale.ImageAlign = System.Drawing.ContentAlignment.TopCenter + Me.btnScale.Location = New System.Drawing.Point(0, 144) + Me.btnScale.Name = "btnScale" + Me.btnScale.Size = New System.Drawing.Size(56, 48) + Me.btnScale.TabIndex = 33 + Me.btnScale.Text = "Scale" + Me.btnScale.TextAlign = System.Drawing.ContentAlignment.BottomCenter + Me.btnScale.UseVisualStyleBackColor = False + ' 'btnMirror ' Me.btnMirror.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control @@ -1507,7 +1614,7 @@ Partial Class Form1 Me.btnMirror.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnMirror.Image = CType(resources.GetObject("btnMirror.Image"), System.Drawing.Image) Me.btnMirror.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnMirror.Location = New System.Drawing.Point(0, 144) + Me.btnMirror.Location = New System.Drawing.Point(0, 96) Me.btnMirror.Name = "btnMirror" Me.btnMirror.Size = New System.Drawing.Size(56, 48) Me.btnMirror.TabIndex = 32 @@ -1515,23 +1622,6 @@ Partial Class Form1 Me.btnMirror.TextAlign = System.Drawing.ContentAlignment.BottomCenter Me.btnMirror.UseVisualStyleBackColor = False ' - 'btnCopy - ' - Me.btnCopy.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control - Me.btnCopy.FlatAppearance.BorderSize = 0 - Me.btnCopy.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control - Me.btnCopy.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption - Me.btnCopy.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.btnCopy.Image = CType(resources.GetObject("btnCopy.Image"), System.Drawing.Image) - Me.btnCopy.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnCopy.Location = New System.Drawing.Point(0, 48) - Me.btnCopy.Name = "btnCopy" - Me.btnCopy.Size = New System.Drawing.Size(56, 48) - Me.btnCopy.TabIndex = 31 - Me.btnCopy.Text = "Copy" - Me.btnCopy.TextAlign = System.Drawing.ContentAlignment.BottomCenter - Me.btnCopy.UseVisualStyleBackColor = False - ' 'btnRotate ' Me.btnRotate.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control @@ -1541,7 +1631,7 @@ Partial Class Form1 Me.btnRotate.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnRotate.Image = CType(resources.GetObject("btnRotate.Image"), System.Drawing.Image) Me.btnRotate.ImageAlign = System.Drawing.ContentAlignment.TopCenter - Me.btnRotate.Location = New System.Drawing.Point(0, 96) + Me.btnRotate.Location = New System.Drawing.Point(0, 48) Me.btnRotate.Name = "btnRotate" Me.btnRotate.Size = New System.Drawing.Size(56, 48) Me.btnRotate.TabIndex = 30 @@ -1621,6 +1711,66 @@ Partial Class Form1 Me.XbtnMirror.Text = "Mirror" Me.XbtnMirror.UseVisualStyleBackColor = False ' + 'ContextMenuTreeView1 + ' + Me.ContextMenuTreeView1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectPartLayObj, Me.cmdDeselectPartLayObj, Me.ToolStripSeparator1, Me.cmdSetName, Me.cmdSetInfo, Me.ToolStripSeparator2, Me.cmdRelocatePartLayObj, Me.cmdCopyPartLayObj, Me.cmdDeletePartLayObj}) + Me.ContextMenuTreeView1.Name = "ContextMenuStrip1" + Me.ContextMenuTreeView1.ShowCheckMargin = True + Me.ContextMenuTreeView1.ShowImageMargin = False + Me.ContextMenuTreeView1.Size = New System.Drawing.Size(120, 170) + ' + 'cmdSelectPartLayObj + ' + Me.cmdSelectPartLayObj.Name = "cmdSelectPartLayObj" + Me.cmdSelectPartLayObj.Size = New System.Drawing.Size(119, 22) + Me.cmdSelectPartLayObj.Text = "Select" + ' + 'cmdDeselectPartLayObj + ' + Me.cmdDeselectPartLayObj.Name = "cmdDeselectPartLayObj" + Me.cmdDeselectPartLayObj.Size = New System.Drawing.Size(119, 22) + Me.cmdDeselectPartLayObj.Text = "Deselect" + ' + 'ToolStripSeparator1 + ' + Me.ToolStripSeparator1.Name = "ToolStripSeparator1" + Me.ToolStripSeparator1.Size = New System.Drawing.Size(116, 6) + ' + 'cmdSetName + ' + Me.cmdSetName.Name = "cmdSetName" + Me.cmdSetName.Size = New System.Drawing.Size(119, 22) + Me.cmdSetName.Text = "Name" + ' + 'cmdSetInfo + ' + Me.cmdSetInfo.Name = "cmdSetInfo" + Me.cmdSetInfo.Size = New System.Drawing.Size(119, 22) + Me.cmdSetInfo.Text = "Info" + ' + 'ToolStripSeparator2 + ' + Me.ToolStripSeparator2.Name = "ToolStripSeparator2" + Me.ToolStripSeparator2.Size = New System.Drawing.Size(116, 6) + ' + 'cmdRelocatePartLayObj + ' + Me.cmdRelocatePartLayObj.Name = "cmdRelocatePartLayObj" + Me.cmdRelocatePartLayObj.Size = New System.Drawing.Size(119, 22) + Me.cmdRelocatePartLayObj.Text = "Relocate" + ' + 'cmdCopyPartLayObj + ' + Me.cmdCopyPartLayObj.Name = "cmdCopyPartLayObj" + Me.cmdCopyPartLayObj.Size = New System.Drawing.Size(119, 22) + Me.cmdCopyPartLayObj.Text = "Copy" + ' + 'cmdDeletePartLayObj + ' + Me.cmdDeletePartLayObj.Name = "cmdDeletePartLayObj" + Me.cmdDeletePartLayObj.Size = New System.Drawing.Size(119, 22) + Me.cmdDeletePartLayObj.Text = "Delete" + ' 'OpenFileDialog ' Me.OpenFileDialog.DefaultExt = "Nge" @@ -1648,16 +1798,6 @@ Partial Class Form1 ' Me.ColorDialog1.AnyColor = True ' - 'Scene1 - ' - Me.Scene1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.Scene1.Cursor = System.Windows.Forms.Cursors.Default - Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill - Me.Scene1.Location = New System.Drawing.Point(92, 83) - Me.Scene1.Name = "Scene1" - Me.Scene1.Size = New System.Drawing.Size(795, 425) - Me.Scene1.TabIndex = 1 - ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1701,6 +1841,7 @@ Partial Class Form1 Me.TabEdit.ResumeLayout(False) Me.TabTransform.ResumeLayout(False) Me.TabTest.ResumeLayout(False) + Me.ContextMenuTreeView1.ResumeLayout(False) Me.ResumeLayout(False) End Sub @@ -1709,15 +1850,15 @@ End Sub Friend WithEvents SaveFileDialog As System.Windows.Forms.SaveFileDialog Friend WithEvents Scene1 As TestEIn.Scene Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip - Friend WithEvents ToolStripStatusCursorPos As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents tsStatusCursorPos As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents tboxCmd As System.Windows.Forms.TextBox Friend WithEvents TreeView1 As System.Windows.Forms.TreeView Friend WithEvents ImageList1 As System.Windows.Forms.ImageList Friend WithEvents tBoxInfo As System.Windows.Forms.TextBox Friend WithEvents btnGetDist As System.Windows.Forms.CheckBox - Friend WithEvents ToolStripStatusOutput As System.Windows.Forms.ToolStripStatusLabel - Friend WithEvents ToolStripStatusOnL As System.Windows.Forms.ToolStripStatusLabel - Friend WithEvents ToolStripStatusOnR As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents tsStatusOutput As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents tsStatusOnL As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents tsStatusOnR As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents XbtnRotM90 As System.Windows.Forms.Button Friend WithEvents XbtnRotP90 As System.Windows.Forms.Button Friend WithEvents XbtnMirror As System.Windows.Forms.Button @@ -1775,12 +1916,11 @@ End Sub Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog Friend WithEvents txtColor As System.Windows.Forms.TextBox Friend WithEvents TabConstruct As System.Windows.Forms.TabPage - Friend WithEvents btnCopy As System.Windows.Forms.Button Friend WithEvents btnMirror As System.Windows.Forms.Button Friend WithEvents btnPlane As System.Windows.Forms.Button Friend WithEvents btnInvertCurve As System.Windows.Forms.Button Friend WithEvents btnJoinCurve As System.Windows.Forms.Button - Friend WithEvents btnSeparateCurve As System.Windows.Forms.Button + Friend WithEvents btnExplodeCurve As System.Windows.Forms.Button Friend WithEvents btnChangeColor As System.Windows.Forms.Button Friend WithEvents btnExtrude As System.Windows.Forms.Button Friend WithEvents InputBox As System.Windows.Forms.GroupBox @@ -1790,7 +1930,7 @@ End Sub Friend WithEvents btnCircleCR As System.Windows.Forms.Button Friend WithEvents btnRevolve As System.Windows.Forms.Button Friend WithEvents ImageList2 As System.Windows.Forms.ImageList - Friend WithEvents ToolStripStatusGrid As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents tsStatusGrid As System.Windows.Forms.ToolStripStatusLabel Friend WithEvents btnBottom As System.Windows.Forms.Button Friend WithEvents TabCPlane As System.Windows.Forms.TabPage Friend WithEvents btnCplaneFront As System.Windows.Forms.Button @@ -1805,5 +1945,21 @@ End Sub Friend WithEvents btnCplane3P As System.Windows.Forms.Button Friend WithEvents btnCplaneRotate As System.Windows.Forms.Button Friend WithEvents btnBreakCurve As System.Windows.Forms.Button + Friend WithEvents btnRuled As System.Windows.Forms.Button + Friend WithEvents ContextMenuTreeView1 As System.Windows.Forms.ContextMenuStrip + Friend WithEvents cmdCopyPartLayObj As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdSelectPartLayObj As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdRelocatePartLayObj As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator + Friend WithEvents cmdDeletePartLayObj As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdDeselectPartLayObj As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdSetName As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents ToolStripSeparator2 As System.Windows.Forms.ToolStripSeparator + Friend WithEvents cmdSetInfo As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents tsStatusTypePos As System.Windows.Forms.ToolStripStatusLabel + Friend WithEvents btnExtendCurve As System.Windows.Forms.Button + Friend WithEvents btnScale As System.Windows.Forms.Button + Friend WithEvents btnDone As System.Windows.Forms.Button + Friend WithEvents btnShow As System.Windows.Forms.Button End Class diff --git a/Form1.resx b/Form1.resx index e53186c..cc1ccd0 100644 --- a/Form1.resx +++ b/Form1.resx @@ -826,7 +826,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4 - DQAAAk1TRnQBSQFMAgEBDgEAAfABCQHwAQkBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DQAAAk1TRnQBSQFMAgEBDgEAAZgBCwGYAQsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -888,14 +888,14 @@ - 757, 10 + 496, 12 AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADW - CAAAAk1TRnQBSQFMAgEBAgEAARABAQEQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAbgBAgG4AQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -986,6 +986,28 @@ 7jjsWENEgupQHHZ0iEhQHY7DjjkiElSn4rCjIiJBdToOO0ZEJKi6xFEO9WjULY70EOPlf7GoaxzpIY+n l+geR3pYuYA+11N6+IML1H4HLvn4UQ7xEovL4rDjSHYcyY4j2XEkO45kx3HC4w3Q1q4ttTanIgAAAABJ RU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAAd0SU1FB94LCww6Oq6On0AAAAOdSURBVFhHxZVbSBRRHMY/QoLShxAioh6DIKGC + gnrwISp6KvBBe6xMcW/p5u7samaWWqTdH+qtp4KuLyUUBFFEUNHNLmZaYtfddVfNCjNTd0/fmXam2fFI + JTEKvzkz3875f9//zHEGQogpRSk6iVJ0EqXoJErRSZSiCmRnzwFmzQKQTyip7/tXlKIdzF02E7Pz8vVz + TpEh7PdMFqVoBWXRmShtfW1e/wrw30IoRQMUPZkHV1TA0yPgelRs6unHMBmMGmYtu2AAz+uVKIkJVH4U + qPnWh2YRRUPvdXgeFoibyFHN+TOYbtcyLkzR/3ETSth1kN2He4dQn3yHY+I+DoiXqBsbgUeuyrMESh9e + xOZbtdjYshEFZ9cgv2kJljcuxIo9i1F4cQ2Krhai+O5OeNrOobxrAJWx+DivcYI/2ojSOM3ZfahnFLVD + CTSJNhxlgL2iEzsH+6n/QIAhyiMCXo5ejm6OLs5xM7ib8329AtsSAv4+rmK/gDbA0H20sPnph/Szgf/D + abg4SWMhLZZE9eevaEi+xRHxAIdEK+rFG2pfoPWMIBBJ8fGk9CAaA8g5QZqHaK6xRpgBQhyrGKCKAcKf + GJRjSdcC6WWQGcDTdhsVevcpVPV+x67hGPan2vXum8VzLn+ExQZpNoog90ZA8g8BKkgg5jPMdU/9kA5w + ah2yUdzNmzmpZvATu+9m549xWDzCPi5/7fc4wokh7o2xzADSXI4MoDGANDYDcDQCBIjWd8kw1731g+Xt + hvlFuSw2ivrUIPZz0x1m9wfFUzSIbj1UKD7M35PjA5AQkQHC9hUgMkCY+yDU/8Mw1/3Mk4xXLLIQ7G5E + 80icz7+Tm7ADe5LvsYPPX27AYCQJLR0gY/nlCsjRCJDu3ghQzQCufmkxzfQ1TvSLjBDkDmag5pUfdV/e + YPcYC8kO5B6Jphhigg3I0VwBRYBtvC6PrDU9TTNDsIcw9A3H8+BuPQZvewJb3/76t/MRPwkYnRsbUD4G + S4CwDEFkgO1yLySazLpWE1O0vGrtv+lcQA42nFmNLXcaUPbkBjwvvmJTl0AZQ7gZwMcA5TSvYOfbaayb + kiAD+EnVwO9vS0ZhG9YgFib4CCGrchFyserAUhReWY+Se14U36uD++kJuNpPwv38PHwdl+HtaIHr5TVj + nq3IxEjjNNYwVib1dVSKf4s0tWAN81foNawFpwKl6CTyL2tKUaVyEqXoJErRSZSikyhFJ1GKziHwEwf3 + KAWuTvelAAAAAElFTkSuQmCC @@ -1028,17 +1050,31 @@ Y4C55tAaQOosc+gKMMscbgvAjp18d86hEWFGgGQcv0Zr90FTwmiAwjie9KsSkv6/r4SRAJl5PLmx/Kos tDAYYN9x+C+5Qgu9AY5vX2UOWhgIsM/L23NdgxbGA/BR9faghTxAI/l8LVpoXFAyJcAo5c4rTNETU/TE FD0xRU9M0RNT9CMsP8YUDae/Iv6fAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAAd0SU1FB94LCwoGNUlPh5wAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAu + M4zml1AAAAHKSURBVFhHxdY/SgNBGAXwGIOQNCIiooUIilgo+K9QtLLVyit4B0sP4RHiLWzE0jPYWqRU + rCTq+t4mO/lm5k2MiYwPfgTfzu632c0u1oqi+FeyzEmWkwqj1lRkOakgO9AFbBJrVamoqHVkMgOn8ABd + uVaV1ihJ7LMNZ7AK57AFZby19g9lzBzDBzzCBTTBizu+HRby0u5M9T8b5Wc6i3AH78CT2IUoboYdGPLC + E+ipu5OJMwebcAI3cAAyboYdaEUZnEBJrD2Ce7iEdWhBMm5feyBLJv3Nec+50xc8wxp4UTNIlqSS6Ofh + Ft6AJ8DLHyU8fkWWpOL6wZVYghXgD+0a9mDo/iFZ0gjhZX+CK+Dbzj1qqWPY47s1qqQfwoG83PQCG+CS + OoY9vlujShoS3mO+21+BC5P3XCWaExaVRDiMG+kT9oG/iXr/k4/oNCQfwWhOWJSljh1O/jfvvaAasABN + kI9sNCssyjLOIXjD5dp2Zxla5fA/PAE+Yrzc0XCxtroNNNtvXOx+bn9ZDsJ3efnPRJ83XKyPotZbsiQk + uudqHaWi1oZ0+Yvhlo3aruhyjOHj0mWm4STLnGSZkyxzkmVOssxJljnJMp+i9g26vAvWHNNcJAAAAABJ + RU5ErkJggg== - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAHdElNRQfeCwsKBjVJT4ecAAAA7UlEQVRYR8WTDQ6CMBTG - OJin9XTeYlIj5jm78TeeJk2kkPQjwFRK+SsqM1GZicqRzL/bDH/mQzlvchQxnj6gjnOs15k8C7EQbsZB - pTHdH2WhPhchFsLQjINKIw5ojSAWwtCNg0qjHlCPIBbCsBoHlS1aI4iFMGyKg8oeNuJoHFSu0RmxKw4q - t2Aj6mu2oHIN7vR1xwNGqOzxiS+cHKGyxU/8/czPjFBpEAth+Hrhjo5QWUMshEHf9ksGEAth6H5qQwcQ - C2HY/Z2voRKIhfAlcXCZFAeXSXFwmRQHlZmozERlJiozUZmJykxU5lGmJ/1JCrpcgBacAAAAAElFTkSu - QmCC + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAAAd0SU1FB94LCwoGNUlPh5wAAADtSURBVFhHxZMNDoIwFMY4mKf1dN5iUiPmObvx + N54mTaSQ9CPAVEr5KyozUZmJypHMv9sMf+ZDOW9yFDGePqCOc6zXmTwLsRBuxkGlMd0fZaE+FyEWwtCM + g0ojDmiNIBbC0I2DSqMeUI8gFsKwGgeVLVojiIUwbIqDyh424mgcVK7RGbErDiq3YCPqa7agcg3u9HXH + A0ao7PGJL5wcobLFT/z9zM+MUGkQC2H4euGOjlBZQyyEQd/2SwYQC2HofmpDBxALYdj9na+hEoiF8CVx + cJkUB5dJcXCZFAeVmajMRGUmKjNRmYnKTFTmUaYn/UkKulyAFpwAAAAASUVORK5CYII= @@ -1101,13 +1137,30 @@ 1AXpLtPnGvrkHPrkHPrkHPrkHPrkHPrkHPrkHPrkHPrkHPqj8QedywzpExYb4AAAAABJRU5ErkJggg== - + - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAAAd0SU1FB94KHhYtDVimFmIAAAC6SURBVFhH7Y9RDoMwDEM5GPe/VldLzcgSUxKY - so+10pPgFSdma639FCorodLSz97BAwN3O8tFoFIzFuiFZ9wqQaWAoWqBW4J3udM+A5VADx/QPzzzUbgM - LrdkvwdcHoNyw27kqASZIQK+HznhMk/lE7BUFbgs4UUwOANZNWc6ywsVtHcZ+vkoYe8FLwKhKP28S9g7 - wYsRmIW+iRerwCqwCqwCf1+gGiorobISKiuhshIqK6GyEirraNsL9oz5sY5cmbEAAAAASUVORK5CYII= + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAHdElNRQfeCxIIEwuRDrBYAAAEb0lEQVRYR8WUa2hcRRzF + z5372t1gTah5tIoxiZCUgtogqORDooFiAkYptBQFq4JIW9RQsSoqJtZE8ugDq2Jqi1ZUCoXiB1ExighR + KEabfSe76WY3pgnpAwuNNQ/heu4md73ZHYv44TrwY2bO7sz5z5nZhWVZ/ytS0UukopdIRS+Riv+V7zqg + JfrxAblMhsf60SL7nhupeC3YaqGqreQhaFoD5/6sblkidQBDyT4cTHajdKwXrYk+nEv2oj5/DzdSUQYN + H4UQHeQFshO6vhOm2QOfeQRGcbBzC8KTh/Cle02yH7vICbeWj1R0w7aOhi+xb4KKNho/CU30wTB+hM/4 + hHoVFPNUbRnShoIRYO2NztrYG6jkNfzgzBfCuM0ZO6ya5MNWSvagqUljv4OFvMbYu2h+AgHfZfj9WwFt + D1T9PSjKt3U1mAHWbP97vaXwLZy2x/Nh1PwRRJXzWe47+YIbtueyvRC7TeBWRt4CXT3C2OPw+6Z5LUPQ + jB4oRd803o3M/Y1IXR/AVYbls9ctRnD7WDfO2OOlGPY6+7opEBzY7mTc9ewbWMC+7FhX34ZhjvPkvzKF + cZ56TIEyLGCOsICYDmW8fiNmVRgfZvewLGX6U8za/WIM79vaYhSbrBBKcj7OIB+2x8l9jHw/6aRhLxP4 + HgGam0aKRcUUIMQCwgIirsLMqPDNVN2ETGUFpp19zp/Cb38m8PBCHF3zUbTMB1G7ysc9ccPWzlPfAaF+ + BEN7BaY+AJ8vzSLSfIRxfh5WIEICSkSFSKpQJ8uLkW7YhInme3gNZlvW6MLnOLo0is+YwFGyq8AnX3Dg + CV9dfvHqF9CNEO89DZ9/krGvmCvZ02sQCUafJkxAmyoOILW9DRd3tOERK40DS3HM/T6K9Yz+CRZwfC6M + 8itJlOZ83KZuWEA3eZ5F2CdP8d4nOU7Y5siaixDNx3j6CdtcB9IaC6hch9S2BzH7+m50WlNop/G7JLYQ + xUn2x65GkPuVZH3cEze89x5G/yIM/WMEAjPsxyGUKAvImjP6uA6Rss2NbAEio6Ho/NZWTHTtxcWBDtxs + 70PTQf7+NyxEsM+eXxjCdUwi9+9YYOzAu36KtNP8Ek+egoIoHx1PL4I0j/LhjS+ffBkN6lSRjszxw0hU + VWPQ3oM/vZed/RbDeNYZuykQHGhew9gPM/6vmEZs5d754pUoY6c5bOPJFTJAYGJzM35+Zz8mIG55hltU + XAmizNmPKWxx7+9QILiB3+xnIQf5EwwzhdMs5Cfe/wgLYRoKi1IiULQQ9JLRDXUYHjiE+MZaxJbXQ7j3 + mougwsat2ayayOC/3TEaf03OQGi/0DAIRYQgjAiEP24X0NyI0JsdOFtXjRTwdO6FFzCMQL62avJPsPXz + 4Z3j/acUBaM+E5HyGxC5qx6xthac3XwvLpkqBoHHimXrr4VUlGHCrObdv2WoSJUVY6G0BItr12BWg3JS + xfoHZGv+DVLRS6Sil0hFL5GKXiIVvUQqeolU9BKp6CVS0UukondY+Av4WLqJ0+rQpgAAAABJRU5ErkJg + gg== @@ -1150,6 +1203,15 @@ qIeJsIvfePHAJikroRrjgIEbb0KdVM9ElL0lvDZexam4Rrfa/kRXKUu0f+6RsrlQ/wUeO7eOqFTLRJSD Zp6b8fNpzM25hJ8x9YoNS7nVqCugU/KZ5JL2LhuRuQBfXnRyq4LiNX1c1oIo03DgfVcDdGzE8rhU/68Q ZT4RZT4RZT4RZT4RZT4RZT4RZf7Q+QMgTr7iuQrsHAAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAAAd0SU1FB94LEQkRLWJCkv4AAAC3SURBVFhH7c7BDcJADETRFECdNJJGEG3kwplK + 6MIwp0HLJKzXxgGJw5NGlrL5k5ntSh4ryWMleazEcVguHs+PRHDg4XmxbkkRHN4ASIjgGAmAYATHaAAE + IjgiATAYwRENgIEIjowAcEZwZAWAI4IjMwDw3obPB2z5B3xnwPlmXdSDXqsBp+vxrYyIUABEI8IBEIlI + CQB801I/bKUFtH4/IMPj8R4vAXuRx0ryWEkeK8ljJXmsY9Mdixw5EYtQsU0AAAAASUVORK5CYII= @@ -1159,16 +1221,6 @@ sSZCJJ+XuAmyHtzAEJgE3hgi+hQoJYFSEii52GMv/MYFSi7/CTDDunkinwSY5SBP6GtAmXKNTyuxAuZ9 1IBXA+7xloCGCCg90XhrADMCSkc23hPAiMASjfcGPETkojTu6A1wFCJyoQEaoAEa4AIqRH9RQIXwrycT LaQBPUDJRQM+D3gDKCWBUhIo5SBzAofF58BukbQYAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAAAd0SU1FB94KGxYWLvGteBoAAADpSURBVFhH7ZRRDsMgDEN7gB160o7Vn92MYQoM - Upc2gNKPDekBcQD7p12cc7dCRUuoOMLyWN8MdhZQsYds9lod5SBIVfTSNJaIENVDPajME0WI3YNa/gGA - KkRhHu6WxQghRCtI7O/uSWGUHETAzgIqavADU0b2z6CiFj+etwUozMMq+2dQ8Sqleaz9ws8eQcUrwBSG - WFn/KlQ8Y5Y54CL5jEDuTzIHdZHM2I8EiCAz+G5axpKJIbZJY56YFGKbfj5A2GhCTDIHdYEQrSCxX94Z - hYspiICdHYWKllDREipaQkVLqGgJFe1wywchNgQ27oTpewAAAABJRU5ErkJggg== @@ -1191,6 +1243,9 @@ RCtI7JdvesFiCsLgcxpA0RIoWgJFS6BoCRQtgaIdbvgCS/kFfmOvgmgAAAAASUVORK5CYII= + + 887, 9 + 18, 8 @@ -1198,10 +1253,10 @@ 165, 7 - 508, 10 + 633, 11 - 634, 10 + 764, 9 42 diff --git a/Form1.vb b/Form1.vb index 6a4588c..5fad4e9 100644 --- a/Form1.vb +++ b/Form1.vb @@ -14,6 +14,7 @@ Public Class Form1 Private WithEvents m_Controller As New Controller Private m_bShowGrid As Boolean Private m_bShowGridFrame As Boolean + Private m_bCPlaneTypePos As Boolean '-------------------------------- Form ------------------------------------------------------------ Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load @@ -85,6 +86,9 @@ Public Class Form1 EgtSetGridFrame(Frame3d.GLOB) EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep) EgtSetGridColor(MinLnColor, MajLnColor) + ' imposto tipo coordinate + m_bCPlaneTypePos = True + Scene1.SetGridCursorPos(m_bCPlaneTypePos) ' modo di visualizzazione Dim nShowMode As Integer = GetPrivateProfileInt("Scene", "ShowMode", SM.SHADING, m_sIniFile) If nShowMode = SM.WIREFRAME Then @@ -172,7 +176,7 @@ Public Class Form1 '-------------------------------- Events management ---------------------------------------------- Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles Scene1.OnCursorPos - ToolStripStatusCursorPos.Text = sCursorPos + tsStatusCursorPos.Text = sCursorPos End Sub Private Sub OnMouseSelected(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles Scene1.OnMouseSelected @@ -186,12 +190,57 @@ Public Class Form1 End If End Sub + Private Sub OnMousePartSelected(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMousePartSelected + ' recupero il pezzo + Dim nPartId = EgtGetParent(EgtGetParent(nId)) + If EgtGetParent(nPartId) <> GDB_ID.ROOT Then + Return + End If + ' eseguo la selezione ed aggiorno + EgtSelectPartObjs(nPartId) + EgtDraw() + End Sub + + Private Sub OnMouseLayerSelected(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseLayerSelected + ' recupero il layer + Dim nLayerId = EgtGetParent(nId) + If EgtGetParent(EgtGetParent(nLayerId)) <> GDB_ID.ROOT Then + Return + End If + ' eseguo la selezione ed aggiorno + EgtSelectLayerObjs(nLayerId) + EgtDraw() + End Sub + + Private Sub OnMousePointForSelection(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMousePointForSelection + m_Controller.SetLastPoint3d(PtP) + End Sub + + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMouseSelectedPoint + m_Controller.SetLastPoint3d(PtP) + If (ModifierKeys And Keys.Control) <> Keys.Control Then + m_Controller.ProcessStatus() + Else + ' eseguo ultimo drag + m_Controller.SetLastPoint3d(PtP) + m_Controller.ExecuteDrag() + ' passo in modalità input da box + Scene1.DisableDrag() + SetInputBoxPoint3d(PtP) + End If + End Sub + + Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMouseMoveSelPoint + m_Controller.SetLastPoint3d(PtP) + m_Controller.ExecuteDrag() + End Sub + Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseAnalyzed SelectIdInObjTree(nId) End Sub Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles Scene1.OnShowDistance - ToolStripStatusOutput.Text = sDistance + tsStatusOutput.Text = sDistance End Sub Private Sub OnNewProject(ByVal sender As Object) Handles Scene1.OnNewProject @@ -248,33 +297,35 @@ Public Class Form1 m_Controller.SetModified() End Sub - Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMouseSelectedPoint - m_Controller.SetLastPoint3d(PtP) - If (ModifierKeys And Keys.Control) <> Keys.Control Then - m_Controller.GoToNextStatus() - Else - ' eseguo ultimo drag - m_Controller.SetLastPoint3d(PtP) - m_Controller.ExecuteDrag() - ' passo in modalità input da box - Scene1.DisableDrag() - SetInputBoxPoint3d(PtP) - End If - End Sub - - Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMouseMoveSelPoint - m_Controller.SetLastPoint3d(PtP) - m_Controller.ExecuteDrag() - End Sub - Private Sub OnSetInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal nType As IBT) Handles m_Controller.SetInputBox SetInputBox(sTitle, sLabel, nType) End Sub + Private Sub OnAddInputCheck(ByVal sLabel As String) Handles m_Controller.AddInputCheck + AddInputCheck(sLabel) + InputCheck.Checked = False + End Sub + + Private Sub OnAddButtonShow() Handles m_Controller.AddButtonShow + btnShow.Show() + End Sub + + Private Sub OnSetInputBoxString(ByVal sText As String) Handles m_Controller.SetInputBoxString + SetInputBoxString(sText) + End Sub + + Private Sub OnSetInputBoxDouble(ByVal dVal As Double) Handles m_Controller.SetInputBoxDouble + SetInputBoxDouble(dVal) + End Sub + + Private Sub OnSetInputBoxPoint3d(ByVal ptP As Point3d) Handles m_Controller.SetInputBoxPoint3d + SetInputBoxPoint3d(ptP) + End Sub + Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI ' pulisco input e relativi messaggi ResetInputBox() - ToolStripStatusOutput.Text = "" + tsStatusOutput.Text = "" ' aggiorno dati correnti EmitTitle() EmitCurrPartLayer() @@ -365,10 +416,10 @@ Public Class Form1 If chkGetDist.Checked Then chkAnalyze.Checked = False Scene1.SetStatusGetDistance() - ToolStripStatusOutput.Text = " " + tsStatusOutput.Text = " " Else Scene1.ResetStatusGetDistance() - ToolStripStatusOutput.Text = " " + tsStatusOutput.Text = " " End If End Sub @@ -490,18 +541,20 @@ Public Class Form1 btnPlane.Enabled = bLayerOk And bSelOk btnExtrude.Enabled = bLayerOk And bSelOk btnRevolve.Enabled = bLayerOk And bSelOk + btnRuled.Enabled = bLayerOk And bSelOk ' Edit btnDelete.Enabled = bSelOk btnChangeColor.Enabled = bSelOk btnInvertCurve.Enabled = bSelOk + btnExtendCurve.Enabled = bSelOk btnBreakCurve.Enabled = bSelOk btnJoinCurve.Enabled = bLayerOk And bSelOk - btnSeparateCurve.Enabled = bSelOk + btnExplodeCurve.Enabled = bSelOk ' Transform - btnCopy.Enabled = bSelOk btnMove.Enabled = bSelOk btnRotate.Enabled = bSelOk btnMirror.Enabled = bSelOk + btnScale.Enabled = bSelOk End Sub @@ -535,7 +588,15 @@ Public Class Form1 End Sub Private Sub btnRevolve_Click(sender As System.Object, e As System.EventArgs) Handles btnRevolve.Click - m_Controller.ExecuteCommand(CMD.REVOLVE) + If (ModifierKeys And Keys.Shift) <> Keys.Shift Then + m_Controller.ExecuteCommand(CMD.REVOLVE) + Else + m_Controller.ExecuteCommand(CMD.REVOLVEPLUS) + End If + End Sub + + Private Sub btnRuled_Click(sender As System.Object, e As System.EventArgs) Handles btnRuled.Click + m_Controller.ExecuteCommand(CMD.RULED) End Sub Private Sub btnDelete_Click(sender As System.Object, e As System.EventArgs) Handles btnDelete.Click @@ -555,6 +616,10 @@ Public Class Form1 m_Controller.ExecuteCommand(CMD.INVERTCRVSURF) End Sub + Private Sub btnExtendCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnExtendCurve.Click + m_Controller.ExecuteCommand(CMD.EXTENDCURVE) + End Sub + Private Sub btnBreakCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnBreakCurve.Click m_Controller.ExecuteCommand(CMD.BREAKCURVE) End Sub @@ -563,18 +628,14 @@ Public Class Form1 m_Controller.ExecuteCommand(CMD.JOINCURVE) End Sub - Private Sub btnSeparateCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnSeparateCurve.Click - m_Controller.ExecuteCommand(CMD.SEPARATECURVE) + Private Sub btnSeparateCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnExplodeCurve.Click + m_Controller.ExecuteCommand(CMD.EXPLODECURVE) End Sub Private Sub btnMove_Click(sender As System.Object, e As System.EventArgs) Handles btnMove.Click m_Controller.ExecuteCommand(CMD.MOVE) End Sub - Private Sub btnCopy_Click(sender As System.Object, e As System.EventArgs) Handles btnCopy.Click - m_Controller.ExecuteCommand(CMD.COPY) - End Sub - Private Sub btnRotate_Click(sender As System.Object, e As System.EventArgs) Handles btnRotate.Click If (ModifierKeys And Keys.Shift) <> Keys.Shift Then m_Controller.ExecuteCommand(CMD.ROTATE) @@ -587,6 +648,14 @@ Public Class Form1 m_Controller.ExecuteCommand(CMD.MIRROR) End Sub + Private Sub btnScale_Click(sender As System.Object, e As System.EventArgs) Handles btnScale.Click + If (ModifierKeys And Keys.Shift) <> Keys.Shift Then + m_Controller.ExecuteCommand(CMD.SCALE) + Else + m_Controller.ExecuteCommand(CMD.SCALE3D) + End If + End Sub + ' ----------------- Test Commands ------------------- Private Sub XbtnRotP90_Click(sender As System.Object, e As System.EventArgs) Handles XbtnRotP90.Click @@ -666,7 +735,7 @@ Public Class Form1 chkAnalyze.Checked = False chkGetDist.Checked = False ' pulisco output - ToolStripStatusOutput.Text = "" + tsStatusOutput.Text = "" ResetInputBox() End If End Sub @@ -684,7 +753,6 @@ Public Class Form1 ' --------------------- Input Box ------------------------------- - Private m_bInput As Boolean = False Private m_nInpType As IBT = IBT.TY_NULL Public Sub SetInputBox(ByRef sTitle As String, ByRef sLabel As String, ByVal nType As IBT) @@ -693,22 +761,28 @@ Public Class Form1 InputLabel.Show() InputLabel.Text = sLabel InputText.Show() - m_bInput = True + InputText.Text = "" m_nInpType = nType InputText.Focus() End Sub + Public Sub AddInputCheck(ByRef sLabel As String) + InputCheck.Text = sLabel + InputCheck.Show() + End Sub + Public Sub ResetInputBox() InputBox.Hide() - InputBox.Text = "" - InputLabel.Hide() - InputLabel.Text = "" - InputText.Hide() - InputText.Text = "" + InputCheck.Hide() + btnShow.Hide() m_nInpType = IBT.TY_NULL - m_bInput = False End Sub + Private Function SetInputBoxString(ByVal sVal As String) As Boolean + InputText.Text = sVal + Return True + End Function + Private Function SetInputBoxDouble(ByVal dVal As Double) As Boolean Dim sText As New StringBuilder sText.Append(dVal.ToString("F3", CultureInfo.InvariantCulture)) @@ -716,7 +790,28 @@ Public Class Form1 Return True End Function + Private Function SetInputBox3Double(ByVal d3Val() As Double) As Boolean + ' verifico ci siano almeno 3 elementi nell'array + If d3Val.Length < 3 Then + Return False + End If + ' visualizzo + Dim sText As New StringBuilder + sText.Append(d3Val(0).ToString("F3", CultureInfo.InvariantCulture)) + sText.Append(",") + sText.Append(d3Val(1).ToString("F3", CultureInfo.InvariantCulture)) + sText.Append(",") + sText.Append(d3Val(2).ToString("F3", CultureInfo.InvariantCulture)) + InputText.Text = sText.ToString() + Return True + End Function + Private Function SetInputBoxPoint3d(ByVal PtVal As Point3d) As Boolean + ' converto da coordinate globali a griglia + Dim frGrid As New Frame3d + EgtGetGridFrame(frGrid) + PtVal.ToLoc(frGrid) + ' visualizzo Dim sText As New StringBuilder sText.Append(PtVal.x.ToString("F3", CultureInfo.InvariantCulture)) sText.Append(",") @@ -731,7 +826,31 @@ Public Class Form1 Return Double.TryParse(InputText.Text, NumberStyles.Float, CultureInfo.InvariantCulture, dVal) End Function + Private Function GetInputBox3Double(ByRef d3Val() As Double) As Boolean + ' verifico ci siano almeno 3 elementi nell'array + If d3Val.Length < 3 Then + Return False + End If + ' leggo le ccordinate + Dim sItems() As String = InputText.Text.Split(",".ToCharArray) + Dim bOk As Boolean = False + d3Val(0) = 0 + d3Val(1) = 0 + d3Val(2) = 0 + If sItems.Count() >= 1 Then + bOk = Double.TryParse(sItems(0), NumberStyles.Float, CultureInfo.InvariantCulture, d3Val(0)) + If sItems.Count() >= 2 Then + bOk = Double.TryParse(sItems(1), NumberStyles.Float, CultureInfo.InvariantCulture, d3Val(1)) And bOk + If sItems.Count() >= 3 Then + bOk = Double.TryParse(sItems(2), NumberStyles.Float, CultureInfo.InvariantCulture, d3Val(2)) And bOk + End If + End If + End If + Return bOk + End Function + Private Function GetInputBoxPoint3d(ByRef PtVal As Point3d) As Boolean + ' leggo le coordinate Dim sItems() As String = InputText.Text.Split(",".ToCharArray) Dim bOk As Boolean = False PtVal = Point3d.ORIG @@ -744,17 +863,30 @@ Public Class Form1 End If End If End If + ' se richiesto, converto in globale + Dim frGrid As New Frame3d + EgtGetGridFrame(frGrid) + PtVal.ToGlob(frGrid) Return bOk End Function Private Function InputBoxTextToLast() As Boolean Select Case m_nInpType + Case IBT.TY_STRING + m_Controller.SetLastString(InputText.Text) + Return True Case IBT.TY_DOUBLE Dim dVal As Double If GetInputBoxDouble(dVal) Then m_Controller.SetLastDouble(dVal) Return True End If + Case IBT.TY_3DOUBLE + Dim d3Val(3) As Double + If GetInputBox3Double(d3Val) Then + m_Controller.SetLast3Double(d3Val) + Return True + End If Case IBT.TY_POINT3D Dim ptP As Point3d If GetInputBoxPoint3d(ptP) Then @@ -775,10 +907,27 @@ Public Class Form1 ' Con RETURN devo eseguire lo stato corrente ElseIf e.KeyData = Keys.Return Then InputBoxTextToLast() - m_Controller.GoToNextStatus() + m_Controller.ProcessStatus() End If End Sub + Private Sub InputCheck_KeyDown(ByVal sender As Object, ByVal e As EventArgs) Handles InputCheck.CheckedChanged + m_Controller.SetLastBoolean(InputCheck.Checked) + End Sub + + Private Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click + ' aggiorno la visualizzazione grafica + InputBoxTextToLast() + Scene1.DisableDrag() + EgtResetGeoLine() + m_Controller.ExecuteDrag() + End Sub + + Private Sub btnDone_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDone.Click + ' eseguo lo stato corrente + InputBoxTextToLast() + m_Controller.ProcessStatus() + End Sub '-------------------------------- Command Box ---------------------------------------------------- Private Sub tboxCmd_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles tboxCmd.KeyDown @@ -791,9 +940,9 @@ Public Class Form1 ' eseguo comando If EgtTscExecLine(sCmd) Then Scene1.Invalidate() - ToolStripStatusOnR.Text = " " + tsStatusOnR.Text = " " Else - ToolStripStatusOnR.Text = "Error executing command" + tsStatusOnR.Text = "Error executing command" End If ' ricarico albero degli oggetti LoadObjTree() @@ -804,15 +953,15 @@ Public Class Form1 '-------------------------------- Current Piece/Layer -------------------------------------------- - Private Sub btnNewPart_Click(sender As System.Object, e As System.EventArgs) Handles btnNewPart.Click + Private Sub btnNewPart_Click(sender As Object, e As EventArgs) Handles btnNewPart.Click m_Controller.ExecuteCommand(CMD.NEWPART) End Sub - Private Sub btnNewLayer_Click(sender As System.Object, e As System.EventArgs) Handles btnNewLayer.Click + Private Sub btnNewLayer_Click(sender As Object, e As EventArgs) Handles btnNewLayer.Click m_Controller.ExecuteCommand(CMD.NEWLAYER) End Sub - Private Sub btnColor_Click(sender As System.Object, e As System.EventArgs) Handles btnColor.Click + Private Sub btnColor_Click(sender As Object, e As EventArgs) Handles btnColor.Click m_Controller.ExecuteCommand(CMD.LAYERCOLOR) End Sub @@ -838,6 +987,7 @@ Public Class Form1 '-------------------------------- Tree View ------------------------------------------------------ Private m_nObjTreeOldId As Integer = GDB_ID.NULL + Private m_nObjTreeMenuId As Integer = GDB_ID.NULL Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick If m_nObjTreeOldId <> GDB_ID.NULL Then @@ -854,6 +1004,7 @@ Public Class Form1 TreeView1.EndUpdate() If nOldId <> GDB_ID.NULL Then SelectIdInObjTree(nOldId) + UpdateObjDataInObjTree(m_nObjTreeOldId) End If End Sub @@ -934,6 +1085,10 @@ Public Class Form1 Private Sub UpdateObjTree() ' per aggiornare l'albero senza ricostruirlo da capo + ' se c'è una entità corrente, ne aggiorno i dati + If m_nObjTreeOldId <> GDB_ID.NULL Then + UpdateObjDataInObjTree(m_nObjTreeOldId) + End If End Sub Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nLev As Integer) As Integer @@ -1001,10 +1156,14 @@ Public Class Form1 End Sub Private Sub ObjTree_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles TreeView1.MouseUp - Dim nId As Integer + ' determino Id di eventuale item sotto il mouse + Dim nId As Integer = GDB_ID.NULL Dim TNode As TreeNode = TreeView1.GetNodeAt(e.Location) - If TNode IsNot Nothing AndAlso Int32.TryParse(TNode.Name, nId) AndAlso - m_nObjTreeOldId = nId Then + If TNode IsNot Nothing Then + Int32.TryParse(TNode.Name, nId) + End If + ' se Id coincide con il corrente + If nId <> GDB_ID.NULL And nId = m_nObjTreeOldId Then ' evidenzio EgtSetMark(m_nObjTreeOldId) EgtDraw() @@ -1012,6 +1171,18 @@ Public Class Form1 ObjTreeTimer.Stop() ObjTreeTimer.Start() End If + ' se rilascio tasto destro + If e.Button = Windows.Forms.MouseButtons.Right Then + ' Id pezzo sotto il mouse + m_nObjTreeMenuId = nId + ' verifico stato visualizzazione per abilitare voci menù + Dim nStat As GDB_ST = GDB_ST.ON_ + Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF + For Each i As ToolStripItem In ContextMenuTreeView1.Items + i.Enabled = bOn + Next + ContextMenuTreeView1.Show(TreeView1, e.Location) + End If End Sub Private Sub ObjTree_MouseDoubleClick(ByVal sender As Object, e As MouseEventArgs) Handles TreeView1.MouseDoubleClick @@ -1044,20 +1215,25 @@ Public Class Form1 End If End Sub - Private Sub ObjTree_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles TreeView1.KeyDown - ' Con DEL eseguo cancellazione del pezzo o del layer selezionati - If e.KeyData = Keys.Delete Then - m_Controller.SetLastIntegers(m_nObjTreeOldId, 0) - m_Controller.ExecuteCommand(CMD.DELETE) - End If - End Sub - Private Sub UpdateObjInObjTree(ByVal nId As Integer) ' ripristino eventuale vecchio oggetto selezionato RevertOldIdInObjTree() + ' stampa dei dati del nuovo oggetto + UpdateObjDataInObjTree(nId) + ' evidenzio l'oggetto + EgtSetMark(nId) + m_nObjTreeOldId = nId + ' imposto il ridisegno della scena + EgtDraw() + ' lancio timer per successiva de-evidenziazione + ObjTreeTimer.Stop() + ObjTreeTimer.Start() + End Sub + + Private Sub UpdateObjDataInObjTree(ByVal nId As Integer) ' recupero il tipo del nuovo oggetto Dim nType As Integer = EgtGetType(nId) - ' stampa dei dati del nuovo oggetto + ' stampa dei dati dell'oggetto Dim sDump As String = String.Empty If nType = GDB_TY.NONE Then tBoxInfo.Text = String.Empty @@ -1074,14 +1250,6 @@ Public Class Form1 tBoxInfo.Text = String.Empty End If End If - ' evidenzio l'oggetto - EgtSetMark(nId) - m_nObjTreeOldId = nId - ' imposto il ridisegno della scena - EgtDraw() - ' lancio timer per successiva de-evidenziazione - ObjTreeTimer.Stop() - ObjTreeTimer.Start() End Sub Private Function RevertOldIdInObjTree() As Integer @@ -1110,6 +1278,30 @@ Public Class Form1 End If End Function + Private Sub MenuObjTree_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuTreeView1.ItemClicked + If e.ClickedItem.Name = "cmdSelectPartLayObj" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.SELECTPARTLAYEROBJ) + ElseIf e.ClickedItem.Name = "cmdDeselectPartLayObj" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.DESELECTPARTLAYEROBJ) + ElseIf e.ClickedItem.Name = "cmdSetName" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.SETNAME) + ElseIf e.ClickedItem.Name = "cmdSetInfo" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.SETINFO) + ElseIf e.ClickedItem.Name = "cmdRelocatePartLayObj" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.RELOCATEPARTLAYEROBJ) + ElseIf e.ClickedItem.Name = "cmdCopyPartLayObj" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.COPYPARTLAYEROBJ) + ElseIf e.ClickedItem.Name = "cmdDeletePartLayObj" Then + m_Controller.SetLastIntegers(m_nObjTreeMenuId, 0) + m_Controller.ExecuteCommand(CMD.DELETE) + End If + End Sub '-------------------------------- Program Title -------------------------------------------------- Private Sub EmitTitle() @@ -1129,15 +1321,27 @@ Public Class Form1 End Sub '-------------------------------- Status Bar ----------------------------------------------------- - Private Sub ToolStripStatusGrid_Click() Handles ToolStripStatusGrid.Click + Private Sub ToolStripStatusGrid_Click() Handles tsStatusGrid.Click m_bShowGrid = Not m_bShowGrid If m_bShowGrid Then - ToolStripStatusGrid.ForeColor = Color.Black + tsStatusGrid.ForeColor = Color.Black + tsStatusGrid.Text = "GRID ON " Else - ToolStripStatusGrid.ForeColor = Color.LightGray + tsStatusGrid.ForeColor = Color.LightGray + tsStatusGrid.Text = "GRID OFF" End If EgtSetGridShow(m_bShowGrid, m_bShowGrid And m_bShowGridFrame) EgtDraw() End Sub + Private Sub ToolStripStatusTypePos_Click() Handles tsStatusTypePos.Click + m_bCPlaneTypePos = Not m_bCPlaneTypePos + If m_bCPlaneTypePos Then + tsStatusTypePos.Text = "CPLANE" + Else + tsStatusTypePos.Text = "WORLD " + End If + Scene1.SetGridCursorPos(m_bCPlaneTypePos) + End Sub + End Class diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index fc7a76c..e2f4b53 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -43,5 +43,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + + diff --git a/Scene.Designer.vb b/Scene.Designer.vb index 71d0bc4..c858ba0 100644 --- a/Scene.Designer.vb +++ b/Scene.Designer.vb @@ -28,88 +28,109 @@ Partial Class Scene Me.cmdDeselectAll = New System.Windows.Forms.ToolStripMenuItem() Me.SepSel1 = New System.Windows.Forms.ToolStripSeparator() Me.cmdWinSelect = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdSelectLayer = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdSelectPart = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdResumeDrag = New System.Windows.Forms.ToolStripMenuItem() Me.cmdSketchPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdGridPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdEndPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdMidPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdCenterPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdNearPoint = New System.Windows.Forms.ToolStripMenuItem() - Me.cmdResumeDrag = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdIntersectionPoint = New System.Windows.Forms.ToolStripMenuItem() Me.MenuScene.SuspendLayout() Me.SuspendLayout() ' 'MenuScene ' - Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.SepSel1, Me.cmdWinSelect, Me.cmdResumeDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint}) + Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.SepSel1, Me.cmdWinSelect, Me.cmdSelectLayer, Me.cmdSelectPart, Me.cmdResumeDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint, Me.cmdIntersectionPoint}) Me.MenuScene.Name = "ContextMenuStrip1" Me.MenuScene.ShowCheckMargin = True Me.MenuScene.ShowImageMargin = False - Me.MenuScene.Size = New System.Drawing.Size(153, 230) + Me.MenuScene.Size = New System.Drawing.Size(168, 318) ' 'cmdSelectAll ' Me.cmdSelectAll.Name = "cmdSelectAll" - Me.cmdSelectAll.Size = New System.Drawing.Size(152, 22) + Me.cmdSelectAll.Size = New System.Drawing.Size(167, 22) Me.cmdSelectAll.Text = "Select All" ' 'cmdDeselectAll ' Me.cmdDeselectAll.Name = "cmdDeselectAll" - Me.cmdDeselectAll.Size = New System.Drawing.Size(152, 22) + Me.cmdDeselectAll.Size = New System.Drawing.Size(167, 22) Me.cmdDeselectAll.Text = "Deselect All" ' 'SepSel1 ' Me.SepSel1.Name = "SepSel1" - Me.SepSel1.Size = New System.Drawing.Size(149, 6) + Me.SepSel1.Size = New System.Drawing.Size(164, 6) ' 'cmdWinSelect ' Me.cmdWinSelect.Name = "cmdWinSelect" - Me.cmdWinSelect.Size = New System.Drawing.Size(152, 22) + Me.cmdWinSelect.Size = New System.Drawing.Size(167, 22) Me.cmdWinSelect.Text = "Select Window" ' + 'cmdSelectLayer + ' + Me.cmdSelectLayer.Name = "cmdSelectLayer" + Me.cmdSelectLayer.Size = New System.Drawing.Size(167, 22) + Me.cmdSelectLayer.Text = "Select Layer" + ' + 'cmdSelectPart + ' + Me.cmdSelectPart.Name = "cmdSelectPart" + Me.cmdSelectPart.Size = New System.Drawing.Size(167, 22) + Me.cmdSelectPart.Text = "Select Part" + ' + 'cmdResumeDrag + ' + Me.cmdResumeDrag.Name = "cmdResumeDrag" + Me.cmdResumeDrag.Size = New System.Drawing.Size(167, 22) + Me.cmdResumeDrag.Text = "ResumeDrag" + ' 'cmdSketchPoint ' Me.cmdSketchPoint.Name = "cmdSketchPoint" - Me.cmdSketchPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdSketchPoint.Size = New System.Drawing.Size(167, 22) Me.cmdSketchPoint.Text = "Sketch Point" ' 'cmdGridPoint ' Me.cmdGridPoint.Name = "cmdGridPoint" - Me.cmdGridPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdGridPoint.Size = New System.Drawing.Size(167, 22) Me.cmdGridPoint.Text = "Grid Point" ' 'cmdEndPoint ' Me.cmdEndPoint.Name = "cmdEndPoint" - Me.cmdEndPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdEndPoint.Size = New System.Drawing.Size(167, 22) Me.cmdEndPoint.Text = "End Point" ' 'cmdMidPoint ' Me.cmdMidPoint.Name = "cmdMidPoint" - Me.cmdMidPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdMidPoint.Size = New System.Drawing.Size(167, 22) Me.cmdMidPoint.Text = "Mid Point" ' 'cmdCenterPoint ' Me.cmdCenterPoint.Name = "cmdCenterPoint" - Me.cmdCenterPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdCenterPoint.Size = New System.Drawing.Size(167, 22) Me.cmdCenterPoint.Text = "Center" ' 'cmdNearPoint ' Me.cmdNearPoint.Name = "cmdNearPoint" - Me.cmdNearPoint.Size = New System.Drawing.Size(152, 22) + Me.cmdNearPoint.Size = New System.Drawing.Size(167, 22) Me.cmdNearPoint.Text = "Near Point" ' - 'cmdResumeDrag + 'cmdIntersectionPoint ' - Me.cmdResumeDrag.Name = "cmdResumeDrag" - Me.cmdResumeDrag.Size = New System.Drawing.Size(152, 22) - Me.cmdResumeDrag.Text = "ResumeDrag" + Me.cmdIntersectionPoint.Name = "cmdIntersectionPoint" + Me.cmdIntersectionPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdIntersectionPoint.Text = "Intersection Point" ' 'Scene ' @@ -133,5 +154,8 @@ End Sub Friend WithEvents cmdSketchPoint As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmdGridPoint As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmdResumeDrag As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdSelectLayer As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdSelectPart As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdIntersectionPoint As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/Scene.vb b/Scene.vb index 9784892..afe8e10 100644 --- a/Scene.vb +++ b/Scene.vb @@ -18,6 +18,8 @@ Public Class Scene ROT ZOOMWIN WINSEL + SELPART + SELLAYER ANALYZE GETDIST GETDIST2 @@ -28,6 +30,7 @@ Public Class Scene Private m_PrevPoint As Point Private m_ptPrev As Point3d Private m_ptGrid As Point3d + Private m_bGridCursorPos As Boolean Private m_nDriver As Integer Private m_b2Buff As Boolean Private m_nColorBits As Integer @@ -55,6 +58,7 @@ Public Class Scene m_nOldStatus = ST.NULL m_nSnapType = SP.PT_GRID m_PrevPoint = Point.Empty + m_bGridCursorPos = False m_nDriver = 3 m_b2Buff = True m_nColorBits = 24 @@ -104,6 +108,10 @@ Public Class Scene m_DstLnColor = DstLnColor End Sub + Public Sub SetGridCursorPos(ByVal bGridCursorPos As Boolean) + m_bGridCursorPos = bGridCursorPos + End Sub + 'Mettere EgtInit, EgtSetKey e EgtSetFont nell'evento Load del Form, prima di inizializzare la o le Scene 'Mettere EgtExit nell'evento FormClosing @@ -123,11 +131,6 @@ Public Class Scene Return m_nGseContext End Function - Protected Overrides Sub OnHandleDestroyed(e As EventArgs) - 'EgtExit va spostata nell'evento FormClosing del Form - 'EgtExit() - End Sub - Protected Overrides Sub OnPaint(e As PaintEventArgs) MyBase.OnPaint(e) ' Salvo il contesto corrente e imposto quello della scena @@ -164,7 +167,10 @@ Public Class Scene '---- Events ---------- Public Event OnMouseSelected(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) + Public Event OnMousePartSelected(ByVal sender As Object, ByVal nId As Integer) + Public Event OnMouseLayerSelected(ByVal sender As Object, ByVal nId As Integer) Public Event OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) + Public Event OnMousePointForSelection(ByVal sender As Object, ByVal PtP As Point3d) Public Event OnMouseDownScene(ByVal sender As Object) Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Public Event OnShowDistance(ByVal sender As Object, ByVal sDistance As String) @@ -200,9 +206,10 @@ Public Class Scene Cursor = New Cursor(Me.GetType(), "WinSelect.cur") m_PrevPoint = e.Location m_nStatus = ST.WINSEL - ' se stato NULL (selezione) o analisi - ElseIf m_nStatus = ST.NULL Or m_nStatus = ST.ANALYZE Then - If m_nStatus = ST.NULL Then + ' se stato NULL (selezione), SELPART, SELLAYER o ANALYZE + ElseIf m_nStatus = ST.NULL Or m_nStatus = ST.SELPART Or + m_nStatus = ST.SELLAYER Or m_nStatus = ST.ANALYZE Then + If m_nStatus <> ST.ANALYZE Then Cursor = New Cursor(Me.GetType(), "Select.cur") Else Cursor = New Cursor(Me.GetType(), "Analyze.cur") @@ -223,10 +230,23 @@ Public Class Scene End If End If If nId <> GDB_ID.NULL Then - If m_nStatus = ST.NULL Then + ' evento per entità selezionate + Select Case m_nStatus + Case ST.NULL RaiseEvent OnMouseSelected(Me, nId, True) - Else + Case ST.SELPART + RaiseEvent OnMousePartSelected(Me, nId) + m_nStatus = ST.NULL + Case ST.SELLAYER + RaiseEvent OnMouseLayerSelected(Me, nId) + m_nStatus = ST.NULL + Case Else RaiseEvent OnMouseAnalyzed(Me, nId) + End Select + ' evento per posizione punto di selezione + Dim PtTemp As Point3d + If EgtGetGraphicSnapPoint(SP.PT_SKETCH, e.Location, DIM_SEL, DIM_SEL, PtTemp) Then + RaiseEvent OnMousePointForSelection(Me, PtTemp) End If End If ' se stato misura di distanza (primo punto) @@ -371,6 +391,10 @@ Public Class Scene i.Visible = True ElseIf i.Name = "cmdWinSelect" Then i.Visible = True + ElseIf i.Name = "cmdSelectPart" Then + i.Visible = True + ElseIf i.Name = "cmdSelectLayer" Then + i.Visible = True Else i.Visible = False End If @@ -397,6 +421,9 @@ Public Class Scene ElseIf i.Name = "cmdNearPoint" Then i.Visible = True DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_NEAR) + ElseIf i.Name = "cmdIntersectionPoint" Then + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_INTERS) Else i.Visible = False End If @@ -529,10 +556,15 @@ Public Class Scene Dim sCursorPos As New System.Text.StringBuilder Dim ptWorld As Point3d - ' se lo stato prevede lo snap a un punto e riesco a ricavare un punto 3d snap - If (m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT) And + ' se coord. griglia e non snap a punto in Z e riesco a ricavare un punto 3d snap + If (m_bGridCursorPos And m_nStatus <> ST.SELPOINTZ) And EgtGetGraphicSnapPoint(IIf(m_nSnapType = SP.PT_GRID, SP.PT_GRID, SP.PT_SKETCH), WinXY, DIM_SEL, DIM_SEL, ptWorld) Then + If m_bGridCursorPos Then + Dim frGrid As New Frame3d + EgtGetGridFrame(frGrid) + ptWorld.ToLoc(frGrid) + End If sCursorPos.Append("X=") sCursorPos.Append(ptWorld.x.ToString("F4", CultureInfo.InvariantCulture)) sCursorPos.Append(" Y=") @@ -542,6 +574,11 @@ Public Class Scene ' se snap a punto in Z e riesco a ricavare un punto 3d snap ElseIf m_nStatus = ST.SELPOINTZ And EgtGetGridSnapPointZ((m_nSnapType = SP.PT_SKETCH), WinXY, m_ptGrid, ptWorld) Then + If m_bGridCursorPos Then + Dim frGrid As New Frame3d + EgtGetGridFrame(frGrid) + ptWorld.ToLoc(frGrid) + End If sCursorPos.Append("X=") sCursorPos.Append(ptWorld.x.ToString("F4", CultureInfo.InvariantCulture)) sCursorPos.Append(" Y=") @@ -582,12 +619,17 @@ Public Class Scene Private Sub MenuScene_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuScene.ItemClicked ' Per selezione If e.ClickedItem.Name = "cmdSelectAll" Then - + EgtSelectAll(True) + EgtDraw() ElseIf e.ClickedItem.Name = "cmdDeselectAll" Then EgtDeselectAll() EgtDraw() ElseIf e.ClickedItem.Name = "cmdWinSelect" Then m_nStatus = ST.WINSEL + ElseIf e.ClickedItem.Name = "cmdSelectPart" Then + m_nStatus = ST.SELPART + ElseIf e.ClickedItem.Name = "cmdSelectLayer" Then + m_nStatus = ST.SELLAYER ' Riabilitazione drag sospeso ElseIf e.ClickedItem.Name = "cmdResumeDrag" Then EgtResetGeoLine() @@ -605,13 +647,15 @@ Public Class Scene m_nSnapType = SP.CENTER ElseIf e.ClickedItem.Name = "cmdNearPoint" Then m_nSnapType = SP.PT_NEAR + ElseIf e.ClickedItem.Name = "cmdIntersectionPoint" Then + m_nSnapType = SP.PT_INTERS End If End Sub '---- Status management ------------- Private Function IsRestorableCurrStatus() As Boolean Select Case m_nStatus - Case ST.NULL, ST.ANALYZE, ST.GETDIST, ST.GETDIST2, ST.SELPOINT, ST.SELPOINTZ + Case ST.NULL, ST.ANALYZE, ST.SELPART, ST.SELLAYER, ST.GETDIST, ST.GETDIST2, ST.SELPOINT, ST.SELPOINTZ Return True Case Else Return False @@ -626,7 +670,7 @@ Public Class Scene Private Function RestoreStatus() As Boolean ' eventuale ripristino vecchio stato - If m_nOldStatus = ST.NULL Then + If m_nOldStatus = ST.NULL Or m_nOldStatus = ST.SELPART Or m_nOldStatus = ST.SELLAYER Then m_nStatus = m_nOldStatus Cursor = New Cursor(Me.GetType(), "Select.cur") Return True