Python library of Solvespace.
Project description
python-solvespace
Python library from the solver of SolveSpace, an open source CAD software.
The example extracted from unit test:
from python_solvespace import SolverSystem, ResultFlag
sys = SolverSystem()
wp = sys.create_2d_base() # Workplane (Entity)
p0 = sys.add_point_2d(0, 0, wp) # Entity
sys.dragged(p0, wp) # Make a constraint with the entity
...
line0 = sys.add_line_2d(p0, p1, wp) # Create entity with others
...
line1 = sys.add_line_2d(p0, p3, wp)
sys.angle(line0, line1, 45, wp) # Constrain two entities
line1 = sys.entity(-1) # Entity handle can be re-generated and negatively indexed
...
if sys.solve() == ResultFlag.OKAY:
# Get the result (unpack from the entity or parameters)
# x and y are actually float type
dof = sys.dof()
x, y = sys.params(p2.params)
...
else:
# Error!
# Get the list of all constraints
failures = sys.failures()
...
Solver can also be serialized and copied, but can not modify or undo last step.
import pickle
print(pickle.dumps(sys))
sys_new = sys.copy()
The entity and parameter handles should have the same lifetime to the solver.
Install
pip install python-solvespace
Build and Test (Repository)
First build and install the module from the repo:
git submodule update --init extlib/mimalloc
cd cython
pip install -e .
Build the module:
pip install -e . --no-deps
Run the unit tests:
python -m unittest
Uninstall the module:
pip uninstall python-solvespace
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for python_solvespace-3.0.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aef8e16fcefdab2241c0bab747e94152b8254e96643976964bbcec867639b7e1 |
|
MD5 | 7fc1c5293ff5ae1d746e133a65422c0c |
|
BLAKE2b-256 | e78e195e0b63686b2974a6fa61c7704c7a86e7918889bc0846bd663cdc782ca7 |
Close
Hashes for python_solvespace-3.0.6-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0b68e54525cab0bafc3d2ed62cd3b5d9ee75d7baf301f4c8cb20d33cd7a7208 |
|
MD5 | 1900cb6b4d29e96423fa6e4f08961418 |
|
BLAKE2b-256 | f4832665a1f62fd3321350859f437bebbcef815fb67aced48c0d3a9bf6c2eb8b |
Close
Hashes for python_solvespace-3.0.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c883c4a2680ba0257d7bd389f85cfdb02f2e56aab7afaf11f37bf7d9854c3dd |
|
MD5 | 725017d4565c767257235b043c08759a |
|
BLAKE2b-256 | 0ef3bed66cd885ca48961996f0e2feee64dc6687bbf67f03ce9c916d8cf9ede6 |
Close
Hashes for python_solvespace-3.0.6-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ce3887773bde38948577188020074d251e2d73851423f4279d47e1114f144ad |
|
MD5 | 85e449c6cafd7264722c0cc96786d713 |
|
BLAKE2b-256 | dc47ec60ab67e690288c7b3727ac213c8234795a9e66c45061d6bdd18c6e0863 |
Close
Hashes for python_solvespace-3.0.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 116c0a23bc417e817d18c38e9f0ecded025b8311670ffb99599fe062a7d436d5 |
|
MD5 | 96a85cbd31a67c553a6cfb0a12b12304 |
|
BLAKE2b-256 | 73bf151fd86aa3d57ba85f1f3f2c27585419ca24d20d9397aaa9a9797f42a578 |
Close
Hashes for python_solvespace-3.0.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b0e307aa227ebd688e39d6a0e096ed9a482e93d8f3c247b8293aff5cd63aacc |
|
MD5 | 30af6ddc17f992d992496b70e5b3c8f2 |
|
BLAKE2b-256 | d5ef7193c405eb8016479c22fd71013aabbfd7fd45119a6fdbea3f6e3eaf4d14 |
Close
Hashes for python_solvespace-3.0.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ba67d2a88f6d34c67d4f83d7a299056fd7518606d8c3ca9b54b8faa4095d834 |
|
MD5 | 41b9725a161763abd4d009afeefd23ec |
|
BLAKE2b-256 | adc82d145d7afa3d7d84729549571f3b16a6868638712f9604c64b58850543c7 |
Close
Hashes for python_solvespace-3.0.6-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b13165a2274cfc60fb749e09df6e4f03bde3cc88821285fc02264ddede25357c |
|
MD5 | d5bfce0d3611a5f097f57e7d85aa91fc |
|
BLAKE2b-256 | 707fa7a4d2e894ca94d0c43edd9d9aacb24fc487a32dd40018b135112899ee5b |
Close
Hashes for python_solvespace-3.0.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04fec66470949add61b086aca192e8715e6c70f5ede3cbd7cda16b118b9cbe68 |
|
MD5 | e057bbff5bed487e2f7e0d65b8bd0bbb |
|
BLAKE2b-256 | 8683cfb27f3eb9e4e1a60a34fe31e72d9891cff2cec643d9bb8001fc6e24aa50 |
Close
Hashes for python_solvespace-3.0.6-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef73c5a5e03af77b8d3bd7cc7f95ffa8a9b3c8cc7bd8d67e5fdbc49b3dc432f2 |
|
MD5 | d0aeb9138cbff03caabada59cfa037f4 |
|
BLAKE2b-256 | 233bc2a9aaa1a548918d3b9f414c2e11bf0f9d19c640a61d88c5adc0528fa0ed |