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
python_solvespace-3.0.5.tar.gz
(221.3 kB
view hashes)
Built Distributions
Close
Hashes for python_solvespace-3.0.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bdeadd53db0c4df9643397b1cb8930e5cd847810a3bf0fad5313a83802e08d1 |
|
MD5 | 71816d832ae67c318d70851ca8493fc7 |
|
BLAKE2b-256 | c02bdf8148198356a324a241b6374f1ab65085f17488ae927b18a7b822b80971 |
Close
Hashes for python_solvespace-3.0.5-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33410c9afe30a3abbacad31a5bb5ee897a3a94aba37bd9d433ff924f47cc80b1 |
|
MD5 | 6db0f7439c75dd16f9a65c44cba2d0f7 |
|
BLAKE2b-256 | 7b25d03b0194e24dd0dc34128cfc594f787c3181ce35c94d5c529bd976712978 |
Close
Hashes for python_solvespace-3.0.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025c25841a5e7914c2b01818ec554527be5fffe5357df1a34672a33dfb4ac262 |
|
MD5 | 7aed9e50b4a460f4b8fd51901f049587 |
|
BLAKE2b-256 | 4295318722499a813732fdea99534ba754e525e656c3f5e893a9351bb276a3bf |
Close
Hashes for python_solvespace-3.0.5-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ade63e838fa8663aa850882e1ca599b3bf412532cfaf82a891156d567a2044f |
|
MD5 | 6cfa78f37c0fc7f8dc8e29006050e7c3 |
|
BLAKE2b-256 | 74a4ab5729dfe7c0ef08d462aa2c4cece7110301e23a32fa7915afc1bb93dfec |
Close
Hashes for python_solvespace-3.0.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c721bdb1f0b04c149654450fb965a584960cb8cc4bac7579392cd361aa60f4d4 |
|
MD5 | 13fba4cc16801c0cab27061ef3b68b57 |
|
BLAKE2b-256 | 36e1f19078055a77e7d99fbc77bcea37573cec6a0f88352b2e9b9501a92671ee |
Close
Hashes for python_solvespace-3.0.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b393e0524ae0fa52bf61437119ccd7f80ae857103b72dd878ba5aa99dc172e21 |
|
MD5 | 707c7737c61236eff5df4086ba5c0c07 |
|
BLAKE2b-256 | 50cfef550270b7c9e4c92e25d60a90cf43fdee47996c9db066bfa64fe6a1fddb |
Close
Hashes for python_solvespace-3.0.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e14d5430fe905eb910148f6619f3fc937498634d8deeac37d65f447a420f1379 |
|
MD5 | d4640c77afdcec0b1a2f34237e1a07e3 |
|
BLAKE2b-256 | 4126066e5212266fcaaf052043cd41ef0acf7d685164db5c5138e3a88a1c5b03 |
Close
Hashes for python_solvespace-3.0.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec7a77af3c766067804db6231d4992c38a029bacd5f3a8dbee7ab42e188e037 |
|
MD5 | 381a77d13da28c09a330e834b5a023db |
|
BLAKE2b-256 | 1cbc60c9ac167cac61945b19242c67d7737e61d9597699afd4245a98184700b1 |
Close
Hashes for python_solvespace-3.0.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89ee28f7c99e3dc9141fc90f7a37b2642d861457847f3ba3854f74f427df4596 |
|
MD5 | c1aadc4445dfc3a30ce5e2da64228d8a |
|
BLAKE2b-256 | 8899a5194dc9bd13e21e2c061d7a770cde1329de48f9aab10bd95a5cf62c2162 |
Close
Hashes for python_solvespace-3.0.5-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be20eec634055245a15ae31f489cc420f07bee2ed79ff32492d191bc4fc8c5a1 |
|
MD5 | 6f73307aaf84f792c9155e4f054b9f6b |
|
BLAKE2b-256 | 0c7aaada91bd991681ae19d4a274f4ed65e86229abfdb65350ca924a1bea0867 |