Skip to content

Commit 638d338

Browse files
committed
Added STEP export test for Shape
1 parent 3c56af3 commit 638d338

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/test_exporters.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Tests basic workplane functionality
33
"""
44
# core modules
5-
import sys
5+
import os
66
import io
77
from pathlib import Path
88
import re
@@ -15,6 +15,27 @@
1515
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
1616

1717

18+
def test_step_options(tmp_path_factory):
19+
"""
20+
Exports a box using the options to decrease STEP file size and
21+
then imports that STEP to validate it.
22+
"""
23+
# Use a temporary directory
24+
tmpdir = tmp_path_factory.mktemp("out")
25+
box_path = os.path.join(tmpdir, "out.step")
26+
27+
# Simple object to export
28+
box = Workplane().box(1, 1, 1)
29+
30+
# Export the STEP with the size-saving options and then import it back in
31+
box.val().exportStep(box_path, write_pcurves=False, precision_mode=0)
32+
w = importers.importStep(box_path)
33+
34+
# Make sure there was a valid box in the exported file
35+
assert w.solids().size() == 1
36+
assert w.faces().size() == 6
37+
38+
1839
class TestExporters(BaseTest):
1940
def _exportBox(self, eType, stringsToFind, tolerance=0.1, angularTolerance=0.1):
2041
"""

0 commit comments

Comments
 (0)