We probably shouldn't have exposed these sketches through the API. We're
hesitant to "fix" issues like this once it's been out for a while since
someone may have taken advantage of this for something and we would break
them to remove it.
Unfortunately there's not a simple method to determine this case either.
Since the sketch is an internal implementation of the flange, we don't
provide access to it from the feature either so you can't determine that
relationship. I did come up with one method that seems to work. This
technique checks to see if a particular sketch is shown in the browser. If
it can't, the assumption is that it's for a feature like a flange, which I
think is a valid assumption. Here's my test code.
Public Sub CheckSketch()
Dim oPart As PartDocument
Set oPart = ThisApplication.ActiveDocument
Dim oSketches As PlanarSketches
Set oSketches = oPart.ComponentDefinition.Sketches
Dim oSketch As PlanarSketch
For Each oSketch In oSketches
Dim oNativeNodeDef As NativeBrowserNodeDefinition
On Error Resume Next
Set oNativeNodeDef =
oPart.BrowserPanes.GetNativeBrowserNodeDefinition(oSketch)
If Err.Number = 0 Then
MsgBox "Good sketch: " & oSketch.Name
Else
MsgBox "Bad sketch: " & oSketch.Name
End If
On Error GoTo 0
Next
End Sub
--
Brian Ekins
Autodesk Inventor API