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.1.2.tar.gz (116.2 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.1.2-cp313-cp313-win_amd64.whl (313.1 kB view details)

Uploaded CPython 3.13Windows x86-64

planegcs-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (380.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

planegcs-0.1.2-cp312-cp312-win_amd64.whl (313.1 kB view details)

Uploaded CPython 3.12Windows x86-64

planegcs-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (380.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for planegcs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6a692be2e383f89150f2dd387a277f0923539992d71ff3088a61155737cb44e5
MD5 cc38d8ae9044560621f5e2c7cc5874b2
BLAKE2b-256 dfdc45d109ddf21f81d81ab57453eb24c10df35b7c32bdc4b7d73be9cae5382f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: planegcs-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 313.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.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 23d5b451519202f54da2df4e34b3f67fcec24e90db5f5202d9d8c897b91d01f1
MD5 af8c1b2ffaf3ad9c15292bea4c59e614
BLAKE2b-256 2cb994bc7bdd31a43b018a019ca64d77832819df7f498d1e86ac2a8fed6a6463

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for planegcs-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41a46cb3da1ecf5c609ca46c09266b5304a5a9fbcd989bd2bdf84bdb5710221b
MD5 8e9aa6637448990ad2ef6b112ee99f0e
BLAKE2b-256 3b63217ae953e813c98cd621898d867e9c323fd50af42a3052800c25676010be

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: planegcs-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 313.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.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9b6def52cfe63bfed803501721a4062577c315a05e31c3893bae0d92a08afd9a
MD5 f81db67cda92fa8bf517edf832957451
BLAKE2b-256 1fc52c1af606e47252e0f5b84964266fd36f21481dc961e07e08f3acd1c330ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for planegcs-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d846279a5be70a8708752cb9f68d13b88c1a7542597b785d64b2e1a1763ee53
MD5 7afd103b6888ca0162cabcc298154d9b
BLAKE2b-256 1c56224ce43d0979425692b9304d5c4aa29a7d06a5454bf5e9920b4f3a96aea4

See more details on using hashes here.

Provenance

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