def import_as_multiple_shapes(event=None): compound = read_step_file(os.path.join('.', 'models', 'as1_pe_203.stp')) t = TopologyExplorer(compound) display.EraseAll() for solid in t.solids(): color = Quantity_Color(random.random(), random.random(), random.random(), Quantity_TOC_RGB) display.DisplayColoredShape(solid, color) display.FitAll()
print(" * single thread runtime: %.2fs" % delta_single) print(" * multi thread runtime: %.2fs" % delta_multi) print(" * muti/single=%.2f%%" % (delta_multi / delta_single * 100)) # TEST 2 : other step, with a loop over each subshape print("TEST 2 ===") shp3 = read_step_file( os.path.join('..', 'examples', 'models', 'RC_Buggy_2_front_suspension.stp')) shp4 = read_step_file( os.path.join('..', 'examples', 'models', 'RC_Buggy_2_front_suspension.stp')) topo1 = TopologyExplorer(shp3) t4 = time.monotonic() for solid in topo1.solids(): o = Tesselator(solid) o.Compute(parallel=False, mesh_quality=0.5) t5 = time.monotonic() delta_single = t5 - t4 topo2 = TopologyExplorer(shp4) t6 = time.monotonic() for solid in topo2.solids(): o = Tesselator(solid) o.Compute(parallel=True, mesh_quality=0.5) t7 = time.monotonic() delta_multi = t7 - t6 print("Test 2 Results:") print(" * single thread runtime: %.2fs" % delta_single)