Reading and Writing array of Rapid
Hi,
How can I read and modify the array of Rapid in VB.net. My reading array program as folllows:
Dim RD As RapidData = Me.controller.Rapid.GetRapidData("T_ROB1", "MainModule", "array1")
If RD.IsArray Then
Dim AD As ArrayData = DirectCast(RD.Value, RapidDomain.ArrayData)
Dim ASum As Double = 0.0R
Dim ANum As RapidDomain.Num
For I As Integer = 1 To AD.Length
ANum = DirectCast(AD(I - 1), Num)
ASum += DirectCast(ANum.Value, Double)
Next
ANum = DirectCast(RD.ReadItem(1, 1), Num)
If RD.IsArray Then
Dim AD As ArrayData = DirectCast(RD.Value, RapidDomain.ArrayData)
Dim ASum As Double = 0.0R
Dim ANum As RapidDomain.Num
For I As Integer = 1 To AD.Length
ANum = DirectCast(AD(I - 1), Num)
ASum += DirectCast(ANum.Value, Double)
Next
ANum = DirectCast(RD.ReadItem(1, 1), Num)
I define the array in Rapid as "PERS num array1{2}:=[50,60];"
The program can not work , the error is "An argument specified by the client is not valid for this type of operation." to the instruction "ANum = DirectCast(RD.ReadItem(1, 1), Num)"
How Can I do? Thanks everyone
0
Comments
-
Shouldn't you use ReadItem(i) instead?You only have a 1-d array, also I think a RapidData object will be 0-based, while the RAPID ArrayData would be 1-based.Russell Drown0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 799 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings