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
s.set_p2p_distance(p1, p2, 5.0)

# 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.3.0.tar.gz (131.1 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.3.0-cp313-cp313-win_amd64.whl (325.1 kB view details)

Uploaded CPython 3.13Windows x86-64

planegcs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (397.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

planegcs-0.3.0-cp312-cp312-win_amd64.whl (325.1 kB view details)

Uploaded CPython 3.12Windows x86-64

planegcs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (398.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for planegcs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ca92354a77aa34f7d4e8b9cf23b6f743c08719d06d6fe8604ad15245dd7c9f8b
MD5 a10e7e03d7a5030f1a3bc3eed60c9a81
BLAKE2b-256 7b9a537a5f63f35d66cb4a8e8f6265d03a19f7b90c8f8b0448cd0caa86545f7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.3.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.3.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: planegcs-0.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 325.1 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.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fcb387c595732252e83760757242d60faf32841e486370b11995b6ccb6772ee3
MD5 0f1981f9f322ccfe35260456c935050a
BLAKE2b-256 9951895ed61fa15d3ef5650a01b7c42b81ad2a01909d9ca64ff9610d913fb97b

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.3.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.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for planegcs-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6083cf93392174e93295511cd8e5b36b6e2b5d4baa36ba1b0e473dca083168e5
MD5 a9af8acbbd4f30d7776a6496e3ad202e
BLAKE2b-256 df3cbdcce6baf392df0f0dbf2525e8b5cba946e2c9badd2825535a59229684e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.3.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.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: planegcs-0.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 325.1 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.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a2e6d81ca4d2102ef68d4934f77bae91980fa4c8ea1de743c8c8d03c2cd90e3e
MD5 33a0c00516ed474b6099e36f5c0e1458
BLAKE2b-256 f03933ca9ab305d525ccf3f2f23635443b65229fae92f5060623f29c0e905378

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.3.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.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for planegcs-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7454aaca9e87c714d4b89d04bab0f97e2979e976ef1a733773ea64ec25c4dea2
MD5 fb0627a0813d99dba5f287403da6c552
BLAKE2b-256 28127c191eee3415a9c8e1bc63429c2149de61c3b491f3b6de1aa97777f26dff

See more details on using hashes here.

Provenance

The following attestation bundles were made for planegcs-0.3.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