static   sgCDimensions*   sgCDimensions::Create(SG_DIMENSION_TYPE dimType, const SG_POINT* formed_points, const sgCFont* fnt, const SG_DIMENSION_STYLE& stl,const char* string)

 

Description:

Creates an object of the DIMENSIONS class of the specified type and with the specified font and style.

 

Arguments:

dimType - type of a dimensional object.

Can take the following values:

SG_DT_LINEAR - linear dimension

SG_DT_ANGLE - angle dimension

SG_DT_RAD - radial dimension

SG_DT_DIAM - diametral dimension

 

formed_points - array of the distinguished point the dimension is built on.

These points has the following meanings for various dimensions types:

The dimension itself is calculated as the distance between the first and the second points.

Dimension type

Distinguished points

Explanation

Necessary number

 

 

 

 

 

Distant

(linear)

dim_pnts_lin

1.The first point is where the start dimension point is.
2.The second point is where the end dimension point is.

The dimension itself is calculated as the distance between the first and the second points.

3.   The third point is an arbitrary point on the dimensional line.

 

 

 

 

 

 

3

 

 

 

 

 

 

 

Angle

 

 

dim_pnts_ang

1.The first point is the first one lying on the first side of the measured angle.
2.The second point is the second one lying on the first side of the measured angle.
3.The third point is the first one lying on the second side of the measured angle.
4.The forth point is the second one lying on the second side of the measured angle.

The dimension itself is calculated as the angle between two these line segments.

 

5.   The fifth point is an arbitrary point on the dimensional line.

 

 

 

 

 

 

5

 

 

 

 

 

 

Radial

dim_pnts_rad

1.The first point is the center of the measured object.
2.The second point is a point on the object.

The dimension itself is calculated as the distance between the first and the second points.

3.   The third point is an arbitrary point on the dimensional line.

 

 

 

 

 

 

 

3

 

 

 

 

 

 

 

 

Diametral

dim_pnts_dim

1.The first point is the center of the measured object.
2.The second point is a point on the object.

The dimension itself is calculated as the double distance between the first and the second points.

3.   The third point is an arbitrary point on the dimensional line.

 

 

 

 

 

 

 

 

 

3

The number of points for each object type given in the table above is a requirment for creating an object.

 

fnt - pointer to a font (read more about fonts - sgCFont) to write the text with

stl - dimension style structure.

This structure is described in sgTD.h and has the following fields:

typedef struct

{

 bool                        dimension_line;

 bool                        first_side_line;

 bool                        second_side_line;

 double                        lug_size;

 

 bool                            automatic_arrows;

 

 bool                        out_first_arrow;

 unsigned char            first_arrow_style;

 

 bool                        out_second_arrow;

 unsigned char            second_arrow_style;

 

 double                         arrows_size;

 

 SG_TEXT_ALIGN      text_align;

 SG_TEXT_STYLE     text_style;

 

 bool                              invert;

 

 SG_DIMENSION_BEHAVIOUR   behaviour_type;

 

 unsigned short  precision;

 

} SG_DIMENSION_STYLE;

 

dimension_line - sign showing that the dimensional line is present (above the text line)

first_side_line - sign showing that the first extension line is present

second_side_line - sign showing that the second extension line is present

lug_size - lug size of extension lines above arrows

automatic_arrows - sing of arrows position automatic calculation - inside or outside the dimension. If this structure field value is true, the arrows position is calculated automatically depending of the text length and arrows size. In this case the out_first_arrow and out_second_arrow fields are ignored.

out_first_arrow  - whether the first arrow is outside the dimension (if the automatic_arrows field value is true the field is ignored)

out_second_arrow - whether the second arrow is outside the dimension (if the automatic_arrows field value is true the field is ignored)

first_arrow_style and second_arrow_style - arrows style.

The following styles are supported:

Field value

Arrow type

 

 

0

dim_arr_1

 

 

1

dim_arr_2

 

2

dim_arr_3

 

 

3

dim_arr_4

 

 

4

dim_arr_5

 

5

dim_arr_6

 

6

dim_arr_7

 

7

dim_arr_8

 

8

dim_arr_9

 

9

dim_arr_10

 

10

dim_arr_11

 

11

    dim_arr_12

 

12

dim_arr_13

 

 

13

dim_arr_14

 

14

dim_arr_15

 

15

    dim_arr_16

 

arrows_size - arrows size

text_align - text string position type on the dimensional line. Can have the following values:

SG_TA_CENTER - center text position,

SG_TA_LEFT - left text position,

SG_TA_RIGHT - right text position.

text_style - text style (read more about text style structure here)

invert - is necessary for angular dimensions (ignored in other cases). If the field value is true, the angle is added to 360 degrees

behaviour_type - is necessary for distant dimensions (ignored in other cases). Specifies the way of building the dimension by the third point (see the values table - formed_points). Has the following values:

SG_DBT_VERTICAL - dimensional line is construced with the vertical segment line projection between first two points

SG_DBT_HORIZONTAL - dimensional line is construced with the horizontal segment line projection between the first two points

SG_DBT_PARALLEL - dimensional line is constructed parallel to the segment line between the first two points

SG_DBT_SLANT - dimensional line is constructed parallel to the segment line between the first two points and the third point is its start (slanting dimensional line)

SG_DBT_OPTIMAL - optimum dimension is constructed between two points considering the third one

precision - dimensional string display accuracy (characters number after the point)

string - text string to be written on the dimensional line. Can be NULL - in this case the dimension value is written on the dimensional line with the accuracy specified in the corresponding field of the stl structure

 

Returned value:

Returns the pointer to the created object. If the function fails NULL is returned.

 

See also:

Objects hierarchy     sgCObject methods