Customization > Automation Interface > Functions > For Modeler Items > Functions for Collections > AddDirected function (automation interface)
AddDirected function (automation interface)
Syntax:
AddDirected("Part¦Port¦Associated Item¦Part Equivalent",<type>)
Where:
<Part> creates a new Part whose type is the target object, and returns the new Part.
<Port> creates a new Port whose type is the target object, and returns the new Port.
<Associated Item> creates an Association to the target object, and returns the new Association.
<Part Equivalent> creates a redefinition of the object (Part or Port) using the target object as the type and returns the new redefinition.
<type> specifies the target object to use for the Part, Port or Association.
The AddDirected function can create Parts, Ports and Associations from a Class, Part or Port. In addition, when using Associated Item, the AddDirected function can be used from an Actor.
For Classes, Attributes (Parts or Ports) and Roles (Parts or Ports) you can use the AddDirected function with the following Roles:
Examples
In this example, a new Part is created for Part3 using Class1 as the type.
Set objPart = Dictionary.Item("Role", "Part3")
Set objType = Dictionary.Item("Class", "Class1")
Call objPart.AddDirected("Part", objType)
In this example, a new Association is created between Part3 and Class1. After setting the aggregation and direction of the Association, the Association can be shown on Composite Structure Diagrams.
Set objPart = Dictionary.Item("Role", "Part3")
Set objType = Dictionary.Item("Class", "Class1")
Set objAssociation = objPart.AddDirected("Associated Item", objType)
objAssociation("Aggregate") = "None"
objAssociation("Navigation") = "start-end"
Was this helpful?