diff --git a/Controller.vb b/Controller.vb index 0321127..8f7a16e 100644 --- a/Controller.vb +++ b/Controller.vb @@ -167,6 +167,7 @@ Public Class Controller GRID_INVERT BIARC CURVEBEZIER + TRIMSURFTMWITHCURVE End Enum Public Enum GRID_TYPE As Integer NONE = 0 @@ -1228,8 +1229,13 @@ Public Class Controller End Sub Public Sub SetLastBoolean(bVal As Boolean) + If m_nLastCmd = CMD.TRIMSURFTMWITHCURVE And m_bLast <> bVal Then + DragInvertCurve() + End If + m_bLast = bVal - If m_nLastCmd = CMD.TEXTPLUS Or m_nLastCmd = CMD.POLYGON Or m_nLastCmd = CMD.EXTRUDE Or m_nLastCmd = CMD.REVOLVE Or m_nLastCmd = CMD.SETCURVETHICKNESS Then + If m_nLastCmd = CMD.TEXTPLUS Or m_nLastCmd = CMD.POLYGON Or m_nLastCmd = CMD.EXTRUDE Or m_nLastCmd = CMD.REVOLVE _ + Or m_nLastCmd = CMD.SETCURVETHICKNESS Or m_nLastCmd = CMD.TRIMSURFTMWITHCURVE Then ' aggiorno drag al cambio di italic ExecuteDrag() End If @@ -1522,6 +1528,9 @@ Public Class Controller ' Cut Surface with Another one Case CMD.CUTSURFSURF bOk = ProcessCutSurfSurf() + ' Cut Surface with (Extrusion of a closed) Curve + Case CMD.TRIMSURFTMWITHCURVE + bOk = ProcessCutSurfTmWithCurve() ' Inverse Cut Surface with Another one Case CMD.INVCUTSURFSURF bOk = ProcessInvCutSurfSurf() @@ -1767,6 +1776,8 @@ Public Class Controller DragSolidSubtractSurf() Case CMD.INTERSECTSURFSURF DragIntersectSurfSurf() + Case CMD.TRIMSURFTMWITHCURVE + DragTrimSurfTmWithCurve() Case CMD.CUTSURFSURF DragCutSurfSurf() Case CMD.INVCUTSURFSURF @@ -6092,6 +6103,81 @@ Public Class Controller End If End Sub + Private Function ProcessCutSurfTmWithCurve() 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 + ' imposto nuovo stato + m_nStep = 1 + ' abilito dialogo + RaiseEvent PrepareInputBox("TRIM SURF WITH CURVE", "", "Invert Curve", True, True) + RaiseEvent SetInputBoxCheck(m_bLastBooleanCheck) + RaiseEvent AddInputBoxCombo("Delete trim curve", True) + RaiseEvent AddInputBoxCombo("Keep trim curve", False) + ' anteprima + EgtDisableModified() + DragTrimSurfTmWithCurve() + EgtEnableModified() + Case 1 + ' eseguo il taglio della superficie + EnableCommandLog() + Dim nLastId As Integer = EgtGetLastSelectedObj() + Dim nPrevId As Integer = EgtGetPrevSelectedObj() + If EgtGetType(nPrevId) = GDB_TY.SRF_MESH And EgtGetType(nLastId) = GDB_TY.CRV_COMPO Then + EgtCutSurfTmClosedCurve(nPrevId, nLastId, False) + If m_nLast = 0 Then + EgtErase(nLastId) + End If + ElseIf EgtGetType(nPrevId) = GDB_TY.CRV_COMPO And EgtGetType(nLastId) = GDB_TY.SRF_MESH Then + EgtCutSurfTmClosedCurve(nLastId, nPrevId, False) + If m_nLast = 0 Then + EgtErase(nPrevId) + End If + End If + DisableCommandLog() + ' salvo stato + m_bLastBooleanCheck = m_bLast + ' reset stato scena + m_Scene.ResetStatus() + ' reset stato + m_nStep = 0 + RaiseEvent UpdateUI(Me, True) + Case Else + m_nStep = 0 + Return False + End Select + Return True + End Function + + Private Sub DragTrimSurfTmWithCurve() + If m_nStep = 1 Then + ' cancello eventuale vecchia superficie taglio + EgtEmptyGroup(m_Scene.GetDragGroup()) + ' eseguo il taglio della prima superficie con la seconda + Dim nLastId As Integer = EgtGetLastSelectedObj() + Dim nPrevId As Integer = EgtGetPrevSelectedObj() + If EgtGetType(nPrevId) = GDB_TY.SRF_MESH And EgtGetType(nLastId) = GDB_TY.CRV_COMPO Then + Dim nDragId As Integer = EgtCopyGlob(nPrevId, m_Scene.GetDragGroup()) + EgtCutSurfTmClosedCurve(nDragId, nLastId, False) + ElseIf EgtGetType(nPrevId) = GDB_TY.CRV_COMPO And EgtGetType(nLastId) = GDB_TY.SRF_MESH Then + Dim nDragId As Integer = EgtCopyGlob(nLastId, m_Scene.GetDragGroup()) + EgtCutSurfTmClosedCurve(nDragId, nPrevId, False) + End If + EgtDraw() + End If + End Sub + + Private Sub DragInvertCurve() + Dim nLastId As Integer = EgtGetLastSelectedObj() + Dim nPrevId As Integer = EgtGetPrevSelectedObj() + If EgtGetType(nPrevId) = GDB_TY.SRF_MESH And EgtGetType(nLastId) = GDB_TY.CRV_COMPO Then + EgtInvertCurve(nLastId) + ElseIf EgtGetType(nPrevId) = GDB_TY.CRV_COMPO And EgtGetType(nLastId) = GDB_TY.SRF_MESH Then + EgtInvertCurve(nPrevId) + End If + End Sub + Private Function ProcessInvCutSurfSurf() As Boolean Select Case m_nStep Case 0