A sanity check of STEP file size. Multiple instances of a shape with same color is not expected to result in significant file size increase.
(tmpdir)
| 2388 | |
| 2389 | |
| 2390 | def test_step_export_filesize(tmpdir): |
| 2391 | """A sanity check of STEP file size. |
| 2392 | Multiple instances of a shape with same color is not expected to result |
| 2393 | in significant file size increase. |
| 2394 | """ |
| 2395 | part = box(1, 1, 1) |
| 2396 | N = 10 |
| 2397 | filesize = {} |
| 2398 | |
| 2399 | for i, color in enumerate((None, cq.Color("red"))): |
| 2400 | assy = cq.Assembly() |
| 2401 | for j in range(1, N + 1): |
| 2402 | assy.add( |
| 2403 | part, name=f"part{j}", loc=cq.Location(x=j * 1), color=copy.copy(color) |
| 2404 | ) |
| 2405 | stepfile = Path(tmpdir) / f"assy_step_filesize{i}.step" |
| 2406 | assy.export(str(stepfile)) |
| 2407 | filesize[i] = stepfile.stat().st_size |
| 2408 | |
| 2409 | assert filesize[1] < 1.2 * filesize[0] |
| 2410 | |
| 2411 | |
| 2412 | def test_assembly_remove_no_name_match(): |