5 Replies Latest reply on Sep 15, 2014 1:36 PM by Rajat Jain

    0x80010108 : The object invoked has disconnected -- after GetTessPts

    Allan Sauder

      Hello all,

       

      Here is a super techie questions with regards to GetTessPts for a curve derived from an edge from a contour from a sketch.

       

      I have created a function to convert the points from a bcurve - sketch edge into a format I need and everything works fine in debug mode.

       

      The problem seems to be in release mode I get occasional errors (not everything on the same part/sketch - 1 of of three)

       

       

      System.Runtime.InteropServices.COMException (0x80010108): The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

         at SolidWorks.Interop.sldworks.IEdge.GetClosestPointOn(Double X, Double Y, Double Z)

         at homagAddin.PMPageHandler.CreateTessCurve(Edge& swEdge, Int32 prcptr, String pid)

       

       

      In a nutshell,  I go from sketchentity to sketch via feature, then contour then edges as per the many examples.

       

      The edge is determined to be a bcurve  which is where CreateTessCurve comes in.

       

      I use swEdge to get swCurve via getcurve and the GetTessPts sems to work  -- but the original swEdge the fails on GetClosestPoint.

       

      the error tells me that Solidworks dropped the connection, but why ??

       

       

      Has anyone seem this before??   And why only in release mode ...  (Visual Studio 2010 VB)

       

      Any help at all would be greatly appreciated.

        • Re: 0x80010108 : The object invoked has disconnected -- after GetTessPts
          Rajat Jain

          Hi Allan,

           

          This is actual behavior. The edges might be recomputed and hence the objects are disconnected.

           

          You need to use the safeEntity object from the Entity object and process the safeEntity object in your computation. The safeEntity object is persistent and hence the issue shall be completely resolved.

           

          Hope it helps!!!

           

          Rajat Jain

            • Re: 0x80010108 : The object invoked has disconnected -- after GetTessPts
              Allan Sauder

              Hi Rajat,

               

              Thanks for the advice. Now that you mention it, it does make sense that it would be expected behavior.

               

              The process I am using starts with a SketchEntity from which I get a Sketch then Contours and finally Edges.   At which level should I be dealing with the SafeEntity? right from the SketchEntity of only at the Edge level.

               

              Also the documentation mentions that safe-entities are not valid across sessions, which I interpret as Persistent Ids will not be the same. (Is this a correct assumption?).  Persistent IDs are a critical feature we rely on as we need to be able to save information about entities from session to session.

               

              In this case, the sketch is the only Persistent ID I need to keep.

               

              Thanks for your advice. 

                • Re: 0x80010108 : The object invoked has disconnected -- after GetTessPts
                  Rajat Jain

                  Hi Allan,

                   

                  I think it depends on your process as to where you should use SafeEntities. It also depends on how your solution is architect and developed. I would prefer writing a class (if your solution is large or you can write a simple function) which takes swEntity and automatically generates output from underlying safeEntity. It is always easier and code can be easily reused.

                   

                  As for the session, I do not think there is an issue with the SafeEntity. This is because we do not store a handle of the SafeEntity or its persistent ID. We are just using the SafeEntity to process our output. Thus, this route should work as normal for multiple sessions.

                   

                  Hope it helps!!!

                   

                  Rajat Jain

                    • Re: 0x80010108 : The object invoked has disconnected -- after GetTessPts
                      Allan Sauder

                      Hi,

                       

                      Just for reference , our application is big so we have broken things out into classes as much as possible (or practical)

                       

                      We have created a test case function to illustrate the depth of what we start with and go to.

                       

                      We still get the problem showing up in 'non-debug compiles'.  And we perform a rebuild before we dive into the model.

                       

                      The code below seems to create a safe entity of the passed in entity but the problem still occurs.  Also note that in this code we try to get safe entities of the contour edges and they always come back as NOTHING>

                       

                      When we use the edges as received from the getedges we get edges as expected...

                       

                      even using myedge.check() we can't seem to catch the issue before it causes a fault ...

                       

                      Any insight would be greatly appreciated.

                       

                       

                      .... snip ...

                                  ' MAKE IT SAFE

                                  swSketchEnt = passedswSketchEnt.GetSafeEntity

                       

                       

                                  If Not swSketchEnt Is Nothing Then

                                      ' convert the Entity to a sketch

                                      If swSketchEnt.GetType() = swSelectType_e.swSelSKETCHES Then

                                          swObj = swSketchEnt

                                          swFeat = swObj

                                          swSketch = swFeat.GetSpecificFeature2

                       

                       

                                          If Not swSketch Is Nothing Then

                                              nSkContoursCount = swSketch.GetSketchContourCount

                                              vSkContours = swSketch.GetSketchContours()

                                              If vSkContours IsNot Nothing Then

                       

                                                  For ii = LBound(vSkContours) To UBound(vSkContours)

                                                      skContour = vSkContours(ii)

                                                      If Not skContour Is Nothing Then

                       

                                                          nEdgesCount = skContour.GetEdgesCount

                                                          vEdges = skContour.GetEdges()

                                                          If vEdges IsNot Nothing Then

                       

                                                              For k = LBound(vEdges) To UBound(vEdges)

                       

                                                                  myEdge = vEdges(k)

                       

                                                                  unsafeENT = myEdge

                                                                  safeENT = unsafeENT.GetSafeEntity

                                                                  myEdge = safeENT

                       

                                                                  If myEdge IsNot Nothing Then

                                                                      ' now do the real work

                       

                                                                      swCurve = myEdge.GetCurve

                       

                                                                      swStartVertex = myEdge.GetStartVertex

                                                                      swEndVertex = myEdge.GetEndVertex

                       

                                                                      If swCurve.IsCircle Then

                                                                          If swStartVertex IsNot Nothing And swEndVertex IsNot Nothing Then

                                                                              ' open edge

                                                                              startPt = swStartVertex.GetPoint()

                                                                              endPt = swEndVertex.GetPoint()

                                                                          ElseIf swStartVertex IsNot Nothing And swEndVertex Is Nothing Then

                                                                              ' closed edge

                                                                              startPt = swStartVertex.GetPoint()

                                                                          End If

                       

                      ... snip ...