Updated the CadQuery library to v1.1.0
This commit is contained in:
parent
c23e237bad
commit
00e6fb8d5c
|
@ -7,7 +7,7 @@ What is a CadQuery?
|
|||
|
||||
[](https://travis-ci.org/dcowden/cadquery?branch=master)
|
||||
[](https://coveralls.io/github/dcowden/cadquery?branch=master)
|
||||
[](https://github.com/dcowden/cadquery/releases/tag/v0.3.0)
|
||||
[](https://github.com/dcowden/cadquery/releases/tag/v1.1.0)
|
||||
[](https://github.com/dcowden/cadquery/blob/master/LICENSE)
|
||||
|
||||
CadQuery is an intuitive, easy-to-use python based language for building parametric 3D CAD models. CadQuery is for 3D CAD what jQuery is for javascript. Imagine selecting Faces of a 3d object the same way you select DOM objects with JQuery!
|
||||
|
|
|
@ -18,4 +18,4 @@ __all__ = [
|
|||
'TypeSelector','DirectionMinMaxSelector','StringSyntaxSelector','Selector','plugins',
|
||||
]
|
||||
|
||||
__version__ = "1.0.0"
|
||||
__version__ = "1.1.0"
|
||||
|
|
|
@ -660,17 +660,17 @@ class Face(Shape):
|
|||
|
||||
def cut(self, faceToCut):
|
||||
"Remove a face from another one"
|
||||
return Shape.cast(self.obj.cut(faceToCut.obj))
|
||||
return Shape.cast(self.wrapped.cut(faceToCut.wrapped))
|
||||
|
||||
def fuse(self, faceToJoin):
|
||||
return Shape.cast(self.obj.fuse(faceToJoin.obj))
|
||||
return Shape.cast(self.wrapped.fuse(faceToJoin.wrapped))
|
||||
|
||||
def intersect(self, faceToIntersect):
|
||||
"""
|
||||
computes the intersection between the face and the supplied one.
|
||||
The result could be a face or a compound of faces
|
||||
"""
|
||||
return Shape.cast(self.obj.common(faceToIntersect.obj))
|
||||
return Shape.cast(self.wrapped.common(faceToIntersect.wrapped))
|
||||
|
||||
|
||||
class Shell(Shape):
|
||||
|
@ -751,18 +751,6 @@ class Solid(Shape):
|
|||
"""
|
||||
return Shape.cast(FreeCADPart.makeTorus(radius1, radius2, pnt, dir, angleDegrees1, angleDegrees2))
|
||||
|
||||
@classmethod
|
||||
def sweep(cls, profileWire, pathWire):
|
||||
"""
|
||||
make a solid by sweeping the profileWire along the specified path
|
||||
:param cls:
|
||||
:param profileWire:
|
||||
:param pathWire:
|
||||
:return:
|
||||
"""
|
||||
# needs to use freecad wire.makePipe or makePipeShell
|
||||
# needs to allow free-space wires ( those not made from a workplane )
|
||||
|
||||
@classmethod
|
||||
def makeLoft(cls, listOfWire, ruled=False):
|
||||
"""
|
||||
|
|
|
@ -2,7 +2,7 @@ Changes
|
|||
=======
|
||||
|
||||
|
||||
v1.1.0 (Unreleased)
|
||||
v1.1.0
|
||||
------
|
||||
* Fixes and addition of graphical examples for selectors (thanks @adam-urbanczyk) #181
|
||||
* Added intersect operation (thanks @fragmuffin) #189
|
||||
|
@ -18,6 +18,11 @@ v1.1.0 (Unreleased)
|
|||
* Fixed Line versus LineSegment incompatibility between FreeCAD 0.16 and 0.17 #209
|
||||
* @RustyVermeer fixed a long-standing bug with the extrusion of invalid faces #210
|
||||
* @adam-urbanczyk fixed a Python 2 versus Python 3 (unicode) issue with SVG export #215
|
||||
* Python 3 support was completed by the community with @adam-urbanczyk leading the way
|
||||
* SVG export improvements including orientation control from @RustyVermeer #232
|
||||
* Improved test coverage
|
||||
* @galou fixed braille example #229
|
||||
|
||||
|
||||
v1.0.0
|
||||
------
|
||||
|
|
|
@ -55,9 +55,9 @@ copyright = 'Parametric Products Intellectual Holdings LLC, All Rights Reserved'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.0'
|
||||
version = '1.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.0.0'
|
||||
release = '1.1.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -16,7 +16,7 @@ from setuptools import setup
|
|||
|
||||
|
||||
#if we are building in travis, use the build number as the sub-minor version
|
||||
version = '1.0.0'
|
||||
version = '1.1.0'
|
||||
if 'TRAVIS_TAG' in list(os.environ.keys()):
|
||||
version= os.environ['TRAVIS_TAG']
|
||||
|
||||
|
|
|
@ -402,6 +402,84 @@ class TestCadObjects(BaseTest):
|
|||
self.assertEquals(surf1.ShapeType(), 'Face')
|
||||
self.assertTrue(surf1.isValid())
|
||||
|
||||
def testCut(self):
|
||||
"""
|
||||
Tests cutting one face from another.
|
||||
"""
|
||||
# Face 1
|
||||
edge1 = Part.makeLine((0, 0, 0), (0, 10, 0))
|
||||
edge2 = Part.makeLine((0, 10, 0), (10, 10, 0))
|
||||
edge3 = Part.makeLine((10, 10, 0), (10, 0, 0))
|
||||
edge4 = Part.makeLine((10, 0, 0), (0, 0, 0))
|
||||
wire1 = Part.Wire([edge1,edge2,edge3,edge4])
|
||||
face1 = Part.Face(wire1)
|
||||
cqFace1 = Face(face1)
|
||||
|
||||
# Face 2 (face to cut out of face 1)
|
||||
edge1 = Part.makeLine((0, 0, 0), (0, 5, 0))
|
||||
edge2 = Part.makeLine((0, 5, 0), (5, 5, 0))
|
||||
edge3 = Part.makeLine((5, 5, 0), (5, 0, 0))
|
||||
edge4 = Part.makeLine((5, 0, 0), (0, 0, 0))
|
||||
wire1 = Part.Wire([edge1,edge2,edge3,edge4])
|
||||
face2 = Part.Face(wire1)
|
||||
cqFace2 = Face(face2)
|
||||
|
||||
# Face resulting from cut
|
||||
cqFace3 = cqFace1.cut(cqFace2)
|
||||
|
||||
self.assertEquals(len(cqFace3.Faces()), 1)
|
||||
self.assertEquals(len(cqFace3.Edges()), 6)
|
||||
|
||||
def testFuse(self):
|
||||
"""
|
||||
Tests fusing one face to another.
|
||||
"""
|
||||
# Face 1
|
||||
edge1 = Part.makeLine((0, 0, 0), (0, 10, 0))
|
||||
edge2 = Part.makeLine((0, 10, 0), (10, 10, 0))
|
||||
edge3 = Part.makeLine((10, 10, 0), (10, 0, 0))
|
||||
edge4 = Part.makeLine((10, 0, 0), (0, 0, 0))
|
||||
wire1 = Part.Wire([edge1,edge2,edge3,edge4])
|
||||
face1 = Part.Face(wire1)
|
||||
cqFace1 = Face(face1)
|
||||
|
||||
# Face 2 (face to cut out of face 1)
|
||||
edge1 = Part.makeCircle(4.0)
|
||||
wire1 = Part.Wire([edge1])
|
||||
face2 = Part.Face(wire1)
|
||||
cqFace2 = Face(face2)
|
||||
|
||||
# Face resulting from fuse
|
||||
cqFace3 = cqFace1.fuse(cqFace2)
|
||||
|
||||
self.assertEquals(len(cqFace3.Faces()), 3)
|
||||
self.assertEquals(len(cqFace3.Edges()), 8)
|
||||
|
||||
def testIntersect(self):
|
||||
"""
|
||||
Tests finding the intersection of two faces.
|
||||
"""
|
||||
# Face 1
|
||||
edge1 = Part.makeLine((0, 0, 0), (0, 10, 0))
|
||||
edge2 = Part.makeLine((0, 10, 0), (10, 10, 0))
|
||||
edge3 = Part.makeLine((10, 10, 0), (10, 0, 0))
|
||||
edge4 = Part.makeLine((10, 0, 0), (0, 0, 0))
|
||||
wire1 = Part.Wire([edge1,edge2,edge3,edge4])
|
||||
face1 = Part.Face(wire1)
|
||||
cqFace1 = Face(face1)
|
||||
|
||||
# Face 2 (face to cut out of face 1)
|
||||
edge1 = Part.makeCircle(4.0)
|
||||
wire1 = Part.Wire([edge1])
|
||||
face2 = Part.Face(wire1)
|
||||
cqFace2 = Face(face2)
|
||||
|
||||
# Face resulting from the intersection
|
||||
cqFace3 = cqFace1.intersect(cqFace2)
|
||||
|
||||
self.assertEquals(len(cqFace3.Faces()), 1)
|
||||
self.assertEquals(len(cqFace3.Edges()), 3)
|
||||
|
||||
def testVertices(self):
|
||||
e = Shape.cast(Part.makeLine((0, 0, 0), (1, 1, 0)))
|
||||
self.assertEqual(2, len(e.Vertices()))
|
||||
|
|
Loading…
Reference in New Issue
Block a user