Hi,
I'm attempting to add B-Spline support to Mike's Alibre add on. I've got the code reading the Alibre splines and creating a CamBam spline but the spline does not display in CamBam even though the points are there.
If anyone's got any ideas I'd appreciate them.
IADSketchBspline S = (IADSketchBspline)SF;
int pOrder, pNumCtlPoints, pNumKnots;
bool pIsRational, pIsClosed, pIsPeriodic;
S.GetDefinition(out pOrder, out pNumCtlPoints, out pNumKnots, out pIsRational, out pIsClosed, out pIsPeriodic);
Array pCtlPoints = new double[pNumCtlPoints * 2];
Array pKnotVector = new double[pNumKnots];
Array pWeights = new double[pNumCtlPoints * 2];
S.GetBsplineData(ref pCtlPoints, ref pKnotVector, ref pWeights);
// create a CamBam spline
CamBam.CAD.Spline cbs = new CamBam.CAD.Spline();
Point3FArray ctlPoints = new Point3FArray();
for (int k = 0; k < pCtlPoints.GetLength(0); k += 2)
{
ctlPoints.Add(new Point2F((double)pCtlPoints.GetValue(k) * scaleFactor, (double)pCtlPoints.GetValue(k + 1) * scaleFactor));
}
cbs.ControlPoints = ctlPoints;
cbs.Knots = (double[])pKnotVector;
cbs.Weights = (double[])pWeights;
entities.Add(cbs);
The attached file should have a roughly circular spline in the gap between the two polylines.
Mark