@ -1,35 +0,0 @@
|
|||||||
version: 2
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
runtests:
|
|
||||||
|
|
||||||
macos:
|
|
||||||
xcode: "9.0"
|
|
||||||
|
|
||||||
environment:
|
|
||||||
PYTEST_QT_API: pyqt5
|
|
||||||
PYTHON_VERSION: 3.6
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget
|
|
||||||
- run: cd && rm -rf ~/.pyenv && rm -rf ~/virtualenvs
|
|
||||||
- run: wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh
|
|
||||||
- run: chmod +x ~/miniconda.sh && ~/miniconda.sh -b
|
|
||||||
- run: echo "export PATH=~/miniconda3/bin:$PATH" >> $BASH_ENV
|
|
||||||
- run: conda config --set always_yes yes
|
|
||||||
- run: conda create --quiet --name cqtest -c cadquery -c conda-forge -c dlr-sc pythonocc-core=0.18.2 oce=0.18.2 python=$PYTHON_VERSION pyparsing mock lldb
|
|
||||||
- run: |
|
|
||||||
source activate cqtest
|
|
||||||
pip install coverage
|
|
||||||
python setup.py install
|
|
||||||
conda env list
|
|
||||||
conda list
|
|
||||||
coverage run runtests.py
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
workflow:
|
|
||||||
jobs:
|
|
||||||
- runtests
|
|
||||||
@ -51,10 +51,9 @@ before_install:
|
|||||||
- hash -r;
|
- hash -r;
|
||||||
- conda config --set always_yes yes --set changeps1 no;
|
- conda config --set always_yes yes --set changeps1 no;
|
||||||
- conda create -y -q -n test_cq -c cadquery -c conda-forge pythonocc-core=0.18.2 oce=0.18.2 python=$TRAVIS_PYTHON_VERSION
|
- conda create -y -q -n test_cq -c cadquery -c conda-forge pythonocc-core=0.18.2 oce=0.18.2 python=$TRAVIS_PYTHON_VERSION
|
||||||
pyparsing mock;
|
|
||||||
- source ~/miniconda/bin/activate test_cq;
|
- source ~/miniconda/bin/activate test_cq;
|
||||||
|
- pip install .[dev]
|
||||||
- python -c 'import OCC.gp as gp; print(gp.gp_Vec())'
|
- python -c 'import OCC.gp as gp; print(gp.gp_Vec())'
|
||||||
- pip install codecov
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- python setup.py install
|
- python setup.py install
|
||||||
@ -64,7 +63,7 @@ before_script:
|
|||||||
- sudo rm -f /cores/core.*
|
- sudo rm -f /cores/core.*
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- coverage run runtests.py
|
- pytest -v --cov
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- codecov
|
- codecov
|
||||||
|
|||||||
@ -19,13 +19,13 @@ install:
|
|||||||
- conda update -q conda
|
- conda update -q conda
|
||||||
- conda create --quiet --name cqtest -c cadquery -c conda-forge -c dlr-sc pythonocc-core=0.18.2 python=%PYTHON_VERSION% pyparsing mock coverage codecov
|
- conda create --quiet --name cqtest -c cadquery -c conda-forge -c dlr-sc pythonocc-core=0.18.2 python=%PYTHON_VERSION% pyparsing mock coverage codecov
|
||||||
- activate cqtest
|
- activate cqtest
|
||||||
- pip install codecov
|
- pip install .[dev]
|
||||||
- python setup.py install
|
- python setup.py install
|
||||||
|
|
||||||
build: false
|
build: false
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- coverage run runtests.py
|
- pytest -v --cov
|
||||||
|
|
||||||
on_success:
|
on_success:
|
||||||
- codecov
|
- codecov
|
||||||
|
|||||||
@ -619,7 +619,7 @@ class Plane(object):
|
|||||||
:param rotate: Vector [xDegrees, yDegrees, zDegrees]
|
:param rotate: Vector [xDegrees, yDegrees, zDegrees]
|
||||||
:return: a copy of this plane rotated as requested.
|
:return: a copy of this plane rotated as requested.
|
||||||
"""
|
"""
|
||||||
rotate = Vector(rotate)
|
rotate = Vector(self.toWorldCoords(rotate))
|
||||||
# Convert to radians.
|
# Convert to radians.
|
||||||
rotate = rotate.multiply(math.pi / 180.0)
|
rotate = rotate.multiply(math.pi / 180.0)
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,12 @@ requirements:
|
|||||||
- pyparsing 2.*
|
- pyparsing 2.*
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
requires:
|
||||||
|
- pytest
|
||||||
source_files:
|
source_files:
|
||||||
- runtests.py
|
|
||||||
- tests/
|
- tests/
|
||||||
commands:
|
commands:
|
||||||
- python runtests.py
|
- pytest -v
|
||||||
|
|
||||||
about:
|
about:
|
||||||
summary: CadQuery fork based on PythonOCC
|
summary: CadQuery fork based on PythonOCC
|
||||||
|
|||||||
@ -6,9 +6,6 @@ dependencies:
|
|||||||
- python=3.6
|
- python=3.6
|
||||||
- pythonocc-core=0.18.2
|
- pythonocc-core=0.18.2
|
||||||
- oce=0.18.2
|
- oce=0.18.2
|
||||||
- pyparsing
|
- pip
|
||||||
- pip:
|
- pip:
|
||||||
- "--editable=."
|
- "--editable=.[dev]"
|
||||||
# Documentation
|
|
||||||
- sphinx
|
|
||||||
- sphinx_rtd_theme
|
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
sphinx-rtd-theme==0.1.9
|
|
||||||
travis-sphinx==1.1.0
|
|
||||||
Sphinx==1.3.1
|
|
||||||
11
setup.py
11
setup.py
@ -32,6 +32,17 @@ setup(
|
|||||||
long_description=open('README.md').read(),
|
long_description=open('README.md').read(),
|
||||||
packages=['cadquery','cadquery.contrib','cadquery.occ_impl','cadquery.plugins','tests'],
|
packages=['cadquery','cadquery.contrib','cadquery.occ_impl','cadquery.plugins','tests'],
|
||||||
install_requires=['pyparsing'],
|
install_requires=['pyparsing'],
|
||||||
|
extras_require={
|
||||||
|
'dev': [
|
||||||
|
# Documentation
|
||||||
|
'sphinx',
|
||||||
|
'sphinx_rtd_theme',
|
||||||
|
# Testing
|
||||||
|
'codecov',
|
||||||
|
'pytest',
|
||||||
|
'pytest-cov',
|
||||||
|
],
|
||||||
|
},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
platforms='any',
|
platforms='any',
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
"""
|
"""
|
||||||
# system modules
|
# system modules
|
||||||
import math,os.path,time,tempfile
|
import math,os.path,time,tempfile
|
||||||
|
from random import choice
|
||||||
|
from random import random
|
||||||
|
from random import randrange
|
||||||
|
|
||||||
# my modules
|
# my modules
|
||||||
from cadquery import *
|
from cadquery import *
|
||||||
@ -246,6 +249,32 @@ class TestCadQuery(BaseTest):
|
|||||||
self.assertEqual(-0.5, endPoint[1])
|
self.assertEqual(-0.5, endPoint[1])
|
||||||
self.assertEqual(2.5, endPoint[2])
|
self.assertEqual(2.5, endPoint[2])
|
||||||
|
|
||||||
|
def testPlaneRotateZNormal(self):
|
||||||
|
"""
|
||||||
|
Rotation of a plane in the Z direction should never alter its normal.
|
||||||
|
|
||||||
|
This test creates random planes, with the normal in a random direction
|
||||||
|
among positive and negative X, Y and Z. The plane is defined with this
|
||||||
|
normal and another random perpendicular vector (the X-direction of the
|
||||||
|
plane). The plane is finally rotated a random angle in the Z-direction
|
||||||
|
to verify that the resulting plane maintains the same normal.
|
||||||
|
"""
|
||||||
|
for _ in range(100):
|
||||||
|
normal_sign = choice((-1, 1))
|
||||||
|
normal_dir = randrange(3)
|
||||||
|
angle = (random() - 0.5) * 720
|
||||||
|
|
||||||
|
normal = [0, 0, 0]
|
||||||
|
normal[normal_dir] = normal_sign
|
||||||
|
xdir = [random(), random(), random()]
|
||||||
|
xdir[normal_dir] = 0
|
||||||
|
|
||||||
|
plane = Plane(origin=(0, 0, 0), xDir=xdir, normal=normal)
|
||||||
|
rotated = plane.rotated((0, 0, angle)).zDir.toTuple()
|
||||||
|
self.assertAlmostEqual(rotated[0], normal[0])
|
||||||
|
self.assertAlmostEqual(rotated[1], normal[1])
|
||||||
|
self.assertAlmostEqual(rotated[2], normal[2])
|
||||||
|
|
||||||
def testLoft(self):
|
def testLoft(self):
|
||||||
"""
|
"""
|
||||||
Test making a lofted solid
|
Test making a lofted solid
|
||||||
Reference in New Issue
Block a user