Merge branch 'Features/3D_In_VeinMatch' of https://gitlab.steamware.net/egaltech/omagoffice into Features/3D_In_VeinMatch
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
Initialized="Window_Initialized"
|
||||
Title="🚌 VEIN MATCH 🏘"
|
||||
MinWidth="300" MinHeight="300">
|
||||
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Command="{Binding Confirm}" Key="Esc"/>
|
||||
</Window.InputBindings>
|
||||
|
||||
<Window.Resources>
|
||||
<Style TargetType="{x:Type Window}">
|
||||
<Setter Property="Template">
|
||||
@@ -187,8 +190,10 @@
|
||||
Margin="1,5,1,0"/>
|
||||
<CheckBox Name="InvertOption" Margin="1,5,1,0"
|
||||
Foreground="{DynamicResource Omag_White}">Invert</CheckBox>
|
||||
<CheckBox Name="FlipOption" Margin="1,5,1,0"
|
||||
Foreground="{DynamicResource Omag_White}">Flip</CheckBox>
|
||||
<CheckBox Name="FlipOption1" Margin="1,5,1,0"
|
||||
Foreground="{DynamicResource Omag_White}">Flip ∥</CheckBox>
|
||||
<CheckBox Name="FlipOption2" Margin="1,5,1,0"
|
||||
Foreground="{DynamicResource Omag_White}">Flip ⟂</CheckBox>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</Border>
|
||||
|
||||
@@ -51,6 +51,7 @@ Public Class VeinMatchingWindow
|
||||
Private m_ptBeforeTrasf As New Point3d
|
||||
Private m_dCorrection As Double = 0
|
||||
Private m_bPreview As Boolean = False
|
||||
Private m_ptPair As New Point3d
|
||||
' Nero, Bianco, Fucsia, Rosso, Verde
|
||||
Private m_ColorList As New List(Of Color3d)({New Color3d(0, 0, 0), New Color3d(255, 255, 255), New Color3d(247, 21, 237),
|
||||
New Color3d(235, 12, 12), New Color3d(78, 249, 43)})
|
||||
@@ -410,11 +411,15 @@ Line1:
|
||||
If EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineAxisRotate = -1 Then
|
||||
PartSolidIdTempSel.nIdLineAxisRotate = nId
|
||||
EgtSetMark(nId)
|
||||
' se trovo già un valore scritto nella casella di testo allora ruoto subito il part attorno all'asse indicato
|
||||
Text5_Changed()
|
||||
Return
|
||||
ElseIf EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineAxisRotate <> -1 Then
|
||||
EgtResetMark(PartSolidIdTempSel.nIdLineAxisRotate)
|
||||
PartSolidIdTempSel.nIdLineAxisRotate = nId
|
||||
EgtSetMark(nId)
|
||||
' se trovo già un valore scritto nella casella di testo allora ruoto subito il part attorno all'asse indicato
|
||||
Text5_Changed()
|
||||
End If
|
||||
' Passo al successivo
|
||||
nId = EgtGetNextObjInSelWin()
|
||||
@@ -1299,6 +1304,8 @@ Line1:
|
||||
Dim nOriId As Integer = GDB_ID.NULL
|
||||
EgtGetInfo(IdFP, KEY_ORI_ID, nOriId)
|
||||
dThick = GetRawHeightFromPart(nOriId, m_nVeinCtx, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())
|
||||
' forza thickness a 20
|
||||
'dThick = 20
|
||||
CreateSolid(IdFP, dThick, False)
|
||||
IdFP = EgtGetNextPart(IdFP)
|
||||
EgtGetName(IdFP, sName)
|
||||
@@ -1356,7 +1363,7 @@ Line1:
|
||||
EgtSetName(TempLay_Y, "AxisY")
|
||||
EgtMove(TempLay_Y, vtMove)
|
||||
Dim TempLay_Z As Integer = EgtCreateGroup(PartSolidSel.TernaId)
|
||||
Dim Line_Z As Integer = EgtCreateLine(TempLay_Z, New Point3d(0, 0, -(100 + PartSolidSel.bbSolid.DimZ / 2)), New Point3d(0, 0, 100 + PartSolidSel.bbSolid.DimZ / 2), GDB_RT.GLOB)
|
||||
Dim Line_Z As Integer = EgtCreateLine(TempLay_Z, New Point3d(0, 0, -(200 + PartSolidSel.bbSolid.DimZ / 2)), New Point3d(0, 0, 200 + PartSolidSel.bbSolid.DimZ / 2), GDB_RT.GLOB)
|
||||
EgtSetColor(Line_Z, New Color3d(0, 0, 255))
|
||||
EgtSetName(TempLay_Z, "AxisZ")
|
||||
EgtMove(TempLay_Z, vtMove)
|
||||
@@ -1372,7 +1379,7 @@ Line1:
|
||||
If PartSolidIdSel.nIdLineAxisRotate = GDB_ID.NULL Then Return
|
||||
EgtStartPoint(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, ptStart)
|
||||
EgtStartVector(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, vtDir)
|
||||
PartSolidIdSel.Rotate(ptStart, vtDir, dAng)
|
||||
PartSolidIdSel.Rotate(ptStart, vtDir, dAng, False, True)
|
||||
'PartSolidIdSel.DeselectPart()
|
||||
'm_nIdPart = -1
|
||||
EgtDraw()
|
||||
@@ -1384,20 +1391,26 @@ Line1:
|
||||
If String.IsNullOrEmpty(sAng) Then Return
|
||||
If Not IsNumeric(sAng) Then Return
|
||||
Dim dAng As Double = CDbl(sAng)
|
||||
RotatePart(dAng - m_dAngRot)
|
||||
If m_dAngRot <> 0 Then
|
||||
ResetRotation(False, False)
|
||||
End If
|
||||
RotatePart(dAng)
|
||||
|
||||
m_dAngRot = dAng
|
||||
End Sub
|
||||
|
||||
Private Sub TgBtn_Rotation_Uncheck() Handles TgBtn_Rotation.Unchecked
|
||||
' conferma rotazione
|
||||
'TgBtn4.IsChecked = False
|
||||
Text5.Text = "0"
|
||||
'Text5.Text = "0"
|
||||
m_dAngRot = 0
|
||||
If m_nIdPart = GDB_ID.NULL Then Return
|
||||
Dim PartSolidSel = GetPartSolid(m_nIdPart)
|
||||
' se ho effettviamente fatto una rotazione attivo il pulsante undo
|
||||
'If PartSolidSel.nIdLineAxisRotate <> GDB_ID.NULL Then UndoBtn.IsEnabled = True
|
||||
'PartSolidSel.ConfirmRotate()
|
||||
If PartSolidSel.nIdLineAxisRotate <> GDB_ID.NULL Then
|
||||
' salvo l'operazione nella storia
|
||||
PartSolidSel.ConfirmRotate()
|
||||
End If
|
||||
PartSolidSel.DeselectPart()
|
||||
PartSolidSel.ResetData()
|
||||
m_nIdPart = -1
|
||||
@@ -1410,15 +1423,24 @@ Line1:
|
||||
|
||||
Private Sub ResetRotationBtn_Click() Handles ResetRotationBtn.Click
|
||||
' resetta rotazione
|
||||
|
||||
'RotatePart(-m_dAngRot)
|
||||
Text5.Text = "0"
|
||||
'Text5.Text = "0"
|
||||
ResetRotation(True, True)
|
||||
End Sub
|
||||
|
||||
Private Sub ResetRotation(Optional bEraseData As Boolean = False, Optional bDraw As Boolean = False)
|
||||
m_dAngRot = 0
|
||||
If m_nIdPart <> -1 Then
|
||||
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
|
||||
If Not IsNothing(PartSolidSel) Then
|
||||
PartSolidSel.ResetData()
|
||||
PartSolidSel.UndoTempTrasf()
|
||||
If bEraseData Then PartSolidSel.ResetData()
|
||||
End If
|
||||
End If
|
||||
If bDraw Then
|
||||
EgtDraw()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TgBtn_Pair_Click(sender As Object, e As RoutedEventArgs) Handles TgBtn_Pair.Click
|
||||
@@ -1505,6 +1527,8 @@ Line1:
|
||||
ptFin = ptMidS
|
||||
Case Else
|
||||
End Select
|
||||
' salvo il punto di arrivo
|
||||
m_ptPair = ptFin
|
||||
' calcolo il vettore movimento e sposto solid e part
|
||||
Dim vtMove As Vector3d = ptFin - ptIni
|
||||
Dim dAng As Double = GetAngle(vtDirF, vtDirS)
|
||||
@@ -1660,6 +1684,7 @@ Line2:
|
||||
'resetto il numero di operazioni effettutate durante il pair
|
||||
m_nTransfNum = -1
|
||||
m_nIdPart = GDB_ID.NULL
|
||||
m_ptPair = New Point3d
|
||||
'UndoBtn.IsEnabled = False
|
||||
'RedoBtn.IsEnabled = False
|
||||
EgtDraw()
|
||||
@@ -1681,7 +1706,7 @@ Line2:
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Flip_Changed() Handles FlipOption.Click
|
||||
Private Sub FlipParallel_Changed() Handles FlipOption1.Click
|
||||
If TgBtn_Pair.IsChecked = False Then Return
|
||||
If m_nIdPart = GDB_ID.NULL Then Return
|
||||
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
|
||||
@@ -1699,6 +1724,28 @@ Line2:
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub FlipPerpendicular_Changed() Handles FlipOption2.Click
|
||||
If TgBtn_Pair.IsChecked = False Then Return
|
||||
If m_nIdPart = GDB_ID.NULL Then Return
|
||||
Dim PartSolidSel1 As PartSolid = GetPartSolid(m_nIdPart)
|
||||
If PartSolidSel1.nIdLineSecond = GDB_ID.NULL Then Return
|
||||
Dim PartSolidSel2 As PartSolid = GetPartSolid(EgtGetParent(EgtGetParent(PartSolidSel1.nIdLineSecond)))
|
||||
' recupero la normale della faccia principale del part del secondo part
|
||||
Dim vtNorm As New Vector3d
|
||||
EgtSurfFrNormVersor(PartSolidSel2.SurfId, GDB_ID.ROOT, vtNorm)
|
||||
Dim vtStartDir As New Vector3d
|
||||
EgtStartVector(PartSolidSel1.nIdLineSecond, GDB_ID.ROOT, vtStartDir)
|
||||
Dim vtDir As Vector3d = vtNorm ^ vtStartDir
|
||||
' recupero il punto usato per l'accoppiamento
|
||||
PartSolidSel1.Rotate(m_ptPair, vtDir, 180)
|
||||
If FindInters(m_nIdPart) Then
|
||||
MyMsgTxBl.Text = "Inters!"
|
||||
MyMsgTxBl.Foreground = Brushes.Red
|
||||
End If
|
||||
m_nTransfNum += 1
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub CompletePair()
|
||||
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
|
||||
Dim ptAx As New Point3d
|
||||
@@ -2102,6 +2149,41 @@ Line2:
|
||||
Next
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
|
||||
'Public Sub confirmOperation() Handles KeyDown
|
||||
|
||||
|
||||
'Private someCommand As ICommand
|
||||
'Public Function Confirm() As ICommand
|
||||
' Return someCommand
|
||||
'End Function
|
||||
|
||||
'someCommand As New ActionCommand()
|
||||
'Public Class ActionCommand : ICommand
|
||||
|
||||
' Private ReadOnly Action _action
|
||||
|
||||
' Public ActionCommand(Action action)
|
||||
|
||||
' _action = action
|
||||
|
||||
|
||||
' Public void Execute(Object parameter)
|
||||
|
||||
' _action()
|
||||
|
||||
|
||||
' Public bool CanExecute(Object parameter)
|
||||
|
||||
' Return True;
|
||||
|
||||
|
||||
' Public Event EventHandler() CanExecuteChanged
|
||||
'End Class
|
||||
|
||||
|
||||
|
||||
'Friend Shared Function prova(ByRef nInt As Integer) As Boolean
|
||||
' nInt += 1
|
||||
' Return True
|
||||
@@ -4189,8 +4271,9 @@ Public Class PartSolid
|
||||
End Sub
|
||||
|
||||
Public Sub ConfirmRotate()
|
||||
Dim trf As Transformation = LastRotation()
|
||||
EgtRotate(m_PartSolidId, trf.m_ptO, trf.m_vtDir, trf.m_dAngOrId)
|
||||
'Dim trf As Transformation = LastRotation()
|
||||
'EgtRotate(m_PartSolidId, trf.m_ptO, trf.m_vtDir, trf.m_dAngOrId)
|
||||
AddTransf(LastTempTransf())
|
||||
End Sub
|
||||
|
||||
Public Function Center() As Point3d
|
||||
@@ -4438,7 +4521,7 @@ Public Class PartSolid
|
||||
Public Sub ApplyTransf(trf As Transformation, Optional bSaveHist As Boolean = True)
|
||||
' se ho una traslazione o una rotazione applico la trasformazione a tutto l'accoppiato
|
||||
If trf.m_dAngOrId = 0 Or Not AreSameVectorExact(New Vector3d, trf.m_vtDir) Then
|
||||
RotateSingle(trf.m_ptO, trf.m_vtDir, trf.m_dAngOrId, bSaveHist)
|
||||
'RotateSingle(trf.m_ptO, trf.m_vtDir, trf.m_dAngOrId, bSaveHist)
|
||||
For Each PartSolidSel In vPairSolid
|
||||
' salvo la storia solo per il pezzo che ho selezionato(anche se si porta dietro tutti gli accoppiati nel movimento)
|
||||
If bSaveHist Then
|
||||
|
||||
Reference in New Issue
Block a user