Object 12 "Curve" (Entity Type "Object") Changed in Version 2021.0

www.CAD6.com

 

A curve is in fact a list of several curves. Each curve starts with a start-point followed by a sequence of curve elements. Three types of curve elements are available:

 

Line

A line is simply defined by stating its end-point. The line is drawn from the curve's current end-point (named 'Start') to the line's end-point (named 'End'). The line's end-point then becomes the curve's current end-point.

 

 

Bézier curve

A Bézier curve is defined by stating two pivot points and an end-point. The Bézier curve is drawn from the curve's current end-point (named 'Start') to the Bézier curve's end-point (named 'End'), influenced by the two pivot points (named Pivot1 and Pivot2). The Bézier curve's end-point then becomes the curve's current end-point.
The points of such a Bézier curve are calculated using the following equation:

 

Point = (1-t)³ × Start + 3t(1-t)² × Pivot1 + 3t²(1-t) × Pivot2 + t³ × End (0<=t<=1)

 

 

Circular arc

A circular arc is defined by its end-point, its orientation and curvature. The arc is drawn from the curve's current end-point (named 'Start') to the arc's end-point (named 'End'), influenced by its orientation and curvature. The arc's end-point then becomes the curve's current end-point.
The value Orientation determines whether to draw the arc in clockwise direction (Orientation < 0) or in counter-clockwise direction (Orientation >= 0).
The value Curvature determines the radius of the arc in indirect manner. In can be handled in two ways. In geometrical view, the absolute value of Curvature is 1/(2 tan( ß/2 )), where ß is the arc-angle of the circular arc. The sign of Curvature determines, which of the two possible arcs to use.
In practical use, this definition is not very handy. Instead, Curvature (or 'C') should be used to perform a simple vector calculation to obtain the arc's defining center-point 'Center':

 

Center.x = 0.5 * ( Start.x + End.x ) - Curvature * ( End.y - Start.y )

Center.y = 0.5 * ( Start.y + End.y ) + Curvature * ( End.x - Start.x )

 

 
After calculating the center-point, all points required to draw a standard circular arc are known.

 

Each curve ends if either a new curve is started by a new start-point or the complete entity is ended (by a data block of type 999).

 

If a curve is drawn with a non-solid line type, this line type has to be continued along the complete curve. A curve may contain up to 10,000 nested curves made of up to MKI_MaxEntityPoints data blocks in total.

 

A curve is by definition an "open" object, i.e. it has a non-closed outline and cannot be filled.

 

Data Block Sequence

Data Block 001( Start )

 

Line

Data Block 002( End )

 

Bézier curve

Data Block 007( Pivot1 )

Data Block 008( Pivot2 )

Data Block 002( End )

 

Circular arc

Data Block 009( Arc )

Data Block 102( Orientation, Curvature )

 

Parameters

Start

[MKI_POINT] Start point of one curve.

Pivot1

[MKI_POINT] First pivot point of a Bézier curve.

Pivot2

[MKI_POINT] Second pivot point of a Bézier curve.

End

[MKI_POINT] End point of a line or a Bézier curve.

Arc

[MKI_POINT] End point of a circular arc.

Orientation

[double] Direction of the arc. If Orientation >= 0, the arc is drawn counter-clockwise from the start angle to the end angle. If Orientation < 0, the arc is drawn clockwise.

Curvature

[double] Indirect definition of the arc's radius, see section "Circular Arc" above. Valid range is -1e100 <= Curvature <= +1e100.

 

Attributes New in Version 2021.0

A curve may contain attribute data blocks (see MKI_BLOCK_ATTRIBUTE) of types "local", "outline", and "point". Their position in the list of data blocks must be as follows:

-Outline attributes must be placed anywhere behind the starting point of the respective outline. Any outline attribute after a starting point data block S and before the next starting point data block (or end of object) belongs to the outline starting with point S.
-Point attributes must be placed behind the respective point. Any point attribute after point data block P and before the next point data block (or end of object) belongs to that point P.
-Local attributes should be placed behind all other datablocks and attributes.

The total number of attributes of each type (local, outline, point) per respective element (entity, outline, and point) is limited to MKI_ATTRIBS_PER_OBJECT.

 

Interface Command Sequence

MKI_ObjectOpen, Type = MKI_OBJ_CURVE

MKI_ObjectAddPoint, Type = MKI_DB_POINT_START

         ...

MKI_ObjectAddPoint, Type = MKI_DB_POINT_END

         ...

MKI_ObjectAddPoint, Type = MKI_DB_POINT_PIVOT1

MKI_ObjectAddPoint, Type = MKI_DB_POINT_PIVOT2

MKI_ObjectAddPoint, Type = MKI_DB_POINT_END

         ...

MKI_ObjectAddPoint, Type = MKI_DB_POINT_ARC

MKI_ObjectAddCurve

         ...

MKI_ObjectFastInsert

 

CAD6interface 2025.1 - Copyright 2025 Malz++Kassner® GmbH