SPLINE Knot vector

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
zrudic
Posts: 6
Joined: 09 Dec 2008, 14:21

SPLINE Knot vector

Post by zrudic » 18 Feb 2010, 14:02

Hello !

I implemented SPLINE processing in CADImporterDLL as is shown in demo sources (sg.cpp and sgSpline.cpp):
case CAD_SPLINE:
FPOINT *FP, *CP, *Knot;
int CCount, *FCount, *KCount;
CCount = Data->Count;
CP = Data->DATA.PolyPoints;
FCount = (int*)(&CP[CCount].x);
FP = &(CP[CCount + 1]);
KCount = (int*)(&FP[*FCount].x);
Knot = &(FP[*FCount + 1]);
DrawSpline(CP, FP, Knot, *FCount, CCount, (LPPARAM)Param);
break;
For some reason, I can see arrays CP (Control Points) and FP (Fitting Points), but Knot array seems to be empty (not completely, but still unusable), although KCount shows correct value. Demo executables CADImporterDLL.exe and DemoVB.exe show SPLINE as single line, while demo_API.exe and DemoCBuilder.exe show the same SPLINE as something that consists of many lines, but only roughly looks like drawing in Acad2008. At first I also got only single line (as CADImporterDLL.exe and DemoVB.exe), but this was because I changed type of variables t and StepT in DrawNURBS(...) in sgSpline.cpp from sgFloat to float, so I got StepT to be zero. This zero is due to small values in Knot array so that their difference (i.e. step) was only visible in double (it is zero in float). Then I switched to double and got lines just as in demo_API.exe and DemoCBuilder.exe.
After some surfing, I found out that fitting points are only internally used in ACAD to calculate control points; there are situations in which ACAD deletes fitting points and stores only control points and knots. Then I found knots in DXF file, created Knot array from them (ignoring Knot array delivered by CADImporter) and got drawing that perfectly suits drawing shown in Acad2008 screen. So I need a way to get Knot array.
I also need a way to know system variable $SPLINETYPE which can either have value 6 (default) meaning that curve is cubic B-spline or value 5 meaning that curve is quadratic B-spline. This variable is ignored in true spline curves (SPLINE), but is used in fit/spline curves created with PEDIT.
So, in short:
1. how can I get array of knots ?
2. how can I get SPLINETYPE value ?

Best regards, Zoran Rudic

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: SPLINE Knot vector

Post by support » 27 Feb 2010, 13:20

Hello.
CAD Importer DLL reads Knot array from dxf. Could you please send the file containing problem spline to support@cadsofttools.com for testing purposes? Please specify the CAD Importer version you used.
Unfortunately, CAD Importer DLL doesn't read $SPLINETYPE variable. Please mail to sales@cadsofttools.com If you need additional functionality.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply