Class SmartComponent
Represents a GraphicComponent that contains Properties, I/O Signals, Assets and other GraphicComponents. The behavior of the component is implemented by Code Behind.
Implements
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
sistent("SmartComponentInstance")]
public sealed class SmartComponent : GraphicComponent, IHasTransform, IHasFrames, IAttachableChild, ISupportCopy, IGfxObject, IAttachableParent, IHasGraphicComponents, IHasIOSignals, IHasIOConnections, IHasDynamicProperties, IHasPropertyBindings, IHasAssets
Constructors
SmartComponent()
Creates and initializes a new SmartComponent object.
Declaration
public SmartComponent()
Properties
Assets
Gets an AssetCollection that represents all the assets of this SmartComponent object.
Declaration
public AssetCollection Assets { get; }
Property Value
Type | Description |
---|---|
AssetCollection | The AssetCollection that represents all the assets of this SmartComponent object. |
Bindings
Gets an PropertyBindingCollection object that represents all the bindings of this SmartComponent object.
Declaration
public PropertyBindingCollection Bindings { get; }
Property Value
Type | Description |
---|---|
PropertyBindingCollection | The PropertyBindingCollection that represents all the bindings of this SmartComponent object. |
CanBeSimulated
Gets or sets a value that indicates whether this SmartComponent object can be simulated, e.g. if the code behind implements the SimTime methods.
Declaration
public bool CanBeSimulated { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
CodeBehindLocation
Gets or sets the the location of the SmartComponentCodeBehind class associated with this component.
Declaration
public string CodeBehindLocation { get; set; }
Property Value
Type | Description |
---|---|
String | A string in the format [Type name],[Assembly name]. |
See Also
Connections
Gets an IOConnectionCollection that represents all the I/O connections on this SmartComponent object.
Declaration
public IOConnectionCollection Connections { get; }
Property Value
Type | Description |
---|---|
IOConnectionCollection |
Description
Gets a localized description for this SmartComponent object.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
String |
DisplayName
Declaration
public override string DisplayName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
GraphicComponents
Gets a GraphicComponentCollection that represents all the graphic components in this SmartComponent object.
Declaration
public GraphicComponentCollection GraphicComponents { get; }
Property Value
Type | Description |
---|---|
GraphicComponentCollection | The GraphicComponentCollection that represents all the graphic components on this SmartComponent object. |
Icon
Gets a Image associated with this SmartComponent object.
Declaration
public Image Icon { get; }
Property Value
Type | Description |
---|---|
Image |
IOSignals
Gets an IOSignalCollection that represents all the I/O signals on this SmartComponent object.
Declaration
public IOSignalCollection IOSignals { get; }
Property Value
Type | Description |
---|---|
IOSignalCollection |
IsBaseComponent
Returns true if this is a built-in base component.
Declaration
public bool IsBaseComponent { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsEditable
Returns true if IsProtected is false and IsBaseComponent is false and Library is null.
Declaration
public bool IsEditable { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsProtected
Gets or sets a value that indicates if the internal structure of this component should be hidden in the GUI, and if the component should be locked for editing.
Declaration
public bool IsProtected { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
LanguageOverride
Forces this component to use the specified language for resources rather than the language set in Options.
Declaration
public string LanguageOverride { get; set; }
Property Value
Type | Description |
---|---|
String |
PerInstanceCodeBehind
Gets or sets a value that specifies if the SmartComponentCodeBehind class should be instantiated once per smart component instance. By default the class is instantiated once, as a singleton.
Declaration
public bool PerInstanceCodeBehind { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
Properties
Gets a DynamicPropertyCollection that represents all the properties of this SmartComponent object.
Declaration
public DynamicPropertyCollection Properties { get; }
Property Value
Type | Description |
---|---|
DynamicPropertyCollection | The DynamicPropertyCollection that represents all the properties of this SmartComponent object. |
RoleObject
Gets or sets an object that defines the role of this SmartComponent.
Declaration
public GraphicComponent RoleObject { get; set; }
Property Value
Type | Description |
---|---|
GraphicComponent | A GraphicComponent that must be a child of this SmartComponent. |
Remarks
This property may be used in different scenarios to have the SmartComponent inherit certain characteristics of a child object. For example, attaching a SmartComponent with a Tool as RoleObject to a Robot should cause ToolData(s) to be created.
SavedStates
Gets a SavedStateCollection that contains saved states for this object.
Declaration
public SavedStateCollection SavedStates { get; }
Property Value
Type | Description |
---|---|
SavedStateCollection |
StateCache
Returns a collection that can be used by code behind to cache state information for this SmartComponent object.
Declaration
public Dictionary<string, object> StateCache { get; }
Property Value
Type | Description |
---|---|
Dictionary<String, Object> |
Remarks
The cache is automatically cleared when Undo or Redo is performed.
Methods
AfterLoad(PimDocument)
Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Overrides
Attach(IAttachableChild, Boolean, Matrix4)
Attaches a child object to this SmartComponent.
Declaration
public bool Attach(IAttachableChild child, bool mount, Matrix4 offset)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be attached. |
Boolean | mount | Specifies whether the child should be mounted, i.e. moved, on to the location of the parent |
Matrix4 | offset | Specifies the offset matrix to be used from the attachment point. This is only used when mount is set to True. |
Returns
Type | Description |
---|---|
Boolean | True, if the attachmet succeded |
BeforeSave(PimDocument)
Declaration
protected override void BeforeSave(PimDocument doc)
Parameters
Type | Name | Description |
---|---|---|
RobotStudio.API.Persistence.PimDocument | doc |
Overrides
CanAttachChild(IAttachableChild)
Test if the supplied child can be attached.
Declaration
public bool CanAttachChild(IAttachableChild child)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be tested. |
Returns
Type | Description |
---|---|
Boolean | True, if the supplied child can be attached, false otherwise |
Detach(IAttachableChild)
Detaches a child object from this SmartComponent.
Declaration
public bool Detach(IAttachableChild child)
Parameters
Type | Name | Description |
---|---|---|
IAttachableChild | child | The child to be detached. |
Returns
Type | Description |
---|---|
Boolean | True, if the detachment succeded |
GetCollectionObjects(ProjectObject)
Returns the objects contained by a SmartComponent that represents a collection.
Declaration
public static IEnumerable<ProjectObject> GetCollectionObjects(ProjectObject projectObject)
Parameters
Type | Name | Description |
---|---|---|
ProjectObject | projectObject |
Returns
Type | Description |
---|---|
IEnumerable<ProjectObject> | Objects in the collection, or projectObject itself if it is not a collection |
GetResourceString(String)
Returns a localized resource string
Declaration
public string GetResourceString(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | String id in the resource asset |
Returns
Type | Description |
---|---|
String | Localized string, or String.Empty if the id was not found |
InitializeCodeBehind()
Initializes the associated SmartComponentCodeBehind, if it exists. If this Smart Component has an associated Code Behind Assembly is necessary to call this method before a Smart Component is saved to library. The Code Behind assembly will be loaded, if its not already loaded, and the OnInitialize(SmartComponent) method will be called.
Declaration
public void InitializeCodeBehind()
OnCreatingObject()
Declaration
protected override void OnCreatingObject()
Overrides
RaiseIOSignalChanged(IOSignal)
Raises the IOSignalChanged event. Call this method to force update of the GUI of a signal.
Declaration
public void RaiseIOSignalChanged(IOSignal signal)
Parameters
Type | Name | Description |
---|---|---|
IOSignal | signal |
RaisePropertyChanged(DynamicProperty)
Raises the PropertyChanged event. Call this method to force update of the GUI of a property.
Declaration
public void RaisePropertyChanged(DynamicProperty prop)
Parameters
Type | Name | Description |
---|---|---|
DynamicProperty | prop |
Events
IOSignalChanged
Raised when any property except Value changes on one of the signals in the IOSignals collection
Declaration
public event IOSignalChangedEventHandler IOSignalChanged
Event Type
Type | Description |
---|---|
IOSignalChangedEventHandler |
IOSignalValueChanged
Raised when the Value property changes on one of the signals in the IOSignals collection
Declaration
public event IOSignalChangedEventHandler IOSignalValueChanged
Event Type
Type | Description |
---|---|
IOSignalChangedEventHandler |
PropertyChanged
Raised when any property except Value changes on one of the properties in the Properties collection
Declaration
public event DynamicPropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
DynamicPropertyChangedEventHandler |
PropertyValueChanged
Raised when the Value property changes on one of the properties in the Properties collection
Declaration
public event DynamicPropertyChangedEventHandler PropertyValueChanged
Event Type
Type | Description |
---|---|
DynamicPropertyChangedEventHandler |