Skip to main content

A Python + C++ toolkit for reading CAD B‑Rep data from HDF5, sampling surfaces/curves, and generating blue‑noise point clouds.

Project description

ABS-HDF5: Geometry processing & blue-noise sampling for HDF5 B-Rep data

image

Description

ABS-HDF5 is a Python + C++ toolkit that turns the raw B-Rep information stored in HDF5 CAD datasets into immediately useful geometry:

  • read curves, surfaces, topology into convenient Python objects
  • sample points on faces/edges with exact parametric control
  • perform fast Poisson-disk (blue-noise) down-sampling via a native pybind11 C++ extension
  • export ready-to-visualise point clouds in PLY or analysis-ready Pickle files

Quick install

pip install abs-hdf5        # pre-built wheels for CPython 3.8 – 3.12

Building from source? You need

  • Python 3.8 +
  • a C++17 compiler (GCC 9 / Clang 12 / MSVC 17.6 or newer)
  • CMake ≥ 3.22 and Ninja
pip install .  # inside a git checkout – scikit-build-core will compile abspy

Command-line tools

abs-to-ply

Convert one file (or a directory of .hdf5 files) to point-cloud PLY.

abs-to-ply data/Cone.hdf5   out/          -n 5000  -j 8
# ^input file / dir          ^output dir   ^pts/part ^workers

Each face gets uniformly-random samples; Poisson-disk down-sampling keeps only 5000 nearly-evenly-spaced points per part. Normals are written alongside every vertex in ASCII PLY.

abs-to-pickle

Same interface, but saves a per-part *.pkl with a dict:

{'file': 'Cone.hdf5', 'part': 0, 'points': ndarray(N,3), 'normals': ndarray(N,3)}

Useful for machine-learning pipelines that prefer NumPy-pickles.


Library use

import abs                       # auto-loads the C++ extension `abspy`

# Read every part stored in a single HDF5 file
parts = abs.read_parts("data/Cylinder.hdf5")

# How to extract 10 000 blue-noise samples on each part (with normals)
def face_normals(part, topo, uv):
    return topo.normal(uv) if topo.is_face() else None

points_per_part, normals_per_part = abs.sample_parts(
        parts, num_samples=10_000, lambda_func=face_normals)

# Poisson-disk down-sample an arbitrary XYZ array to 1 000 pts
idx = abs.poisson_disk_downsample(points_per_part[0], 1000)
sub_pts = points_per_part[0][idx]

See the doc-strings in abs.part_processor, abs.sampler, and abs.shape.Shape for the full low-level API.

Tip: It is recommended to use a virtual environment for isolated installations.

For more usage details, please refer to the Usage page in our documentation.

Documentation

Detailed documentation is available on our website. It includes:

  • Installation Guide
  • Usage Examples
  • API Documentation: Covers modules like Geometry, Topology, Sampling, and Visualization.
  • FAQ, Changelog, Contributing Guidelines, and More

Visit our website: better-step.github.io

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the Repository: Click the "Fork" button on GitHub.

  2. Clone Your Fork Locally:

    git clone https://github.com/better-step/abs.git
    cd abs
    python -m pip install -e .
    pytest
    
  3. Create a Branch:

    git checkout -b feature/your-feature-name
    
  4. Make Your Changes: Ensure your code follows our coding standards (PEP 8) and include docstrings and tests where applicable.

  5. Commit and Push:

    git add .
    git commit -m "Add feature: [description]"
    git push origin feature/your-feature-name
    
  6. Submit a Pull Request: Open a pull request on GitHub with a clear description of your changes.

Note: Please also review our Code of Conduct before contributing.

License

  • Python bindings, packaging scripts, testsMIT License (see LICENSE-MIT)
  • Embedded C++ coreMozilla Public License 2.0 (see LICENSE-MPL-2.0)

Acknowledgments

Better Step is developed and maintained by a dedicated team. For a complete list of contributors, please see the Authors page.


Happy sampling! – The Better Step maintainers

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

abs_hdf5-0.1.2.tar.gz (47.1 kB view details)

Uploaded Source

Built Distribution

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

abs_hdf5-0.1.2-cp39-cp39-macosx_10_16_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.9macOS 10.16+ x86-64

File details

Details for the file abs_hdf5-0.1.2.tar.gz.

File metadata

  • Download URL: abs_hdf5-0.1.2.tar.gz
  • Upload date:
  • Size: 47.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for abs_hdf5-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e4ea980b67169ac4dafce32ac5b5e4e4d66b6d4830ba8ab0fd42756f256a6e87
MD5 30b939cc77c0e8141cd019e8c57de9fe
BLAKE2b-256 69de4581727513d741aaf7845f877e505d23d14d88248937cee76829ed86c1a0

See more details on using hashes here.

File details

Details for the file abs_hdf5-0.1.2-cp39-cp39-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for abs_hdf5-0.1.2-cp39-cp39-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 0b4b82012361c91913fcf58803fa68696999f4f0da07465262729f484e42fa12
MD5 71fa3b7d97a6d06175f476306502b8bc
BLAKE2b-256 5e08b1f6a8ff593b49b8dbd502d4c41ed68666134a9c72cf83fbf79bf4394d67

See more details on using hashes here.

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