Message 1 of 7
Adding BendNote (DrawingCurve) works in VBA but not VB?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If I iterate through the DrawingCurves in a drawing view in VBA looking for kBendDownEdge or kBendUpEdge I am able to add BendNotes to the found curves.
This same logic does not work in VB.net. It errors "Exception User-Unhandled" System.Runtime.InteropServices.COMException: 'Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))'
I'm not sure why and don't know how to proceed to make it work.
Public Sub VBA_BENDNOTE()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet
Dim oCurve As DrawingCurve
Dim myView As DrawingView
Set myView = oSheet.DrawingViews.Item(1)
Dim myBendNote As BendNote
For Each oCurve In myView.DrawingCurves
If oCurve.EdgeType = kBendDownEdge Or oCurve.EdgeType = kBendUpEdge Then
Set myBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
End If
Next
End Sub
Private Sub AddBendNotes(oSheet As Sheet)
Dim oCurve As DrawingCurve
Dim oBendNote As BendNote
Dim myView As DrawingView = oSheet.DrawingViews.Item(1)
For Each oCurve In myView.DrawingCurves
If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge Or Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then
oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve)
End If
Next
End Sub
Mike Thomas
