Importing Spline entity

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
Eliseo
Posts: 7
Joined: 26 Nov 2008, 10:52

Importing Spline entity

Post by Eliseo » 26 Nov 2008, 11:06

Hello, I've been searching about a topic with this information but I couldn't find it. My doubt is about the Knots data. This is a TList containing single type values represented as pointers. How can I conver this "pointers" into Single values. The normal casting in the example doesn't works.

vFit: Single;
for I := 0 to TsgDXFSpline(Sender).FitCount – 1 do
vFit := Single(TsgDXFSpline(Sender).Knots) + vFit;

I work with C language...

aby
Posts: 81
Joined: 21 May 2007, 13:02
Location: Turkey

Re: Importing Spline entity

Post by aby » 26 Nov 2008, 22:33

int vFit = 0;

TsgDXFSpline *Spln = dynamic_cast<TsgDXFSpline *> (Sender);
if (Spln) {
for (int i = 0; i<iSpln->FitCount; ++i)
vFit += (int) Splin->Knots;
}

Propably It must be like that

Aby

Eliseo
Posts: 7
Joined: 26 Nov 2008, 10:52

Re: Importing Spline entity

Post by Eliseo » 27 Nov 2008, 14:06

Thank you aby but I think that I haven't explained the problem correctly. I suppose that I have solved the problem of taking an "int" value from knots array but this is not the corret data type, the correct data type is Single ( or float ). Here it is an example:

Knots values:
0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 3.0, 3.0, 3.0

Correspondent values of array Knots at TsgDXFSpline:
NULL, NULL, NULL, NULL, :3F800000, :40000000, :40400000, :40400000, :40400000, :40400000

How can I convert this pointer values into Single (or float) values?

Evgeny
Posts: 115
Joined: 16 Mar 2004, 11:04
Location: Russia

Re: Importing Spline entity

Post by Evgeny » 27 Nov 2008, 18:58

Hello Eliseo,

TList here stores Knots, not Pointers to Knots. Please make simple conversion:

vKnot := Single(TsgDXFSpline(Sender).Knots);

Post Reply