Run-time error when creating a WorkPoint

Run-time error when creating a WorkPoint

larry.daubenspeck
Advocate Advocate
599 Views
3 Replies
Message 1 of 4

Run-time error when creating a WorkPoint

larry.daubenspeck
Advocate
Advocate

I have a subroutine which creates a WorkPoint with respect to some adjacent components in an assembly.  As it happens, this subroutine is called twice; once for each of two different instances of a class. The particular snippet within the sub is:

 

      Dim LowerYPt As WorkPoint = Nothing

      Try

            LowerYPt = AssyCompDef.WorkPoints.AddFixed(TG.CreatePoint(thisX, thisY, thisZ))

      Catch ex As Exception

            MsgBox(ex.ToString)

      End Try

 

At least one of the X, Y and Z values are different for the two passes.

On the first pass, it runs fine.  On the second pass, I get a runtime error:

 

“System.Runtime.InteropServices.COMException (0x80004005):  Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) at System.RuntimeType……….”

 

Any ideas why it won’t run the second time?

Larry Daubenspeck
Software Programmer
Draper, Inc.
0 Likes
600 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk

Can you share more info about this failure, like adding more code that can be run here to reproduce the problem so we can debug it? From your description you can run it at first time but fails for second time so looks like some variable was destroyed for the second time but we are not sure which one.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 4

larry.daubenspeck
Advocate
Advocate

Not sure where I'd begin, as far as giving you something you could actually run, as this is part of a huge program.  I have narrowed it down somewhat though.  It seems to have something to do with a component (a pear-shaped chain link) which is common to two different 3D sketches.  I use a sketchArc centerpoint to create a WorkPoint, and then a WorkPointProxy.  Each 3D sketch's endpoint is this WorkPointProxy.Point.  At first, I thought it was getting consumed, but that does not seem to be the case.  When I comment the lines having to do with the pear connector, both passes run fine.  Queue the Twilight Zone music!

Larry Daubenspeck
Software Programmer
Draper, Inc.
0 Likes
Message 4 of 4

xiaodong_liang
Autodesk Support
Autodesk Support

Hi larry.daubenspeck,


I am afraid it is still hard for peers here to share a comment with your description only. As you have done, I'd suggest you continue to isolate the project, commenting out the irrelevant code until the code reproduces within a small workflow. 

0 Likes