tags:

views:

57

answers:

1

How can we translate this C# code:

Mesh m7 = new Mesh();

m7.MakeFace(new ICurve[] {(ICurve) redLp }, 
            new ICurve[][] { new ICurve[] { circle } }, Plane.XY, tol, true);

To Managed C++?

Thanks!

A: 
array<ICurve^>^ ar1 = gcnew array<ICurve^> { redLp };
array<array<ICurve^>^>^ ar2 = gcnew array<array<ICurve^>^>{
  gcnew array<ICurve^> { circle }
  }; 

IList<ICurve^>^ list1 = gcnew List<ICurve^>(ar1);
IList<IList<ICurve^>^>^ list2 = gcnew List<IList<ICurve^>^>();
list2->Add( gcnew List<ICurve^>(ar2[0]) );

Mesh^ m7 = gcnew Mesh();
m7->MakeFace( list1, list2, Plane::XY, tol, true);

Note: it might be possible that Plane::XY should be Plane.XY, or Plane->XY but i assumed an Enum.

ngoozeff
@ngoozeff: I get the following error when I compile the Visual Studio project: error C2664: 'void Mesh::MakeFace(System::Collections::Generic::IList<T> ^,System::Collections::Generic::IList<System::Collections::Generic::IList<T> ^> ^,devDept::Geometry::Plane ^,double,bool)' : cannot convert parameter 1 from 'cli::array<Type> ^' to 'System::Collections::Generic::IList<T> ^'
devdept
@devdept: updated answer to reflect new info.
ngoozeff
@ngoozeff: Now this is the compilation error: "error C2872: 'IList' : ambiguous symbol" at the following line: IList<ICurve^>^ list1 = gcnew List<ICurve^>(ar1);
devdept
@devdept: you might have both "using namespace System::Collections::Generic;" and "using namespace System::Collections;" at the top of your cpp. If you look in the Output window, it should say what is causing the ambiguity.
ngoozeff
@ngoozeff: using both:using namespace System::Collections;using namespace System::Collections::Generic;but the error is always the C2872 reported above... Thanks for the help provided so far.
devdept
@devdept: sorry, should have been more clear. You should only have the Generic namespace.
ngoozeff
@ngoozeff: Nothing changes, sorry.
devdept