cli::array help please

Greetings,

Having problem with multidimensional array for C++/CLI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Got a 2x3 array
cli::array<double,2> ^points = gcnew cli::array<double,2>(2,3);

// populate it
points[0,0] = 10.0;
points[0,1] = 20.0;
points[0,2] = 30.0;
points[1,0] = 100.0;
points[1,1] = 200.0;
points[1,2] = 300.0;

// now here's my problem
cli::array<double> ^point = gcnew cli::array<double>(3);
point = point[0];


How can I access to copy the first array of a 2d array into a 1d array?

Help is always greatly appreciated!
What are u trying to do again? I can help but dont understand the question.
I'm kinda guessing at what you're after try this:
1
2
3
4
for(int i=0;i<3;i++)//point = point[0];
{
	point[i] = points[0,i];
}
The CAD API prototype is

 
Vec3->Copy(cli::array<double> ^src, cli::array<double> ^dest);


I have a cli::array<double,2> ^points, contains two 1d arrays of xyz coordinates, so for the function call I tried;

1
2
cli::array<double> ^point = gcnew cli::array<double>(3);
Vec3->Copy(points[0],  point); // copying the first point coordinates to a 1d array 


This is copying the first index of 3 elements from a 2-dimensional array into a 1d array.

For native C++ version I would have done the following for the CAD API function prototype
UF_VEC3_copy(double src[], double dest[]).

1
2
3
double points[2][3];
double point[3];
UF_VEC3_copy(points[0], point);


But I'm moving on to the Managed version of the CAD API.

Thanks again.
Not sure but pretty confident you can't use array:copy for multidimensional arrays. that's why i presented the loop. I'll post back.
Topic archived. No new replies allowed.