SDK:Working with Wall Breaks - Symbol

From Vectorworks Developer
Jump to: navigation, search

.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

By Vladislav Stanev

What is that?

A symbol break is a one type of breaks that the walls can contain. See SDK:Working with Wall Breaks.

A symbol break specifies the insertion of an instance of a symbol or plug-in object into a wall. The symbol cuts the wall as necessary.

A symbol break defines the symbol definition of the inserted symbol, the height of the symbol’s insertion point in the wall, and the orientation of the symbol (towards which quadrant of the wall is the symbol directed).

The following functions are defined for working with breaks:

The symbol break is defined by the type constant:

Sumbol Break Info

const short kSymbolBreak    = 1;

The symbol break is represented by the structure:

struct SymbolBreakType {
  MCObjectHandle  theSymbol;
  Boolean         rightSide;
  Boolean         flipH;
  WorldCoord      height;
						
  InsertModeType  insertMode;
  BreakModeType   breakMode;
};
  • theSymbol -- Handle to the symbol inserted
  • rightSide -- Is the symbol oriented to the right side of the wall
  • flipH -- Is the symbol flipped toward the first point of the wall
  • height -- Height of the bottom of the symbol from the ground plane
  • insertMode -- which edge is the symbol inserted on:
const InsertModeType kSymInsertOnCenter    = 0;
const InsertModeType kSymInsertOnLeftEdge  = 1;
const InsertModeType kSymInsertOnRightEdge = 2;
  • breakMode -- break style for the symbol:
const BreakModeType kSymFullBreakWithCaps = 1;
const BreakModeType kSymFullBreakNoCaps   = 2;
const BreakModeType kSymHalfBreak         = 3;
const BreakModeType kSymNoBreak           = 4;

Adding a break

// 1. Create temp parametric object to be inserted into the wall
MCObjectHandle	hObj  = gSDK->CreateCustomObject( TXString("Window"), WorldPt(0,0), 0, false );

// 2. Create symbol break definition
SymbolBreakType	symBreak;
symBreak.theSymbol    = hObj;
symBreak.rightSide    = false;
symBreak.flipH        = false;
symBreak.height       = 10;
symBreak.insertMode   = kSymInsertOnCenter;
symBreak.breakMode    = kSymFullBreakWithCaps;

// 3. Insert the break into the wall
short breakIndex = gSDK->AddBreak( hWall, 100, kSymbolBreak, & symBreak );

// 4. Delete the temp parametric object
gSDK->DeleteObject( hObj, false );

// 5. Reset the wall to apply the new breaks
gSDK->ResetObject( hWall );

The object that is passed in as 'theSymbol' to VCOM:VectorWorks:ISDK::AddBreak is internally duplicated. This means that the user is responsible for deleting the passed in handle.

Note: Step one will create a "Window" parametric object. If this object is created for the first time in the document, Vectorworks will show the objects default parameters dialog (object preferences). To prevent that of happening you can define the format prior of creation of the object:

gSDK->DefineCustomObject( TXString("Windows"), kCustomObjectPrefNever );

Editing a break

// Search for the break of intereset
gSDK->ForEachBreak( hWall, EnumerateBreaksCallback, NULL );

// Update changes in the wall breaks
gSDK->ResetObject( hWall );

Where the enumeration callback is (we want to replace all symbol breaks with doors flipped horizontally):

static Boolean EnumerateBreaksCallback(MCObjectHandle hWall, long index, WorldCoord off, long breakType, void* pBreakData, CallBackPtr cbp, void* pMyEnv)
{
  if ( breakType == kSymbolBreak ) {
    SymbolBreakType*	pSymbolBreak	= (SymbolBreakType*) pBreakData;

    // 1. Create tepm new object for the break
    MCObjectHandle	hObj	= gSDK->CreateCustomObject( TXString("Door"), WorldPt(0,0), 0, false );

    // 2. Modify the break
    pSymbolBreak->flipH		= true;
    pSymbolBreak->theSymbol	= hObj;

    // 3. Update break information
    gSDK->SetBreak( hWall, index, off, kSymbolBreak, pSymbolBreak );

    // 4. Delete the temp object
    gSDK->DeleteObject( hObj, false );
  }

  return false; // continue
}

Removing a break:

gSDK->DeleteBreak( hWall, breakIndex );

// rest the wall in order removed breaks to be applyed
gSDK->ResetObject( hWall );

See also

SDK:Working with Wall Breaks

SDK:Working with Wall Breaks - Cap | SDK:Working with Wall Breaks - Half | SDK:Working with Wall Breaks - Peak | SDK:Working with Wall Breaks - Symbol

VCOM:VectorWorks:ISDK::AddBreak | VCOM:VectorWorks:ISDK::DeleteBreak |VCOM:VectorWorks:ISDK::ForEachBreak

Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox