admin 发表于 2024-3-14 19:36:42

[每日一码] 如何封闭SPLINE

void setClosed(AcDbSpline *pSpline)
{
    int          degree;
    Adesk::Boolean    rational;
    Adesk::Boolean    closed;
    Adesk::Boolean    periodic;
    AcGePoint3dArraycontrolPoints;
    AcGeDoubleArray    knots;
    AcGeDoubleArray    weights;
    double      controlPtTol;
    double      knotTol;

// get data from the spline
    pSpline->getNurbsData(degree, rational, closed, periodic,
               controlPoints, knots, weights,
               controlPtTol, knotTol);

if(closed == Adesk::kTrue)
      return;

// set as closed
closed = Adesk::kTrue;

// apply data back
    pSpline->setNurbsData(degree, rational, closed, periodic,
               controlPoints, knots, weights,
               controlPtTol, knotTol);
}
页: [1]
查看完整版本: [每日一码] 如何封闭SPLINE