User Defined Components Reference
When using user-defined components, child components must be managed by code so that users can configure them; the UDC functions available for managing I/O and parameters are explained here:
Inventory List:
Returns all the components presents in the UDC.
Example:
for(int f=1; f < 16; f++)
{
UC.Inventory[f].Space.Rotate(speed, 0, 0);
}
bool GetOutput(string name)
- Description: Returns the boolean value of the digital output name
- Example: (in this example is assumed that the UDC has declared an output called StartMotor)
bool connect = UC.GetOutput("StartMotor");
bool TrigOutUp(string name)
- Description: returns the UC output 'name' change status from false to true.
bool TrigOutDwn(string name)
- Description: returns the UC output 'name' change status from true to false.
void SetInput(string name, bool value)
- Description: Sets the value for the digital input name
- Example: (in this example is assumed that the UDC has declared an input called Sensor)
UC.SetInput("Sensor", true);
bool TrigInpUp(string name)
- Description: returns the UC input 'name' change status from false to true.
bool TrigInpDwn(string name)
- Description: returns the UC input 'name' change status from true to false.
float GetParameter(string name)
- Description: Returns the float value of the parameter name
- Example: (in this example is assumed that the UDC has declared a parameter called Speed)
float spd = UC.GetParameter("Speed");
string GetParameterText(string name)
- Description: Returns the value of the parameter name (of string type)
int GetParameterList(string paramName)
- Description: returns the index name for the paramName parameter list.
- Example: (in this example is assumed that the UDC has declared a parameter list called Lenght)
int sel = UC.GetParameterList("Lenght");
float GetAOutput(string name)
- Description: Returns the float value of the analog output name
- Example: (in this example is assumed that the UDC has declared an analogic output called Intensity)
float force = UC.GetAOutput("Intensity");
void SetAInput(string name, float value)
- Description: Sets the value for the analogic input name
- Example: (in this example is assumed that the UDC has declared an analogic input called Light)
UC.SetAInput("Light", lvalue);
void SetOutput(string name, bool value)
- Description: Sets the boolean value for the digital output name
bool GetInput(string name)
- Description: Returns the boolean value of the digital input name
void SetAOutput(string name, float value)
- Description: Sets the float value for the analog output name
float GetAInput(string name)
- Description: Returns the float value of the analog input name
int DInputAddr(string name)
- Description: Returns the address assigned by the user to the digital input name
int DOutputAddr(string name)
- Description: Returns the address assigned by the user to the digital output name
int AInputAddr(string name)
- Description: Returns the address assigned by the user to the analogic input name
int AOutputAddr(string name)
- Description: Returns the address assigned by the user to the analogic output name
int GetParameterListSelectedIndex(string name)
- Description: returns the index for the select parameter list item name passed.
Once a User Defined Component is saved and appears in the Components Tree, is called a User Component. The User Components that are included inside the User Defined Components have the following functions, in order can be managed by the UDC Script Code.
void SetInputAddress(string name, int addres)
- Description: Sets the UC digital input address for the name digital input
- Example: Assuming we are working in the script code of an UserDefinedComponet that has mapped one digital input called Sensor. This UCD has an UC called MySwitch and has one digital input called Pressure:
MySwitch.SetInputAddress("Pressure", UC.DInputAddr("Sensor"));
void SetOutputAddress(string name, int addres)
- Description: Sets the UC digital output address for the name digital output
- Example: Assuming we are working in the script code of an UserDefinedComponet that has mapped one digital output called Motor. This UCD has an UC called MyTransport and has one digital output called Start:
MySwitch.SetOutputAddress("Start", UC.DOutputAddr("Motor"));
void SetAInputAddress(string name, int addres)
- Description: Sets the UC analogic input address for the name analogic input
- Example: Assuming we are working in the script code of an UserDefinedComponet that has mapped one analogic input called Value. This UCD has an UC called MySensor and has one analogic input called Val:
MySensor.SetAInputAddress("Val", UC.AInputAddr("Value"));
void SetAOutputAddress(string name, int addres)
- Description: Sets the UC analogic output address for the name analogic output
- Example: Assuming we are working in the script code of an UserDefinedComponet that has mapped one analogic output called Force. This UCD has an UC called MyDevice and has one analogic output called Forc:
MyDevice.SetAOutputAddress("Forc", UC.AOutputAddr("Force"));
void SetParameter(string name, float value)
- Description: Sets the UC parameter value for the name parameter
- Example: Assuming we are working in the script code of an UserDefinedComponet that has mapped one parameter called Speed. This UCD has an UC called MyControl and has one parameter called Velocity:
MyControl.SetParameter("Velocity", UC.GetParameter("Speed"));
void SetParameter(string name, string value)
- Description: Sets the UC parameter value for the name parameter of string type
float GetParameter(string name)
- Description: Returns the float value of the parameter name
string GetParameterText(string name)
- Description: Returns the string value of the parameter name
void IsVisible(bool value)
- Description: Sets if the User Component is visible (value = true) or not (value = false)
ComponentBase UDCComponent(string name)
- Description: returns the ComponentBase object with description 'name'
int GetParameterListSelectedIndex(string name)
- Description: returns the index for the select parameter list item name passed.
List<Rigidbody> bodyList
- Description: returns the list of all rigid bodies that make up the UCC.