Projection of a TopoDS_Wire on a TopoDS_Face

Hi,

I am trying to do a projection of a TopoDS_Wire on a TopoDS_Face.
So far I tried to use BrepOffsetAPI_NormalProjection, but it seems to work only on 2D surfaces.
Now if I want to use GeomProjLib::Project, how can I convert the wire in a Geom_Curve and the face in Geom_Surface?
Or is there any better way of calculating the projection? In result I am looking for a wire that is conformal to the surface and can be evolved.

Regards,

Udo

Hugues's picture

Use class BRep_Tool and its static functions to translate topology entities to geometric entities.
There are functions "Curve" and "Surface".
To translate a TopoDS_Wire, I think you will need to iterate on the edges of that wire and translate them to Geom_Curve objects.
Use class TopExp_Explorer to iterate on a topology entity.

Udo's picture

Thanks a lot, like most of the time it is easy if you know the right class. I am learned a lot of the API until now. But still there are a lot of questions...

Udo's picture

As for now I am able to do the projection using: Handle(Geom_Curve) projection = GeomProjLib::Project(aCurve, aSurface);. But actually I just want the part of the edge that is in the range of the face that I am currently looking at. Now it is just doing the projection to the plane the face is lying in. I guess Curve2d is doing such a thing but I would not expect a 2D curve as the result? What point am I missing here?

Regards,

Udo

Hugues's picture

Hi,

I have never tried to project a curve on a surface with OCC. I have just taken a look at the implementation file of GeomProjLib(look at src/GeomProjLib/GeomProjLib.cxx).
Static function "GeomProjLib::Project" makes use of class "ProjLib_CompProjectedCurve".
You should consider and test this class, see its interface(the CDL file), particularly routines "FirstParameter" and "LastParameter". They seem to give what you want.

Udo's picture

Thank you, it seems to be necessary to go through the implementation of commands from time to time. I found that my face is handled by the
if ( AS.GetType() == GeomAbs_Plane) {
ProjLib_ProjectOnPlane Proj( AS.Plane().Position());
[...]
part of GeomProjLib::Project.
This would explain the result of receiving a projection on planes. However, I do not understand why I receive a GeomAbs_Plane instance when I call:
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aCurrentFace);
Here the sourcecode does not give any hints. Any suggestions?

Regards,

Udo

Hugues's picture

Are you working with a curve and a plane?
If so what is the problem then?

Udo's picture

No, actually I am working with a TopoDS_Wire and a TopoDS_Face. I imported a STEP file and used a Face Explorer to apply the projection to every face with a normal with positiv z-component.
I then use Brep_Tool and a wire explorer to transform the wire to a Geom_Curve and Brep_Tool::Surface to transform the face into a surface.
Of course the face is lying in a plane, but I am only interested in the projection on that part of the the face wich is really forming my shell of the current AIS_Shape, i.e. the imported STEP file.