or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/numpy-stl@3.2.x
tile.json

tessl/pypi-numpy-stl

tessl install tessl/pypi-numpy-stl@3.2.0

Library 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%

task.mdevals/scenario-1/

STL Format Router

A small utility for loading STL files with automatic ASCII/BINARY detection, exporting them in a requested format, and optionally disabling performance speedups.

Capabilities

Auto-detected loading

  • Loading an ASCII STL sample reports detected_format as "ascii" and provides the triangle count from the file contents. @test
  • Loading a binary STL sample reports detected_format as "binary" and provides the triangle count from the file contents. @test

Controlled saving

  • Saving a previously loaded mesh with format_hint="ascii" writes ASCII output even when the input was binary. @test
  • Saving a previously loaded mesh with format_hint="binary" writes binary output even when the input was ASCII. @test

Speedup toggle

  • Initializing the utility with use_speedups=False still loads and saves meshes successfully and reports speedups_enabled as False in the load result. @test

Implementation

@generates

API

from typing import Any, Dict, Literal

class STLConverter:
    def __init__(self, use_speedups: bool = True) -> None:
        """Store whether performance speedups should be used when loading and saving."""

    def load(self, source_path: str) -> Dict[str, Any]:
        """
        Read an STL file with automatic ASCII/BINARY detection and return:
        - "mesh": mesh handle from the dependency
        - "triangle_count": triangle count as int
        - "detected_format": "ascii" or "binary"
        - "speedups_enabled": whether speedups were used
        """

    def save(self, mesh_obj: Any, target_path: str, format_hint: Literal["auto", "ascii", "binary"] = "auto") -> None:
        """
        Write the mesh to target_path, using ASCII/BINARY according to format_hint.
        When format_hint is "auto", preserve the detected_format from the last load.
        """

Dependencies { .dependencies }

numpy-stl { .dependency }

Python library for reading and writing STL meshes with automatic ASCII/BINARY handling and optional Cython speedups. @satisfied-by