If this is actually your code, than your array initialization is wrong!
AcGePoint3dArray ptAry(6);
for (int n = 0; n < 6; n++)
ptAry[n].set(x, y, 0);
The first line constructs an array with a physical length of 6 elements. But it still has a logical length of 0!
In other words: ptAry.length()=0. So you are calling the AcDbSpline() constructor with an empty array of points.
See acarray.h:
AcArray< T, R > ::AcArray(int physicalLength, int growLength)
: mpArray(nullptr),
mPhysicalLen(physicalLength),
mLogicalLen(0), <-------------------- !!
mGrowLen(growLength) [...}
Use ptAry.setLogicalLength(6) before the for-loop to fix this.
Or use ptAry.append(pt) instead of. These methods will increment the logical length for you.
In case your ptAry is ok:
The ARX docs for the AcDbSpline() constructors say:
If any of the parameters are not acceptable, then the gelib object for the spline is not created and this constructor
behaves like the default constructor (that is, the passed in values are not used and the data query methods on the
spline return invalid values).
The constructors you are using are:
AcDbSpline(const AcGePoint3dArray& fitPoints,
int order = 4, //order=degree+1
double fitTolerance = 0.0);
AcDbSpline(const AcGePoint3dArray& fitPoints,
AcGe::KnotParameterization knotParam,
int degree = 3, //order=degree+1
double fitTolerance = 0.0);
The first one is deprecated according to the ARX 2018 docs. You shouldn't use it anymore. the second one should work.
I would suggest to use the default constructor and setFitData(...) / setNurbsData(...) methods and look at their retured ErrorStatus to find out what is going wrong.
Thomas Brammer ● Software Developer ● imos AG ● LinkedIn ● 
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.