Extrude custom profile

Hi guys! How i can to extrude custom 2D profile with holes in OCC, like in solidworks? 

 

 

Attachments: 
P G's picture

Use BRepPrimAPI_MakePrism class , prior to that build your face using the input set of wires( 2D profile). 

P G's picture

Use BRepPrimAPI_MakePrism class , prior to that build your face using the input set of wires( 2D profile). 

Malcolm Revenge's picture

Thanks bro, I realized how to extrude out the profile, but now I have another question, how to extrude a profile with holes? That is, there is an external profile and several circles inside (or rectangles)....

This is my code without holes. How to make face with holes? 

BRepBuilderAPI_MakePolygon polygon;
    polygon.Add(gp_Pnt(0, 0, 0));
    polygon.Add(gp_Pnt(-5, 0, 0));
    polygon.Add(gp_Pnt(-5, 0, -5));
    polygon.Add(gp_Pnt(-10, 0, -5));
    polygon.Add(gp_Pnt(-10, 0, -10));
    polygon.Add(gp_Pnt(0, 0, -10));
    polygon.Close();

 
    TopoDS_Wire wire = polygon.Wire();
    TopoDS_Face face = BRepBuilderAPI_MakeFace(wire);    
    TopoDS_Shape shape = BRepPrimAPI_MakePrism(face, gp_Vec(0, 10, 0));
P G's picture

Hi, I do not have access to api documentation of makeFace but you could add your circles (make wire out of it) to the face made from outer profile before sending it to makePrism API.
Good luck

Malcolm Revenge's picture

i found: 

BRepBuilderAPI_MakeFace::Add function do it.

But now new problem, how to get edges of one face? I need just simple collction of 3d lines (for drawing in custom OpenGL engine)

Any ideas?