Skip to main content

Generate 3D meshes from signed distance functions with a simple Python API.

Project description

texosdf

texosdf is a lightweight Python package for generating 3D meshes from signed distance functions (SDFs).

It is a modernized fork of fogleman/sdf, published as texosdf with proper packaging, curated exports, typed modules, and clearer optional dependency handling.

texosdf example

Installation

Install the core package:

pip install texosdf

Optional extras:

pip install texosdf[plot]
pip install texosdf[mesh]
pip install texosdf[all]

Notes:

  • plot installs matplotlib for show_slice()
  • mesh installs meshio for mesh loading and non-STL export
  • Mesh.sdf() also requires OpenVDB and pyopenvdb
  • pyopenvdb is intentionally not included in package requirements because it is platform-specific and only needed for the advanced mesh-to-SDF workflow

Quickstart

from texosdf import *

shape = sphere(1) & box(1.5)

cutout = cylinder(0.5)
shape -= cutout.orient(X) | cutout.orient(Y) | cutout.orient(Z)

shape.save("out.stl")

Why import *?

While import * is usually not ideal in general Python code, CAD and geometry scripting has broadly moved in that direction because it makes modeling scripts shorter and easier to read. texosdf keeps that convenience on purpose.

If you use Ruff in scripts written that way, add:

# ruff: noqa: F403, F405
from texosdf import *

Features

  • 2D and 3D analytic SDF primitives
  • boolean operators such as union, difference, and intersection
  • transforms and deformations such as translate, rotate, twist, bend, and shell
  • 2D-to-3D operations such as extrude, revolve, and profile blending
  • text and image-based masks
  • optional plotting and mesh loading/export helpers
  • custom SDF authoring with decorators such as @sdf2, @sdf3, @op2, and @op3

Full Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

texosdf-0.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

texosdf-0.1.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file texosdf-0.1.0.tar.gz.

File metadata

  • Download URL: texosdf-0.1.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for texosdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95b1bb1bb654695aa9b9e1ee04ad277dc1da5c81529c66c1e905bc1de3bb33c3
MD5 229d5229edc33e29dd728d10e1769b4a
BLAKE2b-256 7e64653409ec7c04da5d34d9cdb99b9e967c486b4fbdc5135b6f1af25b215fa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for texosdf-0.1.0.tar.gz:

Publisher: publish.yml on torayeff/texosdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file texosdf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: texosdf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for texosdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e32b4712c646c7fa9af453f2b7d56102d3cfae249cc4321402b24f65e68adc9a
MD5 4690302549ca7f74a877273c63944eb0
BLAKE2b-256 7b238050ea6c6f9e9a7d9a82810a8cb6f10410b7f00b83cabee68cf2f29d7d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for texosdf-0.1.0-py3-none-any.whl:

Publisher: publish.yml on torayeff/texosdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page