Skip to content

Commit 6a5a176

Browse files
committed
fix frame subd bug and add subd schemes
1 parent 4a5a5c6 commit 6a5a176

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## Unreleased
1010

11-
1211
### Added
1312

1413
* Added Python 3.9 support.
1514
* Added crease handling to catmull-clark subdivision scheme.
1615
* Added `compas_ghpython.get_grasshopper_userobjects_path` to retrieve User Objects target folder.
1716
* Added direction option for mesh thickening.
1817
* Added check for closed meshes.
18+
* Added 'loop' and 'frames' to schemes of `compas.datastructures.mesh.subdivision.mesh_subdivide`.
1919

2020
### Changed
2121

2222
* Fixed box scaling.
2323
* Fixed a bug in `Polyline.divide_polyline_by_length` related to a floating point rounding error.
2424
* Fixed bug in `RobotModel.zero_configuration`.
2525
* Fixed bug in `compas.geometry.normals`.
26+
* Fixed bug in `compas.datastructures.mesh.subdivision.mesh_subdivide_frames`.
2627

2728
### Removed
2829

src/compas/datastructures/mesh/subdivision.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def mesh_subdivide(mesh, scheme='catmullclark', **options):
100100
----------
101101
mesh : Mesh
102102
A mesh object.
103-
scheme : {'tri', 'quad', 'corner', 'catmullclark', 'doosabin'}, optional
103+
scheme : {'tri', 'quad', 'corner', 'catmullclark', 'doosabin', 'frames', 'loop'}, optional
104104
The scheme according to which the mesh should be subdivided.
105105
Default is ``'catmullclark'``.
106106
options : dict
@@ -127,6 +127,10 @@ def mesh_subdivide(mesh, scheme='catmullclark', **options):
127127
return mesh_subdivide_catmullclark(mesh, **options)
128128
if scheme == 'doosabin':
129129
return mesh_subdivide_doosabin(mesh, **options)
130+
if scheme == 'frames':
131+
return mesh_subdivide_frames(mesh, **options)
132+
if scheme == 'loop':
133+
return trimesh_subdivide_loop(mesh, **options)
130134

131135
raise ValueError('Scheme is not supported')
132136

@@ -584,6 +588,7 @@ def mesh_subdivide_frames(mesh, offset, add_windows=False):
584588
>>>
585589
586590
"""
591+
cls = type(mesh)
587592

588593
subd = SubdMesh()
589594

@@ -626,7 +631,7 @@ def mesh_subdivide_frames(mesh, offset, add_windows=False):
626631
if add_windows:
627632
subd.add_face(window)
628633

629-
return subd
634+
return cls.from_data(subd.data)
630635

631636

632637
def trimesh_subdivide_loop(mesh, k=1, fixed=None):
@@ -761,8 +766,7 @@ def trimesh_subdivide_loop(mesh, k=1, fixed=None):
761766

762767
del subd.face[fkey]
763768

764-
subd2 = cls.from_data(subd.data)
765-
return subd2
769+
return cls.from_data(subd.data)
766770

767771

768772
# ==============================================================================

0 commit comments

Comments
 (0)