Skip to content

Commit 69b9983

Browse files
committed
Patched PyEuclid to deal with shortcomings in the released version. TODO: remove this patch when Euclid gets updated
1 parent cb5837b commit 69b9983

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

solid/screw_thread.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
from solid import *
66
from solid.utils import *
77
from euclid import *
8+
# NOTE: The PyEuclid on PyPi doesn't include several elements added to
9+
# the module as of 13 Feb 2013. Add them here until euclid supports them
10+
# TODO: when euclid updates, remove this cruft. -ETJ 13 Feb 2013
11+
def patch_euclid():
12+
def as_arr_local( self):
13+
return [ self.x, self.y, self.z]
14+
15+
if 'as_arr' not in dir( Vector3):
16+
Vector3.as_arr = as_arr_local
17+
patch_euclid()
818

919
def thread( outline_pts, inner_rad, pitch, length, segments_per_rot=32,
1020
neck_in_degrees=0, neck_out_degrees=0):

solid/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,15 @@ def nut( screw_type='m3'):
326326
# = -------------- =
327327
try:
328328
from euclid import *
329+
# NOTE: The PyEuclid on PyPi doesn't include several elements added to
330+
# the module as of 13 Feb 2013. Add them here until euclid supports them
331+
def patch_euclid():
332+
def as_arr_local( self):
333+
return [ self.x, self.y, self.z]
334+
335+
if 'as_arr' not in dir( Vector3):
336+
Vector3.as_arr = as_arr_local
337+
patch_euclid()
329338

330339
def euclidify( an_obj, intended_class=Vector3):
331340
# If an_obj is an instance of the appropriate PyEuclid class,

0 commit comments

Comments
 (0)