Object 13 "Surface" (Entities) Changed in Version 2021.0

www.CAD6.com

Data Block Sequence

Data Block 001( x1, y1 )

- Start-point of a curve

 

Line

Data Block 002( x?, y? )

- End-point of a line

 

Bézier curve

Data Block 007( x?, y? )

- Pivot point 1

Data Block 008( x?, y? )

- Pivot point 2

Data Block 002( x?, y? )

- End-point of a Bézier curve

 

Circular arc

Data Block 009( x?, y? )

- End-point of the circular arc

Data Block 102( Orientation, Curvature )

- Orientation and of curvature of the circular arc

 

A surface is a collection of several curves, each defining a closed area. Each curve starts with a start-point in a data block of type 001 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 in a data block of type 002. The line is drawn from the curve's current end-point (named 'S') to the line's end-point (named 'E'). 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 in data blocks of type 007 and 008, and an end-point in a data block of type 002. The Bézier curve is drawn from the curve's current end-point (named 'S') to the Bézier curve's end-point (named 'E'), influenced by the two pivot points (named P1 and P2). The Bézier curve's end-point then becomes the curve's current end-point.
The points P of such a Bézier curve are calculated using the following equation:

 

P = (1-t)³×S + 3t(1-t)²×P1 + 3t²(1-t)×P2 + t³×E (0<=t<=1)

 

 

Circular arc

A circular arc is defined by two data blocks. The first is of type 009 and contains the end-point of the arc, the second is of type 102 and contains both its orientation and its curvature. The arc is drawn from the curve's current end-point (named 'S') to the arc's end-point (named 'E'), 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 should be used to perform a simple vector calculation to obtain the arc's defining center-point M:

x(M) = 0.5 * ( x(S) + x(E) ) - Curvature * ( y(E) - y(S) )

y(M) = 0.5 * ( y(S) + y(E) ) + Curvature * ( x(E) - x(S) )

 

 
After calculating the center-point, all points required to draw a standard circular arc are known. The allowed value range of Curvature is ±1e100.

 

Each curve ends if either a new curve is started by a new start-point (in a data block of type 001) or the complete surface is ended (by a data block of type 999). Each curve is closed, i.e. its start-point and end-point are connected with a line. When creating a surface, you should not end each curve with an extra point identical to the curve's start point (although you may).

 

If a surface consists of only one curve simply the inside area of that curve will be filled:

 

 

If a surface consists of multiple curves they will be filled alternately, i.e. only areas overlapped by an odd number of curve's insides will be filled. If, e.g., a small round curve lies inside a large one, this small round curve will be transparent, as its inside in overlapped by two curves (even number!):

 

 

If a surface is drawn with a non-solid line type, this line type has to be continued during each curve. A surface may contain up to 10000 nested curves made of up to MKI_MaxEntityPoints data blocks in total.

 

Attributes New in Version 2021.0

A surface may contain attribute data blocks (see MKI_BLOCK_ATTRIBUTE) of types "local", "outline", and "point". Their position in the list of data blocks is 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. Please note that you cannot assign a point attribute to the end point of a closed outline since that end point is physically identical to its starting point.
-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_SURFACE

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 2024.2 - Copyright 2024 Malz++Kassner® GmbH