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.7-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48d2680920858ffb02ae1c3f4b03a54f3b1d7a2e5c0e779ae5eb542e45551872 |
|
MD5 | 354e7fbe369e041133704e5630496911 |
|
BLAKE2b-256 | 48b816b0aa7836b3931902a0dafc472b1142fc4be5bebd2936611c69b7303831 |
Close
Hashes for python_solvespace-3.0.7-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ead9a79b1ccee52e86d4d02087a826fe065a81bc13fee9581ad0a90a88b71d3 |
|
MD5 | f941b4c3133cfc31cbf3d14a83403f60 |
|
BLAKE2b-256 | c5baa1ce31cc2251eef27f28dbff21a588b6ea553de966255aaca212a85e9529 |
Close
Hashes for python_solvespace-3.0.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b737c544cddafe9fa172eefb49230133dec036da4499e8dca252fdc0e70dd98 |
|
MD5 | c33d08d9abb17603299e10525df50da9 |
|
BLAKE2b-256 | 3bc15041faf8b1f76d43cb09084d5843814c126283bad68c9148e6b8a3579c98 |
Close
Hashes for python_solvespace-3.0.7-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761e513621cc887a2b3eb6a8180aec0722822364f7c96e950a759b0b3d60f7dd |
|
MD5 | b640328958801c7355b7de15e0f985af |
|
BLAKE2b-256 | a71cf6c6a73c9208af3d1d1aed3610cb86411e665f4f47abba18c2a99b0efac0 |
Close
Hashes for python_solvespace-3.0.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5ccf06167c66a74832982c8efb742a6dce3521d7b52f35977c9b31dc079875f |
|
MD5 | 799c4cc77b354403e0f09ccd32e29dae |
|
BLAKE2b-256 | 84056b49cb2dc25a665bbe9ec5a3de765172f04319d6a9ab2b999a53bc28b6f5 |
Close
Hashes for python_solvespace-3.0.7-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f6ba2b8d59e967d2433b0564235d337ee412e498e377bbcf4aaff4021e8b62c |
|
MD5 | f7cfbd3e922f0606ebbb8c13bb8b85bb |
|
BLAKE2b-256 | ea67e740b34dfd8cbf62a676e9697a0b987d4c44e00aee40c76ad61fcead52cb |
Close
Hashes for python_solvespace-3.0.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91ec19c5e4b4825e0b05adb38432d89f1c44e46a452f5ef60bbd4d749aa55245 |
|
MD5 | ace0397b7166dcb89ef868c706f5a0d0 |
|
BLAKE2b-256 | 5a9ebd4009465c142959e44e8e8cc3079f9f6d3b253baae91ec1f867a793b5c4 |
Close
Hashes for python_solvespace-3.0.7-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 925e048f00ee7d4ae5741b48fe123a88c3f469a17c464c167cf5fd8c2e07c5a9 |
|
MD5 | a491fd56b721be09119136fd81f888c6 |
|
BLAKE2b-256 | 4cb03a090875f4878cde1105163ef7a77cd9110df5bbf2d9fb615415b65f3e2d |
Close
Hashes for python_solvespace-3.0.7-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ed50ac724698f0f27a2ed2f621d5c89f92edd6b536dd9ebadc27a4a0491e74a |
|
MD5 | 703f94c09b8316b96bcc344fbac22ceb |
|
BLAKE2b-256 | e8e3fa07662bc6308dbef907eeeeef6c2228db6c82072a7fed31281cee1b8c13 |
Close
Hashes for python_solvespace-3.0.7-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50082587844a2cf24e6def02d136d14fa7db9134f3485589b396681e1aedd39c |
|
MD5 | c44355539446cb3770be3449d16f1560 |
|
BLAKE2b-256 | 7128b631ee9fe73e48500e75d28642fe8b649b9899309b54e468319ea8b163a5 |