Creating Groups (Developer's Guide)

www.CAD6.com

When creating multiple objects during the execution of one command, it will often be useful to store these objects inside a group. A group is a special form of block that is stored directly in the drawing.

 

As a simple example, let's create a group that contains two ing lines. Groups may, however, also contain more complex objects and even instances of other groups or blocks.

 

C++ Source Code

bool fResult = true;

 

MKI_UndoInitProcess();

 

// Open a group. While a group is open, all objects and

// instances created will be added to that group.

MKI_GroupOpen();

 

// Create the first object to be added to the group.

if( fResult )

{

  if( !MKI_EntityLine( -148.5, -105.0, 148.5, 105.0 ) )

    fResult = false;

}

 

// Create the second object to be added to the group.

if( fResult )

{

  if( !MKI_EntityLine( 148.5, -105.0, -148.5, 105.0 ) )

    fResult = false;

}

 

// Close the group, insert it into the drawing and

// create an instance that references that group.

if( fResult )

{

  if( !MKI_GroupFastInsert( nullptr ) )

    fResult = false;

}

 

// Update the internal links (necessary if groups or blocks

// have been created) and draw the newly created objects.

if( fResult )

{

  MKI_UndoFinishProcess();

  MKI_UndoUpdateLinks();

  MKI_DrawNewObjects();

}

else

  MKI_UndoCancelProcess();

 

CAD6interface 2026.0 - Copyright 2026 Malz++Kassner® GmbH