【NX二次开发】创建样条曲线

创建样条曲线:

 

 源码:

int doWork()
{
    int iCount = 4;
    double douPoint[5][3] = {0.0};
    douPoint[0][0] = -41.275;
    douPoint[0][1] = 40.7458333333333;
    douPoint[0][2] = 0.0;

    douPoint[1][0] = -3.43958333333333;
    douPoint[1][1] = 33.8666666666667;
    douPoint[1][2] = 0.0;

    douPoint[2][0] = -2.44121020572704;
    douPoint[2][1] = 18.5208333333333;
    douPoint[2][2] = 0.0;

    douPoint[3][0] = 54.8278522942727;
    douPoint[3][1] = -11.5154693670258;
    douPoint[3][2] = 0.0;

    SPLINE_FIT_t fit_data = { 0 };
    fit_data.num_of_points = iCount;
    fit_data.points = new double[iCount * 3];
    for (int i = 0; i < iCount; i++)
    {
        fit_data.points[3 * i] = douPoint[i][0];
        fit_data.points[3 * i + 1] = douPoint[i][1];
        fit_data.points[3 * i + 2] = douPoint[i][2];

        tag_t tagP = NULL_TAG;
        UF_CURVE_create_point(douPoint[i], &tagP);
    }
    fit_data.degree = 3;
    fit_data.tolerance = 0.005;
    double max_fit_err = 0;
    int max_fit_pnt = 0;
    tag_t fit_curve_id = 0;
    //王牌飞行员_里海 代码分享 QQ3123197280
    UF_MODL_create_fitted_spline(&fit_data, &max_fit_err, &max_fit_pnt, &fit_curve_id);
    delete[]fit_data.points;
    return 0;
}

 

posted @ 2022-07-03 10:11  王牌飞行员_里海  阅读(126)  评论(0编辑  收藏  举报