AnsweredAssumed Answered

BSpline curve creation issues

Question asked by Jean-Marc Langlois on May 23, 2019

Hi all,


I am currently trying to resolve once and for all various bspline curve creation issues through the SolidWorks API.

The main issue I am experiencing is that from time to time, I get errors trying to create bspline curves from what seems to be at first glance valid data (control points, knot values, degree, order, etc) - at least visually these curves do not have self-intersections, "spikes / cusps", etc.

Even worst, in my typical workflow, I have XYZ control points positions in mm, and when creating bspline curves in SW with the API these are converted to meters, and again from time to time I am unable to create the curve in SW. Not converting the XYZ values to meters, the curve gets created correctly ?!?!


So a few questions here:

1) Is there a way to get an error code (and of course some textual details) of some sort when the creation of a bsline curve fails with the API ? As of now, I can only rely on the fact that the SketchManager.CreateSplinesByEqnParams2 returned valid data or not, which is not too helpful for diagnosis purposes.


2) Is there some pre-validation that could be done on our end to help detect potential bspline creation problems (continuity, tangency, etc.) that will likely cause the bspline curve creation to fail ?


Attached is some sample code that reproduces typical issues I have been having, along with a screenshot of the original curves in another software.


Any help / comment will be greatly appreciated.




JM Langlois