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 extlib/eigen
cd cython
pip install -e .
Rebuild 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.8-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1191b004298d57936058d9dbdd395c44c1f46d5a9c854e36c507c49c3e6b6382 |
|
MD5 | 0a6a9bd51e58855aa40e09468fe70ef2 |
|
BLAKE2b-256 | b14c0140a197e00be797f3ee26278a9205cccfb668b8c7d7746350bb72bff3c7 |
Close
Hashes for python_solvespace-3.0.8-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c899978359d95c274bbcc31405b080517af3839beca98e3342c52a37409bb916 |
|
MD5 | b5e40ff0d148a66201d13e335c4e4145 |
|
BLAKE2b-256 | e56a3d3f3ffa52b4952a4d63506b20d55e23e5bf34dfd096c185cfd4b262d9a2 |
Close
Hashes for python_solvespace-3.0.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33c150f68c81addf8045e28ffeb28a828fcbbe9ab84cc4a9f1e50d0847b23bfb |
|
MD5 | f5a2b27c6fee089f6e15bbcc096042ff |
|
BLAKE2b-256 | c7287e8ea55da42cd9e0ab9bdc607f5d57270c553baa9c4dab63866bba7c6e40 |
Close
Hashes for python_solvespace-3.0.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd3366cda1f3bac7c239c3fad98c6eee97c3d9299ee5c3a1ab3e4ea5e112b81a |
|
MD5 | 616085e94db7f4c44b6ceb3cd1714a67 |
|
BLAKE2b-256 | 1c73cfd7e631395b036052356517c2c8b8e7917308b4c397694da34260f7eff6 |
Close
Hashes for python_solvespace-3.0.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da03f9758553af996dc879dc939ce33336721896a8365f3e719491fca913b990 |
|
MD5 | ca02793f6c1869e097e55af2cb889c17 |
|
BLAKE2b-256 | f21b1754073fd9ae3322e201fa504fdb4ee5c13fde339ece9bab085b19f1d08e |
Close
Hashes for python_solvespace-3.0.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 967c55b10cc431cc867509c49cfaa164e1313d683029f57a74e4256989b364ba |
|
MD5 | db9dee79b45ffe679656a4cc06d17076 |
|
BLAKE2b-256 | c66435d77989e460fbd392b70eaa1508a4e6db1150c1766b17faf7eeb413594f |
Close
Hashes for python_solvespace-3.0.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27343000974e477209dbb4f9d5f46af45d6b6c760b477a8c7a05e2b28a032195 |
|
MD5 | 11ca746a7aba85147839160b477f7bd2 |
|
BLAKE2b-256 | 66a5b7a88d5bbbaf5d4a293e6be1574f83a7730e3359e363cf741fd98b13cefc |
Close
Hashes for python_solvespace-3.0.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd195c0ad977fc3f25d3589fee7609eaae4213994ad7faae2cad95c183978dd5 |
|
MD5 | 201c7d03c47706167de5115c6a889f84 |
|
BLAKE2b-256 | 628a136a1ebb52bf5649cd506097022678409c49b7f224202833766cda1a01fe |
Close
Hashes for python_solvespace-3.0.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1466613204c3814c52bb2532520dae41eea9e792e722a7df428cbc0121e9bde9 |
|
MD5 | 0dba1f04faffb6d50cb20e67cc4e8cc8 |
|
BLAKE2b-256 | 9540d611d381cd8110257f2878fbe53a607f522c22560a18ed83c77dc1692418 |
Close
Hashes for python_solvespace-3.0.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae8ad1084a5ade1604401b53699ee3a2e4c7521638b0629ee79e4d5d1c9e718 |
|
MD5 | 5b7572fad666123e9a8f7952ce416a85 |
|
BLAKE2b-256 | e2156fbdc4406683c4882de70ce325c27594f54d7472940fd19e37658e1898e4 |
Close
Hashes for python_solvespace-3.0.8-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ecc5fd4fe9fc63079ab371707bd4db6b121d89e15ed8f95650986aa9d57c4c |
|
MD5 | 7296652a36443dcfcd8ed303a9bc830b |
|
BLAKE2b-256 | 838600a8f779e7f78626757d5dcf738d6d4debba9a51a076a6172c3586c933d8 |
Close
Hashes for python_solvespace-3.0.8-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c682903335fc8caaf93863388dfabf500fc247f3e0207d55ec51a3810682772 |
|
MD5 | d9df8a5dc29c400d46e2dd9e09665c23 |
|
BLAKE2b-256 | c0bb14303ae537f11b5a10ecddc76025351a562e6e94e2a37807de9cb95f7340 |