Skip to content

Commit e7f09a0

Browse files
committed
updated readme adn title image
1 parent 0909333 commit e7f09a0

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ SPDX-License-Identifier: AGPL-3.0-or-later
88

99
This cli program converts STL files into STEP file in a non-trivial way. It segments the mesh into basic shapes. That means, the generated STEP file isn't only a bunch of triangles, it has planes, cylinders, spheres etc. resulting in less memory usage and it is friendlier to CAD and CAM.
1010

11-
Experimental state: Only planes are implemented! Holes are not supported!
11+
Experimental state: Only planes are implemented! Holes __are__ supported now!
1212

13-
![screenshot of the output screw.step imported into FreeCAD](screw_step.png)
13+
![screenshot of the output step file imported into FreeCAD and the conversion log](example_step.png)
1414

1515

1616
## Installation

screw_step.png

-278 KB
Binary file not shown.

stl2step/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def cluster_planes(faces_arr):
4040
if np.isnan(e[0]):
4141
continue
4242
clust[(e[0], e[1], e[2], e[3])].append(i)
43-
return list(clust.values())
43+
# remove all planes with a single triangle only
44+
filtered = {k: v for k, v in clust.items() if len(v) > 1}
45+
return list(filtered.values())
4446

4547

4648
def sort_edges(edges_merged):
@@ -192,14 +194,14 @@ def count_len(lst):
192194
# find planes
193195
faces_to_be_merged_list = cluster_planes(faces)
194196
print(f"Number of planes found: {len(faces_to_be_merged_list):16d}")
195-
unique, counts = count_len(faces_to_be_merged_list)
196-
for i, c in enumerate(unique):
197-
print(f" with {c:6d} polygon{'s:' if c != 1 else ': '} {counts[i]:16d}")
198197

199198
# construct polygons of planes
200199
polygons_pts_idx = merge_faces(
201200
faces_to_be_merged_list, face_idx2edge_idx_list, edge_idx2edge
202201
)
202+
unique, counts = count_len(polygons_pts_idx)
203+
for i, c in enumerate(unique):
204+
print(f" with {c:6d} polygon{'s:' if c != 1 else ': '} {counts[i]:16d}")
203205

204206
# construct remaining unclassified triangles
205207
remaining_faces = get_unclassified_faces(

0 commit comments

Comments
 (0)