Merge pull request #2 from CadQuery/master

update
This commit is contained in:
Bruno Agostini
2019-12-24 10:45:49 +01:00
committed by GitHub
17 changed files with 53 additions and 54 deletions

View File

@ -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

View File

@ -51,10 +51,9 @@ before_install:
- hash -r;
- 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
pyparsing mock;
- source ~/miniconda/bin/activate test_cq;
- pip install .[dev]
- python -c 'import OCC.gp as gp; print(gp.gp_Vec())'
- pip install codecov
install:
- python setup.py install
@ -64,7 +63,7 @@ before_script:
- sudo rm -f /cores/core.*
script:
- coverage run runtests.py
- pytest -v --cov
after_success:
- codecov

View File

@ -19,13 +19,13 @@ install:
- 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
- activate cqtest
- pip install codecov
- pip install .[dev]
- python setup.py install
build: false
test_script:
- coverage run runtests.py
- pytest -v --cov
on_success:
- codecov

View File

@ -619,7 +619,7 @@ class Plane(object):
:param rotate: Vector [xDegrees, yDegrees, zDegrees]
:return: a copy of this plane rotated as requested.
"""
rotate = Vector(rotate)
rotate = Vector(self.toWorldCoords(rotate))
# Convert to radians.
rotate = rotate.multiply(math.pi / 180.0)

View File

@ -20,11 +20,12 @@ requirements:
- pyparsing 2.*
test:
requires:
- pytest
source_files:
- runtests.py
- tests/
commands:
- python runtests.py
- pytest -v
about:
summary: CadQuery fork based on PythonOCC

View File

@ -6,9 +6,6 @@ dependencies:
- python=3.6
- pythonocc-core=0.18.2
- oce=0.18.2
- pyparsing
- pip
- pip:
- "--editable=."
# Documentation
- sphinx
- sphinx_rtd_theme
- "--editable=.[dev]"

View File

@ -1,3 +0,0 @@
sphinx-rtd-theme==0.1.9
travis-sphinx==1.1.0
Sphinx==1.3.1

View File

View File

@ -32,6 +32,17 @@ setup(
long_description=open('README.md').read(),
packages=['cadquery','cadquery.contrib','cadquery.occ_impl','cadquery.plugins','tests'],
install_requires=['pyparsing'],
extras_require={
'dev': [
# Documentation
'sphinx',
'sphinx_rtd_theme',
# Testing
'codecov',
'pytest',
'pytest-cov',
],
},
include_package_data=True,
zip_safe=False,
platforms='any',

View File

@ -4,6 +4,9 @@
"""
# system modules
import math,os.path,time,tempfile
from random import choice
from random import random
from random import randrange
# my modules
from cadquery import *
@ -246,6 +249,32 @@ class TestCadQuery(BaseTest):
self.assertEqual(-0.5, endPoint[1])
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):
"""
Test making a lofted solid