Free dotNET Wrapper for OpenCascade 6.2

You will find a free dotNET wrapper for OpenCascade 6.2 in the open source community (new components):
http://www.opencascade.org/org/community/projects/?d_id=60

Colin Bulled's picture

This is a great piece of work !
But can you please explain how I get create a V3d_Viewer and attach it to my .net form from within c# ?

I can create a V3d_Viewer in C++, create an AIS_Shape and pass it a TopoDS_Shape. But I cant work out how to pass it a TopoDS.Shape from the wrapped dll.

Gerhard Hofmann's picture

Hello Colin,
unfortunately I don't have any experience with V3d and AIS packages. These packages are not included in our wrapper, althought it might be easy to add these packeges to the wrapper and generate new dlls. We will think about it.
Let me tell you how we do it: We create a windows form and attach an OpenGL rendering context to it. Then we get triangulation from the TopoDS.Shape objects and display them with OpenGL.
Gerhard

Jorge Roman Espino's picture

Could you post a code example?

Thank you

Jorge Roman Espino's picture

We are trying to make scenes with OpenCascade and finally render the scenes over bitmaps files. All our effort have been lost because all the ways we try need to use a windows form to represent the picture.

Our code is running as a web service so we haven't access to the display.

Do you know how to render a 3D OpenCascade scene over a bitmap objetc without use a control like panel and picturebox, or windows form?

Thank you.

Gerhard Hofmann's picture

I would convert the scene to VRML or X3D and let the user choose the view and scroll position. Conversion to VRML does not need a device context or windows form.
Gerhard

Jorge Roman Espino's picture

First of all, thank you very much for the replay Gerhard.

We have exported the scene to vrml but the problem we have encountered is the vrml export lose the colors, 3D text and lines for shirts. (Any idea about that situation?)

The clients are web clients and they haven't enought process capacity.

We are going to try the X3D format. Perhaps this format will be the solution.

Anyway, if you could show us how to represent the OCC shapes from your wrapper over a CImage or similar object, it wil be fantastic.

Jorge

Colin Bulled's picture

Hello Gerhard,
Have you had any more thoghts regarding adding V3d and AIS to your wrapper ?

Regards
Colin

Gerhard Hofmann's picture

sorry Colin, I had no time yet, just returning from vacation.
Do you know if there is any need for callback functions (OpenCascade code calling back to user code) in V3d or AIS modules? Because we don't implement that in the current wrapper generator.
Gerhard

Hesham Nasif's picture

Dear Gerhard
I have one problem when i am writing the gc classes. The problem is as follows, I can not define two classes to each other, it gives me error 2460
I am trying as follows
in the Trsf.h file writing that
Trsf(Trsf2d* T)
{
}
and in Trsf2d.h file i am writing
Trsf2d(Trsf* T)
{
}

so this is give recursive class error
Please if you have a suggestion i would appriciate that

Hesham Nasif's picture

Dear Gerhard
I have one problem when i am writing the gc classes. The problem is as follows, I can not define two classes to each other, it gives me error 2460
I am trying as follows
in the Trsf.h file writing that
Trsf(Trsf2d* T)
{
}
and in Trsf2d.h file i am writing
Trsf2d(Trsf* T)
{
}

so this is give recursive class error
Please if you have a suggestion i would appriciate that

Jorge Roman Espino's picture

Could you show us how to make the triangulation operation over a shape?

We know how to make the operation under c++, but we don't find the "wrapper" way. Could you help me with a code example?

Over c++ we have coded:

TopLoc_Location loc;
TopoDS_Face f = TopoDS::Face( ExFaces.Current());
ExFacss.Next();
Handle(Poly_Triangulation) tri = BRep_Tool::Triangulation(f, loc);

Jorge

OCC-ME's picture
OCC-ME's picture
Hesham Nasif's picture

Dear Gerhard
I have one problem when i am writing the gc classes. The problem is as follows, I can not define two classes to each other, it gives me error 2460
I am trying as follows
in the Trsf.h file writing that
Trsf(Trsf2d* T)
{
}
and in Trsf2d.h file i am writing
Trsf2d(Trsf* T)
{
}

so this is give recursive class error
Please if you have a suggestion i would appriciate that

Hesham Nasif's picture

Dear Gerhard
I have one problem when i am writing the gc classes. The problem is as follows, I can not define two classes to each other, it gives me error 2460
I am trying as follows
in the Trsf.h file writing that
Trsf(Trsf2d* T)
{
}
and in Trsf2d.h file i am writing
Trsf2d(Trsf* T)
{
}

so this is give recursive class error
Please if you have a suggestion i would appriciate that

Hesham Nasif's picture

Dear Gerhard
I have one problem when i am writing the gc classes. The problem is as follows, I can not define two classes to each other, it gives me error 2460
I am trying as follows
in the Trsf.h file writing that
Trsf(Trsf2d* T)
{
}
and in Trsf2d.h file i am writing
Trsf2d(Trsf* T)
{
}

so this is give recursive class error
Please if you have a suggestion i would appriciate that

P Dolbey's picture

Why is that recursive - all that says is that you have defined two classes, each of which can be constructed from a pointer to the other. What you should be looking for are circular references in the class definition, e.g. class Trsf2d : public Trsf;

Have you forward referenced the classes to each other as needed?

Pete

Hesham Nasif's picture

Dear Pete
Thanks for your kind reply, what i tried your suggesstion but still with a Error, i want to forward referenced classes to each other

P Dolbey's picture

Have you tried a Trsf.h file that looks like

class Trsf2d;
class Trsf
{
public:
Trsf(Trsf2d* T);
.
.
};

and Trsf2d.h
class Trsf2d;
class Trsf2d
{
public:
Trsf2d(Trsf* T);
.
.
};

with the actual #include "Trsf2d.h" in Trfg.cpp and vice versa?

Pete

P Dolbey's picture

For the seconf bit, that should have read

class Trsf;
class Trsf2d
{
public:
Trsf2d(Trsf* T);
.
.
};

Hesham Nasif's picture

Dear Gerhard
First of all i would like to express my thanks to you at early time help. I almost finish one application using OCC, it is not commericial but rather it is help for creating some geometrical model for other code. I wanted to ask you a question, and i am willing your answer as usual. How can i put my code into other machine does not have OCC on it
Best. My E-mail address has been changed to that one
Hesham