EgtTestEIn 1.6c6 :

- migliorato trim/extend.
This commit is contained in:
Dario Sassi
2015-03-23 11:42:09 +00:00
parent 94309ff76c
commit e6b681e500
4 changed files with 71 additions and 60 deletions
+12 -10
View File
@@ -175,6 +175,7 @@ Public Class Controller
Private EXTRUDE_STD As Double = 20
Private EXTEND_STD As Double = 50
Private EXTEND_ADD As Double = 10
Private EXTEND_BIG_ADD As Double = 200
Private OFFSET_STD As Double = 0
' Metodi
@@ -3619,10 +3620,11 @@ Public Class Controller
Select Case m_nStep
Case 0
' verifico condizioni e preparo per il drag
If Not PrepareTransform(False, True) Then
If Not PrepareTransform(False) Then
Return False
End If
EgtUnselectableAdd(EgtGetLastSelectedObj())
m_Scene.SetDragIntersForSelPoint(True)
' imposto stato a lunghezza di estensione
m_nStep = 1
m_dLast = EXTEND_STD
@@ -3658,7 +3660,6 @@ Public Class Controller
EnableCommandLog()
EgtTrimExtendCurveByLen(nId, m_dLast, m_ptP1.Loc(GDB_ID.GRID), REF_TY.GRID)
DisableCommandLog()
EgtUnselectableRemove(nId)
' reset stato scena
m_Scene.ResetStatus()
' aggiorno stato
@@ -3674,8 +3675,8 @@ Public Class Controller
Private Function DragExtendCurve() As Boolean
If m_nStep = 1 Then
' devo sempre partire dalla curva originale
m_Scene.EraseDragGroup()
PrepareTransform(False, True)
EgtEmptyGroup(m_Scene.GetDragGroup())
PrepareTransform(False)
' verifico se caso speciale : drag
Dim bSpecial As Boolean = m_Scene.GetDragStatus()
' lunghezza aggiuntiva per caso speciale
@@ -3699,7 +3700,7 @@ Public Class Controller
Else
Dim dLen As Double
Dim nDragId As Integer = EgtGetFirstInGroup(m_Scene.GetDragGroup())
If EgtCurveLengthAtPoint(nDragId, m_ptLast.Loc(nDragId), dLen) Then
If EgtCurveLengthAtPoint(nDragId, m_ptLast.Loc(nDragId), EXTEND_BIG_ADD, dLen) Then
' modifico inizio (su drag inizio spostato di m_dLast)
If m_bLast Then
Dim dDragLen As Double
@@ -4516,15 +4517,16 @@ Public Class Controller
Return False
End Function
Private Function PrepareTransform(Optional ByVal bAllSelected As Boolean = True,
Optional ByVal bDragSelectable As Boolean = False) As Boolean
Private Function PrepareTransform(Optional ByVal bAllSelected As Boolean = True) 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(bDragSelectable) Then
Return False
' se non esiste già, creo il gruppo di drag e vi copio le entità selezionate
If m_Scene.GetDragGroup() = GDB_ID.NULL Then
If Not m_Scene.CreateDragGroup() Then
Return False
End If
End If
' se devo prendere tutti
If bAllSelected Then
+3
View File
@@ -1727,7 +1727,10 @@ Public Function EgtCurveLength(ByVal nId As Integer, ByRef dLen As Double) As Bo
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Function EgtCurveLengthAtPoint(ByVal nId As Integer, ByRef ptOn As Point3d, ByVal dExtend As Double, ByRef dLen As Double) As Boolean
End Function
Public Function EgtCurveLengthAtPoint(ByVal nId As Integer, ByRef ptOn As Point3d, ByRef dLen As Double) As Boolean
Return EgtCurveLengthAtPoint(nId, ptOn, 0, dLen)
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
+2 -2
View File
@@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices
' utilizzando l'asterisco (*) come descritto di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.3.5")>
<Assembly: AssemblyFileVersion("1.6.3.5")>
<Assembly: AssemblyVersion("1.6.3.6")>
<Assembly: AssemblyFileVersion("1.6.3.6")>
+54 -48
View File
@@ -42,9 +42,10 @@ Public Class Scene
SELPOINT
SELPOINTZ
End Enum
Private m_nSnapType As SP ' tipo di snap in selezione punto
Private m_bAlsoSelDir As Boolean ' abilita anche selezione direzione quando selezione punto
Private m_bExcludeSurfForSnap As Boolean ' abilita anche le superfici come sorgenti per snap a punto
Private m_nSnapType As SP ' tipo di snap in selezione punto
Private m_bAlsoSelDir As Boolean ' abilita anche selezione direzione quando selezione punto
Private m_bAlsoDragIntersForSnap As Boolean ' abilita intersezione con drag per snap a punto
Private m_bAlsoSurfForSnap As Boolean ' abilita anche le superfici come sorgenti per snap a punto
Private m_PrevPoint As Point
Private m_ptPrev As Point3d
Private m_ptGrid As Point3d
@@ -76,7 +77,7 @@ Public Class Scene
m_nOldStatus = ST.SEL
m_nSnapType = SP.PT_GRID
m_bAlsoSelDir = False
m_bExcludeSurfForSnap = False
m_bAlsoSurfForSnap = True
m_PrevPoint = Point.Empty
m_bGridCursorPos = False
m_nDriver = 3
@@ -266,7 +267,7 @@ Public Class Scene
End If
' se stato GETDIST (primo punto per misura di distanza)
ElseIf m_nStatus = ST.GETDIST Then
EgtSetObjFilterForSelect(True, True, (Not m_bExcludeSurfForSnap), True, True)
EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSnap, True, True)
If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then
' salvo il punto di riferimento
Dim ptWin As Point3d
@@ -276,7 +277,7 @@ Public Class Scene
End If
' se stato GETDIST2(secondo punto per misura di distanza)
ElseIf m_nStatus = ST.GETDIST2 Then
EgtSetObjFilterForSelect(True, True, (Not m_bExcludeSurfForSnap), True, True)
EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSnap, True, True)
Dim ptSel As Point3d
If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, ptSel) Then
' disegno la linea (coordinate geo globali)
@@ -302,19 +303,15 @@ Public Class Scene
End If
' se stato selezione punto
ElseIf m_nStatus = ST.SELPOINT Then
EgtSetObjFilterForSelect(True, True, (Not m_bExcludeSurfForSnap), True, True)
EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSnap, True, True)
If Not m_bDragOn Then
' rendo selezionabile gruppo di drag
If Not m_bDragSelectable Then
EgtUnselectableRemove(m_nDragGroup)
End If
EgtUnselectableRemove(m_nDragGroup)
' eseguo selezione
Dim nSel As Integer = GDB_ID.NULL
EgtSelect(e.Location, DIM_SEL, DIM_SEL, nSel)
' ripristino stato precedente di selezionabilità drag
If Not m_bDragSelectable Then
EgtUnselectableAdd(m_nDragGroup)
End If
EgtUnselectableAdd(m_nDragGroup)
' click su geometria di drag equivale a Done
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
@@ -324,33 +321,40 @@ Public Class Scene
End If
nId = EgtGetNextObjInSelWin()
End While
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
m_nStatus = ST.SELPOINTZ
m_ptGrid = m_ptPrev
' altrimenti si restituisce il punto
Else
If m_bAlsoDragIntersForSnap And m_nSnapType = SP.PT_INTERS Then
EgtUnselectableRemove(m_nDragGroup)
Else
' se richiesta anche direzione, restituisco prima questa
If m_bAlsoSelDir Then
Dim vtDir As Vector3d
If EgtGetLastSnapDir(vtDir) Then
RaiseEvent OnMouseSelectedDir(Me, vtDir)
End If
End If
' 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
EgtUnselectableAdd(m_nDragGroup)
End If
If 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
m_nStatus = ST.SELPOINTZ
m_ptGrid = m_ptPrev
' altrimenti si restituisce il punto
Else
nSep = SEP.PT_STD
' se richiesta anche direzione, restituisco prima questa
If m_bAlsoSelDir Then
Dim vtDir As Vector3d
If EgtGetLastSnapDir(vtDir) Then
RaiseEvent OnMouseSelectedDir(Me, vtDir)
End If
End If
' 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
RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev, nSep, EgtGetLastSnapId())
End If
End If
' se stato selezione Z di punto
@@ -812,7 +816,7 @@ Public Class Scene
Case "cmdExcludeSurfForSnap"
i.Text = EgtMsg(1123) ' Exclude Surfaces
i.Visible = True
DirectCast(i, ToolStripMenuItem).Checked = m_bExcludeSurfForSnap
DirectCast(i, ToolStripMenuItem).Checked = Not m_bAlsoSurfForSnap
Case "sepSelPnt2"
i.Visible = (m_nStatus <> ST.GETDIST And m_nStatus <> ST.GETDIST2)
Case "cmdStopDrag"
@@ -897,7 +901,7 @@ Public Class Scene
RaiseEvent OnChangedSnapPointType(Me, m_nSnapType)
' esclusione superfici da punto snap
ElseIf e.ClickedItem.Name = "cmdExcludeSurfForSnap" Then
m_bExcludeSurfForSnap = Not m_bExcludeSurfForSnap
m_bAlsoSurfForSnap = Not m_bAlsoSurfForSnap
' Sospensione drag
ElseIf e.ClickedItem.Name = "cmdStopDrag" Then
m_bDragOn = False
@@ -1032,6 +1036,7 @@ Public Class Scene
' reset entità non selezionabili
EgtSetObjFilterForSelect(True, True, True, True, True)
EgtUnselectableClearAll()
m_bAlsoDragIntersForSnap = False
' imposto lo stato
m_nStatus = ST.SEL
m_nOldStatus = ST.SEL
@@ -1071,9 +1076,16 @@ Public Class Scene
End If
End Function
Public Sub SetDragIntersForSelPoint(ByVal bVal As Boolean)
m_bAlsoDragIntersForSnap = bVal
End Sub
Public Sub SetSurfForSelPoint(ByVal bVal As Boolean)
m_bAlsoSurfForSnap = bVal
End Sub
'---- Drag Group ------
Private m_bDragOn As Boolean = True
Private m_bDragSelectable As Boolean = False
Private m_nDragGroup As Integer = GDB_ID.NULL
Public Sub EnableDrag()
@@ -1088,7 +1100,7 @@ Public Class Scene
Return m_bDragOn
End Function
Public Function CreateDragGroup(Optional bSelectable As Boolean = False) As Boolean
Public Function CreateDragGroup() As Boolean
' le azioni successive sono temporanee -> non devono cambiare lo stato di modifica del progetto
EgtDisableModified()
' creo il gruppo di drag
@@ -1097,12 +1109,7 @@ Public Class Scene
If bOk Then
EgtSetLevel(m_nDragGroup, GDB_LV.TEMP)
EgtSetMark(m_nDragGroup)
m_bDragSelectable = bSelectable
If m_bDragSelectable Then
EgtUnselectableRemove(m_nDragGroup)
Else
EgtUnselectableAdd(m_nDragGroup)
End If
EgtUnselectableAdd(m_nDragGroup)
End If
' riabilito possibilità modifica stato progetto
EgtEnableModified()
@@ -1114,7 +1121,6 @@ Public Class Scene
EgtDisableModified()
' cancello il gruppo di drag
EgtErase(m_nDragGroup)
m_bDragSelectable = False
EgtUnselectableRemove(m_nDragGroup)
m_nDragGroup = GDB_ID.NULL
' riabilito possibilità modifica stato progetto