Arrays Rank and dimensions

labu
✭✭
Hi,
I know the question has already been placed by Antoine but without any answer.
When a rapiddata returns IsArray, is there a way to know the rank and size of each dimensions.
there is a not too dirty solution with try/catch to get the number of dimensions (copied hereunder) but I do not see an acceptable workaround for the sizes.
As this information is available under the debug window via the dimensions int[] it should be possible to reach it from the application.

Any help warmly welcomed.
BR
Laurent
Note: Code to find an array number of dimensions
static int NbDim(RapidData d)
{
string s;
try
{
s=d.ReadItem(1).ToString();
return 1;
}
catch
{
try
{
s=d.ReadItem(1,1).ToString();
return 2;
}
catch
{
try
{
s=d.ReadItem(1,1,1).ToString();
return 3;
}
catch
{
try
{
s=d.ReadItem(1,1,1,1).ToString();
return 4;
}
catch
{
return -1;
}
}
}
}
}
I know the question has already been placed by Antoine but without any answer.
When a rapiddata returns IsArray, is there a way to know the rank and size of each dimensions.
there is a not too dirty solution with try/catch to get the number of dimensions (copied hereunder) but I do not see an acceptable workaround for the sizes.
As this information is available under the debug window via the dimensions int[] it should be possible to reach it from the application.

Any help warmly welcomed.
BR
Laurent
Note: Code to find an array number of dimensions
static int NbDim(RapidData d)
{
string s;
try
{
s=d.ReadItem(1).ToString();
return 1;
}
catch
{
try
{
s=d.ReadItem(1,1).ToString();
return 2;
}
catch
{
try
{
s=d.ReadItem(1,1,1).ToString();
return 3;
}
catch
{
try
{
s=d.ReadItem(1,1,1,1).ToString();
return 4;
}
catch
{
return -1;
}
}
}
}
}
0
Categories
- All Categories
- 5.4K RobotStudio
- 375 UpFeed
- 15 Tutorials
- 12 RobotApps
- 286 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 241 ScreenMaker
- 2.7K Robot Controller
- 266 IRC5
- 40 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 721 RAPID Programming
- 15 Wizard Easy Programming
- 107 Collaborative Robots
- 3 Job listings