def offset_cube(event=None):
    S2 = BRepPrimAPI_MakeBox(gp_Pnt(300, 0, 0), 220, 140, 180).Shape()
    offsetB = BRepOffsetAPI_MakeOffsetShape(S2, -20, 0.01, BRepOffset_Skin, False, False, GeomAbs_Arc)
    offB = display.DisplayColoredShape(S2, 'BLUE')
    display.Context.SetTransparency(offB, 0.3)
    display.DisplayColoredShape(offsetB.Shape(), 'GREEN')
    display.FitAll()
Ejemplo n.º 2
0
def make_offset_shape(shapeToOffset,
                      offsetDistance,
                      tolerance=TOLERANCE,
                      offsetMode=BRepOffset_Skin,
                      intersection=False,
                      selfintersection=False,
                      joinType=GeomAbs_Arc):
    """
    builds an offsetted shell from a shape
    construct an offsetted version of the shape
    """
    from OCC.BRepOffsetAPI import BRepOffsetAPI_MakeOffsetShape
    try:
        offset = BRepOffsetAPI_MakeOffsetShape(shapeToOffset, offsetDistance,
                                               tolerance, offsetMode,
                                               intersection, selfintersection,
                                               joinType)
        if offset.IsDone():
            return offset.Shape()
        else:
            return None
    except RuntimeError('failed to offset shape'):
        return None
Ejemplo n.º 3
0
def offSetShell(shape):
    b = BRepOffsetAPI_MakeOffsetShape(solid, -0.15, 0, False, False)
    b.Build()
    return b.Shape()