SelectObject Method (View Object)

Scope: Schematic editor

Object: View Object

Prerequisites: None

Selects an object by name.

Usage

View.SelectObject(ByVal ObjectType As VdObjectType, ByVal Expression As String, ByVal SelectOwner As Boolean, ByVal RegExp As Boolean, ByVal AddSelect As Boolean) As Long

Arguments

ObjectType

Indicates which object types to consider. This is of the form “VdObjectType Enum”.

Expression

String expression that will be compared to the label or name on each object. This can be a regular expression.

SelectOwner

Specifies whether or not to select the parent of the target object.

True - the parent object is selected. False - the parent object is not selected.

RegExp

Specifies whether or not to evaluate the Expression string or perform a simple string comparison.

True - evaluate the Expression string normally. False - only performs a simple string comparison.

AddSelect

Indicates whether or not to add the newly-selected items to the existing selection list.

True - the newly-selected items are added to the existing selection list. False - the newly-selected items are not added to the existing selection list; a new selection list is started.

Return Values

As Long. Returns zero (0). No objects are returned.

Description

This method provides a way to select objects, and optionally their owners, based on a regular expression. Use the method to restart the selection list or add to the existing list. Objects are selected by type in each search, but you can apply this function several times with different object types to do more general selections.

Examples

The example below selects all components with symbol name “cap_fxd_001_xfr.2”:

Dim res,itms

'select components with same symbol name
res=ActiveView.SelectObject(VDTS_COMPONENT, "cap_fxd_001_xfr.2", False,
   True, False)
MsgBox(res)’method returns 0

'get collection of selected components in the view
set itms=ActiveView.Query(VDM_COMP,VD_SELECTED)

if itms.count=0 then
    MsgBox("No Components Found")
else	
	 MsgBox(itms.count & " Components Found")
end if