dumped_box = shape_factory.getBox(10., 10., 10.)
    box = pickle.loads(dumped_box)
    display.DisplayShape(box)


def get_sphere(event=None):
    shape_factory = xmlrpclib.ServerProxy(xmlrpc_address)
    dumped_sphere = shape_factory.getSphere(50.)
    sphere = pickle.loads(dumped_sphere)
    display.DisplayShape(sphere)


# def get_surface_from_revolution(event=None):
#     shape_factory = xmlrpclib.ServerProxy("http://localhost:8888")
#     dumped_surf = shape_factory.getSurfaceFromRevolution()
#     surf = pickle.loads(dumped_surf)
#     display.DisplayShape(surf)


def exit(event=None):
    sys.exit()


if __name__ == '__main__':
    add_menu('geometry')
    add_function_to_menu('geometry', get_box)
    add_function_to_menu('geometry', get_sphere)
    # add_function_to_menu('geometry',get_surface_from_revolution)
    add_function_to_menu('geometry', exit)
    start_display()
Exemplo n.º 2
0
        curve1 = GeomAPI_PointsToBSpline(point_list_1(surf.points)).Curve()
        curve1.GetObject()
        e1 = Edge(curve1.GetHandle())
        display.DisplayShape(e1)
        #face1 = make_face(surf1.GetHandle())
        #display.DisplayShape(face1)
    def test_extract_shape_vertices(self):
        clear()
        occ_shape = BRepPrimAPI_MakeBox(Point(0, 0, 0), Point(1, 1, 1)).Shape()
        display.DisplayShape(occ_shape)
        temp_points = extract_shape_vertices(occ_shape)
        self.assertTrue(len(temp_points) > 0)
        surf = Surface()
        surf.shape = occ_shape
        surf.points = temp_points
        surf.approximate()


if __name__ == "__main__":
    #unittest.main()
    #exit()
    from OCC.Display.wxSamplesGui import add_function_to_menu, add_menu, start_display
    add_menu("demo")
    add_function_to_menu("demo", TestApproximation.test_stl)
    add_function_to_menu("demo", demo)
    add_function_to_menu("demo", clear)
    add_function_to_menu("demo", ask_user)
    add_function_to_menu("demo", exit_app)
    init_display()
    start_display()
Exemplo n.º 3
0
        from OCC.Display.wxSamplesGui import add_function_to_menu, add_menu, start_display
        add_menu('demo')
        for f in [
                    add_valid_lego,
                    draw_all_tangents,
                    draw_random_line,
                    draw_random_arc,
                    line_arc_line_path,
                    random_cone,
                    random_sweep,
                    make_arrow,
                    chain_arrows,
                    coordinate_arrows,
                    #test_coordinate_arrows,
                    show_interfaces,
                    make_lego,
                    add_lego,
                    clear,
                    save,
                    exit
                    ]:
            add_function_to_menu('demo', f)
        #random_sweep()
        init_display()
        make_lego()
        add_lego()
        coordinate_arrows()
        #test_transformation()
        start_display()
        
Exemplo n.º 4
0
        curve1 = GeomAPI_PointsToBSpline(point_list_1(surf.points)).Curve()
        curve1.GetObject()
        e1 = Edge(curve1.GetHandle())
        display.DisplayShape(e1)
        #face1 = make_face(surf1.GetHandle())
        #display.DisplayShape(face1)
    def test_extract_shape_vertices(self):
        clear()
        occ_shape = BRepPrimAPI_MakeBox(Point(0,0,0), Point(1,1,1)).Shape()
        display.DisplayShape(occ_shape)
        temp_points = extract_shape_vertices(occ_shape)
        self.assertTrue(len(temp_points)>0)
        surf = Surface()
        surf.shape = occ_shape
        surf.points = temp_points
        surf.approximate()

if __name__ == "__main__":
    #unittest.main()
    #exit()
    from OCC.Display.wxSamplesGui import add_function_to_menu, add_menu, start_display
    add_menu("demo")
    add_function_to_menu("demo", TestApproximation.test_stl)
    add_function_to_menu("demo", demo)
    add_function_to_menu("demo", clear)
    add_function_to_menu("demo", ask_user)
    add_function_to_menu("demo", exit_app)
    init_display()
    start_display()

Exemplo n.º 5
0
if __name__ == '__main__':
    from OCC.Display.wxSamplesGui import add_function_to_menu, add_menu, start_display
    add_menu('demo')
    for f in [
            add_valid_lego,
            draw_all_tangents,
            draw_random_line,
            draw_random_arc,
            line_arc_line_path,
            random_cone,
            random_sweep,
            make_arrow,
            chain_arrows,
            coordinate_arrows,
            #test_coordinate_arrows,
            show_interfaces,
            make_lego,
            add_lego,
            clear,
            save,
            exit
    ]:
        add_function_to_menu('demo', f)
    #random_sweep()
    init_display()
    make_lego()
    add_lego()
    coordinate_arrows()
    #test_transformation()
    start_display()
xmlrpc_address = "http://jelleferinga.com/pythonocc_xmlrpc"

def get_box(event=None):
    shape_factory = xmlrpclib.ServerProxy(xmlrpc_address)
    dumped_box = shape_factory.getBox(10.,10.,10.)
    box = pickle.loads(dumped_box)
    display.DisplayShape(box)

def get_sphere(event=None):
    shape_factory = xmlrpclib.ServerProxy(xmlrpc_address)
    dumped_sphere = shape_factory.getSphere(50.)
    sphere = pickle.loads(dumped_sphere)
    display.DisplayShape(sphere)

# def get_surface_from_revolution(event=None):
#     shape_factory = xmlrpclib.ServerProxy("http://localhost:8888")    
#     dumped_surf = shape_factory.getSurfaceFromRevolution()
#     surf = pickle.loads(dumped_surf)
#     display.DisplayShape(surf)
    
def exit(event=None):
    sys.exit()
    
if __name__=='__main__':
    add_menu('geometry')
    add_function_to_menu('geometry',get_box)
    add_function_to_menu('geometry',get_sphere)
    # add_function_to_menu('geometry',get_surface_from_revolution)
    add_function_to_menu('geometry',exit)
    start_display()