Skip to content

Commit b8cef0d

Browse files
authored
Merge pull request #1481 from compas-dev/copilot/fix-1480
Support both .step and .stp file extensions in RhinoBrep STEP methods
2 parents 7c8b5ff + 3f7d049 commit b8cef0d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Added support for `.stp` file extension in addition to `.step` for `RhinoBrep.from_step()` and `RhinoBrep.to_step()` methods.
13+
1214
### Changed
1315

1416
* Updated minimum library version to `2.14.1` in Rhino8 GH components.

src/compas_rhino/geometry/brep/brep.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,8 @@ def from_step(cls, filepath):
749749
:class:`compas_rhino.geometry.RhinoBrep`
750750
751751
"""
752-
if not filepath.endswith(".step"):
753-
raise ValueError("Expected file with .step extension")
752+
if not (filepath.endswith(".step") or filepath.endswith(".stp")):
753+
raise ValueError("Expected file with .step or .stp extension")
754754
return _import_brep_from_file(filepath)
755755

756756
@classmethod
@@ -891,7 +891,7 @@ def to_viewmesh(self, linear_deflection: float = 0.001):
891891
return _join_meshes(self.to_meshes()), []
892892

893893
def to_step(self, filepath):
894-
if not filepath.endswith(".step"):
894+
if not (filepath.endswith(".step") or filepath.endswith(".stp")):
895895
raise ValueError("Attempted to export STEP but file ends with {} extension".format(filepath.split(".")[-1]))
896896
_export_brep_to_file(self._brep, filepath)
897897

0 commit comments

Comments
 (0)