Skip to main content

Python bindings for FreeCAD's PlaneGCS 2D geometric constraint solver

Project description

planegcs

Python bindings for FreeCAD's PlaneGCS 2D geometric constraint solver.

This project extracts the constraint solver system from FreeCAD's Sketcher component, changes the headers so that it can be used outside FreeCAD, and adds some thin C++ and Python wrappers so it can be used as a Python library. As per the FreeCAD licence requirements, the result is licenced under the LPGL 2.1 or later.

Installation

pip install planegcs

or:

uv add planegcs

If wheels aren't available, you'll need C++ tools and some development headers:

  • eigen3
  • boost

Quick Start

from planegcs import Sketch, SolveStatus

s = Sketch()

# Create three points for a triangle
p1 = s.add_point(0, 0)
p2 = s.add_point(5, 0)
p3 = s.add_point(2.5, 4)

# Create lines
l1 = s.add_line(p1, p2)
l2 = s.add_line(p2, p3)
l3 = s.add_line(p3, p1)

# Make it equilateral
s.equal_length(l1, l2)
s.equal_length(l2, l3)

# Fix first point and make base horizontal
s.fix_point(p1, 0, 0)
s.horizontal(l1)

# Fix the side length to 5
d = s.add_param(5.0)
s.p2p_distance(p1, p2, d)

# Solve
status = s.solve()
assert status == SolveStatus.Success

# Read results
print(s.get_point(p1))  # (0.0, 0.0)
print(s.get_point(p2))  # (5.0, 0.0)
print(s.get_point(p3))  # (~2.5, ~4.33)

Docs

Full documentation at readthedocs, and in the docs/ folder (requires Sphinx to build).

License

LGPL-2.1-or-later (same as the FreeCAD source code it wraps).

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

planegcs-0.2.0.tar.gz (117.8 kB view details)

Uploaded Source

Built Distributions

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

planegcs-0.2.0-cp313-cp313-win_amd64.whl (313.2 kB view details)

Uploaded CPython 3.13Windows x86-64

planegcs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (380.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

planegcs-0.2.0-cp312-cp312-win_amd64.whl (313.2 kB view details)

Uploaded CPython 3.12Windows x86-64

planegcs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (380.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file planegcs-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for planegcs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 92b535b864c170fbc59fd8302a385c5cc79ddc274e5e24eede415b72cb3622f1
MD5 9d1c6e9fcba0c1406659add487a5e49c
BLAKE2b-256 eb0052c3bb90421c55c2760fd9dbbadd6cccc0d75f7b80a4adb01e72b3ec0b01

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.2.0.tar.gz:

Publisher: release.yml on spookylukey/planegcs

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

File details

Details for the file planegcs-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: planegcs-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 313.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for planegcs-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 036cc3549b48d7ff4537816cca082d219f8d82b07194a695bf1b31c0fb9cb3ad
MD5 bfb45ab34002936f79d7378bfb662bf5
BLAKE2b-256 c844a68a45840537545741796ba4d3001ceddcdee473dde882995aa3e436263d

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.2.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on spookylukey/planegcs

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

File details

Details for the file planegcs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for planegcs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc8f2dad74a7609447d83d1f8193f7d66beae5fd9d7774ec5bbb95cfbb732ffc
MD5 b2a74a123a2a27c8e7b0a18b55987ff7
BLAKE2b-256 eddae7de7257143496b372584647acd2d6a047a7b5f42d71bd0f28dea0f6c6c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on spookylukey/planegcs

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

File details

Details for the file planegcs-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: planegcs-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 313.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for planegcs-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4b0c4eb52c3e12359d376418b0901b815cf442a2b03b7f40e0d1a435ee6639b9
MD5 3e7836d7085b5f96024e661ca9ebf4c0
BLAKE2b-256 347c90c4ee4aee57760a65cb46a1a13a1d02153bd5d0050a78708b1634e28c23

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on spookylukey/planegcs

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

File details

Details for the file planegcs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for planegcs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4f78a55bea3bb052b5ba36cf5dda380a471e840ce46523717a685da9c9e2886
MD5 0bc43671e394c34eee9d889d80420e46
BLAKE2b-256 bfd637ae54b6d5d00fbed897249cf8d1584db994f8404e2ad40e736f70820b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on spookylukey/planegcs

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