bdeReplaceBlock

Replaces blockToReplace with a copy of replacement in diagram. blockToReplace and replacement are of type hwscpHyperBlock.

Syntax

bdeReplaceBlock(blockToReplace, replacement, cutOperation);

Inputs

blockToReplace
Block to replace.
Type: block
replacement
The block that will replace blockToReplace.
Type: block
cutOperation
Whether or not the original version of replacement should be cut. If true the original version of replacement will be cut. If false then the blockToReplace will be replaced and the original replacement will stay untouched.
Type: Boolean

Outputs

replaced
The block that replaced blockToReplace.
Type: block

Examples

Replace a block within a diagram:

          diagram = bdeGetCurrentDiagram();
          blockToReplace = bdeGetSelectedBlock(diagram);
          replacement = bdeCloneBlock(blockToReplace);
          bdeAddBlockToDiagram(diagram, replacement);
          bdeRedrawDiagram(diagram);
          replaced = bdeReplaceBlock(blockToReplace, replacement, true);
          bdeRedrawDiagram(diagram)
        
replaced = hwscpHyperBlock