tessl install tessl/pypi-numpy-stl@3.2.0Library to make reading, writing and modifying both binary and ascii STL files easy.
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.39x
Baseline
Agent success rate without this tile
61%
Build a small utility that reads zipped 3MF files, extracts every mesh they contain, and produces summaries plus an STL export option. Rely on the provided dependency for parsing the 3MF container rather than manually handling XML or ZIP structures.
cube.3mf returns one entry named Cube with triangles equal to 12 and bounding_box ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0)), preserving the mesh name from the file. @testassembly.3mf returns two entries in file order: first Bracket with triangles 24 and bounding_box ((0.0, 0.0, 0.0), (40.0, 20.0, 10.0)), then Clip with triangles 8 and bounding_box ((5.0, 0.0, 0.0), (15.0, 10.0, 5.0)). @testassembly.3mf with ["Clip"] returns a single Clip summary with triangles 8. @testassembly.3mf with default merging writes an STL file that combines all meshes and returns a summary whose triangles total 32 and whose bounding_box spans both parts ((0.0, 0.0, 0.0), (40.0, 20.0, 10.0)). @testinclude=["Clip"] writes an STL containing only the Clip mesh, returns a summary with triangles 8, and leaves existing files at other paths untouched. @test@generates
from typing import Iterable, List, TypedDict, Tuple
Point = Tuple[float, float, float]
BoundingBox = Tuple[Point, Point]
class MeshSummary(TypedDict):
name: str
triangles: int
bounding_box: BoundingBox
def summarize_3mf(path: str, *, recalc_normals: bool = True) -> List[MeshSummary]:
"""Load every mesh in a 3MF file and return ordered summaries with triangle counts and bounding boxes."""
def summarize_filtered_3mf(path: str, include: Iterable[str], *, recalc_normals: bool = True) -> List[MeshSummary]:
"""Return summaries only for meshes whose names appear in the include list, preserving file order."""
def export_stl_from_3mf(
source_path: str,
destination_path: str,
*,
include: Iterable[str] | None = None,
merge_meshes: bool = True,
recalc_normals: bool = True,
) -> MeshSummary:
"""Write an STL derived from the 3MF contents (optionally filtered/merged) and return a summary of what was written."""Provides 3MF mesh ingestion and STL writing support.