Find minimum radius of curve with FeatureScript?

EvanReese
EvanReese Member, Mentor Posts: 3,105 PRO
edited April 2022 in FeatureScript
I looked through the documentation for a function that would return the minimum radius of a curve and didn't see anything that would. I'm looking for the same minimum radius value that's given by the show curvature dialogue. Am I missing an existing function for this, or do I need to do some kind of iterative sampling to check the curve at a bunch of places and return the min radius I find?
Evan Reese
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com

Comments

  • Jacob_Corder
    Jacob_Corder Member Posts: 141 PRO
    @Evan_Reese
    Nope. no built in function.
    Solidworks has one, which likely means parasolid does also and onshape is holding out on us (joking guys) 

    I am just guessing here, but this might give you a start.

    extract the b spline curve using evApproximateBSplineCurve  then read this crazyness and see if section 2.1 Smoothness measure section will help.
    I have been meaning to do this myself but just haven't gotten to it.
    https://www.diva-portal.org/smash/get/diva2:996026/FULLTEXT01

    The reason you would want to use the b spline curve is because then you are not guessing at how much to approximate the curve which could take a huge amount of time and also you would never find that minimum curvature point when guessing. you could get very very close but never totally get it. 




  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image
    edited April 2022
    Sample the curve using evEdgeCurvatures and radius at each point is 1 / curvature
    Senior Director, Technical Services, EMEA
  • EvanReese
    EvanReese Member, Mentor Posts: 3,105 PRO
    @NeilCooke and @Jacob_Corder

    Thanks. That's what I was afraid of. I hoped that since the Show Curvature tool does it well there might already be a function for it. If I go the sample route, I may even do it in two phases: one coarse pass on the whole curve to find the area that's likely to have the most curvature, then a second set of samples right around that area to refine the result, but it's definitely less simple that just typing evMinimumRadius().
    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • Jacob_Corder
    Jacob_Corder Member Posts: 141 PRO
    edited May 2022
    @Evan_Reese
    I tried to see if it was a hidden call somewhere in the @darkSide of onshape, but i couldn't get a match with many tries.(@evMinimumRadius, @evMinimumCurvature .....).
     evMinimumRadius would be great. 

    Also, Evan, if you are going to be calling evEdgeCurvatures, it is significantly faster to call @evEdgeCurvatures because building the frames and data and storing them into maps of types is actually a lot more time consuming that you would imagine. using the raw numbers is faster to get, faster to evaluate because ValueWithUnits is removed and vector removed. I have seen it cut the time by half in a thickness analysis feature I wrote, and at least cut in half for an edge tangency checking feature that I wrote. I couldn't believe how long it took to convert from normal numbers to the structures we use (vector, line,plane,....).