Skip to main content

OBPlib for Python

OBPlib creates and reads OpenBeamPath (OBP) data for electron-beam powder-bed fusion systems. Build a path from lines, cubic Bézier curves, timed points, and synchronization signals, then write it as binary .obp or human-readable .obpj data.

The package requires Python 3.13 or newer.

Install

Install OBPlib from PyPI in your Python environment.

$ python3 -m pip install obplib

The package includes the Python dependencies for the desktop and notebook viewers. The desktop viewer also needs Tcl/Tk in your Python installation.

On Debian with the Freemelt package repository configured, you can install the Debian package.

$ sudo apt-get update
$ sudo apt-get install python3-obplib

For a source installation on Debian 13 (Trixie), download and unpack the PyPI source distribution or clone the release with its OpenBeamPath schema submodule.

$ git clone --branch 3.1.0.post1 --recurse-submodules https://gitlab.com/freemelt/openmelt/obplib-python.git

From the unpacked source or clone root, install the build and runtime dependencies, including Tk for the desktop viewer.

$ sudo apt-get install python3-click python3-protobuf python3-grpc-tools \
    protobuf-compiler python3-setuptools python3-wheel python3-venv \
    python3-numpy python3-matplotlib python3-ipywidgets python3-tk
$ python3 -m venv --system-site-packages .venv
$ .venv/bin/python3 -m pip install --no-build-isolation --no-deps --editable .

The editable-install step also generates the Python modules for OBP.proto.

Quick start

Coordinates and spot sizes are in micrometres (µm), beam power is in watts, and scan speed is in micrometres per second (µm/s).

from pathlib import Path

import obplib as obp

beam = obp.Beamparameters(spot_size=80, power=250)

path = [
    obp.Line(
        obp.Point(0, 0),
        obp.Point(10_000, 0),
        500_000,
        beam,
    ),
    obp.Curve(
        obp.Point(10_000, 0),
        obp.Point(12_000, 0),
        obp.Point(15_000, 3_000),
        obp.Point(15_000, 5_000),
        400_000,
        beam,
    ),
]

obp.write_obp(path, Path("example.obp"))
obp.write_obpj(path, Path("example.obpj"))

example.obp is the length-delimited protobuf representation used by OBP consumers. example.obpj is a JSON representation intended for inspection and conversion.

Read binary data back into library objects:

segments = obp.read_obp("example.obp")

for segment in segments:
    print(type(segment).__name__, segment)

Reading .obpj is deliberately different: read_obpj() returns the decoded JSON dictionary rather than path objects.

document = obp.read_obpj("example.obpj")
print(document["OBP"][0]["line"])

Documentation and examples

  • User guide — concepts, every public path type, transformations, file I/O, command-line tools, viewers, and current limitations.
  • Create an OBP job — builds a mixed path and writes both file formats.
  • Transform a path — scales, rotates, and translates geometry without modifying the originals.

Run the example from the root of the source distribution or Git checkout.

$ python3 examples/create_job.py --output-dir /tmp/obp-example

Command-line tools

Convert between binary and textual OBP:

$ obpc decompile example.obp   # writes example.obpj
$ obpc compile example.obpj    # writes example.obp

With Tcl/Tk available, open the binary path in the desktop viewer.

$ obpviewer example.obp

See the user guide for compiler usage, viewer controls and cross-platform wheel installation. SVG conversion is no longer included. See release validation for dependency and GUI qualification.

Format definition

The protocol is defined in openbeampath/OBP.proto. Each protobuf Packet is stored with a varint32 length prefix in an .obp file. An .obpj file contains the JSON form under a top-level "OBP" array.

License

Copyright © 2018–2026 Freemelt AB.

OBPlib and OpenBeamPath are licensed under the Apache License 2.0.

Metadata

Release files for obplib 3.1.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obplib 3.1.0.post1
File Size Uploaded Provenance Actions
obplib-3.1.0.post1.tar.gz 46.5 kB Without provenance Details for obplib-3.1.0.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for obplib 3.1.0.post1
File Interpreter ABI Platform Actions
obplib-3.1.0.post1-py3-none-any.whl Python 3 none any Details for obplib-3.1.0.post1-py3-none-any.whl

Total release size: 89.9 kB

Release files / obplib-3.1.0.post1.tar.gz

Download URL obplib-3.1.0.post1.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cad6b98631c383aa4dd9d0c890fa3a6646845abe0139d9973bd5fb8745497c43
BLAKE2b-256 checksum
How to use checksums
a937686b6820b8e149aee2cbfd8997e104680d99d64d5be9b20d010039b5b642
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / obplib-3.1.0.post1-py3-none-any.whl

Download URL obplib-3.1.0.post1-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57273edbbbc525a3803d82cf662947fa4382f983ac74e727a3ee3f2ee59b4a6a
BLAKE2b-256 checksum
How to use checksums
269bcd10b9d77f080c3144d9063d59d38012d71b81f3e227abd43882387bb03e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for obplib 3.1.0.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page