Example #1
0
def make_lens(body, face1, face2):
    splitter = BOPAlgo_Splitter()
    splitter.AddArgument(body)
    splitter.AddTool(face1)
    splitter.AddTool(face2)
    splitter.Perform()
    print(splitter.Arguments())
    print(splitter.ShapesSD())
    exp = TopExp_Explorer(splitter.Shape(), TopAbs_SOLID)
    shp = []
    while exp.More():
        print(exp.Current())
        shp.append(exp.Current())
        exp.Next()
    return shp
Example #2
0
    axs = gp_Ax3()
    ax1 = gp_Ax3(gp_Pnt(0, 0, -10), axs.Direction())
    vec = gp_Vec(gp_Pnt(0, 0, -10), gp_Pnt(0, 0, 10))
    face = obj.make_EllipWire(rxy=[50.0, 50.0], axs=ax1, skin=0)
    body = BRepPrimAPI_MakePrism(face, vec).Shape()
    data1 = (mesh[0]**2 / 750 + mesh[1]**2 / 750) + 6.0
    data2 = (mesh[0]**2 / 1000 + mesh[1]**2 / 1000) - 6.0
    face1 = spl_face(*mesh, data1, axs=axs)
    face2 = spl_face(*mesh, data2, axs=axs)

    splitter = BOPAlgo_Splitter()
    splitter.AddArgument(body)
    splitter.AddTool(face1)
    splitter.AddTool(face2)
    splitter.Perform()
    print(splitter.Arguments())
    print(splitter.ShapesSD())
    exp = TopExp_Explorer(splitter.Shape(), TopAbs_SOLID)
    shp = []
    while exp.More():
        print(exp.Current())
        shp.append(exp.Current())
        exp.Next()

    obj.show_axs_pln(axs, scale=20)
    obj.display.DisplayShape(face1, transparency=0.9, color="RED")
    obj.display.DisplayShape(face2, transparency=0.9, color="BLUE")
    obj.display.DisplayShape(shp[1])
    # obj.display.DisplayShape(splitter.Shape())
    # obj.display.DisplayShape(sol)
    obj.show()