BRepPrimAPI_MakePrism strange behaviour


I use this function to create a solid. So I need a face. Depending on how is created the wire to get the face, I am getting different result.
The wire is defined in 'YZ' plane and extruded in X direction during 'Length' distance.

Case 1: If wire is defined clockwise, my solid has faces REVERSED with UV coordinated from (-length) to (0)
Case 2: If wire is defined anticlockwise, my solid has faces FORWARD with UV coordinated from (0) to (length).
This is what I want, but, in this case, when I display the solid, it is magically moved length in X axis, so my solid goes from Length to 2*length, instead of from 0 to length, like in case 1.

Does anybody know why it is happening?

Roman Lygin's picture

Hi arkoala,

Not sure if I fully got your problem. Does your solid display incorrectly, or is your only concern about internal parameterization ?
Anyway, you should not make strong assumptions on internal parameterization range. It is guaranteed to be from P to P+length but P can be different. I don't remember exactly, but lateral faces can likely be constructed with different geometries (e.g. planar, cylindrical or generic surface of linear extrusion). You just have to ensure that your base wire and face has correct orientations before you extrude, and then work with lateral faces in their own individual ranges.

--- - blog on Open CASCADE

arkoala's picture

I think I explained very bad my problem.

Depending on the wire direction definition I get correct U coordinates or reversed coordinated which I get surprised.

But, if wire definition is the correct one (in my case, anticlockwise), I get a strange thing. My solid is translated the same distance than the MakePrism function, why?

That is I define the face on YZ plane (X=0), and MakePrims gets (1000, 0, 0) vector.
1.- If the wire is clockwised, my solid goes from 0 to 1000 in X axis, but faces are wrong.
2.- If the wire is anticlockwised, my solid has good faces, but it goes from 1000 to 2000 in X axis. (If the vector is (-1000, 0, 0), the solid goes from 0 to -1000).

There are no any instruction to translate an object in the whole application, so it is very strange. Are there any reason to do that?

I am getting and compiling OCC6.3.0 and forget v6.2.0, maybe it was a small error fixed...

Jeff Moody's picture

I had a similar issue where it didn't appear to be duplicating the front surface to the back (when extruding in the z direction).
In order to make a prism from the wire correctly, I had to set the copy parameter of the BRepPrimAPI_MakePrism constructor to true. E.g.:

TopoDS_Face face = BRepBuilderAPI_MakeFace(wire, Standard_True);
TopoDS_Shape shape = BRepPrimAPI_MakePrism(face, gp_Vec(1000, 0, 0), Standard_True);

arkoala's picture

Tried, but without success.

It was an easy test, but nothing happened. Tested even with 6.3.0

I refuse to translate back the solid!

arkoala's picture

Sorry for your time. It was my fault.

I got confused between top and bottom faces, and when I was re-doing the shape, I did it from the end of the previous solid, so I translated the solid in a complicated way.

Remove this nonsense thread if you consider it.