Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Merge 396c9c0 into 5deb3c6
Browse files Browse the repository at this point in the history
  • Loading branch information
fragmuffin committed Feb 20, 2018
2 parents 5deb3c6 + 396c9c0 commit a80f4b1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions cadquery/cq.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def add(self, obj):
"""
if type(obj) == list:
self.objects.extend(obj)
elif type(obj) == CQ or type(obj) == Workplane:
elif isinstance(obj, CQ):
self.objects.extend(obj.objects)
else:
self.objects.append(obj)
Expand Down Expand Up @@ -2131,7 +2131,7 @@ def union(self, toUnion=None, combine=True, clean=True):
"""

#first collect all of the items together
if type(toUnion) == CQ or type(toUnion) == Workplane:
if isinstance(toUnion, CQ):
solids = toUnion.solids().vals()
if len(solids) < 1:
raise ValueError("CQ object must have at least one solid on the stack to union!")
Expand Down
50 changes: 25 additions & 25 deletions cadquery/freecad_impl/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,18 @@ def named(cls, stdName, origin=(0, 0, 0)):

namedPlanes = {
# origin, xDir, normal
'XY': Plane(origin, (1, 0, 0), (0, 0, 1)),
'YZ': Plane(origin, (0, 1, 0), (1, 0, 0)),
'ZX': Plane(origin, (0, 0, 1), (0, 1, 0)),
'XZ': Plane(origin, (1, 0, 0), (0, -1, 0)),
'YX': Plane(origin, (0, 1, 0), (0, 0, -1)),
'ZY': Plane(origin, (0, 0, 1), (-1, 0, 0)),
'front': Plane(origin, (1, 0, 0), (0, 0, 1)),
'back': Plane(origin, (-1, 0, 0), (0, 0, -1)),
'left': Plane(origin, (0, 0, 1), (-1, 0, 0)),
'right': Plane(origin, (0, 0, -1), (1, 0, 0)),
'top': Plane(origin, (1, 0, 0), (0, 1, 0)),
'bottom': Plane(origin, (1, 0, 0), (0, -1, 0))
'XY': cls(origin, (1, 0, 0), (0, 0, 1)),
'YZ': cls(origin, (0, 1, 0), (1, 0, 0)),
'ZX': cls(origin, (0, 0, 1), (0, 1, 0)),
'XZ': cls(origin, (1, 0, 0), (0, -1, 0)),
'YX': cls(origin, (0, 1, 0), (0, 0, -1)),
'ZY': cls(origin, (0, 0, 1), (-1, 0, 0)),
'front': cls(origin, (1, 0, 0), (0, 0, 1)),
'back': cls(origin, (-1, 0, 0), (0, 0, -1)),
'left': cls(origin, (0, 0, 1), (-1, 0, 0)),
'right': cls(origin, (0, 0, -1), (1, 0, 0)),
'top': cls(origin, (1, 0, 0), (0, 1, 0)),
'bottom': cls(origin, (1, 0, 0), (0, -1, 0))
}

try:
Expand All @@ -347,73 +347,73 @@ def named(cls, stdName, origin=(0, 0, 0)):

@classmethod
def XY(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)):
plane = Plane.named('XY', origin)
plane = cls.named('XY', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def YZ(cls, origin=(0, 0, 0), xDir=Vector(0, 1, 0)):
plane = Plane.named('YZ', origin)
plane = cls.named('YZ', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def ZX(cls, origin=(0, 0, 0), xDir=Vector(0, 0, 1)):
plane = Plane.named('ZX', origin)
plane = cls.named('ZX', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def XZ(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)):
plane = Plane.named('XZ', origin)
plane = cls.named('XZ', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def YX(cls, origin=(0, 0, 0), xDir=Vector(0, 1, 0)):
plane = Plane.named('YX', origin)
plane = cls.named('YX', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def ZY(cls, origin=(0, 0, 0), xDir=Vector(0, 0, 1)):
plane = Plane.named('ZY', origin)
plane = cls.named('ZY', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def front(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)):
plane = Plane.named('front', origin)
plane = cls.named('front', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def back(cls, origin=(0, 0, 0), xDir=Vector(-1, 0, 0)):
plane = Plane.named('back', origin)
plane = cls.named('back', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def left(cls, origin=(0, 0, 0), xDir=Vector(0, 0, 1)):
plane = Plane.named('left', origin)
plane = cls.named('left', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def right(cls, origin=(0, 0, 0), xDir=Vector(0, 0, -1)):
plane = Plane.named('right', origin)
plane = cls.named('right', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def top(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)):
plane = Plane.named('top', origin)
plane = cls.named('top', origin)
plane._setPlaneDir(xDir)
return plane

@classmethod
def bottom(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)):
plane = Plane.named('bottom', origin)
plane = cls.named('bottom', origin)
plane._setPlaneDir(xDir)
return plane

Expand Down Expand Up @@ -595,7 +595,7 @@ def rotated(self, rotate=(0, 0, 0)):
newXdir = Vector(m.multiply(self.xDir.wrapped))
newZdir = Vector(m.multiply(self.zDir.wrapped))

return Plane(self.origin, newXdir, newZdir)
return type(self)(self.origin, newXdir, newZdir)

def rotateShapes(self, listOfShapes, rotationMatrix):
"""Rotate the listOfShapes by the supplied rotationMatrix
Expand Down

0 comments on commit a80f4b1

Please sign in to comment.