Determinate face basis edge after BRepPrimAPI_MakePrism.

Is it possible to determine the edge on the basis of which the face was generated after BRepPrimAPI_MakePrism?
For example, I have a wire of four edges(segments) - rectangle, then I make an BRepPrimAPI_MakePrism and want to determine on the basis of which specific edge this side face of the cube is formed?

Mikhail Sazonov's picture

Use the method Generated().

Caleb Smith's picture

Mikhail, thanks for response, but no, I meant something else, look at this:

Or another example:

Hmm...  const TopTools_ListOfShape& shapes = history->Generated() return only TopTools_ListOfShape (for example, faces) without links to base edges... Any ides?

Mikhail Sazonov's picture

const TopTools_ListOfShape& BRepPrimAPI_MakePrism::Generated (const TopoDS_Shape& S)

Mikhail Sazonov's picture

The methods Generated() (from prism) and Modified() (from BOP) you should use to follow the history of edges. What do you want is reverse procedure. So, you should remember the history in a map face-edge, which you fill in during following history of each edge.

Caleb Smith's picture

Mikhail Sazonov, hi again and thanks for reply! I know about Generated() and Modifies, but that's not exactly what I need, if you have ~6 min free time available, please watch my video-question about this topic, without a video it’s too difficult to explain what exactly I need: https://youtu.be/dm3TKy2bzwo

Mikhail Sazonov's picture

Hi Caleb, I understood your problem correctly and my answer is left as is.
May be it was too short for understanding.
Each operation has history of generation, modification and deletion of sub-shapes. The side face of prism is returned in the list by Generated() method applied to a base edge.
The BO has no generated shapes in the history. It is because it does not produce such operations. It can produce only modifications. So, the face of the tool prism in your example is Modified() into the face of the result of Cut operation. Or, it can be not modified, in which case it will be the Same() shape.
So, by using history you always can follow the history of modification/generation of an edge. In order to obtain a base edge for a face in the result you need to maintain your own data map.
I hope now it became more clear.

Caleb Smith's picture

I think, my trouble is that I am using ShapeFix_Face before extrude base face for reordering edges in correct way (sketch may contain many contours with holes). ShapeFix_Face removes almost all edges (all but the first), therefore the relationship with the base profile is lost. I think that I shouldn't use this tool and implement the algorithm for reversing the edges in correct direction manually.

"So, the face of the tool prism in your example is Modified() into the face of the result of Cut operation" - hmm...I'll go check it out, thanks!

Mikhail Sazonov's picture

ShapeFix_Face also stores the history inside its context (in instance of ShapeBuild_ReShape). You should use it to see what shape was modified to what other.

Caleb Smith's picture

wow wow, i wouldn't have guessed that history is kept in context. Well, you're just a god of OpenCASCADE, you know all :) Thanks!

Mikhail Sazonov's picture

OCCT has its own naming mechanism that allows maintaining a chain of operations with automatic recalculation of the result when some initial shape is modified. It is located in TNaming package. It is a part of OCAF (application framework).

Caleb Smith's picture

in fact, I don’t want to get too tied up in the cascade, because I want to be able to change the geometric kernel to another in the future, so I use the cascade by minimum, only "extrusions" and Boolean operations.

in the future, if I have enough time and don't die, I plan to develop my own geometric kernel on the distance field or a comprehensive BIM system on a revolutionary true artificial intelligence system, which I do in my free time, which will allow me to draw real-world level 3d graphics and recombine the objects of this world as you like ("dream generator"), will allow you to compress images and video streams with million times compression ratio, will ultimately allow you to write a code generator for any software using AI, but that’s a completely different story...

Laxminarayan Raja's picture

I have a somewhat dated question: What happened to the Voxelization feature in OpenCascade. If it is removed in the new releases, is it possible to perform voxelization from a objects CAD file, e.g. STEP file.