From c1e60221c5d2cb1239a2d41534fb78a536d2bb54 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 1 Dec 2014 14:54:24 +0000 Subject: [PATCH] TestEIn 1.5k5 : - aggiunta gestione linee tangenti - miglioramenti a trim/extend di curve. --- Controller.vb | 239 +++++++++++++++++++++++++++----- EgtInterface.vb | 74 ++++++++-- Form1.Designer.vb | 113 ++++++++++----- Form1.resx | 14 +- Form1.vb | 79 +++++++++-- My Project/AssemblyInfo.vb | 4 +- Scene.Designer.vb | 64 ++++++--- Scene.vb | 272 ++++++++++++++++++++++++++----------- 8 files changed, 667 insertions(+), 192 deletions(-) diff --git a/Controller.vb b/Controller.vb index 571fdbf..14c4ca1 100644 --- a/Controller.vb +++ b/Controller.vb @@ -70,7 +70,7 @@ Public Class Controller CHANGECOLOR RESETCOLOR INVERTCRVSURF - EXTENDCURVE + TRIMEXTENDCURVE BREAKCURVE JOINCURVE EXPLODECURVE @@ -81,6 +81,7 @@ Public Class Controller MIRROR SCALE SCALE3D + OFFSET End Enum Public Enum GRID_TYPE As Integer NONE = 0 @@ -94,8 +95,14 @@ Public Class Controller Private m_nLastCmd As CMD = CMD.NULL Private m_nStep As Integer = 0 Private m_ptP1 As Point3d + Private m_sepP1 As SEP + Private m_nIdP1 As Integer Private m_ptP2 As Point3d + Private m_sepP2 As SEP + Private m_nIdP2 As Integer Private m_ptLast As Point3d + Private m_sepLast As SEP + Private m_nIdLast As Integer Private m_dPrev As Double = 0 Private m_dAux As Double = 0 Private m_dLast As Double = 0 @@ -109,12 +116,13 @@ Public Class Controller Private m_vtCont As Vector3d ' direzione finale di entità precedente (per continuazione) ' Input - Public Enum IBT As Integer + Private Enum IBT As Integer TY_NULL = 0 TY_STRING TY_DOUBLE TY_DIRECTION TY_LENGTH + TY_SPECIALDOUBLE TY_3DOUBLE TY_POINT3D End Enum @@ -125,6 +133,8 @@ Public Class Controller Private DIAM_STD As Double = 20 Private EXTRUDE_STD As Double = 20 Private EXTEND_STD As Double = 50 + Private EXTEND_ADD As Double = 10 + Private OFFSET_STD As Double = 10 ' Metodi Public Sub MouseSelectedObj(ByVal nId As Integer, ByVal bLast As Boolean) @@ -160,33 +170,35 @@ Public Class Controller EgtDraw() End Sub - Public Sub MouseSelectedPoint(ByVal PtP As Point3d, ByVal bDone As Boolean) - SetDataFromSelPoint(PtP) + Public Sub MouseSelectedPoint(ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer, ByVal bDone As Boolean) + SetDataFromSelPoint(PtP, nSep, nId) ' avanzo di un passo If bDone Then ProcessStatus() ' eseguo ultimo drag e passo in modalità input da box Else - ExecuteDrag() m_Scene.DisableDrag() + ExecuteDrag() Select Case m_nInpType Case IBT.TY_POINT3D SetInputBoxPoint3d(m_ptLast) - Case IBT.TY_DIRECTION, IBT.TY_LENGTH + Case IBT.TY_DIRECTION, IBT.TY_LENGTH, IBT.TY_SPECIALDOUBLE SetInputBoxDouble(m_dLast) End Select End If End Sub Public Sub MouseMoveInSelectionPoint(ByVal PtP As Point3d) - SetDataFromSelPoint(PtP) + SetDataFromSelPoint(PtP, SEP.PT_STD, GDB_ID.NULL) ' eseguo drag ExecuteDrag() End Sub - Private Sub SetDataFromSelPoint(ByVal PtP As Point3d) - ' recupero il punto - SetLastPoint3d(PtP) + Private Sub SetDataFromSelPoint(ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) + ' recupero il punto e le sue info ausiliarie + m_ptLast = PtP + m_sepLast = nSep + m_nIdLast = nId ' se usato per tipi speciali Select Case m_nInpType Case IBT.TY_DIRECTION @@ -194,6 +206,8 @@ Public Class Controller m_dAux = GridLenFromGlobLen(m_ptLast - m_ptP1) Case IBT.TY_LENGTH m_dLast = (m_ptLast - m_ptP1) * m_vtCont + Case IBT.TY_SPECIALDOUBLE + ExecuteSpecialData() End Select End Sub @@ -268,7 +282,7 @@ Public Class Controller Case IBT.TY_STRING m_sLast = sText Return True - Case IBT.TY_DOUBLE, IBT.TY_DIRECTION, IBT.TY_LENGTH + Case IBT.TY_DOUBLE, IBT.TY_DIRECTION, IBT.TY_LENGTH, IBT.TY_SPECIALDOUBLE Return TextToDouble(sText, m_dLast) Case IBT.TY_3DOUBLE Return TextTo3Double(sText, m_d3Last) @@ -354,6 +368,9 @@ Public Class Controller Public Sub ResetStatus() m_nStep = 0 + m_sepP1 = SEP.PT_STD + m_sepP2 = SEP.PT_STD + m_sepLast = SEP.PT_STD m_Scene.ResetStatus() End Sub @@ -485,7 +502,7 @@ Public Class Controller Case CMD.INVERTCRVSURF Return ProcessInvertCurveSurf() ' Extend Curve - Case CMD.EXTENDCURVE + Case CMD.TRIMEXTENDCURVE Return ProcessExtendCurve() ' Break Curve Case CMD.BREAKCURVE @@ -517,10 +534,11 @@ Public Class Controller ' Scale 3d Case CMD.SCALE3D ProcessScale3D() - Case Else - Return False + ' Offset + Case CMD.OFFSET + ProcessOffset() End Select - Return True + Return False End Function Private Function ExecuteDrag() As Boolean @@ -547,7 +565,7 @@ Public Class Controller DragRevolve() Case CMD.REVOLVEPLUS DragRevolvePlus() - Case CMD.EXTENDCURVE + Case CMD.TRIMEXTENDCURVE DragExtendCurve() Case CMD.SETCURVETHICKNESS DragSetCurveThickness() @@ -563,12 +581,23 @@ Public Class Controller DragScale() Case CMD.SCALE3D DragScale3D() + Case CMD.OFFSET + DragOffset() Case Else Return False End Select Return True End Function + Private Function ExecuteSpecialData() As Boolean + Select Case m_nLastCmd + ' Trim/Extend di curva + Case CMD.TRIMEXTENDCURVE + ExecuteSpecialDataExtendCurve() + End Select + Return False + End Function + Private Function ProcessGrid() As Boolean If m_nStep <> 0 Then Return False @@ -1208,18 +1237,32 @@ Public Class Controller RaiseEvent PrepareInputBox("LINE 2P", "Insert Start Point", "", False) m_nInpType = IBT.TY_POINT3D SetInputBoxPoint3d(m_ptCont) + m_Scene.EnableTangentPoint() + m_Scene.EnablePerpendicularPoint() + m_Scene.EnableMinDistPoint() Case 1 m_ptP1 = m_ptLast + m_sepP1 = m_sepLast + m_nIdP1 = m_nIdLast m_nStep = 2 m_Scene.EnableDrag() RaiseEvent PrepareInputBox("LINE 2P", "Insert End Point ", "", True) m_nInpType = IBT.TY_POINT3D SetInputBoxPoint3d(m_ptLast.Loc(GetCurrLayer())) + Select Case m_sepP1 + Case SEP.PT_TG, SEP.PT_PERP + m_Scene.DisableMinDistPoint() + Case SEP.PT_MINDIST + m_Scene.DisableTangentPoint() + m_Scene.DisablePerpendicularPoint() + m_Scene.DisableMinDistPoint() + End Select Case 2 ' reset scena m_Scene.ResetStatus(False) ' creo la linea (i punti sono in globale) - Dim nId As Integer = EgtCreateCurveLine(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_ptLast.Loc(GetCurrLayer())) + Dim nId As Integer = EgtCreateCurveLineEx(GetCurrLayer(), m_ptP1.Loc(GetCurrLayer()), m_sepP1, m_nIdP1, + m_ptLast.Loc(GetCurrLayer()), m_sepLast, m_nIdLast) If nId <> GDB_ID.NULL Then m_ptCont = m_ptLast m_vtCont = (m_ptLast - m_ptP1) @@ -1237,13 +1280,21 @@ Public Class Controller End Function Private Sub DragLine2P() + ' il gruppo di Drag ha riferimento globale If m_nStep = 2 Then - ' durante la creazione di oggetti il gruppo di Drag ha riferimento globale + ' recupero possibile entità già nel gruppo di drag Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - If nId = GDB_ID.NULL Then - EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) + ' se punti entrambi già definiti + If m_sepP1 = SEP.PT_STD And m_sepLast = SEP.PT_STD Then + If nId = GDB_ID.NULL Then + EgtCreateCurveLine(m_Scene.GetDragGroup(), m_ptP1, m_ptLast) + Else + EgtModifyCurveEndPoint(nId, m_ptLast) + End If + ' altrimenti, uno dei punti tangente o normale Else - EgtModifyCurveEndPoint(nId, m_ptLast) + EgtErase(nId) + EgtCreateCurveLineEx(m_Scene.GetDragGroup(), m_ptP1, m_sepP1, m_nIdP1, m_ptLast, m_sepLast, m_nIdLast) End If EgtDraw() End If @@ -1281,6 +1332,7 @@ Public Class Controller m_dLast = m_dAux m_nStep = 3 m_Scene.DisableDrag() + EgtUnselectableRemove(m_Scene.GetDragGroup()) RaiseEvent PrepareInputBox("LINE PDL", "Insert Length", "", True) m_nInpType = IBT.TY_LENGTH SetInputBoxDouble(m_dLast) @@ -1996,21 +2048,42 @@ Public Class Controller Select Case m_nStep Case 0 ' verifico condizioni e preparo per il drag - If Not PrepareTransform(False) Then + If Not PrepareTransform(False, True) Then Return False End If ' imposto stato a lunghezza di estensione m_nStep = 1 m_dLast = EXTEND_STD + ' recupero dati estremo più vicino a punto di selezione per permettere drag lunghezza con mouse + m_Scene.SetStatusSelPoint(False) + Dim nId As Integer = EgtGetLastSelectedObj() + EgtCurveLength(nId, m_dPrev) + Dim ptStart As Point3d + EgtStartPoint(nId, ptStart) + ptStart = ptStart.Glob(nId) + Dim ptEnd As Point3d + EgtEndPoint(nId, ptEnd) + ptEnd = ptEnd.Glob(nId) + If ((ptStart - m_ptLast).SqLen() <= (ptEnd - m_ptLast).SqLen()) Then + m_bLast = True + m_ptP1 = ptStart + EgtStartVector(nId, m_vtCont) + m_vtCont = -m_vtCont.Glob(nId) + Else + m_bLast = False + m_ptP1 = ptEnd + EgtEndVector(nId, m_vtCont) + m_vtCont = m_vtCont.Glob(nId) + End If ' abilito dialogo RaiseEvent PrepareInputBox("EXTEND", "Insert Length", "", True) - m_nInpType = IBT.TY_DOUBLE + m_nInpType = IBT.TY_SPECIALDOUBLE SetInputBoxDouble(m_dLast) DragExtendCurve() 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)) + EgtTrimExtendCurveByLen(nId, m_dLast, m_ptP1.Loc(nId)) EgtDeselectAll() ' reset stato scena m_Scene.ResetStatus() @@ -2024,17 +2097,51 @@ Public Class Controller Return True End Function - Private Sub DragExtendCurve() + Private Function DragExtendCurve() As Boolean If m_nStep = 1 Then ' devo sempre partire dalla curva originale m_Scene.EraseDragGroup() - PrepareTransform(False) - ' eseguo estensione sull'estremo più vicino al punto di selezione + PrepareTransform(False, True) + ' verifico se caso speciale : estensione + drag + snap a punto intersezione + Dim bSpecial As Boolean = (m_Scene.GetDragStatus() And + m_Scene.GetSnapPointType() = SP.PT_INTERS) + ' lunghezza aggiuntiva per caso speciale + Dim dAddLen As Double = IIf(bSpecial, EXTEND_ADD, 0) + ' eseguo trim/estensione sull'estremo più vicino al punto di selezione Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) - EgtExtendCurveByLen(nId, m_dLast, m_ptLast) + EgtTrimExtendCurveByLen(nId, m_dLast + dAddLen, m_ptP1) EgtDraw() End If - End Sub + Return False + End Function + + Private Function ExecuteSpecialDataExtendCurve() As Boolean + If m_nStep = 1 Then + ' verifico se caso speciale : estensione + drag + snap a punto intersezione + Dim bSpecial As Boolean = (m_Scene.GetDragStatus() And + m_Scene.GetSnapPointType() = SP.PT_INTERS) + ' se standard + If Not bSpecial Then + m_dLast = (m_ptLast - m_ptP1) * m_vtCont + ' altrimenti speciale + Else + Dim dLen As Double + Dim nDragId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + If EgtCurveLengthAtPoint(nDragId, m_ptLast, dLen) Then + ' modifico inizio (su drag inizio spostato di m_dLast) + If m_bLast Then + Dim dDragLen As Double + EgtCurveLength(nDragId, dDragLen) + m_dLast = dDragLen - dLen - m_dPrev + ' modifico fine (inizio fisso) + Else + m_dLast = dLen - m_dPrev + End If + End If + End If + End If + Return False + End Function Private Function ProcessBreakCurve() As Boolean Select Case m_nStep @@ -2047,7 +2154,8 @@ Public Class Controller m_nInpType = IBT.TY_POINT3D Case 1 ' eseguo spezzatura - EgtSplitCurveAtPoint(EgtGetLastSelectedObj(), m_ptLast) + Dim nId As Integer = EgtGetLastSelectedObj() + EgtSplitCurveAtPoint(nId, m_ptLast.Loc(nId)) EgtDeselectAll() ' reset stato scena m_Scene.ResetStatus() @@ -2618,13 +2726,80 @@ Public Class Controller End If End Sub - Private Function PrepareTransform(Optional ByVal bAllSelected As Boolean = True) As Boolean + Private Function ProcessOffset() As Boolean + Select Case m_nStep + Case 0 + ' verifico condizioni e preparo per il drag + If Not PrepareTransform(False) Then + Return False + End If + ' imposto stato a lunghezza di offset + m_nStep = 1 + m_dLast = OFFSET_STD + ' abilito dialogo + RaiseEvent PrepareInputBox("OFFSET", "Insert Distance", "Copy", True) + m_nInpType = IBT.TY_DOUBLE + SetInputBoxDouble(m_dLast) + RaiseEvent SetInputBoxCheck(True) + DragOffset() + Case 1 + ' parametri di offset + Dim nSide As OFF_SIDE + If m_dLast > 0 Then + nSide = OFF_SIDE.LEFT + Else + nSide = OFF_SIDE.RIGHT + End If + ' reset stato scena + m_Scene.ResetStatus(False) + ' eseguo copia e offset + If m_bLast Then + Dim nId As Integer = EgtCopyGlob(EgtGetLastSelectedObj(), GetCurrLayer()) + EgtOffsetCurve(nId, Math.Abs(m_dLast), nSide, OFF_TYPE.FILLET) + ' altrimenti solo offset + Else + Dim nId As Integer = EgtGetLastSelectedObj() + EgtOffsetCurve(nId, Math.Abs(m_dLast), nSide, OFF_TYPE.FILLET) + 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 DragOffset() + If m_nStep = 1 Then + ' devo sempre partire dalla curva originale + m_Scene.EraseDragGroup() + PrepareTransform(False) + ' parametri di offset + Dim nSide As OFF_SIDE + If m_dLast > 0 Then + nSide = OFF_SIDE.LEFT + Else + nSide = OFF_SIDE.RIGHT + End If + ' eseguo offset + Dim nId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup()) + EgtOffsetCurve(nId, Math.Abs(m_dLast), nSide, OFF_TYPE.FILLET) + EgtDraw() + End If + End Sub + + Private Function PrepareTransform(Optional ByVal bAllSelected As Boolean = True, + Optional ByVal bDragSelectable As Boolean = False) As Boolean ' verifico ci sia qualcosa di selezionato If EgtGetFirstSelectedObj() = GDB_ID.NULL Then Return False End If ' creo il gruppo di drag e vi copio le entità selezionate - If Not m_Scene.CreateDragGroup() Then + If Not m_Scene.CreateDragGroup(bDragSelectable) Then Return False End If ' se devo prendere tutti diff --git a/EgtInterface.vb b/EgtInterface.vb index 13629cc..ca2ed46 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -732,6 +732,12 @@ Public Shared Function EgtCreateCurveLine(ByVal nParentId As Integer, ByRef PtStart As Point3d, ByRef PtEnd As Point3d) As Integer End Function + +Public Shared Function EgtCreateCurveLineEx(ByVal nParentId As Integer, + ByRef PtStart As Point3d, ByVal nSepS As SEP, ByVal nIdS As Integer, + ByRef PtEnd As Point3d, ByVal nSepE As SEP, ByVal nIdE As Integer) As Integer +End Function + Public Shared Function EgtCreateCurveLinePVL(ByVal nParentId As Integer, ByRef PtStart As Point3d, ByRef VtDir As Vector3d, ByVal dLen As Double) As Integer @@ -843,13 +849,17 @@ Public Shared Function EgtExtendCurveEndByLen(ByVal nId As Integer, ByVal dLen A End Function -Public Shared Function EgtExtendCurveByLen(ByVal nId As Integer, ByVal dLen As Double, ByRef PtNear As Point3d) As Boolean +Public Shared Function EgtTrimExtendCurveByLen(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 + +Public Shared Function EgtOffsetCurve(ByVal nId As Integer, ByVal dDist As Double, ByVal nSide As OFF_SIDE, ByVal nType As OFF_TYPE) As Boolean +End Function + Public Shared Function EgtModifyCurveCircleCPN(ByVal nId As Integer, ByRef PtOn As Point3d) As Boolean End Function @@ -1320,12 +1330,20 @@ End Function Public Shared Function EgtAtParamVector(ByVal nId As Integer, ByVal dU As Double, ByRef VtV As Vector3d) As Boolean End Function + +Public Shared Function EgtCurveLength(ByVal nId As Integer, ByRef dLen As Double) As Boolean +End Function + + +Public Shared Function EgtCurveLengthAtPoint(ByVal nId As Integer, ByRef ptOn As Point3d, ByRef dLen As Double) As Boolean +End Function + Public Shared Function EgtCurveExtrusion(ByVal nId As Integer, ByRef VtExtr As Vector3d) As Boolean End Function -Public Shared Function EgtCurveThickness(ByVal nId As Integer, ByRef DThick As Double) As Boolean +Public Shared Function EgtCurveThickness(ByVal nId As Integer, ByRef dThick As Double) As Boolean End Function @@ -1467,6 +1485,14 @@ End Function Public Shared Function EgtUnselectableClearAll() As Boolean End Function + +Private Shared Function EgtGetPointFromSelect(ByVal nSelId As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, + ByRef ptP As Point3d) As Boolean +End Function +Public Shared Function EgtGetPointFromSelect(ByVal nSelId As Integer, ByVal PtWin As Point, ByRef ptP As Point3d) As Boolean + Return EgtGetPointFromSelect(nSelId, PtWin.X, PtWin.Y, ptP) +End Function + Private Shared Function EgtGetGraphicSnapPoint(ByVal nSnap As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal nSelW As Integer, ByVal nSelH As Integer, @@ -1572,6 +1598,10 @@ End Function Public Shared Function EgtGetCameraDir(ByRef nDir As Integer) As Boolean End Function + +Public Shared Function EgtProjectPoint(ByRef ptP As Point3d, ByRef ptWin As Point3d) As Boolean +End Function + Private Shared Function EgtUnProjectPoint(ByVal nWinX As Integer, ByVal nWinY As Integer, ByRef ptP As Point3d) As Boolean End Function @@ -1579,10 +1609,6 @@ Public Shared Function EgtUnProjectPoint(ByVal Curr As Point, ByRef ptP As Point Return EgtUnProjectPoint(Curr.X, Curr.Y, ptP) End Function - -Public Shared Function EgtProjectPoint(ByRef ptP As Point3d, ByRef ptWin As Point3d) As Boolean -End Function - '---------- Tsc Executor ------------------------------------------------------- @@ -1712,13 +1738,24 @@ Public Enum VT As Integer End Enum 'Costanti : TIPO SNAP POINT Public Enum SP As Integer - PT_SKETCH = 0 - PT_GRID = 1 - PT_END = 2 - PT_MID = 3 - CENTER = 4 - PT_NEAR = 5 - PT_INTERS = 6 + PT_NONE = 0 + PT_SKETCH = 1 + PT_GRID = 2 + PT_END = 3 + PT_MID = 4 + CENTER = 5 + PT_NEAR = 6 + PT_INTERS = 7 + PT_TANGENT = 8 + PT_PERPENDICULAR = 9 + PT_MINDIST = 10 +End Enum +'Costanti : TIPO SELECTED POINT +Public Enum SEP As Integer + PT_STD = 0 + PT_TG = 1 + PT_PERP = 2 + PT_MINDIST = 3 End Enum 'Costanti : flag per BBOX Public Enum BBF As Integer @@ -1728,5 +1765,16 @@ Public Enum BBF As Integer IGNORE_DIM = 3 EXACT = 4 End Enum +'Costanti : lato di offset +Public Enum OFF_SIDE As Integer + RIGHT = -1 + LEFT = 1 +End Enum +'Costanti : tipo di offset +Public Enum OFF_TYPE As Integer + FILLET = 0 + CHAMFER = 1 + EXTEND = 2 +End Enum End Class diff --git a/Form1.Designer.vb b/Form1.Designer.vb index 26b7a35..143c875 100644 --- a/Form1.Designer.vb +++ b/Form1.Designer.vb @@ -25,13 +25,13 @@ 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.tsStatusOnL = New System.Windows.Forms.ToolStripStatusLabel() Me.tsStatusOutput = New System.Windows.Forms.ToolStripStatusLabel() Me.tsStatusOnR = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusSnapPointType = New System.Windows.Forms.ToolStripStatusLabel() Me.tsStatusGrid = New System.Windows.Forms.ToolStripStatusLabel() - Me.tsStatusTypePos = New System.Windows.Forms.ToolStripStatusLabel() + Me.tsStatusCurPosType = 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() @@ -123,6 +123,7 @@ Partial Class Form1 Me.btnInvertCurve = New System.Windows.Forms.Button() Me.btnDelete = New System.Windows.Forms.Button() Me.TabTransform = New System.Windows.Forms.TabPage() + Me.btnOffset = New System.Windows.Forms.Button() Me.btnScale = New System.Windows.Forms.Button() Me.btnMirror = New System.Windows.Forms.Button() Me.btnRotate = New System.Windows.Forms.Button() @@ -146,6 +147,7 @@ Partial Class Form1 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() @@ -188,27 +190,17 @@ Partial Class Form1 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80.0!)) Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle()) - Me.TableLayoutPanel1.Size = New System.Drawing.Size(1096, 533) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(1096, 561) 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.tsStatusOnL, Me.tsStatusOutput, Me.tsStatusOnR, Me.tsStatusGrid, Me.tsStatusTypePos, Me.tsStatusCursorPos}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 511) + Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsStatusOnL, Me.tsStatusOutput, Me.tsStatusOnR, Me.tsStatusSnapPointType, Me.tsStatusGrid, Me.tsStatusCurPosType, Me.tsStatusCursorPos}) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 539) Me.StatusStrip1.MaximumSize = New System.Drawing.Size(0, 22) Me.StatusStrip1.MinimumSize = New System.Drawing.Size(0, 22) Me.StatusStrip1.Name = "StatusStrip1" @@ -230,7 +222,7 @@ Partial Class Form1 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.Size = New System.Drawing.Size(293, 17) Me.tsStatusOutput.Spring = True Me.tsStatusOutput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' @@ -241,23 +233,39 @@ Partial Class Form1 Me.tsStatusOnR.Size = New System.Drawing.Size(190, 17) Me.tsStatusOnR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' + 'tsStatusSnapPointType + ' + Me.tsStatusSnapPointType.AutoSize = False + Me.tsStatusSnapPointType.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.tsStatusSnapPointType.Name = "tsStatusSnapPointType" + Me.tsStatusSnapPointType.Size = New System.Drawing.Size(80, 17) + Me.tsStatusSnapPointType.Text = "Grid Point" + ' 'tsStatusGrid ' + Me.tsStatusGrid.AutoSize = False + Me.tsStatusGrid.BackColor = System.Drawing.SystemColors.Control 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.tsStatusGrid.BorderStyle = System.Windows.Forms.Border3DStyle.Raised Me.tsStatusGrid.Name = "tsStatusGrid" Me.tsStatusGrid.Size = New System.Drawing.Size(64, 17) Me.tsStatusGrid.Text = " GRID ON " ' - 'tsStatusTypePos + 'tsStatusCurPosType ' - Me.tsStatusTypePos.BorderSides = CType((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) _ + Me.tsStatusCurPosType.AutoSize = False + Me.tsStatusCurPosType.BackColor = System.Drawing.SystemColors.Control + Me.tsStatusCurPosType.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.tsStatusTypePos.Name = "tsStatusTypePos" - Me.tsStatusTypePos.Size = New System.Drawing.Size(55, 17) - Me.tsStatusTypePos.Text = "CPLANE" + Me.tsStatusCurPosType.BorderStyle = System.Windows.Forms.Border3DStyle.Raised + Me.tsStatusCurPosType.Name = "tsStatusCurPosType" + Me.tsStatusCurPosType.Size = New System.Drawing.Size(55, 17) + Me.tsStatusCurPosType.Text = "CPLANE" ' 'tsStatusCursorPos ' @@ -1089,26 +1097,26 @@ Partial Class Form1 Me.TableLayoutPanel3.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30.0!)) Me.TableLayoutPanel3.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 140.0!)) Me.TableLayoutPanel3.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50.0!)) - Me.TableLayoutPanel3.Size = New System.Drawing.Size(200, 425) + Me.TableLayoutPanel3.Size = New System.Drawing.Size(200, 453) Me.TableLayoutPanel3.TabIndex = 9 ' 'tBoxInfo ' Me.tBoxInfo.BackColor = System.Drawing.SystemColors.ControlLightLight Me.tBoxInfo.Dock = System.Windows.Forms.DockStyle.Fill - Me.tBoxInfo.Location = New System.Drawing.Point(3, 180) + Me.tBoxInfo.Location = New System.Drawing.Point(3, 200) Me.tBoxInfo.Margin = New System.Windows.Forms.Padding(3, 1, 3, 3) Me.tBoxInfo.Multiline = True Me.tBoxInfo.Name = "tBoxInfo" Me.tBoxInfo.ReadOnly = True Me.tBoxInfo.ScrollBars = System.Windows.Forms.ScrollBars.Vertical - Me.tBoxInfo.Size = New System.Drawing.Size(194, 51) + Me.tBoxInfo.Size = New System.Drawing.Size(194, 59) Me.tBoxInfo.TabIndex = 24 ' 'tboxCmd ' Me.tboxCmd.Dock = System.Windows.Forms.DockStyle.Fill - Me.tboxCmd.Location = New System.Drawing.Point(3, 377) + Me.tboxCmd.Location = New System.Drawing.Point(3, 405) Me.tboxCmd.Multiline = True Me.tboxCmd.Name = "tboxCmd" Me.tboxCmd.ScrollBars = System.Windows.Forms.ScrollBars.Vertical @@ -1127,7 +1135,7 @@ Partial Class Form1 Me.TreeView1.Margin = New System.Windows.Forms.Padding(3, 3, 3, 0) Me.TreeView1.Name = "TreeView1" Me.TreeView1.SelectedImageIndex = 0 - Me.TreeView1.Size = New System.Drawing.Size(194, 126) + Me.TreeView1.Size = New System.Drawing.Size(194, 146) Me.TreeView1.StateImageList = Me.ImageList2 Me.TreeView1.TabIndex = 0 ' @@ -1229,7 +1237,7 @@ Partial Class Form1 Me.InputBox.Controls.Add(Me.InputLabel) Me.InputBox.Dock = System.Windows.Forms.DockStyle.Fill Me.InputBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.InputBox.Location = New System.Drawing.Point(3, 237) + Me.InputBox.Location = New System.Drawing.Point(3, 265) Me.InputBox.Name = "InputBox" Me.InputBox.Size = New System.Drawing.Size(194, 134) Me.InputBox.TabIndex = 26 @@ -1297,7 +1305,7 @@ Partial Class Form1 Me.TabControl2.Multiline = True Me.TabControl2.Name = "TabControl2" Me.TabControl2.SelectedIndex = 0 - Me.TabControl2.Size = New System.Drawing.Size(83, 425) + Me.TabControl2.Size = New System.Drawing.Size(83, 453) Me.TabControl2.TabIndex = 10 ' 'TabDraw @@ -1314,7 +1322,7 @@ Partial Class Form1 Me.TabDraw.Location = New System.Drawing.Point(23, 4) Me.TabDraw.Name = "TabDraw" Me.TabDraw.Padding = New System.Windows.Forms.Padding(3) - Me.TabDraw.Size = New System.Drawing.Size(56, 417) + Me.TabDraw.Size = New System.Drawing.Size(56, 445) Me.TabDraw.TabIndex = 0 Me.TabDraw.Text = "Draw" ' @@ -1463,7 +1471,7 @@ Partial Class Form1 Me.TabConstruct.Controls.Add(Me.btnPlane) Me.TabConstruct.Location = New System.Drawing.Point(23, 4) Me.TabConstruct.Name = "TabConstruct" - Me.TabConstruct.Size = New System.Drawing.Size(56, 417) + Me.TabConstruct.Size = New System.Drawing.Size(56, 445) Me.TabConstruct.TabIndex = 4 Me.TabConstruct.Text = "Construct" ' @@ -1548,7 +1556,7 @@ Partial Class Form1 Me.TabEdit.Controls.Add(Me.btnDelete) Me.TabEdit.Location = New System.Drawing.Point(23, 4) Me.TabEdit.Name = "TabEdit" - Me.TabEdit.Size = New System.Drawing.Size(56, 417) + Me.TabEdit.Size = New System.Drawing.Size(56, 445) Me.TabEdit.TabIndex = 3 Me.TabEdit.Text = "Edit" ' @@ -1577,13 +1585,14 @@ Partial Class Form1 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.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 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.Text = "Trim/Ext" Me.btnExtendCurve.TextAlign = System.Drawing.ContentAlignment.BottomCenter Me.btnExtendCurve.UseVisualStyleBackColor = False ' @@ -1693,16 +1702,34 @@ Partial Class Form1 'TabTransform ' Me.TabTransform.BackColor = System.Drawing.SystemColors.Control + Me.TabTransform.Controls.Add(Me.btnOffset) Me.TabTransform.Controls.Add(Me.btnScale) Me.TabTransform.Controls.Add(Me.btnMirror) Me.TabTransform.Controls.Add(Me.btnRotate) Me.TabTransform.Controls.Add(Me.btnMove) Me.TabTransform.Location = New System.Drawing.Point(23, 4) Me.TabTransform.Name = "TabTransform" - Me.TabTransform.Size = New System.Drawing.Size(56, 417) + Me.TabTransform.Size = New System.Drawing.Size(56, 445) Me.TabTransform.TabIndex = 2 Me.TabTransform.Text = "Transform" ' + 'btnOffset + ' + Me.btnOffset.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control + Me.btnOffset.FlatAppearance.BorderSize = 0 + Me.btnOffset.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.Control + Me.btnOffset.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.btnOffset.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnOffset.Image = CType(resources.GetObject("btnOffset.Image"), System.Drawing.Image) + Me.btnOffset.ImageAlign = System.Drawing.ContentAlignment.TopCenter + Me.btnOffset.Location = New System.Drawing.Point(0, 192) + Me.btnOffset.Name = "btnOffset" + Me.btnOffset.Size = New System.Drawing.Size(56, 48) + Me.btnOffset.TabIndex = 34 + Me.btnOffset.Text = "Offset" + Me.btnOffset.TextAlign = System.Drawing.ContentAlignment.BottomCenter + Me.btnOffset.UseVisualStyleBackColor = False + ' 'btnScale ' Me.btnScale.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control @@ -1780,7 +1807,7 @@ Partial Class Form1 Me.TabTest.Location = New System.Drawing.Point(23, 4) Me.TabTest.Name = "TabTest" Me.TabTest.Padding = New System.Windows.Forms.Padding(3) - Me.TabTest.Size = New System.Drawing.Size(56, 417) + Me.TabTest.Size = New System.Drawing.Size(56, 445) Me.TabTest.TabIndex = 1 Me.TabTest.Text = "Test" ' @@ -1913,20 +1940,30 @@ 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, 453) + Me.Scene1.TabIndex = 1 + ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoSize = True Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None - Me.ClientSize = New System.Drawing.Size(1096, 533) + Me.ClientSize = New System.Drawing.Size(1096, 561) Me.Controls.Add(Me.TableLayoutPanel1) Me.Cursor = System.Windows.Forms.Cursors.Arrow Me.ForeColor = System.Drawing.SystemColors.ControlText Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.KeyPreview = True Me.Margin = New System.Windows.Forms.Padding(2) - Me.MinimumSize = New System.Drawing.Size(1112, 512) + Me.MinimumSize = New System.Drawing.Size(1112, 600) Me.Name = "Form1" Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual @@ -2071,7 +2108,7 @@ End Sub 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 tsStatusCurPosType 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 @@ -2082,5 +2119,7 @@ End Sub Friend WithEvents btnSetCurveTh As System.Windows.Forms.Button Friend WithEvents btnCPlaneObj As System.Windows.Forms.Button Friend WithEvents btnCPlanePerpCurve As System.Windows.Forms.Button + Friend WithEvents btnOffset As System.Windows.Forms.Button + Friend WithEvents tsStatusSnapPointType As System.Windows.Forms.ToolStripStatusLabel End Class diff --git a/Form1.resx b/Form1.resx index d151d4d..8d3f39a 100644 --- a/Form1.resx +++ b/Form1.resx @@ -848,7 +848,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4 - DQAAAk1TRnQBSQFMAgEBDgEAAQgBDAEIAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DQAAAk1TRnQBSQFMAgEBDgEAAWgBDAFoAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -917,7 +917,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADW - CAAAAk1TRnQBSQFMAgEBAgEAASgBAwEoAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAYgBAwGIAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -1270,6 +1270,16 @@ qIeJsIvfePHAJikroRrjgIEbb0KdVM9ElL0lvDZexam4Rrfa/kRXKUu0f+6RsrlQ/wUeO7eOqFTLRJSD Zp6b8fNpzM25hJ8x9YoNS7nVqCugU/KZ5JL2LhuRuQBfXnRyq4LiNX1c1oIo03DgfVcDdGzE8rhU/68Q ZT4RZT4RZT4RZT4RZT4RZT4RZf7Q+QMgTr7iuQrsHAAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAAAd0SU1FB94LHAotKJH3eQoAAADISURBVFhH7ZLBCcJAEEVTgJVYQsAK7MNahBxs + QcQuvHj2YB12sbqBZGaHb9wZ4eeyh0eGR0jeTtKllFYFSiZQMoGSCZRMoGQiw244hemP+4x+cC0ybG73 + vwiGyGBP5cWE6JcsAaWX6eRziCNChutzG6F4WCBChssruTk/DosRrgBzsp/kl38JGSMqtwBlLUXI5zp7 + xxag9FBE6C2of0Hfb4HSyxhhPgU1IGO3wA+YttACWkALaAFrBUSBkgmUTKBkAiUTKHmk7g1iOdspSkxx + ywAAAABJRU5ErkJggg== diff --git a/Form1.vb b/Form1.vb index 6cd2372..a9bfd1f 100644 --- a/Form1.vb +++ b/Form1.vb @@ -193,12 +193,17 @@ Public Class Form1 m_Controller.MouseSelectedLayer(nId) End Sub - Private Sub OnMousePointForSelection(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMousePointForSelection + Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMousePointFromSelection m_Controller.SetLastPoint3d(PtP) End Sub - Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles Scene1.OnMouseSelectedPoint - m_Controller.MouseSelectedPoint(PtP, (ModifierKeys And Keys.Control) <> Keys.Control) + Private Sub OnMouseDone(ByVal sender As Object) Handles Scene1.OnMouseDone + m_Controller.Done(InputText.Text) + End Sub + + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles Scene1.OnMouseSelectedPoint + Dim bDone As Boolean = (ModifierKeys And Keys.Control) <> Keys.Control + m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone) End Sub Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Handles Scene1.OnMouseSelectedDir @@ -210,6 +215,7 @@ Public Class Form1 End Sub Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseAnalyzed + UpdateObjInObjTree(nId) SelectIdInObjTree(nId) End Sub @@ -319,7 +325,15 @@ Public Class Form1 End Sub Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click - Scene1.SaveProject(m_Controller.GetCurrFile()) + If Not String.IsNullOrWhiteSpace(m_Controller.GetCurrFile()) Then + Scene1.SaveProject(m_Controller.GetCurrFile()) + Else + Dim sFile As String = String.Empty + GetPrivateProfileString("General", "LastNgeDir", "", sFile, m_sIniFile) + sFile.TrimEnd("\"c) + sFile += "\New.nge" + Scene1.SaveAsProject(sFile) + End If End Sub Private Sub btnSaveAs_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveAs.Click @@ -530,6 +544,7 @@ Public Class Form1 btnRotate.Enabled = bSelOk btnMirror.Enabled = bSelOk btnScale.Enabled = bSelOk + btnOffset.Enabled = bSelOk End Sub @@ -604,7 +619,7 @@ Public Class Form1 End Sub Private Sub btnExtendCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnExtendCurve.Click - m_Controller.ExecuteCommand(CMD.EXTENDCURVE) + m_Controller.ExecuteCommand(CMD.TRIMEXTENDCURVE) End Sub Private Sub btnBreakCurve_Click(sender As System.Object, e As System.EventArgs) Handles btnBreakCurve.Click @@ -647,6 +662,10 @@ Public Class Form1 End If End Sub + Private Sub btnOffset_Click(sender As System.Object, e As System.EventArgs) Handles btnOffset.Click + m_Controller.ExecuteCommand(CMD.OFFSET) + End Sub + ' ----------------- Test Commands ------------------- Private Sub XbtnRotP90_Click(sender As System.Object, e As System.EventArgs) Handles XbtnRotP90.Click @@ -774,6 +793,7 @@ Public Class Form1 Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean InputCheck.Checked = bCheck + m_Controller.SetLastBoolean(InputCheck.Checked) Return True End Function @@ -837,15 +857,24 @@ Public Class Form1 Private Sub EmitCurrPartLayer() Dim sText As String = " " + Dim sName As String = String.Empty Dim colObj As Color3d EgtGetColor(GDB_ID.ROOT, colObj) Dim nCurrPart As Integer = m_Controller.GetCurrPart() If nCurrPart <> GDB_ID.NULL Then - sText = "Part " + nCurrPart.ToString() + If EgtGetName(nCurrPart, sName) Then + sText = sName + Else + sText = "Part " + nCurrPart.ToString() + End If EgtGetCalcColor(nCurrPart, colObj) Dim nCurrLayer As Integer = m_Controller.GetCurrLayer() If nCurrLayer <> GDB_ID.NULL And EgtExistsObj(nCurrLayer) Then - sText += " --> Layer " + nCurrLayer.ToString() + If EgtGetName(nCurrLayer, sName) Then + sText += " --> " + sName + Else + sText += " --> Layer " + nCurrLayer.ToString() + End If EgtGetCalcColor(nCurrLayer, colObj) End If End If @@ -1191,6 +1220,33 @@ Public Class Form1 End Sub '-------------------------------- Status Bar ----------------------------------------------------- + Private Sub ToolStripStatusSnapPointType_Changed(ByVal sender As Object, ByVal nSpType As SP) Handles Scene1.OnChangedSnapPointType + Select Case nSpType + Case SP.PT_SKETCH + tsStatusSnapPointType.Text = "Sketch Point" + Case SP.PT_GRID + tsStatusSnapPointType.Text = "Grid Point" + Case SP.PT_END + tsStatusSnapPointType.Text = "End Point" + Case SP.PT_MID + tsStatusSnapPointType.Text = "Mid Point" + Case SP.CENTER + tsStatusSnapPointType.Text = "Center" + Case SP.PT_NEAR + tsStatusSnapPointType.Text = "Near Point" + Case SP.PT_INTERS + tsStatusSnapPointType.Text = "Inters Point" + Case SP.PT_TANGENT + tsStatusSnapPointType.Text = "Tang Point" + Case SP.PT_PERPENDICULAR + tsStatusSnapPointType.Text = "Perp Point" + Case SP.PT_MINDIST + tsStatusSnapPointType.Text = "MinDist Point" + Case Else + tsStatusSnapPointType.Text = "---" + End Select + End Sub + Private Sub ToolStripStatusGrid_Click() Handles tsStatusGrid.Click m_bShowGrid = Not m_bShowGrid If m_bShowGrid Then @@ -1204,14 +1260,17 @@ Public Class Form1 EgtDraw() End Sub - Private Sub ToolStripStatusTypePos_Click() Handles tsStatusTypePos.Click + Private Sub ToolStripStatusTypePos_Click() Handles tsStatusCurPosType.Click m_bCPlaneTypePos = Not m_bCPlaneTypePos If m_bCPlaneTypePos Then - tsStatusTypePos.Text = "CPLANE" + tsStatusCurPosType.Text = "CPLANE" Else - tsStatusTypePos.Text = "WORLD " + tsStatusCurPosType.Text = "WORLD " End If Scene1.SetGridCursorPos(m_bCPlaneTypePos) End Sub +Private Sub ToolStripSnapPointType_Changed(sender As System.Object, nSpType As TestEIn.EgtInterface.SP) + +End Sub End Class diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 2eb0556..f173287 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 406f275..d167ca7 100644 --- a/Scene.Designer.vb +++ b/Scene.Designer.vb @@ -38,6 +38,9 @@ Partial Class Scene Me.cmdCenterPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdNearPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdIntersectionPoint = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdTangentPoint = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdPerpendicularPoint = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdMinDistPoint = New System.Windows.Forms.ToolStripMenuItem() Me.sepSelPnt1 = New System.Windows.Forms.ToolStripSeparator() Me.cmdStopDrag = New System.Windows.Forms.ToolStripMenuItem() Me.MenuScene.SuspendLayout() @@ -45,105 +48,123 @@ Partial Class Scene ' 'MenuScene ' - Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.sepSel1, Me.cmdWinSelect, Me.cmdSelectLayer, Me.cmdSelectPart, Me.cmdRestartDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint, Me.cmdIntersectionPoint, Me.sepSelPnt1, Me.cmdStopDrag}) + Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.sepSel1, Me.cmdWinSelect, Me.cmdSelectLayer, Me.cmdSelectPart, Me.cmdRestartDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint, Me.cmdIntersectionPoint, Me.cmdTangentPoint, Me.cmdPerpendicularPoint, Me.cmdMinDistPoint, Me.sepSelPnt1, Me.cmdStopDrag}) Me.MenuScene.Name = "ContextMenuStrip1" Me.MenuScene.ShowCheckMargin = True Me.MenuScene.ShowImageMargin = False - Me.MenuScene.Size = New System.Drawing.Size(168, 346) + Me.MenuScene.Size = New System.Drawing.Size(179, 412) ' 'cmdSelectAll ' Me.cmdSelectAll.Name = "cmdSelectAll" - Me.cmdSelectAll.Size = New System.Drawing.Size(167, 22) + Me.cmdSelectAll.Size = New System.Drawing.Size(178, 22) Me.cmdSelectAll.Text = "Select All" ' 'cmdDeselectAll ' Me.cmdDeselectAll.Name = "cmdDeselectAll" - Me.cmdDeselectAll.Size = New System.Drawing.Size(167, 22) + Me.cmdDeselectAll.Size = New System.Drawing.Size(178, 22) Me.cmdDeselectAll.Text = "Deselect All" ' 'sepSel1 ' Me.sepSel1.Name = "sepSel1" - Me.sepSel1.Size = New System.Drawing.Size(164, 6) + Me.sepSel1.Size = New System.Drawing.Size(175, 6) ' 'cmdWinSelect ' Me.cmdWinSelect.Name = "cmdWinSelect" - Me.cmdWinSelect.Size = New System.Drawing.Size(167, 22) + Me.cmdWinSelect.Size = New System.Drawing.Size(178, 22) Me.cmdWinSelect.Text = "Select Window" ' 'cmdSelectLayer ' Me.cmdSelectLayer.Name = "cmdSelectLayer" - Me.cmdSelectLayer.Size = New System.Drawing.Size(167, 22) + Me.cmdSelectLayer.Size = New System.Drawing.Size(178, 22) Me.cmdSelectLayer.Text = "Select Layer" ' 'cmdSelectPart ' Me.cmdSelectPart.Name = "cmdSelectPart" - Me.cmdSelectPart.Size = New System.Drawing.Size(167, 22) + Me.cmdSelectPart.Size = New System.Drawing.Size(178, 22) Me.cmdSelectPart.Text = "Select Part" ' 'cmdRestartDrag ' Me.cmdRestartDrag.Name = "cmdRestartDrag" - Me.cmdRestartDrag.Size = New System.Drawing.Size(167, 22) - Me.cmdRestartDrag.Text = "Restart Drag" + Me.cmdRestartDrag.Size = New System.Drawing.Size(178, 22) + Me.cmdRestartDrag.Text = "Drag On" ' 'cmdSketchPoint ' Me.cmdSketchPoint.Name = "cmdSketchPoint" - Me.cmdSketchPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdSketchPoint.Size = New System.Drawing.Size(178, 22) Me.cmdSketchPoint.Text = "Sketch Point" ' 'cmdGridPoint ' Me.cmdGridPoint.Name = "cmdGridPoint" - Me.cmdGridPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdGridPoint.Size = New System.Drawing.Size(178, 22) Me.cmdGridPoint.Text = "Grid Point" ' 'cmdEndPoint ' Me.cmdEndPoint.Name = "cmdEndPoint" - Me.cmdEndPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdEndPoint.Size = New System.Drawing.Size(178, 22) Me.cmdEndPoint.Text = "End Point" ' 'cmdMidPoint ' Me.cmdMidPoint.Name = "cmdMidPoint" - Me.cmdMidPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdMidPoint.Size = New System.Drawing.Size(178, 22) Me.cmdMidPoint.Text = "Mid Point" ' 'cmdCenterPoint ' Me.cmdCenterPoint.Name = "cmdCenterPoint" - Me.cmdCenterPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdCenterPoint.Size = New System.Drawing.Size(178, 22) Me.cmdCenterPoint.Text = "Center" ' 'cmdNearPoint ' Me.cmdNearPoint.Name = "cmdNearPoint" - Me.cmdNearPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdNearPoint.Size = New System.Drawing.Size(178, 22) Me.cmdNearPoint.Text = "Near Point" ' 'cmdIntersectionPoint ' Me.cmdIntersectionPoint.Name = "cmdIntersectionPoint" - Me.cmdIntersectionPoint.Size = New System.Drawing.Size(167, 22) + Me.cmdIntersectionPoint.Size = New System.Drawing.Size(178, 22) Me.cmdIntersectionPoint.Text = "Intersection Point" ' + 'cmdTangentPoint + ' + Me.cmdTangentPoint.Name = "cmdTangentPoint" + Me.cmdTangentPoint.Size = New System.Drawing.Size(178, 22) + Me.cmdTangentPoint.Text = "Tangent Point" + ' + 'cmdPerpendicularPoint + ' + Me.cmdPerpendicularPoint.Name = "cmdPerpendicularPoint" + Me.cmdPerpendicularPoint.Size = New System.Drawing.Size(178, 22) + Me.cmdPerpendicularPoint.Text = "Perpendicular Point" + ' + 'cmdMinDistPoint + ' + Me.cmdMinDistPoint.Name = "cmdMinDistPoint" + Me.cmdMinDistPoint.Size = New System.Drawing.Size(178, 22) + Me.cmdMinDistPoint.Text = "Min Dist Point" + ' 'sepSelPnt1 ' Me.sepSelPnt1.Name = "sepSelPnt1" - Me.sepSelPnt1.Size = New System.Drawing.Size(164, 6) + Me.sepSelPnt1.Size = New System.Drawing.Size(175, 6) ' 'cmdStopDrag ' Me.cmdStopDrag.Name = "cmdStopDrag" - Me.cmdStopDrag.Size = New System.Drawing.Size(167, 22) - Me.cmdStopDrag.Text = "Stop Drag" + Me.cmdStopDrag.Size = New System.Drawing.Size(178, 22) + Me.cmdStopDrag.Text = "Drag Off" ' 'Scene ' @@ -172,5 +193,8 @@ End Sub Friend WithEvents cmdIntersectionPoint As System.Windows.Forms.ToolStripMenuItem Friend WithEvents sepSelPnt1 As System.Windows.Forms.ToolStripSeparator Friend WithEvents cmdStopDrag As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdTangentPoint As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdPerpendicularPoint As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdMinDistPoint As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/Scene.vb b/Scene.vb index cba32e6..b7be9d1 100644 --- a/Scene.vb +++ b/Scene.vb @@ -58,6 +58,7 @@ Public Class Scene m_nStatus = ST.NULL m_nOldStatus = ST.NULL m_nSnapType = SP.PT_GRID + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) m_bAlsoSelDir = False m_PrevPoint = Point.Empty m_bGridCursorPos = False @@ -172,14 +173,16 @@ Public Class Scene Public Event OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Public Event OnMouseSelectedLayer(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 OnMousePointFromSelection(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) Public Event OnCloseGetDist(ByVal sender As Object) - Public Event OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d) + Public Event OnMouseDone(ByVal sender As Object) + Public Event OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Public Event OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Public Event OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) + Public Event OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP) Public Event OnNewProject(ByVal sender As Object) Public Event OnOpeningProject(ByVal sender As Object) Public Event OnOpenProject(ByVal sender As Object, ByVal sFile As String) @@ -248,8 +251,8 @@ Public Class Scene 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) + If EgtGetPointFromSelect(nId, e.Location, PtTemp) Then + RaiseEvent OnMousePointFromSelection(Me, PtTemp) End If End If ' se stato misura di distanza (primo punto) @@ -283,12 +286,14 @@ Public Class Scene sOut.Append(dZ.ToString("F4", CultureInfo.InvariantCulture)) ' lancio l'evento per visualizzare la distanza RaiseEvent OnShowDistance(Me, sOut.ToString()) - m_nStatus = ST.NULL + m_nStatus = ST.GETDIST m_nOldStatus = ST.NULL End If ' se stato selezione punto ElseIf m_nStatus = ST.SELPOINT Then - If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then + If Not m_bDragOn Then + RaiseEvent OnMouseDone(Me) + ElseIf EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then ' se Snap Sketch o Grid e premuto SHIFT si passa a modalità elevatore If (m_nSnapType = SP.PT_SKETCH Or m_nSnapType = SP.PT_GRID) And (ModifierKeys And Keys.Shift) = Keys.Shift Then @@ -303,8 +308,18 @@ Public Class Scene RaiseEvent OnMouseSelectedDir(Me, vtDir) End If End If - ' restituisco punto - RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev) + ' restituisco punto con info ausiliarie + Dim nSep As SEP + If m_nSnapType = SP.PT_TANGENT Then + nSep = SEP.PT_TG + ElseIf m_nSnapType = SP.PT_PERPENDICULAR Then + nSep = SEP.PT_PERP + ElseIf m_nSnapType = SP.PT_MINDIST Then + nSep = SEP.PT_MINDIST + Else + nSep = SEP.PT_STD + End If + RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev, nSep, EgtGetLastSnapId()) End If End If ' se stato selezione Z di punto @@ -312,7 +327,7 @@ Public Class Scene If EgtGetGridSnapPointZ((m_nSnapType = SP.PT_SKETCH), e.Location, m_ptGrid, m_ptPrev) Then ' ritorno allo stato base di selezione punto m_nStatus = ST.SELPOINT - RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev) + RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev, SEP.PT_STD, GDB_ID.NULL) ' non ci può essere selezione di ddirezione End If End If @@ -392,70 +407,8 @@ Public Class Scene End If ' --- Rilascio tasto destro --- ElseIf e.Button = Windows.Forms.MouseButtons.Right Then - If m_nStatus = ST.NULL Then - MenuScene.Visible = True - For Each i As ToolStripItem In MenuScene.Items - If i.Name = "cmdSelectAll" Then - i.Visible = True - ElseIf i.Name = "cmdDeselectAll" Then - i.Visible = True - ElseIf i.Name = "sepSel1" Then - 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 - Next - ElseIf m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then - MenuScene.Visible = True - If m_bDragOn Then - For Each i As ToolStripItem In MenuScene.Items - If i.Name = "cmdSketchPoint" Then - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_SKETCH) - ElseIf i.Name = "cmdGridPoint" Then - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_GRID) - ElseIf i.Name = "cmdEndPoint" Then - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_END) - ElseIf i.Name = "cmdMidPoint" Then - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_MID) - ElseIf i.Name = "cmdCenterPoint" Then - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.CENTER) - 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) - ElseIf i.Name = "sepSelPnt1" Then - i.Visible = True - ElseIf i.Name = "cmdStopDrag" Then - i.Visible = True - Else - i.Visible = False - End If - Next - Else - For Each i As ToolStripItem In MenuScene.Items - If i.Name = "cmdRestartDrag" Then - i.Visible = True - Else - i.Visible = False - End If - Next - End If - Else - MenuScene.Visible = False - End If + ' sistemazioni menù contestuale + PrepareMenuScene() ' --- Tutti gli altri casi --- Else MyBase.OnMouseUp(e) @@ -632,6 +585,142 @@ Public Class Scene RaiseEvent OnCursorPos(Me, sCursorPos.ToString) End Sub + + '---- Contextual Menu management ------------- + Private m_bTangentPointOn As Boolean = False + Private m_bPerpendicularPointOn As Boolean = False + Private m_bMinDistPointOn As Boolean = False + + Public Sub EnableTangentPoint() + m_bTangentPointOn = True + End Sub + + Public Sub EnablePerpendicularPoint() + m_bPerpendicularPointOn = True + End Sub + + Public Sub EnableMinDistPoint() + m_bMinDistPointOn = True + End Sub + + Public Sub DisableTangentPoint() + m_bTangentPointOn = False + If m_nSnapType = SP.PT_TANGENT Then + m_nSnapType = SP.PT_NEAR + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + End If + End Sub + + Public Sub DisablePerpendicularPoint() + m_bPerpendicularPointOn = False + If m_nSnapType = SP.PT_PERPENDICULAR Then + m_nSnapType = SP.PT_NEAR + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + End If + End Sub + + Public Sub DisableMinDistPoint() + m_bMinDistPointOn = False + If m_nSnapType = SP.PT_MINDIST Then + m_nSnapType = SP.PT_NEAR + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + End If + End Sub + + Private Sub PrepareMenuScene() + ' per selezione oggetti + If m_nStatus = ST.NULL Then + MenuScene.Visible = True + For Each i As ToolStripItem In MenuScene.Items + If i.Name = "cmdSelectAll" Then + i.Visible = True + ElseIf i.Name = "cmdDeselectAll" Then + i.Visible = True + ElseIf i.Name = "sepSel1" Then + 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 + Next + ' per selezione punti + ElseIf m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then + MenuScene.Visible = True + ' se drag abilitato + If m_bDragOn Then + For Each i As ToolStripItem In MenuScene.Items + Select Case i.Name + Case "cmdSketchPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_SKETCH) + Case "cmdGridPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_GRID) + Case "cmdEndPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_END) + Case "cmdMidPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_MID) + Case "cmdCenterPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.CENTER) + Case "cmdNearPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_NEAR) + Case "cmdIntersectionPoint" + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_INTERS) + Case "cmdTangentPoint" + If m_bTangentPointOn Then + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_TANGENT) + Else + i.Visible = False + End If + Case "cmdPerpendicularPoint" + If m_bPerpendicularPointOn Then + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_PERPENDICULAR) + Else + i.Visible = False + End If + Case "cmdMinDistPoint" + If m_bMinDistPointOn Then + i.Visible = True + DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_MINDIST) + Else + i.Visible = False + End If + Case "sepSelPnt1" + i.Visible = True + Case "cmdStopDrag" + i.Visible = True + Case Else + i.Visible = False + End Select + Next + ' altrimenti con drag disabilitato + Else + For Each i As ToolStripItem In MenuScene.Items + If i.Name = "cmdRestartDrag" Then + i.Visible = True + Else + i.Visible = False + End If + Next + End If + ' altri casi + Else + MenuScene.Visible = False + End If + End Sub + Private Sub MenuScene_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuScene.ItemClicked ' Per selezione If e.ClickedItem.Name = "cmdSelectAll" Then @@ -653,18 +742,34 @@ Public Class Scene ' Scelta tipo punto snap ElseIf e.ClickedItem.Name = "cmdSketchPoint" Then m_nSnapType = SP.PT_SKETCH + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdGridPoint" Then m_nSnapType = SP.PT_GRID + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdEndPoint" Then m_nSnapType = SP.PT_END + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdMidPoint" Then m_nSnapType = SP.PT_MID + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdCenterPoint" Then m_nSnapType = SP.CENTER + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdNearPoint" Then m_nSnapType = SP.PT_NEAR + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ElseIf e.ClickedItem.Name = "cmdIntersectionPoint" Then m_nSnapType = SP.PT_INTERS + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + ElseIf e.ClickedItem.Name = "cmdTangentPoint" Then + m_nSnapType = SP.PT_TANGENT + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + ElseIf e.ClickedItem.Name = "cmdPerpendicularPoint" Then + m_nSnapType = SP.PT_PERPENDICULAR + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) + ElseIf e.ClickedItem.Name = "cmdMinDistPoint" Then + m_nSnapType = SP.PT_MINDIST + RaiseEvent OnChangedSnapPointType(Me, m_nSnapType) ' Sospensione drag ElseIf e.ClickedItem.Name = "cmdStopDrag" Then m_bDragOn = False @@ -730,6 +835,10 @@ Public Class Scene ' imposto lo stato m_nStatus = ST.NULL m_nOldStatus = ST.NULL + ' disabilito scelta punto tangente, perpendicolare e minima distanza + DisableTangentPoint() + DisablePerpendicularPoint() + DisableMinDistPoint() ' abilito drag m_bDragOn = True ' aggiorno visualizzazione @@ -754,6 +863,14 @@ Public Class Scene RaiseEvent OnCloseGetDist(Me) End Sub + Public Function GetSnapPointType() As SP + If m_nStatus <> ST.SELPOINT And m_nStatus <> ST.SELPOINTZ Then + Return SP.PT_NONE + Else + Return m_nSnapType + End If + End Function + '---- Drag Group ------ Private m_bDragOn As Boolean = True Private m_nDragGroup As Integer = GDB_ID.NULL @@ -770,14 +887,16 @@ Public Class Scene Return m_bDragOn End Function - Public Function CreateDragGroup() As Boolean + Public Function CreateDragGroup(Optional bSelectable As Boolean = False) As Boolean m_nDragGroup = EgtCreateGroup(GDB_ID.ROOT) If m_nDragGroup = GDB_ID.NULL Then Return False End If EgtSetLevel(m_nDragGroup, GDB_LV.TEMP) EgtSetMark(m_nDragGroup) - EgtUnselectableAdd(m_nDragGroup) + If Not bSelectable Then + EgtUnselectableAdd(m_nDragGroup) + End If Return True End Function @@ -858,7 +977,7 @@ Public Class Scene End Function Public Function SaveProject(Optional ByVal sFile As String = "") As Boolean - If String.IsNullOrEmpty(sFile) Or EgtGetFileType(sFile) <> FT.NGE Then + If String.IsNullOrWhiteSpace(sFile) Or EgtGetFileType(sFile) <> FT.NGE Then Return SaveAsProject(sFile) Else 'Prima del salvataggio @@ -885,6 +1004,7 @@ Public Class Scene SaveFileDialog.Title = "Save" SaveFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge" SaveFileDialog.FileName = sFile + SaveFileDialog.InitialDirectory = Path.GetDirectoryName(sFile) If SaveFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then Return True End If