1 Reply Latest reply on Jan 27, 2016 5:31 PM by Artem Taturevych

    Strange Error (rpc_e_disconnected) when trying to access Curve

    Julian Wotschke

      Hello everyone,


      in my programm I have to automatically associate a number of points with certain preselected edges of the model. Therefore I created a class which holds the pointdata and contains an enity which i use for keeping track of the edge. When associating the points and the edges, I take an edge, convert it to an entity, use GetSafeEntity() and store the resulting safe entity with the corresponding point.

      When I am done with that process, I create a sketch to illustrate the results. Then the user can make changes manually. When I invoke my method to draw the sketch a second time to show the new results an unexpected error occurs (0x80010108 (RPC_E_DISCONNECTED)). This is the part of my code which causes the error:


           Vertex vs = (Vertex)((Edge)punkte[i].grundbahnkante).GetStartVertex();

           Vertex ve = (Vertex)((Edge)punkte[i].grundbahnkante).GetEndVertex();

           double[] start = (double[])vs.GetPoint();

           double[] ende = (double[])ve.GetPoint();

           double[] tessPoint = ((Curve)((Edge)punkte[i].grundbahnkante).GetCurve()).GetTessPts(0.0001, 0, start, ende);


      "punkte[i].grundbahnkante" contains a safe entity corresponding to an edge. The first four lines are executed properly and give the expected results. The last line causes the error.

      As I said this error always occurs when I invoke the method for creating a sketch a second time. The first time it works fine.


      I hope someone can help me. Thank you in advance.

        • Re: Strange Error (rpc_e_disconnected) when trying to access Curve
          Artem Taturevych

          Hi Julian,


          I came across similar situations in the past. I found pointers to entities are not that 'solid' and sometimes, especially if you are moving them across different threads or doing the assembly manipulations (suppressing/unsuppressing or inserting new components) as well as sketch manipulations. I have fixed that by wrapping my entities in the custom 'PermanentEntity' class. The pseudo code is:


          class PermanentEntity


               IEntity m_Ent;


               MySafeEntity(IEntity ent)


                    m_Ent  = ent;

                    SaveEntityAttribute();//store the entity id or associate with an attribute.



               public IEntity Entity




                         if (!ValidateEntity());//Call some method in try-catch block and if failed


                              RetrieveEntityFromAttribute();//get the valid pointer from the stored attribute



                         return m_Ent;




          You can find some example of attributes and references here: How to attach Attribute to a Face