Draw a BezierCurve in dxf

Use this forum to ask questions about how to do things in dxflib.

Moderator: andrew

Draw a BezierCurve in dxf

Postby kayoot » Thu Nov 26, 2009 11:13 am

Hello

I've got a problem with export to dxf. I need to export bezier curve, i have coordinates of start point, end point ang control points. Unfortunately, on the dxf entiti section there is no it.

Could anyone help me with this ?

THX a lot.


EDIT:

I try to do it by SPLINE but it isn't working...
kayoot
 
Posts: 1
Joined: Thu Nov 26, 2009 11:05 am

Postby andrew » Thu Nov 26, 2009 3:30 pm

Code: Select all
// write spline entity
dxf.writeSpline(writer,
    DL_SplineData(degreeOfSpline,
                      numKnots,
                      numCtrl,
                      flags),
        attributes);

// write spline knots (example, might vary in your case):
int k = degreeOfSpline +1;
DL_KnotData kd;
for (int i=1; i<=numKnots; i++) {
        if (i<=k) {
            kd = DL_KnotData(0.0);
        } else if (i<=numKnots-k) {
            kd = DL_KnotData(1.0/(numKnots-2*k+1) * (i-k));
        } else {
            kd = DL_KnotData(1.0);
        }
        dxf.writeKnot(writer, kd);
}

// write spline control points (numCtrl control points):
dxf.writeControlPoint(writer, DL_ControlPointData(x, y, z));
dxf.writeControlPoint(writer, DL_ControlPointData(x, y, z));
...

andrew
Site Admin
 
Posts: 1800
Joined: Fri Mar 30, 2007 6:07 am


Return to dxflib 'How Do I' Questions

Who is online

Users browsing this forum: No registered users and 1 guest