Application_AddComponent Event

Scope: Schematic editor

Object: Components Object

Prerequisites: None

You can use the Application_AddComponent event to check a component’s properties before adding it to the schematic. For example, checking if the approved part’s properties exist before instantiating a component can help prevent adding unapproved parts to the schematic.

Usage

Sub Application_AddComponent (ByVal component As Component)

Note:

Component.Continue = FALSE setting cancels the add component function.

Arguments

component

Component. The component to be added to the schematic.

Description

Applies to the Components object (see Components Object). The script calls the event before adding a component to the schematic.

Examples

This event handler sets the visibility of a property and removes a property from the collection:

Function Application_AddComponent(component) 
''' 
  'Add a property 
   	component.Attributes.Add "TEST", "SCRIPTING", TRUE, TRUE, TRUE 
  'set the visibility of a property  
   set attr = component.Attributes.Item("Value")  
   attr.NameVisible = FALSE 
  'Remove a property 
   component.Attributes.Remove("Tolerance")  
  'If the Continue property is TRUE, then the component will be  
  'added to the schematic 
  'If the Continue property is FALSE, then the component is not added 
   Component.Continue = TRUE 
End Function