Ejemplo n.º 1
0
    vd.filter_graph(pi_filt)

    of = ovd.Offset(
        vd.getGraph())  # pass the created graph to the Offset class
    ofs_list = []
    t_before = time.time()
    for t in [0.01 * x for x in range(1, 30)]:
        ofs = of.offset(t)
        ofs_list.append(ofs)
    t_after = time.time()
    oftime = t_after - t_before

    print("offset done in %s" % oftime)

    for ofs in ofs_list:
        offset2vtk.drawOffsets2(myscreen, ofs)

    oftext = ovdvtk.Text()
    oftext.SetPos((50, 100))
    oftext_text = "Offset in {0:.3f} s CPU time.".format(oftime)
    oftext.SetText(oftext_text)
    myscreen.addActor(oftext)

    # turn off vd
    pi_filt = ovd.PolygonInterior(True)
    vd.filter_graph(pi_filt)

    vod.setVDText2(times)
    vod.setAll()

    # for v in vd.getFaceVertices(14705):
Ejemplo n.º 2
0
    segs = ttt_segments("L", 40000)
    # segs = translate(segs, -0.06, 0.05)
    segs = modify_segments(segs)

    times = insert_many_polygons(vd, segs)
    print "all sites inserted. "
    print "VD check: ", vd.check()

    pi = ovd.PolygonInterior(True)
    vd.filter_graph(pi)

    of = ovd.Offset(
        vd.getGraph())  # pass the created graph to the Offset class
    ofs_dist = 0.0001
    ofs = []
    for n in range(50):
        ofsx = of.offset(ofs_dist)  # generate offsets at the given distance.
        ofs.extend(ofsx)
        ofs_dist = ofs_dist + 0.0001

    offset2vtk.drawOffsets2(myscreen, ofs)  # draw the generated offsets

    # ma = ovd.MedialAxis(1)
    # vd.filter_graph(ma)

    vod.setVDText2(times)
    vod.setAll()
    print "PYTHON All DONE."
    myscreen.render()
    myscreen.iren.Start()
Ejemplo n.º 3
0
    vod.vertexRadius = 0.0031
    vod.drawVertices=0
    vod.drawVertexIndex=0
    vod.drawGenerators=0
    vod.offsetEdges = 0
    vd.setEdgeOffset(0.05)
    times = insert_many_polygons(vd,svgr)

    print "all sites inserted. "
    print "VD check: ", vd.check()

    pi = ovd.PolygonInterior(  True )
    vd.filter_graph(pi)

    of = ovd.Offset( vd.getGraph() ) # pass the created graph to the Offset class
    step = svgr.radius *.01
    ofs_dist= step
    ofs = []
    for n in range(15):
        ofsx = of.offset(ofs_dist) # generate offsets at the given distance.
        ofs.extend(ofsx)
        ofs_dist = ofs_dist + step
    offset2vtk.drawOffsets2(myscreen, ofs) # draw the generated offsets
    #ma = ovd.MedialAxis(1)
    #vd.filter_graph(ma)
    vod.setVDText2(times)
    vod.setAll()
    print "PYTHON All DONE."
    myscreen.render()   
    myscreen.iren.Start()
                                     (zmult + 1) * camPos)
    myscreen.camera.SetFocalPoint(0.0, 0, 0)

    import sys
    filename = "star2_scaled.dxf"
    offset_distance = 0.1
    sys.argv = ["dummy", filename, offset_distance]

    import pycam.Importers.DXFImporter as importer
    print "reading from DXF-file: ", sys.argv[1]
    model = importer.import_model(sys.argv[1])
    model.revise_directions()

    # draw the input geometry
    point_set, line_set = _polygons_to_line_set(model.get_polygons())
    offset2vtk.drawLinesegs(myscreen, point_set, line_set)

    first_offset = 0.03
    second_offset = 0.015
    interior = True
    N_offsets = -1
    offset_loops = pocket_model(model.get_polygons(), first_offset,
                                second_offset, interior, N_offsets)
    #offset2vtk.drawOffsets( myscreen, offset_loops)

    offset2vtk.drawOffsets2(myscreen, offset_loops)

    print "PYTHON All DONE."
    myscreen.render()
    myscreen.iren.Start()
Ejemplo n.º 5
0
    # times = insert_many_polygons(vd,segs)
    # print "all sites inserted. "
    # print "VD check: ", vd.check()

    pi = ovd.PolygonInterior(True)
    vd.filter_graph(pi)

    of = ovd.Offset(vd.getGraph())  # pass the created graph to the Offset class
    ofs_list = []
    t_before = time.time()
    for t in [0.0003 * x for x in range(1, 20)]:
        ofs = of.offset(t)
        ofs_list.append(ofs)

    t_after = time.time()
    oftime = t_after - t_before
    for ofs in ofs_list:
        offset2vtk.drawOffsets2(myscreen, ofs)

    oftext = ovdvtk.Text()
    oftext.SetPos((50, 100))
    oftext_text = "Offset in {0:.3f} s CPU time.".format(oftime)
    oftext.SetText(oftext_text)
    myscreen.addActor(oftext)

    vod.setVDText2(times)
    vod.setAll()
    print "PYTHON All DONE."
    myscreen.render()
    myscreen.iren.Start()
    import sys

    filename = "star2_scaled.dxf"
    offset_distance = 0.1
    sys.argv = ["dummy", filename, offset_distance]

    import pycam.Importers.DXFImporter as importer

    print "reading from DXF-file: ", sys.argv[1]
    model = importer.import_model(sys.argv[1])
    model.revise_directions()

    # draw the input geometry
    point_set, line_set = _polygons_to_line_set(model.get_polygons())
    # print("point_set[0]:%s" % point_set[0])
    offset2vtk.drawLinesegs(myscreen, point_set, line_set)

    first_offset = 0.03
    second_offset = 0.015
    interior = True
    N_offsets = -1
    offset_loops = pocket_model(model.get_polygons(), first_offset, second_offset, interior, N_offsets)
    # offset2vtk.drawOffsets( myscreen, offset_loops)

    offset2vtk.drawOffsets2(myscreen, offset_loops)

    print "PYTHON All DONE."

    myscreen.render()
    myscreen.iren.Start()