vcSimInterface
vcSimInterface is an interface used for connecting components physically or remotely to one another and exchanging data.
Inherits: vcBehaviour
vcSimInterface can support one-to-one and one-to-many connections and is the object type for One to One Interface and One to Many Interface behaviors.
Properties
Name | Type | Access | Description |
AngleTolerance | Real | RW | Defines an angle tolerance for allowing interfaces to connect to the interface when not aligned on same axis. |
ConnectedComponent | vcComponent | R | Gets the component connected to interface.
If no connection, value is None. |
ConnectedComponents | List of vcComponent | R | If one-to-many interface, gets a list of all components connected to interface.
If no connection, value is an empty list. |
ConnectedFromSections | List of vcSimInterfaceSection | R | If one-to-many interface, gets a list of all sections in interface that have an active connection.
If no connection, value is an empty list. |
ConnectedSection | vcSimInterfaceSection | R | If one-to-one interface, gets a section of interface that have an active connection.
(Deprecated) |
DistanceTolerance |
Real | R | Defines the distance at which the interface snaps to an available connection, thereby completing Plug and Play. |
ConnectedSections | List of vcSimInterfaceSection | R | If one-to-many interface, gets a list of all sections in interface that have an active connection.
(Deprecated) |
ConnectedToSections | List of vcSimInterfaceSection | R | Gets a list of sections connected to interface.
If no connection, value is an empty list. |
ConnectionEditName | String | RW | Defines the name of a Button property to temporarily create in component for connecting the interface.
If an empty string, button is not created and/or removed from GUI. The string can use format [tab name]::[button name] to list button in a specific tab. If tab does not exist, it will be automatically created to contain button as long as string refers to that tab. If tab name is not given, button is listed as a default property. |
IsAbstract | Boolean | RW | Defines if interface supports remote connections. |
IsConnected | Boolean | R | If True, interface is connected; otherwise interface is not connected. |
Sections | List of vcSimInterfaceSection | R | Gets a list of all sections in interface.
If no sections, value is an empty list. |
Methods
Name | Return Type | Parameters | Description |
canConnect | Boolean | vcSimInterface interface | Returns True if a given interface can connect to the interface; otherwise, returns False. |
connect | Boolean | vcSimInterface interface, [Boolean retain_offset] | Connects a given interface to the interface. An optional retain_offset argument can be used to retain the offset when attaching component to another using Hierarchy field. If connection is successful, returns True; otherwise returns False. |
createSection | vcSimInterfaceSection | String section_name | Adds a new section of a given name to interface, and then returns the new section. |
deleteSection | Boolean | Integer index | If one-to-one interface, deletes a section at a given index from interface.
Returns True is deletion is successful; otherwise returns False. |
disconnect | Boolean | vcSimInterface other_interface | Removes all connections in interface.
An optional other_interface argument can be used to disconnect a specific interface from the interface, for example when interface is one-to-many. Returns True if disconnection is successful; otherwise returns None. |
overrideEventResult | None | 1, Integer result | Overrides event result to have a given result. |
unConnect | Boolean | [vcSimInterface other_interface] | (Deprecated) Use disconnect(). |
Events
Name | Parameters | Description |
OnConnect | vcSimInterface other_interface, Boolean retain_offset | Triggered when interface is connected to another interface. |
OnDisconnect | vcSimInterface other_interface | Triggered when interface is disconnected from another interface. |
OnMatch | vcSimInterface other_interface | Triggered when interfaces are tested as being able to connect to one another. |
OnUnConnect | vcSimInterface other_interface | (Deprecated) Use OnDisconnect. |
Examples
Example. Manipulate a conveyor line
from vcScript import * comp = getComponent() iface = comp.findBehaviour('OutInterface') # name of the interface need to match with this one other_component = iface.ConnectedComponent # this returns a component which is connected to this interface, # return None if nothing is connected all_conveyors = [comp] # create a python list where all conveyors will be added while iface.ConnectedComponent: # traverse thru a chain of connected conveyors other_component = iface.ConnectedComponent all_conveyors.append( other_component ) iface = other_component.findBehaviour('OutInterface') #name of the interface need to match with this one print [x.Name for x in all_conveyors] # prints a list of names of the conveyors in the chain # connect a component at the end of the conveyor chain app = getApplication() myConv = app.findComponent('MyConveyor') inIface = myConv.findBehaviour('InInterface') lastConvInChain = all_conveyors[-1] # take the last item from the list outIface = lastConvInChain.findBehaviour('OutInterface') if outIface.canConnect(inIface): outIface.connect(inIface) #OPTION 1: this will not move the connected component #app.connectComponents(lastConvInChain, myConv) # OPTION 2: this will move them app.render() |