
Thu, 06/29/2006 - 14:39
Hi,
I want to use C# to make a shape and get the handle of the shape.
I try to modify the shell of C# sample, but have no idea how to return Handle_AIS_InteractiveObject to C#?
Anyone can help me?
Thanks.
==========================================
In OCCViewer:
Handle_AIS_InteractiveObject OCCViewer::MakeCircle(float x, float y, float z, float i, float j, float k, float d)
{
gp_Ax2 Ax(gp_Pnt(x, y, z), gp_Dir(i, j, k));
gp_Circ Cir(Ax, d);
TopoDS_Edge c = BRepBuilderAPI_MakeEdge(Cir);
Handle(AIS_Shape) myCircle = new AIS_Shape(c);
myAISContext->SetDisplayMode(myCircle, 1);
myAISContext->Display(myCircle);
return myCircle;
}
In shell:
void MakeCircle(float x, float y, float z, float i, float j, float k, float d)
{
if (myOCCViewer != NULL)
{
Handle(AIS_InteractiveObject) h_Object = myOCCViewer->MakeCircle(x, y, z, i, j, k, d);
//??????????? how to return h_Object;
}
}
Thu, 06/29/2006 - 14:48
I think the point is to use shell instead of transferring objects to C#. That's what the wrapper is for.
At least this is the way I do it. I'm not saying this impossible but I guess you would need a C# wrapper for the OC class otherwise.
Pawel
Thu, 06/29/2006 - 20:35
Hi Jack,
You can download an example Visual Studio 2005 (.NET Framework v2.0) project I have created from: -
http://www.myxyz.co.uk/Downloads/Development/
(the path is case sensitive and it contains about 20Mb of files)
Its a simple Windows form hosting a OpenCASCADE window with a rotating sphere created on a thread.
(The debug folder also contains all the runtime .dll files, including the OpenCASCADE v5.2 runtime files)
I am currently working on support for the new OpenCASCADE v6.1.0 release.
Let me know if you have any comments or queries.
Jonathan
Tue, 08/15/2006 - 16:48
Hi,
I generated C# wrapper from CDL files. To be platform independant I use PInvoke. Some of it is discussed here:
http://www.opencascade.org/org/forum/thread_8927/
You can also download a trial version of CADability from http://www.sofa.de which includes this wrapper machanism. You only need these two dlls: "OpenCascade.dll", which is a C# class library that you can browse and "OCasToCSharp.dll" which is a plain C++ dll that is accessed from opaencascade.dll.
There is only a subset of the CDL files converted, just those parts we need ourselves, but since conversion is done automatically, we could wrap any classes.
I would be glad to get some feedback.
Gerhard