evaluateSpline: Parameter at index 0 is outside the knot vector

Jonathan_Hutchinson
Jonathan_Hutchinson Member Posts: 162 PRO
I used a Split feature on a curve (helix) entity, and wanted to then subdivide this split version of the entity into line segments. However, I got the below error. Is this because the curve needs to in an ideal world be reparameterised between 0 and 1? Has the split operation done some funky business where it's almost treating it like a trimmed surface, and now no longer exists in the domain of the curve? I couldn't initially see anything in the FS documentation to fix this.

@evaluateSpline: Parameter at index 0 is outside the knot vector.
Tagged:

Answers

  • GregBrown
    GregBrown Member, Onshape Employees, csevp, pcbaevp Posts: 412 image
    Correct, you'll often see knot vectors with domains other than [0.0 ....1.0] - particularly when trim, project etc operations have been performed. You'll likely have to do a bit of rescaling of the parameter you pass into the evaluation.
  • Jonathan_Hutchinson
    Jonathan_Hutchinson Member Posts: 162 PRO
    Hey Greg, thanks for the quick response. I think we spoke in London briefly at the Design Alliance.

    The hack I did was then using a path instead (FS: evPathTangentLines to evaluate point at parameters) which was a bit more clunky I suppose, but seemed to be the workaround to reset to 0-1 again. Is there an option somewhere else to reparameterise or, as you mention, rescale the parameter before subsequent operations without Paths?
  • Jacob_Corder
    Jacob_Corder Member Posts: 141 PRO
    If you want to normalize the not array, i use this

    export function normalizeKnotArray(knots is array)returns array
    {
        var ret = knots;
        var minKnot = ret[0];      
        var ct =size(knots);
        if(minKnot !=0)
        {
            //resets knots to start at 0
            for(var j=0;j<ct;j+=1)
            {
                ret[j] = ret[j] - minKnot;
            }
        }
        var newMax = ret[ct-1];
      
        if(newMax!=1)
        {
            //normalizing the max knot to be 1 and all others scaled in between.
              var mult = (1/newMax);
            for(var j=0;j<ct;j+=1)
            {
                ret[j] = ret[j] * mult; 
            }
        }
        return ret; 
    }