neuralcad / core /utils.py
CallMeDaniel's picture
refactor: extract derive_part_name, remove dead code from prompts.py
44c1e10
raw
history blame contribute delete
367 Bytes
# 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"