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

Commit

Permalink
Merge pull request #124 from dcowden/implupdates
Browse files Browse the repository at this point in the history
Implupdates
  • Loading branch information
jmwright committed Nov 24, 2015
2 parents 066855c + 007725a commit 9ce84fb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cadquery/CQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def _computeXdir(normal):
normal = normal.multiply(-1.0)

#offset origin if desired
offsetVector = normal.normalize().multiply(offset)
offsetVector = normal.normalized().multiply(offset)
offsetCenter = center.add(offsetVector)

#make the new workplane
Expand Down
8 changes: 4 additions & 4 deletions cadquery/freecad_impl/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def multiply(self, scale):
tmp_fc_vector = FreeCAD.Base.Vector(self.wrapped)
return Vector(tmp_fc_vector.multiply(scale))

def normalize(self):
def normalized(self):
"""Return a normalized version of this vector"""
tmp_fc_vector = FreeCAD.Base.Vector(self.wrapped)
tmp_fc_vector.normalize()
Expand Down Expand Up @@ -343,7 +343,7 @@ def __init__(self, origin, xDir, normal):
normal = Vector(normal)
if (normal.Length == 0.0):
raise ValueError('normal should be non null')
self.zDir = normal.normalize()
self.zDir = normal.normalized()
xDir = Vector(xDir)
if (xDir.Length == 0.0):
raise ValueError('xDir should be non null')
Expand Down Expand Up @@ -539,8 +539,8 @@ def _setPlaneDir(self, xDir):
if (self.zDir.dot(xDir) > 1e-5):
raise ValueError('xDir must be parralel to the plane')
xDir = Vector(xDir)
self.xDir = xDir.normalize()
self.yDir = self.zDir.cross(self.xDir).normalize()
self.xDir = xDir.normalized()
self.yDir = self.zDir.cross(self.xDir).normalized()

def _calcTransforms(self):
"""Computes transformation matrices to convert between coordinates
Expand Down
24 changes: 24 additions & 0 deletions cadquery/freecad_impl/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def __init__(self, obj):
self.wrapped = obj
self.forConstruction = False

# Helps identify this solid through the use of an ID
self.label = ""

@classmethod
def cast(cls, obj, forConstruction=False):
"Returns the right type of wrapper, given a FreeCAD object"
Expand Down Expand Up @@ -356,6 +359,9 @@ def __init__(self, obj, forConstruction=False):
self.Y = obj.Y
self.Z = obj.Z

# Helps identify this solid through the use of an ID
self.label = ""

def toTuple(self):
return (self.X, self.Y, self.Z)

Expand All @@ -381,6 +387,9 @@ def __init__(self, obj):
FreeCADPart.Circle: 'CIRCLE'
}

# Helps identify this solid through the use of an ID
self.label = ""

def geomType(self):
t = type(self.wrapped.Curve)
if self.edgetypes.has_key(t):
Expand Down Expand Up @@ -476,6 +485,9 @@ def __init__(self, obj):
"""
self.wrapped = obj

# Helps identify this solid through the use of an ID
self.label = ""

@classmethod
def combine(cls, listOfWires):
"""
Expand Down Expand Up @@ -546,6 +558,9 @@ def __init__(self, obj):
FreeCADPart.Cone: 'CONE'
}

# Helps identify this solid through the use of an ID
self.label = ""

def geomType(self):
t = type(self.wrapped.Surface)
if self.facetypes.has_key(t):
Expand Down Expand Up @@ -602,6 +617,9 @@ def __init__(self, wrapped):
"""
self.wrapped = wrapped

# Helps identify this solid through the use of an ID
self.label = ""

@classmethod
def makeShell(cls, listOfFaces):
return Shell(FreeCADPart.makeShell([i.obj for i in listOfFaces]))
Expand All @@ -614,6 +632,9 @@ def __init__(self, obj):
"""
self.wrapped = obj

# Helps identify this solid through the use of an ID
self.label = ""

@classmethod
def isSolid(cls, obj):
"""
Expand Down Expand Up @@ -915,6 +936,9 @@ def __init__(self, obj):
"""
self.wrapped = obj

# Helps identify this solid through the use of an ID
self.label = ""

def Center(self):
return self.Center()

Expand Down

0 comments on commit 9ce84fb

Please sign in to comment.