Skip to main content

Cadwork Math Utilities

Logo

PyPI PyPI - Python Version RTD Issues Pulls GitHub

Dependency-free geometry types for cadwork plugin authors. Frozen Point / Vec pairs in 2D and 3D, a right-handed Frame3, Plane3, Line3, and projections. Python 3.14, managed with UV. Millimetres are the implicit length unit.

Installation

uv add cwmath

From a checkout:

uv sync --group dev

Example

Copy this into a cadwork plugin (or cadwork IDLE). It converts a host point_3d, builds a frame, drops a local point onto the XY plane, and converts the foot back for cwapi3d.

import cadwork
from cwmath import (
    Frame3,
    Plane3,
    Point3,
    Vec3,
    project_point_on_plane,
    to_point_3d,
)

origin = Point3.from_xyz(cadwork.point_3d(1000.0, 2000.0, 0.0))
x_dir = Vec3.from_xyz(cadwork.point_3d(1.0, 0.0, 0.0))
y_dir = Vec3.from_xyz(cadwork.point_3d(0.0, 1.0, 0.0))
frame = Frame3.from_origin_xy(origin, x_dir, y_dir)

local = Point3(50.0, 25.0, 10.0)
world = frame.to_world(local)
plane = Plane3.from_point_normal(origin, frame.z_axis)
foot = project_point_on_plane(world, plane)
result = to_point_3d(foot)

to_point_3d imports cadwork only at the call site. Unit tests inject a duck-typed factory instead of the host.

Contributing

Contributions are always welcome! Before contributing, please check our contributing agreement.

Authors

License

MIT

Metadata

Release files for cwmath 1.0.2

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

Source distribution (sdist)

Source distribution for cwmath 1.0.2
File Size Uploaded Provenance Actions
cwmath-1.0.2.tar.gz 314.7 kB With provenance Details for cwmath-1.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 327.1 kB

Release files / cwmath-1.0.2.tar.gz

Download URL cwmath-1.0.2.tar.gz
Size 314.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2139ab9428dc4367e29c01e1a3feb3af5445f5254882d34cc30d9c25409f11c2
BLAKE2b-256 checksum
How to use checksums
643e327bd15ee2c0e355e9cbf21ae4c91475f79fbd1c0084b1ec6279c0b36aa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / cwmath-1.0.2-py3-none-any.whl

Download URL cwmath-1.0.2-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97a868c96bb58d95495a975cb73199935076d068e6c3735473723ed11fa29e02
BLAKE2b-256 checksum
How to use checksums
810f0ab3be1743598ee97a6bc21bfb8ac3c905d1971e99ce55691a7cbc131289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Security for cwmath 1.0.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cwmath-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

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