MCPcopy
hub / github.com/CadQuery/cadquery / test_step_color

Function test_step_color

tests/test_assembly.py:2510–2533  ·  view source on GitHub ↗

Checks color handling for STEP export.

(tmpdir)

Source from the content-addressed store, hash-verified

2508
2509
2510def test_step_color(tmpdir):
2511 """
2512 Checks color handling for STEP export.
2513 """
2514
2515 step_color_path = os.path.join(tmpdir, "step_color.step")
2516
2517 # Create a simple assembly with color
2518 assy = cq.Assembly()
2519 assy.add(cq.Workplane().box(10, 10, 10), color=cq.Color(0.47, 0.253, 0.18, 1.0))
2520
2521 success = exportStepMeta(assy, step_color_path)
2522 assert success
2523
2524 # Read the file as a string and check for the correct colors
2525 with open(step_color_path, "r") as f:
2526 step_content = f.readlines()
2527
2528 # Step through and try to find the COLOUR line
2529 for line in step_content:
2530 if "COLOUR_RGB(''," in line:
2531 assert "0.47" in line
2532 assert "0.25" in line
2533 assert "0.18" in line
2534
2535
2536def test_special_methods(subshape_assy):

Callers

nothing calls this directly

Calls 3

addMethod · 0.95
exportStepMetaFunction · 0.90
boxMethod · 0.80

Tested by

no test coverage detected