Spel Class Properties

AsyncMode Property, Spel Class

Description
Sets / returns asynchronous execution mode.

Syntax
Property AsyncMode As Boolean

Default value
False

Return value
A Boolean value that is True if asynchronous mode is active, False if not.

See Also
Using AsyncMode, WaitCommandComplete

AsyncMode Example
VB Example:

With m_spel  
  .AsyncMode = True  
  .Jump("pick")  
  .Delay(500)  
  .On(1)  
  .WaitCommandComplete()  
End With  

C# Example:

m_spel.AsyncMode = true;  
m_spel.Jump("pick");  
m_spel.Delay(500);  
m_spel.On(1);  
m_spel.WaitCommandComplete();  

AvoidSingularity Property, Spel Class

Description
Sets / returns singularity avoidance mode.

Syntax
Property AvoidSingularity As Boolean

Default value
False

Return value
A Boolean value that is True if singularity avoidance is active, False if not.

See Also
Go, Jump, Move

AvoidSingularity Example
VB Example:

m_spel.AvoidSingularity = True  

C# Example:

m_spel.AvoidSingularity = true;  

CommandInCycle Property, Spel Class

Description
Returns whether a method is being executed.

Syntax
ReadOnly Property CommandInCycle As Boolean

Return value
A Boolean value that is True if a method is executing, False if not.

See Also
AsyncMode

CommandInCycle Example
VB Example:

If m_spel.CommandInCycle Then  
    MsgBox "A SPEL command is executing, operation aborted"  
End If  

C# Example:

if (m_spel.CommandInCycle)  
    MessageBox.Show("SPEL command is executing, operation aborted");  

CommandTask Property, Spel Class

Description
Specifies the reserved API task to use in the Controller for executing robot commands.

Syntax
Property CommandTask As Integer

Default Value
The default value is 0 (do not use a reserved API task).

Remarks
Use CommandTask when you want to execute Spel robot commands on another thread in the Controller. Normally, CommandTask is used on a multi-robot system. Before using CommandTask, you must first reserve tasks in the Controller to be used by the API from Epson RC+ menu -[Setup]-[System Configuration]-[Controller]-[Preferences]. You can reserve up to 16 API tasks in the Controller.

See Also
ServerInstance

CommandTask Example
VB Example:

' In Robot1 thread  
m_spel.CommandTask = 1  
m_spel.Robot = 1  
  
' In Robot2 thread  
m_spel.CommandTask = 2  
m_spel.Robot = 2  
  
C# Example:  
// In Robot1 thread  
m_spel.CommandTask = 1;  
m_spel.Robot = 1;  
  
// In Robot2 thread  
m_spel.CommandTask = 2;  
m_spel.Robot = 2;  

DisableMsgDispatch Property, Spel Class

Description
Sets / returns whether Windows messages should be processed during Spel method execution.

Syntax
DisableMsgDispatch

Type
Boolean

Default Value
False

Remarks
This property should normally not be used. It is intended for special applications that do not want keyboard or mouse processing while a Spel method is executing.

ErrorCode Property, Spel Class

Description
Returns the current Controller error code.

Syntax
ReadOnly Property ErrorCode As Integer

Return Value
Integer value containing the error code.

See Also
ErrorOn

ErrorCode Example
VB Example:

If m_spel.ErrorOn Then  
    lblErrorCode.Text = m_spel.ErrorCode.ToString()  
Else  
    lblErrorCode.Text = ""  
End If  
  
C# Example:  
if (m_spel.ErrorOn)  
    lblErrorCode.Text = m_spel.ErrorCode.ToString();  
else  
    lblErrorCode.Text = "";  

ErrorOn Property, Spel Class

Description
Returns True if a critical error has occurred in the Controller.

Syntax
ReadOnly Property ErrorOn As Boolean

Return value
True if the Controller is in the error state, False if not.

Remarks
When the Controller is in the error state, the ErrorOn property returns True, and you can retrieve the error code by using the ErrorCode property.

See Also
ErrorCode

ErrorOn Example
VB Example:

If m_spel.ErrorOn Then  
    m_spel.Reset  
End If  
  
C# Example:  
if (m_spel.ErrorOn)  
    m_spel.Reset();  

EStopOn Property, Spel Class

Description
Returns the status of the Controller's emergency stop.

Syntax
ReadOnly Property EStopOn As Boolean

Return Value
True if the emergency stop is active, False if not.

EStopOn Example
VB Example:

If m_spel.EStopOn Then  
    lblEStop.Text = "Emergency stop is active"   
Else  
    lblEStop.Text = ""  
EndIf  

C# Example:

if (m_spel.EStopOn)  
    lblEStop.Text = "Emergency stop is active";  
else  
    lblEStop.Text = "";  

MotorsOn Property, Spel Class

Description
Sets and return the status of the motor power on or off for the current robot.

Syntax
Property MotorsOn As Boolean

Default value
False

Return value
A Boolean value that is True if motors are on, False if not.

See Also
PowerHigh, Reset, Robot

MotorsOn Example
VB Example:

If Not m_spel.MotorsOn Then  
   m_spel.MotorsOn = True  
End If  

C# Example:

if (\!m_spel.MotorsOn)  
   m_spel.MotorsOn = true;  

NoProjectSync Property, Spel Class

Description
Sets / returns whether the current project in the PC should be synchronized with the Controller project.

Syntax
NoProjectSync

Type
Boolean

Default Value
False

Remarks
When NoProjectSync is set to False (default), then the Spel class ensures that the project on the PC is synchronized with the project on the Controller.
When NoProjectSync is set to True, the Spel class does not check for any project on the PC and does not synchronize the PC project with the Controller. This allows you to run programs in the Controller without any project on the PC.

This property is not persistent. You must set it after creating a Spel class instance if you want to set it to True.

See Also
Start

NoProjectSync Examples
VB Example:

m_spel.Initialize()  
m_spel.NoProjectSync = True  

C# Example:

m_spel.Initialize();  
m_spel.NoProjectSync = true;  

OperationMode Property, Spel Class

Description
Reads or sets the Epson RC+ 8.0 mode of operation.

Syntax
Property OperationMode As SpelOperationMode

Return value
SpelOperationMode value

Remarks
When OperationMode is set to Program, the Epson RC+ 8.0 GUI for the current instance of the Spel class is opened and the Controller operation mode is set to Program. If the user closes the GUI, OperationMode is set to Auto. If OperationMode is set to Auto from Visual Basic, the GUI also closes.

OperationMode Example
VB Example:

Sub btnSpelProgramMode_Click _  
       ByVal sender As System.Object, _  
       ByVal e As System.EventArgs) _  
       Handles btnHideIOMonitor.Click  
  
  Try  
    m_spel.OperationMode = _  
                  RCAPINet.SpelOperationMode.Program  
    ' If you want to wait for the user to close the RC+ GUI,   
    ' you can wait here for OperationMode to change to Auto  
    Do  
      Application.DoEvents()  
      System.Threading.Thread.Sleep(10)      
    Loop Until m_spel.OperationMode = _  
                   RCAPINet.SpelOperationMode.Auto  
  Catch ex As RCAPINet.SpelException  
    MsgBox(ex.Message)  
  End Try    
End If  

C# Example:

void btnSpelProgramMode_Click(object sender, EventArgs e)  
{  
  try {  
m_spel.OperationMode = RCAPINet.SpelOperationMode.Auto;  
// If you want to wait for the user to close the RC+ GUI, you can wait here  
    Do {  
       Application.DoEvents();  
       Systme.Threading.Thread.Sleep(10);  
    } while(\!m_spel.OperationMode = RCAPINet.OperationMode.Auto);  
  }  
  Catch (SpelException ex){  
    MessageBox.Show(ex.Message);  
  }  
}  

ParentWindowHandle Property, Spel Class

Description
Sets / returns the handle for the parent window used for dialogs and windows.

Syntax
Property ParentWindowHandle As Integer

Return Value
Integer value containing the window handle.

Remarks
Use ParentWindowHandle to specify the parent window from applications that do not have .NET forms, such as LabVIEW.

See Also
ServerOutOfProcess

ParentWindowHandle Example
VB Example:

m_spel.ParentWindowHandle = Me.Handle  
m_spel.ShowWindow(RCAPINet.SpelWindows.IOMonitor)  

C# Example:

m_spel.ParentWindowHandle  = (int)this.Handle;  
m_spel.ShowWindow(RCAPINet.SpelWindows.IOMonitor);  

PauseOn Property, Spel Class

Description
Returns status of the Controller pause state.

Syntax
ReadOnly Property PauseOn As Boolean

Return Value
True if the Controller is in the pause state, False if not.

See Also
Continue, Pause

PauseOn Example
VB Example:

If m_spel.PauseOn Then  
    btnPause.Enabled = False  
    btnContinue.Enabled = True  
End If  

C# Example:

if (m_spel.PauseOn){  
    btnPause.Enabled = false;  
    btnContinue.Enabled = true;  
}  

PowerHigh Property, Spel Class

Description
Sets and returns the power state for the current robot.

Syntax
Property PowerHigh As Boolean

Default Value
False

Return Value
True if the current robot power is high, False if not.

See Also
MotorsOn

PowerHigh Example
VB Example:

If Not m_spel.PowerHigh Then  
    m_spel.PowerHigh = True  
End If  

C# Example:

if (\!m_spel.PowerHigh)  
    m_spel.PowerHigh = true;  

Project Property, Spel Class

Description
Sets / returns the current project.

Syntax
Property Project As String

Default Value
Empty string.

Return Value
A string containing the project path and file.

Remarks
When setting the Project, you must supply the full path and name of the Epson RC+ 8.0 project make file. The make file is the project name with a .SPRJ extension.

Project Example
VB Example:

m_spel.Project = "c:\EpsonRC80\projects\myapp\myapp.sprj"  

C# Example:

m_spel.Project = @"c:\EpsonRC80\projects\myapp\myapp.sprj";  

ProjectBuildComplete Property, Spel Class

Description
Returns the status of the current project build.

Syntax
ReadOnly Property ProjectBuildComplete As Boolean

Return Value
True if the project build is complete, False if not.

See Also
BuildProject

ProjectBuildComplete Example
VB Example:

If m_spel.ProjectBuildComplete Then  
    lblBuild.Text = "Project build is Complete"  
Else  
    lblBuild.Text = "Project build is not Complete"  
End If  

C# Example:

if (m_spel.ProjectBuildComplete)  
    lblBuild.Text = "Project build is Complete";  
else  
    lblBuild.Text = "Project build is not Complete";  

ProjectOverwriteWarningEnabled Property, Spel Class

Description
Sets / returns whether the project overwrite warning will be displayed.

Syntax
Property ProjectOverwriteWarningEnabled As Boolean

Default Value
True

Return Value
True if the project overwrite warning is enabled, False if not.

See Also
BuildProject

Remarks
By default, when the current project is not the same as the project in the controller, then a project overwrite warning message is displayed when the project is built and sent to the controller. Set ProjectOverwriteWarningEnabled to False when you don't want the overwrite warning message to be displayed. This is useful for when your application needs to switch projects used in the controller.

ProjectOverwriteWarningEnabled Example
VB Example:

' Disable the project overwrite warning  
m_spel.ProjectOverwriteWarningEnabled = False  
m_spel.Project = "c:\EpsonRC80\Projects\Project1\Project1.sprj"  

C# Example:

// Disable the project overwrite warning  
m_spel.ProjectOverwriteWarningEnabled = false;  
m_spel.Project = @"c:\EpsonRC80\Projects\Project1\Project1.sprj";  

ResetAbortEnabled Property, Spel Class

Description
Sets / returns whether ResetAbort method should be enabled or not.

Syntax
Property ResetAbortEnabled As Boolean

Default Value
True

Return Value
True if ResetAbort is enabled, False if not.

See Also
ResetAbort

ResetAbortEnabled Example
VB Example:

' Enable reset abort  
m_spel.ResetAbortEnabled = True  

C# Example:

// Enable reset abort  
m_spel.ResetAbortEnabled = true;  

Robot Property, Spel Class

Description
Sets / returns the current robot number.

Syntax
Property Robot As Integer

Default Value
If one or more robots exists, the default value for the first Spel instance is 1, otherwise it is 0. For all other Spel instances, the default value is 0.

Return Value
Integer value that contains the current robot number.

Remarks
On a system using multiple robots, use the Robot property to set the robot for subsequent robot related commands, such as motion commands.

See Also
RobotModel, RobotType

Robot Example
VB Example:

m_spel.Robot = 2  
If Not m_spel.MotorsOn Then  
  m_spel.MotorsOn = True  
End If  

C# Example:

m_spel.Robot = 2;  
if (\!m_spel.MotorsOn)  
  m_spel.MotorsOn = true;  

RobotModel Property, Spel Class

Description
Returns the model name for the current robot.

Syntax
ReadOnly Property RobotModel As String

Return Value
String that contains the current robot's model name.

See Also
Robot, RobotType

RobotModel Example
VB Example:

lblRobotModel.Text = m_spel.RobotModel  

C# Example:

lblRobotModel.Text = m_spel.RobotModel;  

RobotType Property, Spel Class

Description
Returns the type of the current robot.

Syntax
ReadOnly Property RobotType As SpelRobotType

Return Value
SpelRobotType value

See Also
Robot, RobotModel

RobotType Example
VB Example:

Select Case m_spel.RobotType  
  Case RCAPINet.SpelRobotType.Scara  
    lblRobotType.Text = "Scara"  
  Case RCAPINet.SpelRobotType.Cartesian  
    lblRobotType.Text = "Cartesian"  
End Select      

C# Example:

switch (m_spel.RobotType)  
{  
    case SpelRobotType.Scara:  
         lblRobotType.Text = "Scara";  
break;  
case SpelRobotType.Cartesian:  
         lblRobotType.Text = "Cartesian";  
break;  
    default:  
         break;  
}  

SafetyOn Property, Spel Class

Description
Returns status of the Controller's safeguard input.

Syntax
ReadOnly Property SafetyOn As Boolean

Return Value
True if the safeguard is open, False if not.

Remarks
Use the SafetyOn property to obtain the safeguard status when your application starts, then use the SafeguardOpen and SafeguardClose events to update the status.

SafetyOn Example
VB Example:

If m_spel.SafetyOn Then  
    lblSafeguard.Text = "Safe guard is active"   
Else  
    lblSafeguard.Text = ""  
End If  

C# Example:

if (m_spel.SafetyOn)  
    lblSafeguard.Text = "Safe guard is active";  
else  
    lblSafeguard.Text = "";  

ServerInstance Property, Spel Class

Description
Specifies which instance of Epson RC+ server to use.

Syntax
Property ServerInstance As Integer

Default Value
The default value is the next available server instance.

Remarks
The API communicates with an RC+ server process. ServerInstance specifies which server to use. Each server instance corresponds with one controller and one project. By default, when you create a new Spel class instance, the ServerInstance is automatically set to 1.
Sometimes you may want multiple instances of the Spel class for the same Controller, such as for multithreading in your application. In that case, you must set the ServerInstance property to the same value for each Spel class instance using the same controller.
ServerInstance must be between 1 and 10 and it must be set before executing Initialize or any other methods.

See Also
CommandTask, Initialize

ServerInstance Example
VB Example:

' Controller 1  
spel1 = New Spel  
spel1.ServerInstance = 1  
spel1.Initialize()  
spel1.Connect(1)  
  
' Controller 2  
spel2 = New Spel  
spel2.ServerInstance = 2  
spel2.Initialize()  
spel2.Connect(2)  

C# Example:

// Controller 1  
RCAPINet.Spel spel1 = new RCAPINet.Spel();  
spel1.ServerInstance = 1;  
spel1.Initialize();  
spel1.Connect(1);  
  
// Controller 2  
RCAPINet.Spel spel2 = new RCAPINet.Spel();  
spel2.ServerInstance = 2;  
spel2.Initialize();  
spel2.Connect(2);  

SPELVideoControl Property, Spel Class

Description
Used to connect a SPELVideo control to the Spel class instance so that video and graphics can be displayed.

Syntax
Property SpelVideoControl As SpelVideo

See Also
Graphics Enabled, VideoEnabled, Camera

SpelVideoControl Example
VB Example:

m_spel.SpelVideoControl = SpelVideo1  

C# Example:

m_spel.SpelVideoControl = SpelVideo1;  

Version Property, Spel Class

Description
Returns the current Epson RC+ 8.0 software version.

Syntax
ReadOnly Property Version As String

Return Value
String that contains the current Epson RC+ 8.0 software version.

Version Example
VB Example:

' Get version of software  
curVer = m_spel.Version  

C# Example:

// Get version of software  
curVer = m_spel.Version;  

WarningCode Property, Spel Class

Description
Returns Controller warning code.

Syntax
ReadOnly Property WarningCode As Integer

Return Value
Integer value that contains the current controller warning code.

See Also
WarningOn

WarningCode Example
VB Example:

If m_spel.WarningOn Then  
    lblWarningCode.Text = m_spel.WarningCode.ToString()  
Else  
    lblWarningCode.Text = ""  
End If  

C# Example:

if (m_spel.WarningOn)  
    lblWarningCode.Text = m_spel.WarningCode.ToString();  
else  
    lblWarningCode.Text = "";  

WarningOn Property, Spel Class

Description
Returns status of the Controller warning state.

Syntax
ReadOnly Property WarningOn As Boolean

Return Value
True if the Controller is in the warning state, False if not.

See Also
WarningCode

WarningOn Example
VB Example:

If m_spel.WarningOn Then  
    lblWarningStatus.Text = "ON"  
Else  
    lblWarningStatus.Text = "OFF"  
End If  

C# Example:

if (m_spel.WarningOn)  
    lblWarningStatus.Text = "ON";  
else  
    lblWarningStatus.Text = "OFF";