- corretti errori minori

- escluso l'inters
This commit is contained in:
Daniele Bariletti
2023-12-15 15:33:02 +01:00
parent 46d2869dbc
commit 06248bee99
+72 -28
View File
@@ -313,25 +313,36 @@ Public Class VeinMatchingWindow
PartSolidIdTempSel.nIdLineFirst = nId
EgtSetMark(nId)
Return
ElseIf EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineSecond = -1 Then
' impongo anche che il secondo lato appartenga ad un solid diverso dal primo selezionato
ElseIf EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineSecond = -1 And
nPartId <> PartSolidIdTempSel.PartId And nPartId <> PartSolidIdTempSel.PartSolidId Then
PartSolidIdTempSel.nIdLineSecond = nId
EgtSetMark(nId)
PairPart(False)
Return
ElseIf EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineSecond <> -1 Then
' impongo anche che il secondo lato appartenga ad un solid diverso dal primo selezionato
ElseIf EgtGetType(nId) = GDB_TY.CRV_LINE And PartSolidIdTempSel.nIdLineSecond <> -1 And
nPartId <> PartSolidIdTempSel.PartId And nPartId <> PartSolidIdTempSel.PartSolidId Then
EgtResetMark(PartSolidIdTempSel.nIdLineSecond)
EgtSetMark(nId)
PartSolidIdTempSel.nIdLineSecond = nId
PairPart(False)
Return
' impongo che la prima faccia appartenga al primo solido selezionato
ElseIf (ModifierKeys.Shift And Keyboard.Modifiers) > 0 And EgtGetType(nId) = GDB_TY.SRF_FRGN And
PartSolidIdTempSel.nIdLineSecond <> -1 And PartSolidIdTempSel.nIdSurfFirst = -1 Then
PartSolidIdTempSel.nIdLineSecond <> -1 And PartSolidIdTempSel.nIdSurfFirst = -1 And
nPartId = PartSolidIdTempSel.PartSolidId Then
PartSolidIdTempSel.nIdSurfFirst = nId
EgtSurfFrNormVersor(nId, GDB_ID.ROOT, PartSolidIdTempSel.vtNormFirst)
EgtSetMark(nId)
Return
' impongo che la seconda faccia appartenga ad un solido diverso dal primo selezionato
ElseIf (ModifierKeys.Shift And Keyboard.Modifiers) > 0 And EgtGetType(nId) = GDB_TY.SRF_FRGN And
PartSolidIdTempSel.nIdLineSecond <> -1 And PartSolidIdTempSel.nIdSurfFirst <> -1 Then
If nPartId = PartSolidIdTempSel.PartSolidId Then
MyMsgTxBl.Text = "Devi selezionare una faccia appartente ad un altro pezzo"
Return
End If
EgtSurfFrNormVersor(nId, GDB_ID.ROOT, PartSolidIdTempSel.vtNormSecond)
EgtResetMark(PartSolidIdTempSel.nIdSurfSecond)
PartSolidIdTempSel.nIdSurfSecond = nId
@@ -344,7 +355,6 @@ Public Class VeinMatchingWindow
Continue While
End If
'Dim PartSolidIdSel As PartSolid = GetPartSolid(nPartId)
' selezione semplice
If EgtIsPart(nPartId) Then
Dim nStat As Integer = GDB_ST.ON_
@@ -618,11 +628,14 @@ Public Class VeinMatchingWindow
If m_nIdToSel <> GDB_ID.NULL Then
' Eseguo la selezione in Nesting
Dim PartSolidIdToSel As PartSolid = GetPartSolid(m_nIdToSel)
If IsNothing(PartSolidIdToSel) Then
' selezione di un Part che non ha un SOLID associato
EgtSelectObj(m_nIdToSel)
Return
End If
' in teoria questo controllo non serve, perché creo un part Solid per tutti i part e se non hanno il solid non è un problema
'If IsNothing(PartSolidIdToSel) Then
' 'selezione di un Part che non ha un SOLID associato
' EgtSelectObj(m_nIdToSel)
' Return
'End If
m_nIdToSel = PartSolidIdToSel.PartId
' seleziono
Dim bSelected As Boolean = False
@@ -990,14 +1003,11 @@ Public Class VeinMatchingWindow
'TgBtn4.IsChecked = False
Text5.Text = "0"
m_dAngRot = 0
If m_nIdPart = GDB_ID.NULL Then Return
Dim PartSolidSel = GetPartSolid(m_nIdPart)
If Not IsNothing(PartSolidSel) Then
'PartSolidSel.ConfirmRotate()
PartSolidSel.DeselectPart()
PartSolidSel.ResetData()
Else
EgtDeselectAll()
End If
'PartSolidSel.ConfirmRotate()
PartSolidSel.DeselectPart()
PartSolidSel.ResetData()
m_nIdPart = -1
EgtDraw()
End Sub
@@ -1070,6 +1080,7 @@ Public Class VeinMatchingWindow
ptIni = ptEndF
ptFin = ptEndS
Case 4
' Mid-Mid
ptIni = ptMidF
ptFin = ptMidS
Case Else
@@ -1086,7 +1097,7 @@ Public Class VeinMatchingWindow
'PartSolidIdSel.nIdLineSecond = -1
'If FindInters(PartSolidIdSel.PartId) Then
' MyMsgTxBl.Text = "Ciula!"
' MyMsgTxBl.Text = MyMsgTxBl.Text & "Ciula!"
' MyMsgTxBl.Foreground = Brushes.Red
'End If
EgtDraw()
@@ -1096,13 +1107,14 @@ Public Class VeinMatchingWindow
Dim vtAx As Vector3d = vtDirF ^ vtDirS
PartSolidIdSel.Rotate(ptFin, vtAx, dAng, bPart)
'If FindInters(PartSolidIdSel.PartId) Then
' MyMsgTxBl.Text = "Ciula!"
' MyMsgTxBl.Text = MyMsgTxBl.Text & "Ciula!"
' MyMsgTxBl.Foreground = Brushes.Red
'End If
EgtDraw()
End Sub
Private Sub TgBtn6_Uncheck() Handles TgBtn6.Unchecked
If m_nIdPart = GDB_ID.NULL Then Return
' conferma l'accoppiamento
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
'PairPart(True) '' questo servirà per accoppiare il part col suo solid dopo un accoppiamento tra solidi
@@ -1111,17 +1123,28 @@ Public Class VeinMatchingWindow
PartSolidSel.DeselectPart()
m_nIdPart = -1
'TgBtn6.IsChecked = False
MyMsgTxBl.Text = "ciao mondo ciao mondo ciao mondo ciao mondo ciao mona ciao mondo ciao mondo"
EgtDraw()
End Sub
Private Sub PairOption_Changed() Handles PairOption.SelectionChanged
If Not TgBtn6.IsChecked Then Return
If m_nIdPart = GDB_ID.NULL Then Return
PairPart(False)
'If FindInters(m_nIdPart) Then
' MyMsgTxBl.Text = MyMsgTxBl.Text & "Ciula!"
' MyMsgTxBl.Foreground = Brushes.Red
'End If
End Sub
Private Sub InvertOption_Changed() Handles InvertOption.Click
If Not TgBtn6.IsChecked Then Return
If m_nIdPart = GDB_ID.NULL Then Return
PairPart(False)
'If FindInters(m_nIdPart) Then
' MyMsgTxBl.Text = MyMsgTxBl.Text & "Ciula!"
' MyMsgTxBl.Foreground = Brushes.Red
'End If
End Sub
Private Sub CompletePair()
@@ -1142,6 +1165,7 @@ Public Class VeinMatchingWindow
End Sub
Private Sub ResetPair()
If m_nIdPart = GDB_ID.NULL Then Return
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
PartSolidSel.ResetData()
EgtDraw()
@@ -1160,24 +1184,39 @@ Public Class VeinMatchingWindow
Private Function FindInters(nPartId As Integer) As Boolean
Dim PartSolidCurr As PartSolid = GetPartSolid(nPartId)
Dim nIdTempL = EgtGetFirstNameInGroup(PartSolidCurr.PartSolidId, "Temp")
Dim nIdSurf As Integer = PartSolidCurr.SurfId
EgtSetCurrentContext(m_nVeinCtx)
For Each PartSolidSel As PartSolid In m_PartSolidList
Dim nIdSurfToCheck As Integer = PartSolidSel.SurfId
If nIdSurfToCheck = -1 Then Continue For
Dim nIdCopy As Integer = EgtCopy(nIdSurf, nIdTempL)
EgtSurfTmIntersect(nIdCopy, nIdSurf)
Next
' svuoto il layer prima di trovare le nuove intersezioni
Dim nIdInters As Integer = EgtGetFirstInGroup(nIdTempL)
While nIdInters <> GDB_ID.NULL
Dim nIdNext As Integer = EgtGetNext(nIdInters)
EgtErase(nIdInters)
nIdInters = nIdNext
End While
Dim nIdSolid As Integer = PartSolidCurr.SolidId
EgtSetCurrentContext(m_nVeinCtx)
Dim vIntersId As New ObservableCollection(Of Integer)
For Each PartSolidSel As PartSolid In m_PartSolidList
Dim nIdSurfToCheck As Integer = PartSolidSel.SolidId
If nIdSurfToCheck = -1 Then Continue For
Dim nIdCopy As Integer = EgtCopy(nIdSolid, nIdTempL)
EgtSurfTmIntersect(nIdCopy, nIdSurfToCheck)
If EgtSurfTmFacetCount(nIdCopy) <> 0 Then
EgtSetColor(nIdCopy, New Color3d(255, 0, 0))
vIntersId.Add(PartSolidSel.PartId)
End If
Next
nIdInters = EgtGetFirstInGroup(nIdTempL)
' se trovo delle intersezioni metto tutto in trasparenza tranne le intersezioni
If nIdInters <> -1 Then
For Each PartSolidSel As PartSolid In m_PartSolidList
'EgtSetMark(nIdTempL)
For Each PartId As Integer In vIntersId
Dim PartSolidSel As PartSolid = GetPartSolid(PartId)
PartSolidSel.MakeTransparent()
Next
Return True
Else
For Each PartSolidSel As PartSolid In m_PartSolidList
PartSolidSel.MakeOpaque()
MyMsgTxBl.Foreground = Brushes.DarkKhaki
Next
End If
Return False
@@ -1194,6 +1233,7 @@ Public Class VeinMatchingWindow
End If
If TgBtn6.IsChecked Then
TgBtn6.IsChecked = False
If m_nIdPart = GDB_ID.NULL Then Return
Dim PartSolidSel = GetPartSolid(m_nIdPart)
PartSolidSel.ResetMark()
PartSolidSel.ResetData()
@@ -1219,13 +1259,17 @@ Public Class VeinMatchingWindow
Private Sub Flip_Changed() Handles FlipOption.Click
If TgBtn6.IsChecked = False Then Return
If m_nIdPart = GDB_ID.NULL Then Return
Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
Dim vtNorm As New Vector3d
EgtSurfFrNormVersor(PartSolidSel.SurfId, GDB_ID.ROOT, vtNorm)
Dim ptMid As New Point3d
EgtMidPoint(PartSolidSel.nIdLineFirst, GDB_ID.ROOT, ptMid)
PartSolidSel.Rotate(ptMid, vtNorm, 180)
'FindInters(m_nIdPart)
'If FindInters(m_nIdPart) Then
' MyMsgTxBl.Text = MyMsgTxBl.Text & "Ciula!"
' MyMsgTxBl.Foreground = Brushes.Red
'End If
EgtDraw()
End Sub