Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Michael.RostZ454J
739 Views, 10 Replies

highlightset is not highlighted after second pick of the same face

Hello,

 

I have an iLogic rule to calculate the area of multiple selected faces. 

 

The user should select all faces needed and after that press ESC and the calculation is done. When CTRL is pressed during the pick, already selected faces should get unselected. During that, all faces that are selected are highlighted.

 

The Problem is, if all selected faces get selected again, without pressing CTRL, the hightlightset is not highlightet anymore. The selectset and the highlightset are still containing all previous selected faces and the calculation of the area is working. Only the highlighting itself is not working.

 

I'm clueless, what might be the issue.

 

Thanks for your help MichaelRostZ454J_0-1699019949339.png.

 

 

'Definition
Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oStartFace,oFace As Inventor.Face '= Nothing
Dim AreaCache As Double = 0
Dim FaceCol As New Collection
FaceCol.Clear
Dim oHSet As HighlightSet = oDoc.CreateHighlightSet()
oHSet.Clear

'if done, start again
TheStart:
On Error GoTo ENDE

While True
	Dim i As Double
	Dim k As Integer
	k = 1
	Dim bNEW As Boolean
	bNEW = True
	Dim oStartFaceIN, oFaceIN As String
	
	oStartFace = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartFaceFilter, "Fläche anwählen + ""Esc"" bestätigen.") 

	' If nothing gets selected then we're done	
	If IsNothing(oStartFace) Then Exit While
	
	
	''Läuft nicht
	If System.Windows.Forms.Control.ModifierKeys = System.Windows.Forms.Keys.Control Then
		If FaceCol.Count>0 Then
			For i = 1 To FaceCol.Count
				oFaceIN = FaceCol.Item(i).InternalName
				oStartFaceIN = oStartFace.InternalName
				If InStr(oFaceIN, oStartFaceIN) = 1 Then
					bNEW = False
					Exit For
				End If
				k = k + 1
			Next i
		End If
		If bNEW = False
			FaceCol.Remove(k)
			oHSet.Remove(k)
			ThisApplication.ActiveView.Update
		End If
	Else
		If FaceCol.Count>0 Then
			For i = 1 To FaceCol.Count
				oFaceIN = FaceCol.Item(i).InternalName
				oStartFaceIN = oStartFace.InternalName
				If InStr(oFaceIN, oStartFaceIN) = 1 Then
					bNEW = False
					Exit For
				End If
				k = k + 1
			Next i
		End If
		If bNEW = True Then
			FaceCol.Add(oStartFace)
			oHSet.AddItem(oStartFace)
		End If
	End If
	''Läuft nicht
	
	oStartFace = Nothing

End While

For Each oFace In FaceCol
	AreaCache = AreaCache + oFace.Evaluator.Area
Next

If AreaCache = 0 Then
	GoTo ENDE
End If

AreaCache = Math.Round(AreaCache*100,1)
MessageBox.Show(AreaCache & "mm²")
oHSet.Clear
FaceCol.Clear
AreaCache = 0

'if done, go to the start
GoTo TheStart

Return
ENDE: