|
Creating Dimension Objects (Developer's Guide) |
www.CAD6.com |
|
A rather common type of complex objects are dimensions. This chapter will show some examples on how to create these types of objects. Dimension objects consist of several types of data: Geometrical data defining the measure, geometrical data defining the dimension line's position, the dimension texts, a description of the font to be used, and the position of the text. Each type of dimension has its special sequence of data blocks required to provide all this data.
First, lets create a simple length dimension using standard parameters.
C++ Source Code// Variables required to create a dimension object. MKI_DIMLARGE cData;
// Initialize the variables. cData.InitLarge();
// Create a dimension text object. MKI_ObjectOpen( MKI_OBJ_DDISTANCE ); MKI_ObjectAddPoint( MKI_DB_POINT_START, -100.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_END, 100.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 0.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 0.0, 10.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 0.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 0.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 0.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, -100.0, 0.0 ); MKI_ObjectAddPoint( MKI_DB_POINT_ANY, 100.0, 0.0 ); MKI_ObjectAddTextShort( L"", false ); MKI_ObjectAddTextShort( L"", true ); MKI_ObjectAddTextShort( L"", false ); MKI_ObjectAddTextShort( L"", false ); MKI_ObjectAddTextShort( L"", false ); MKI_ObjectAddDimLarge( &cData, true, false );
// Insert the text object into the current drawing. bool fResult = ( MKI_ObjectFastInsert( nullptr ) != nullptr );
This short code sequence will result in a distance dimension that measures the distance between the point (-100.0, 0.0) and (100.0, 0.0). The dimension line's position is determined by the point (0.0, 10.0).
For further information about the internal data block structure of the object MKI_OBJ_DDISTANCE, see Object 25 "Distance Dimension".
|
CAD6interface 2026.0 - Copyright 2026 Malz++Kassner® GmbH