Interop Exception for View.DrawingCurves

Interop Exception for View.DrawingCurves

varad.keshatwar
Contributor Contributor
790 Views
21 Replies
Message 1 of 22

Interop Exception for View.DrawingCurves

varad.keshatwar
Contributor
Contributor

Hello Guys,
I am facing an error with the following API
View.DrawingCurves(OModel as Object)
I am facing this Interop error in Visual Basic, while using Inventor 2024 DLL.
I have attached the screenshots of all the errors here with, also attaching my code snippet.

 

Public Overridable Function GetGrooveCurvePoint(iGrooveNo As Integer) As Point2d
        Try
            Dim onumer As DrawingCurvesEnumerator = Nothing
            Dim oCurveLeft As DrawingCurve
            Dim dRefXMin As Double = 1000

 

            'onumer = oViewSection.DrawingCurves(oIptDoc.ComponentDefinition.Features(GlobalCADRes.strGroove + " " & iGrooveNo))
            Dim oFeature As Object = CType(oIptDoc.ComponentDefinition.Features(GlobalCADRes.strGroove & " " & iGrooveNo), Object)
            onumer = oViewSection.DrawingCurves(oFeature)

 

            'Get the Longest Curve of groove
            For Each oDrawCurve As DrawingCurve In onumer
                If oDrawCurve.StartPoint.X > oViewSection.Center.X And oDrawCurve.EndPoint.X > oViewSection.Center.X Then
                    If Math.Round(oDrawCurve.StartPoint.X, 2) = Math.Round(oDrawCurve.EndPoint.X, 2) Then
                        'If Math.Round(oDrawCurve.StartPoint.Y, 2) <> Math.Round(oDrawCurve.EndPoint.Y, 2) Then     ''''change by Nilesh for 69769 on 29/09/11
                        If oDrawCurve.EndPoint.X < dRefXMin Then
                            dRefXMin = oDrawCurve.EndPoint.X
                            oCurveLeft = oDrawCurve
                            'End If
                        End If
                    End If
                End If
            Next

 

            If oCurveLeft IsNot Nothing Then
                If oCurveLeft.StartPoint.X > oCurveLeft.EndPoint.X Then
                    Return oCurveLeft.StartPoint
                Else
                    Return oCurveLeft.EndPoint
                End If
            End If

 

            Return Nothing
        Catch ex As Exception
        End Try
    End Function

 

 

0 Likes
791 Views
21 Replies
Replies (21)
Message 21 of 22

marcin_otręba
Advisor
Advisor

hi, so why you just don't leave sketch mode ? or stop execution if drawing is in sketch mode ?

If drawing is not in sketch ode does it work as it should ? after update ?

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 22 of 22

Stakin
Collaborator
Collaborator

This is a preset mode of the program, not an error.


@varad.keshatwar wrote:

Hello Inventor Community,

@Stakin @jjstr8 @marcin_otręba 
Guys, I have observed one more issue with the following API.

DrawingView.DrawingCurves([ModelObject] As Variant) As DrawingCurvesEnumerator 

I have observed, when the sheet is sketch mode, and if requires update in that case too this API fails throws the same threw an exception of type 'System.Runtime.InteropServices.COMException'. Even Sheet update and Doc update does not work in this case.
Please refer screenshot attached

varadkeshatwar_0-1742223811010.png

 

PS: Guyz, I'm facing daily new issues with this API. Your guidance will be of great use if you help me to point this to any Autodesk executive ASAP😥😟


 

0 Likes