ChangeComponent Method (Block Object)

Scope: Schematic editor

Object: Block Object

Prerequisites: None

Exchanges one or more components with a different component.

Usage

Block.ChangeComponent(ByVal OldComp As String, ByVal NewComp As String) As Boolean

Arguments

OldComp

Name of the component to be replaced. The special string "< Selected Components >" will cause all the components on the selected list to be replaced by the new component.

NewComp

Name of the component which replaces OldComp.

Description

The special string "< Selected Components >" causes all the components on the selected list to be replaced by the new component.

This method returns a Boolean True if the component was replaced, or False if the component could not be replaced. False throws an Automation exception if the special string is used and there are not any components on the selected list.

Examples

Replace all components with a resistor.

ActiveView.Block.ChangeComponent "< Selected Components >", "resistor.1" 
'Replace all capacitors with resistors 
ActiveView.Block.ChangeComponent "cap.1", "resistor.1"