Got the revolution operation partly working. There seems to be something wrong with how the wires are being handled still.

This commit is contained in:
Jeremy Wright 2014-09-30 17:38:24 -04:00
parent 0d0c40f596
commit bfcc07ba60
5 changed files with 24 additions and 22 deletions

View File

@ -1,6 +1,6 @@
Metadata-Version: 1.0
Metadata-Version: 1.1
Name: cadquery
Version: 0.1.5
Version: 0.1.6
Summary: CadQuery is a parametric scripting language for creating and traversing CAD models
Home-page: https://github.com/dcowden/cadquery
Author: David Cowden

View File

@ -16,6 +16,7 @@ cadquery/contrib/__init__.py
cadquery/freecad_impl/__init__.py
cadquery/freecad_impl/exporters.py
cadquery/freecad_impl/geom.py
cadquery/freecad_impl/importers.py
cadquery/freecad_impl/shapes.py
cadquery/freecad_impl/verutil.py
cadquery/plugins/__init__.py
@ -23,6 +24,7 @@ tests/TestCQSelectors.py
tests/TestCadObjects.py
tests/TestCadQuery.py
tests/TestExporters.py
tests/TestImporters.py
tests/TestImports.py
tests/TestWorkplanes.py
tests/__init__.py

View File

@ -1884,7 +1884,7 @@ class Workplane(CQ):
* if combine is true, the value is combined with the context solid if it exists,
and the resulting solid becomes the new context solid.
"""
r = self._extrude(angleDegrees) #returns a Solid ( or a compound if there were multiple )
r = self._revolve(angleDegrees) #returns a Solid ( or a compound if there were multiple )
if combine:
return self._combineWithBase(r)
else:

View File

@ -737,32 +737,32 @@ class Solid(Shape):
return Shape.cast(result)
@classmethod
def revolve(cls,outerWire,innerWires, angleDegrees):
"""
Attempt to revolve the list of wires into a solid in the provided direction
@classmethod
def revolve(cls,outerWire,innerWires, angleDegrees):
"""
Attempt to revolve the list of wires into a solid in the provided direction
:param outerWire: the outermost wire
:param innerWires: a list of inner wires
:param angleDegrees: the angle through which to revolve the wires
:return: a Solid object
:param outerWire: the outermost wire
:param innerWires: a list of inner wires
:param angleDegrees: the angle through which to revolve the wires
:return: a Solid object
The wires must not intersect
The wires must not intersect
* all wires must be closed
* there cannot be any intersecting or self-intersecting wires
* wires must be listed from outside in
* more than one levels of nesting is not supported reliably
* all wires must be closed
* there cannot be any intersecting or self-intersecting wires
* wires must be listed from outside in
* more than one levels of nesting is not supported reliably
This method will attempt to sort the wires, but there is much work remaining to make this method
reliable.
This method will attempt to sort the wires, but there is much work remaining to make this method
reliable.
"""
freeCADWires = [outerWire.wrapped]
for w in innerWires:
freeCADWires.append(w.wrapped)
f = FreeCADPart.Face(freeCADWires)
result = f.revolve(Base.Vector(60,0,0), Vector(0,0,1), angleDegrees)
result = f.revolve(FreeCAD.Base.Vector(5,0,0), FreeCAD.Base.Vector(0,1,0), angleDegrees)
return Shape.cast(result)

View File

@ -20,9 +20,9 @@ import cadquery
import Part
#The dimensions of the model. These can be modified rather than changing the shape's code directly.
rectangle_width = 13.0
rectange_length = 19.0
angleDegrees = 180.0
rectangle_width = 15.0
rectange_length = 15.0
angleDegrees = 360.0
#Extrude a cylindrical plate with a rectangular hole in the middle of it
result = cadquery.Workplane("front").rect(rectangle_width, rectange_length).revolve(angleDegrees)