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

Download files

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

Source Distribution

cwmath-1.0.2.tar.gz (314.7 kB view details)

Uploaded Source

Built Distribution

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

cwmath-1.0.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file cwmath-1.0.2.tar.gz.

File metadata

  • Download URL: cwmath-1.0.2.tar.gz
  • Upload date:
  • Size: 314.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cwmath-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2139ab9428dc4367e29c01e1a3feb3af5445f5254882d34cc30d9c25409f11c2
MD5 e54caa838ff282681ea14b902fb5a245
BLAKE2b-256 643e327bd15ee2c0e355e9cbf21ae4c91475f79fbd1c0084b1ec6279c0b36aa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwmath-1.0.2.tar.gz:

Publisher: publish.yml on cwapi3d/cwmath

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

File details

Details for the file cwmath-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: cwmath-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cwmath-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97a868c96bb58d95495a975cb73199935076d068e6c3735473723ed11fa29e02
MD5 55705ce609a9cc7d8ae79e5ca7a74372
BLAKE2b-256 810f0ab3be1743598ee97a6bc21bfb8ac3c905d1971e99ce55691a7cbc131289

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwmath-1.0.2-py3-none-any.whl:

Publisher: publish.yml on cwapi3d/cwmath

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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

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