Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start: Looking for a certain topic? Check out the categories filter or use Search (upper right).
 Need support? Ask a question to our Community Support category.
 Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
 Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Any plans to expose bSplineSurface and bSplineCurve from evSurfaceDefinition and evCurveDefinition?
Jacob_Corder
Member Posts: 122 PRO
I am wondering if there are plans to expose the geometry data of non primitives to us. I really need the bSplineCurve definition and bSplineCurve definitions from evSurfaceDefinition and evCurveDefinition.
Returning {surfaceType : OTHER} is not really all that helpful.
Returning {surfaceType : OTHER} is not really all that helpful.
4
Best Answers

ilya_baran Onshape Employees, Developers, HDM Posts: 1,170Yes, we definitely intend to do that. As always, that's about as much as I can say.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5

ilya_baran Onshape Employees, Developers, HDM Posts: 1,170♪ Ops is making a build, QA's checking it twice, R&D has determined that you've been nice ♪
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc10
Answers
good to know. so, in the next year? earlier? later?
FEATURESCRIPT EVALUATION IMPROVEMENTS
In this release, evSurfaceDefinition and evCurveDefinition now return bspline surfaces and curves respectively. There is also a new function named evApproximateBSplineCurve that will approximate any curve as a bspline. Both of these updates give you more flexibility in capturing existing geometry for use in Custom Features.Thank you so much for your constant updates and upgrades. This allows us developers to do anything that we can possibly want without contaminating surfaces and curves with over approximation which leads to faster models and faster downstream operations.
Also. the time to get the definition is less than 1 ms which is AMAZING for the b splines I tested.
I have not yet tested evApproximateBSplineCurve yet
I'm playing with evCurveDefinition using my own simple custom FeatureScript, and I don't understand why I'm getting a response of "curveType" : "OTHER" from many of the edges.
What I can get to work is:
What I'm starting to guess is that "OTHER" is NURBS not bspline, because I'm seeing either weights (in the case of converting an arc) or nonrational knot values. I still don't understand why case #3 isn't just a Bézier.
It would be really nice if evApproximateBSplineCurve had an option for forceBezier.
Force bezier would not likely work as the degree would rise above onshapes max degree which is think is 17, but i cant remember. Which means the number of points cannot exceed 18 (i think)
the return from evCurveDefinition may return a line, circle or any other primitive shapes also so check for those. you might be working with a circle.
Are you setting evCurveDefinition returnBSplinesAsOther to true? If so, set it to false.
I have been able to extract basically everything i have tested so far. Most of the stuff i am extracting are wire body edges or intersection curves between faces created by opBoolean or opSplitFace.
Be careful of the approximator. I have had returns of 800 control points for a 60mm spline.
You are getting a "spline" from a briding curve?? a Bridging Curve is literally a b spline curve. it is however a bezier curve with the knots being auto created but still, that makes no sense.
3D fit splines with start and end magnitude are exactly cubic b splines where the start and end derivative are the first and 2nd control points. but those derivatives are calculated on the server. The Arrows of the fit spline feature, at the base, is actually the first control point of the created b spline curve so fitsplines should always return a bspline curve with control point count of vertex count + 1 for start derivative, end derivative, match curvature at start and end.
should return a b spline curve for briding curves, fit splines and any other wire body spline i would assume.
edges generated from lofts are likely not going to be any of these and need approximation as they are trimming curves where the 2 untrimmed b spline surfaces merge and are split. Also, there are 2 curves for each two sided edge, and neither of them are exactly the same as each other most of the time. Even if those edges were created from a guide, it does not mean that that guide is even used to separate them perfectly. I have noticed variations of very small but still exist for loft face edges and the guides that were used.
any edge between any face unless a primative like line arc circle conic, is likely going to be an approximated b spline curve.
I hope i am not just rambling on here, these are the results of m findings so far.
My main goal is to figure out how to enable more classa style of working. Practices seem to be evolving, but traditionally most automotive classa surfacing is done with single span Bézier surfaces. I'm trying to figure out what I can to reduce the complexity out of the default tools in Onshape.
Yes, Bridging curve is a single span bspline  which is equivalent to a Bézier. evCurveDefinition returns this as "curveType" : "SPLINE". The control points seem to match the Bridging curve, but I need to confirm.
With a true arc/circle, evCurveDefinition piped through evApproximateBSplineCurve is giving a weighted bspline in order to get what looks to be an exact match. From what I know, this is why we have NURBS in the first place is to be able to modify the weights and get all the conic sections exactly.
In many of the use cases I'm planning, I would like the option to get a Bézier, even at the expense of slight approximation errors. The idea being to use sweep/loft/offset to build the design intent, but with heavy splines  then rebuild them with lighter/cleaner Béziers.
I understand that in general, a two sided edge can have two nonequal trim curves, but I was hoping that with simple clean Béziers, the edge of the surfaces would be the guide curve. I've seen stuff in Solidworks where the surfaces get slightly overbuilt and then trimmed back for some reason (e.g. revolve does this), so perhaps this is something Parasolid is doing.
I am getting b spline curves from onshape for bridging curves. I am even getting a bezier curve back from a bridging curve.
I think i know what is happening.
You are just checking the curveType.
Do this
If(c is BSplineCurve)
{
it returns a b spline curve with curveType as another field.
}
this is my sample and it returns b spline curves on all wire bodies that are not extracted from edges
Did my last comment I left fix your issue getting the bspline curve from evCurveDefinition?
Yes. This helped. Thanks.