Hallo.
I get some strange behavior in my code.
The idea was to have this code delete all bend notes in a drawing view of a flat pattern. but it dose not work. It's like the DrawingCurve.Parent is returning different drawing view, then the one i picked at the start.
I have solved this by using Reference Keys from the drawing view and comparing them.
So I´m just wondering if I´m missing something or is this intend behavior?
Dim DrawingView As Inventor.DrawingView
DrawingView = m_inventor.CommandManager.Pick(Inventor.SelectionFilterEnum.kDrawingViewFilter, "Pick")
If DrawingView IsNot Nothing Then
Dim Sheet As Sheet
Sheet = DrawingView.Parent
Dim DrawingDocument As Document
DrawingDocument = Sheet.Parent
Dim ReferencedDocument As Document
ReferencedDocument = DrawingView.ReferencedDocumentDescriptor.ReferencedDocument
Dim ComponentDefinition As ComponentDefinition
ComponentDefinition = GetComponentDefinition(ReferencedDocument)
If TypeOf ComponentDefinition Is SheetMetalComponentDefinition Then
Dim BendNotes As BendNotes
BendNotes = Sheet.DrawingNotes.BendNotes
For Each BendNote In BendNotes.Cast(Of BendNote)
Dim DrawingCurve As DrawingCurve
DrawingCurve = BendNote.BendEdge
' For some reason this donse not return same drawing view that was used as input.
Dim ParentDrawingView As DrawingView
ParentDrawingView = DrawingCurve.Parent
If DrawingView = ParentDrawingView = True Then
BendNote.Delete()
End If
Next
Document.Update()
End If
End If