diff --git a/cadquery/assembly.py b/cadquery/assembly.py index fdf98dd73..4ba2421ff 100644 --- a/cadquery/assembly.py +++ b/cadquery/assembly.py @@ -598,6 +598,8 @@ def export( if exportType is None: t = path.split(".")[-1].upper() + if t == "WRL": + t = "VRML" if t in ("STEP", "XML", "XBF", "VRML", "VTKJS", "GLTF", "GLB", "STL"): exportType = cast(ExportLiterals, t) else: diff --git a/cadquery/occ_impl/exporters/__init__.py b/cadquery/occ_impl/exporters/__init__.py index 266dd4ac9..ed8998366 100644 --- a/cadquery/occ_impl/exporters/__init__.py +++ b/cadquery/occ_impl/exporters/__init__.py @@ -74,6 +74,8 @@ def export( if exportType is None: t = fname.split(".")[-1].upper() + if t == "WRL": + t = ExportTypes.VRML if t in ExportTypes.__dict__.values(): exportType = cast(ExportLiterals, t) else: diff --git a/tests/test_assembly.py b/tests/test_assembly.py index 08d4a5f21..4862e9dac 100644 --- a/tests/test_assembly.py +++ b/tests/test_assembly.py @@ -1439,7 +1439,7 @@ def test_toJSON(simple_assy, empty_top_assy): ("xml", ()), ("stp", ("STEP",)), ("caf", ("XML",)), - ("wrl", ("VRML",)), + ("wrl", ()), ("stl", ("STL",)), ], ) @@ -1464,7 +1464,7 @@ def test_save(extension, args, nested_assy, tmpdir): ("stl", (), {"ascii": True}), ("stp", ("STEP",), {}), ("caf", ("XML",), {}), - ("wrl", ("VRML",), {}), + ("wrl", (), {}), ("stl", ("STL",), {}), ], ) diff --git a/tests/test_exporters.py b/tests/test_exporters.py index 0e5355a02..67dfbed6e 100644 --- a/tests/test_exporters.py +++ b/tests/test_exporters.py @@ -629,12 +629,14 @@ def testTJS(self): def testVRML(self): - exporters.export(self._box(), str(self.tmpdir / "out1.vrml")) + for extension in ("vrml", "wrl"): + output = self.tmpdir / f"out1.{extension}" + exporters.export(self._box(), str(output)) - with open(self.tmpdir / "out1.vrml") as f: - res = f.read(10) + with open(output) as f: + res = f.read(10) - assert res.startswith("#VRML V2.0") + assert res.startswith("#VRML V2.0") # export again to trigger all paths in the code exporters.export(self._box(), str(self.tmpdir / "out2.vrml"))