Thicken face in normal direction


Does anyone know how to add thickness to a face by its normal direction?

I cannot use the Prism function as I want it in the normal direction of the face over the whole surface.

I've tried the BRepOffsetAPI_MakeOffsetShape

and the BRepOffsetAPI_MakeThickSolid

I always just end up with the only the offset face and not a solid.

Niels Nielsen's picture

For reference here is the solution using PythonOCC.

In the line "solid.Initialize(f1,1.0,1.e-5,BRepOffset_Skin,False,False,GeomAbs_Intersection,True)" take care of the last "True" as that enables the thickening.

#!/usr/bin/env python

from import gp_Pnt
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeFace
from OCC.GeomAbs import GeomAbs_Intersection
from OCC.BRepOffset import BRepOffset_MakeOffset,BRepOffset_Skin

from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()

def faceExtrude():
    p1 = gp_Pnt(0,0,0)
    p2 = gp_Pnt(10,0,0)
    p3 = gp_Pnt(10,10,0)
    p4 = gp_Pnt(0,10,0)

    e1 = BRepBuilderAPI_MakeEdge(p1,p2).Edge()
    e2 = BRepBuilderAPI_MakeEdge(p2,p3).Edge()
    e3 = BRepBuilderAPI_MakeEdge(p3,p4).Edge()
    e4 = BRepBuilderAPI_MakeEdge(p4,p1).Edge()

    w1 = BRepBuilderAPI_MakeWire(e1,e2,e3,e4).Wire()

    f1 = BRepBuilderAPI_MakeFace(w1).Face()

    solid = BRepOffset_MakeOffset()
    solid.Initialize(f1,1.0,1.e-5,BRepOffset_Skin,False,False,GeomAbs_Intersection,True) #The last True is important to make solid
    aShape = solid.Shape()

    display.DisplayShape(f1, update=False)
    display.DisplayShape(aShape, update=True)

if __name__ == '__main__':