From bfcc07ba60864fa135a4a800c7b4dd1cca47c445 Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Tue, 30 Sep 2014 17:38:24 -0400 Subject: [PATCH] Got the revolution operation partly working. There seems to be something wrong with how the wires are being handled still. --- cadquery.egg-info/PKG-INFO | 4 ++-- cadquery.egg-info/SOURCES.txt | 2 ++ cadquery/CQ.py | 2 +- cadquery/freecad_impl/shapes.py | 32 ++++++++++++++-------------- examples/FreeCAD/Ex024_Revolution.py | 6 +++--- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/cadquery.egg-info/PKG-INFO b/cadquery.egg-info/PKG-INFO index e0fafbe..22ab98a 100644 --- a/cadquery.egg-info/PKG-INFO +++ b/cadquery.egg-info/PKG-INFO @@ -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 diff --git a/cadquery.egg-info/SOURCES.txt b/cadquery.egg-info/SOURCES.txt index 2328c8b..2e88412 100644 --- a/cadquery.egg-info/SOURCES.txt +++ b/cadquery.egg-info/SOURCES.txt @@ -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 \ No newline at end of file diff --git a/cadquery/CQ.py b/cadquery/CQ.py index fa66ced..277d768 100644 --- a/cadquery/CQ.py +++ b/cadquery/CQ.py @@ -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: diff --git a/cadquery/freecad_impl/shapes.py b/cadquery/freecad_impl/shapes.py index b3d16a8..4badc7b 100644 --- a/cadquery/freecad_impl/shapes.py +++ b/cadquery/freecad_impl/shapes.py @@ -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) diff --git a/examples/FreeCAD/Ex024_Revolution.py b/examples/FreeCAD/Ex024_Revolution.py index 3263412..dce2159 100644 --- a/examples/FreeCAD/Ex024_Revolution.py +++ b/examples/FreeCAD/Ex024_Revolution.py @@ -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)