Esempio n. 1
0
def _thicksolid(proto, t, refs):
    facesToRemove = TopTools_ListOfShape()

    for p in refs:
        facesToRemove.Append(_near_face(proto, p).Face())

    algo = BRepOffsetAPI_MakeThickSolid()
    algo.MakeThickSolidByJoin(proto.Shape(), facesToRemove, t, 1.e-3)

    return Shape(algo.Shape())
Esempio n. 2
0
def thick_solid(event=None):
    S = BRepPrimAPI_MakeBox(150, 200, 110).Shape()

    topo = TopologyExplorer(S)
    vert = next(topo.vertices())

    shapes = TopTools_ListOfShape()
    for f in topo.faces_from_vertex(vert):
        shapes.Append(f)

    _thick_solid = BRepOffsetAPI_MakeThickSolid(S, shapes, 15, 0.01)
    display.EraseAll()
    display.DisplayShape(_thick_solid.Shape())
    display.FitAll()
anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl1)
anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2)
anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment.Value(), aCyl2)

threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1.Edge(),
                                         anEdge2OnSurf1.Edge())
threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2.Edge(),
                                         anEdge2OnSurf2.Edge())

# Compute the 3D representations of the edges/wires
breplib.BuildCurves3d(threadingWire1.Shape())
breplib.BuildCurves3d(threadingWire2.Shape())

# Create the surfaces of the threading
aTool = BRepOffsetAPI_ThruSections(True)
aTool.AddWire(threadingWire1.Wire())
aTool.AddWire(threadingWire2.Wire())
aTool.CheckCompatibility(False)
myThreading = aTool.Shape()

# Build the resulting compound
bottle = TopoDS_Compound()
aBuilder = BRep_Builder()
aBuilder.MakeCompound(bottle)
aBuilder.Add(bottle, myBody_step3.Shape())
aBuilder.Add(bottle, myThreading)
print("bottle created")

export_shape_to_svg(bottle, "./test_mypy_classic_occ_bottle.svg")
write_step_file(bottle, "./test_mypy_classic_occ_bottle.stp")