Hi @J.Pelfrene. When you say that you are finding sketch entities in the DrawingCurves, are you referring to sketch entities of a DrawingSketch, or entities of sketches in the model? When we make sketches in a drawing, they can either belong to the Sheet, or to a DrawingView. If you have a sketch in your drawing, and the view is its 'Parent', then that sketch's geometry will be found within the DrawingView.DrawingCurve collection. And you can tell which ones they are using:
Logger.Info(TypeName(oDrawingCurve.ModelGeometry))
The 'model geometry' of most curves will usually be Edge or EdgeProxy, but can be several different types of things, which is why DrawingCurve.ModelGeometry returns Object type, instead of Edge or another specific type. Another related property would be the DrawingCurve.EdgeType, but it does not have a variation for sketch entities, so not useful in this case.
Edit: Since checking Log entries will not tell you 'which' ones you are looking for, and testing String type values is not that efficient, below is another example iLogic rule you can test with, which you may then be able to use some of it in your overall code based solution. This will let you manually select a view with your mouse after you start the rule, then it will start iterating through its DrawingCurves, checking the Type of each curve's model geometry using 'TypeOf' operator, which is much more efficient. When it finds ones that represent some sort of SketchEntity, it then gathers those up into two different collections. One for the ones belonging to DrawingSketch belonging to that DrawingView, and one for model based sketch entities. Then at the end, if any were found, it will highlight them, and prompt you to review them, only while that message dialog is showing, then they are cleared from the HighLightSet, and the other group is evaluated. So, at the end, if you do not need to 'see' which ones are which, you can use one, or both of those collections however you may need later.
Dim oInvApp As Inventor.Application = ThisApplication
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a Drawing View.")
If oView Is Nothing Then Exit Sub
Dim oSheet As Inventor.Sheet = oView.Parent
Dim oDDoc As DrawingDocument = oSheet.Parent
Dim oTO As TransientObjects = oInvApp.TransientObjects
Dim oOtherSketchCurves As Inventor.ObjectCollection = oTO.CreateObjectCollection()
Dim oViewSketchCurves As Inventor.ObjectCollection = oTO.CreateObjectCollection()
For Each oDC As DrawingCurve In oView.DrawingCurves
Dim oMG As Object = oDC.ModelGeometry
If TypeOf oMG Is SketchEntity Then
Dim oSE As SketchEntity = oMG
Dim oSketch As Inventor.Sketch = oSE.Parent
If TypeOf oSketch Is DrawingSketch Then
For Each oDCS As DrawingCurveSegment In oDC.Segments
oViewSketchCurves.Add(oDCS)
Next
Else
For Each oDCS As DrawingCurveSegment In oDC.Segments
oOtherSketchCurves.Add(oDCS)
Next
End If
End If
Next
Dim oHLS As HighlightSet = oDDoc.CreateHighlightSet()
If oViewSketchCurves.Count > 0 Then
oHLS.AddMultipleItems(oViewSketchCurves)
MsgBox("Review Highlighted DrawingCurves belonging to View Sketch.", , "")
oHLS.Clear()
End If
If oOtherSketchCurves.Count > 0 Then
oHLS.AddMultipleItems(oOtherSketchCurves)
MsgBox("Review Highlighted DrawingCurves belonging to 'other' Sketches.", , "")
oHLS.Clear()
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)