Hello Muary,
I use the below test code can reproduce what Mstn tool does.
extern "C" int mdlBspline_computeEqualChordByNumber ( Dpoint3d *pointsP, /* <= chord points with length of numSeg+1 */ double *paramsP, /* <= paramsters for equal chord length */ MSBsplineCurve *curveP, /* => input B-spline curve */ int numSeg, /* => number of required chords */ double convergeTol /* => tolerance checking if chords are same length */ ); void Test() { MSElementDescrP edP = NULL; MSBsplineCurve bsCurve; DPoint3d *pPts = NULL; double *pU = NULL; int numSeg = 5; memset(&bsCurve, 0, sizeof(MSBsplineCurve)); mdlAssoc_getElementDescr(&edP, NULL, 510, ACTIVEMODEL, FALSE); pPts = (DPoint3d*)dlmSystem_mdlMalloc((numSeg+1) * sizeof(DPoint3d)); pU = (double *)dlmSystem_mdlMalloc((numSeg + 1) * sizeof(double)); mdlBspline_convertToCurve(&bsCurve, edP); mdlBspline_computeEqualChordByNumber(pPts, pU, &bsCurve, numSeg, 1.0); mdlBspline_freeCurve(&bsCurve); mdlElmdscr_freeAll(&edP); mdlLineString_create(dgnBuf, NULL, pPts, numSeg+1); mdlElement_add(dgnBuf); dlmSystem_mdlFree(pPts); dlmSystem_mdlFree(pU); }