Skip to content

Commit 3f7d38c

Browse files
committed
now at least you can import
1 parent ef92f65 commit 3f7d38c

8 files changed

Lines changed: 27 additions & 31 deletions

File tree

cadquery/CQ.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(self):
3030
self.firstPoint = None #a reference to the first point for a set of edges. used to determine how to behave when close() is called
3131
self.tolerance = 0.0001 #user specified tolerance
3232

33-
3433
class CQ(object):
3534
"""
3635
Provides enhanced functionality for a wrapped CAD primitive.

cadquery/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@
1616
You should have received a copy of the GNU Lesser General Public
1717
License along with this library; If not, see <http://www.gnu.org/licenses/>
1818
"""
19-
#these items are the common implementation
20-
from .CQ import CQ
21-
from .workplane import Workplane
22-
from . import plugins
23-
from . import selectors
19+
2420

2521
#these items point to the freecad implementation
2622
from .freecad_impl.geom import Plane,BoundBox,Vector
2723
from .freecad_impl.shapes import Shape,Vertex,Edge,Wire,Solid,Shell,Compound
2824
from .freecad_impl.exporters import SvgExporter, AmfExporter, JsonExporter
2925

26+
#these items are the common implementation
27+
from .CQ import CQ
28+
from .workplane import Workplane
29+
from . import plugins
30+
from . import selectors
31+
3032
__all__ = [
3133
'CQ','Workplane','plugins','selectors','Plane','BoundBox',
3234
'Shape','Vertex','Edge','Wire','Solid','Shell','Compound',

cadquery/freecad_impl/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@
1616
You should have received a copy of the GNU Lesser General Public
1717
License along with this library; If not, see <http://www.gnu.org/licenses/>
1818
"""
19-
20-
import FreeCAD
21-
from FreeCAD import Part
22-
from FreeCAD import Base
23-
FreeCADVector = Base.Vector
24-
DEFAULT_TOLERANCE = 0.0001

cadquery/freecad_impl/exporters.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def guessUnitOfMeasure(shape):
5757
class Exporter(object):
5858

5959
def export(self):
60-
"""
61-
return a string representing the model exported in the specified format
62-
"""
60+
"""
61+
return a string representing the model exported in the specified format
62+
"""
6363
raise NotImplementedError()
6464

65-
class AMFExporter(Exporter):
65+
class AmfExporter(Exporter):
6666
def __init__(self,tessellation):
6767

6868
self.units = "mm"
@@ -135,8 +135,10 @@ def toJson(self):
135135
'nFaces' : self.nFaces
136136
};
137137

138-
class SVGExporter(Exporter):
139-
138+
class SvgExporter(Exporter):
139+
140+
def export(self):
141+
pass
140142

141143
def getPaths(freeCadSVG):
142144
"""

cadquery/freecad_impl/geom.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"""
1919

2020
import math,sys
21+
import FreeCAD
22+
import FreeCAD.Part
2123

2224
def sortWiresByBuildOrder(wireList,plane,result=[]):
2325
"""
@@ -95,11 +97,11 @@ class Vector(object):
9597
def __init__(self,*args):
9698

9799
if len(args) == 3:
98-
fV = FreeCADVector(args[0],args[1],args[2])
100+
fV = FreeCAD.Base.Vector(args[0],args[1],args[2])
99101
elif len(args) == 1:
100102
if type(args[0]) is tuple:
101-
fV = FreeCADVector(args[0][0],args[0][1],args[0][2])
102-
elif type(args[0] is FreeCADVector):
103+
fV = FreeCAD.Base.Vector(args[0][0],args[0][1],args[0][2])
104+
elif type(args[0] is FreeCAD.Base.Vector):
103105
fV = args[0]
104106
elif type(args[0] is Vector):
105107
fV = args[0].wrapped
@@ -137,7 +139,7 @@ def multiply(self,scale):
137139
Note: FreeCAD has a bug here, where the
138140
base is also modified
139141
"""
140-
tmp = FreeCADVector(self.wrapped)
142+
tmp = FreeCAD.Base.Vector(self.wrapped)
141143
return Vector( tmp.multiply(scale))
142144

143145
def normalize(self):
@@ -147,7 +149,7 @@ def normalize(self):
147149
Note: FreeCAD has a bug here, where the
148150
base is also modified
149151
"""
150-
tmp = FreeCADVector(self.wrapped)
152+
tmp = FreeCAD.Base.Vector(self.wrapped)
151153
tmp.normalize()
152154
return Vector( tmp )
153155

cadquery/freecad_impl/shapes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
object each one returns, so these are better grouped by the type of object they return.
4848
(who would know that Part.makeCircle() returns an Edge, but Part.makePolygon() returns a Wire ?
4949
"""
50-
50+
from cadquery import Vector
51+
import FreeCAD
52+
import FreeCAD.Part
5153

5254
class Shape(object):
5355
"""
@@ -63,7 +65,7 @@ def __init__(self,obj):
6365
def cast(cls,obj,forConstruction = False):
6466
"Returns the right type of wrapper, given a FreeCAD object"
6567
s = obj.ShapeType
66-
if type(obj) == FreeCADVector:
68+
if type(obj) == Base.Vector:
6769
return Vector(obj)
6870
tr = None
6971

cadquery/plugins/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@
1616
License along with this library; if not, write to the Free Software
1717
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
"""
19-
20-
from .CQ import CQ
21-
from .workplane import Workplane
22-
23-
__version__ = 0.9

cadquery/workplane.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"""
1919

2020
import math
21-
2221
from . import CQ
22+
from cadquery import Vector
2323

2424
class Workplane(CQ):
2525
"""

0 commit comments

Comments
 (0)