Spaces:
Sleeping
Sleeping
File size: 367 Bytes
44c1e10 | 1 2 3 4 5 6 7 8 9 10 11 | # core/utils.py
"""Shared utility functions for NeuralCAD."""
from __future__ import annotations
def derive_part_name(text: str, max_chars: int = 40) -> str:
"""Derive a filesystem-safe part name from text."""
name = text[:max_chars].strip().replace(" ", "_").lower()
name = "".join(c for c in name if c.isalnum() or c == "_")
return name or "part"
|