1 Reply Latest reply on Nov 22, 2013 1:50 PM by Louis Bouchard

    are SplineHandles not reliable?

    Louis Bouchard

      Hello,

       

      In my add-in, I keep a list of SplineHandles, among other things.  I am having problems using them they way I would like.

       

      1) the splinehandle seem unreliable.  If I try to call a splinehandle's method, or get/set one of it's properties, I randomly get a "rpc_e_disconnected" error, saying that "The object invoked has disconnected from its clients."  It seems that if I don't do something with the splinehandle the moment after obtaining it with ISketchSpline::IGetSplineHandles, it becomes rather volatile.

       

      2) When it works, trying to change any property doesn't seem to do anything.  Whatever value I set doesn't stick.  If I query the property right after setting it, I get the original value, not the one I specified.  Even if I set the Editable property to true.

       

      Are splinehandles not meant to be used this way?

       

      any insight would be appreciated

       

      thanks,

       

      Louis

        • Re: are SplineHandles not reliable?
          Louis Bouchard

          I was revisiting this problem these past few days.  I found a workaround for the rpc_e_disconnected error: don't keep pointers to splinehandles specifically, always refer to them via the array returned by SketchSpline.GetSplineHandles().

           

          I found something strange regarding item (2):  If the open document is a part, everything works fine, I can set splinehandles' properties successfully.  But if the open document is an assembly, setting any property of a splinehandle just doesn't work, like I said in the original post.  For example:

           

          SketchSpline spline = <something>;

          MessageBox.Show("TangentRadialDirection = " + spline.GetSplineHandles()[0].TangentRadialDirection);

          spline.GetSplineHandles()[0].TangentRadialDirection += <some value>;

          MessageBox.Show("TangentRadialDirection = " + spline.GetSplineHandles()[0].TangentRadialDirection);

           

          ... this will show the same value twice, but if I open the part by itself (not the assembly), the value will stick, as intended.

           

          So, is there a fundamental difference in functionality when trying to programmatically alter splinehandles in a sketch that is in a part when the part is opened by it self and when an assembly containing that same part it opened?

           

          thanks,

           

          Louis