PKG Add python-solvespace (#2287)

python-solvespace is a python library from the geometric constraints
solver of SolveSpace, open source CAD software.
This commit is contained in:
Frank 2022-03-23 12:52:43 +08:00 committed by GitHub
parent 0f2ce88edb
commit 0a2b307cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 1 deletions

View File

@ -19,7 +19,7 @@ substitutions:
- {{Fix}} matplotlib now loads multiple fonts correctly {pr}`2271`
- New packages: boost-histogram {pr}`2174`, cryptography v3.3.2 {pr}`2263`, the
standard library ssl module {pr}`2263`
standard library ssl module {pr}`2263`, python-solvespace v3.0.7
- Upgraded packages: distlib (0.3.4), lxml (4.8.0) {pr}`2239`, astropy (5.0.2)

View File

@ -0,0 +1,18 @@
package:
name: python_solvespace
version: 3.0.6
source:
url: https://files.pythonhosted.org/packages/50/a6/4e01d2c90de41a431041f813aebada874d05d6d578ce25b2462872d2a3e6/python_solvespace-3.0.6.tar.gz
sha256: 951b4cf3858dc337bbfa9f6d9efe9fd6e8dfa7fed022556196add1ba5a56b045
build:
script: |
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz && tar -zxvf eigen-3.4.0.tar.gz
cp -rn eigen-3.4.0/Eigen python_solvespace/include
test:
imports:
- python_solvespace
about:
home: https://github.com/KmolYuan/solvespace/tree/python
PyPI: https://pypi.org/project/python_solvespace
summary: Python library of Solvespace.
license: GPLv3+

View File

@ -0,0 +1,26 @@
from pyodide_build.testing import run_in_pyodide
@run_in_pyodide(packages=["python_solvespace"])
def test_regex():
from python_solvespace import ResultFlag, SolverSystem
sys = SolverSystem()
wp = sys.create_2d_base()
p0 = sys.add_point_2d(0, 0, wp)
sys.dragged(p0, wp)
p1 = sys.add_point_2d(90, 0, wp)
sys.dragged(p1, wp)
line0 = sys.add_line_2d(p0, p1, wp)
p2 = sys.add_point_2d(20, 20, wp)
p3 = sys.add_point_2d(0, 10, wp)
p4 = sys.add_point_2d(30, 20, wp)
sys.distance(p2, p3, 40, wp)
sys.distance(p2, p4, 40, wp)
sys.distance(p3, p4, 70, wp)
sys.distance(p0, p3, 35, wp)
sys.distance(p1, p4, 70, wp)
line1 = sys.add_line_2d(p0, p3, wp)
sys.angle(line0, line1, 45, wp)
result_flag = sys.solve()
assert result_flag == ResultFlag.OKAY