summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvasile <jvasile>2008-07-17 21:31:18 +0000
committerjvasile <jvasile@cb376a5e-1013-0410-a455-b6b1f9ac8223>2008-07-17 21:31:18 +0000
commit6a7a4f983a4523e5d1cb0a296d734189414b6efa (patch)
tree3af49ec474bf1daacc6224fcf3a20815fc2426e9
parentd98228651f895d9bbde3038bceba50f43a5484d2 (diff)
downloadreprap-6a7a4f983a4523e5d1cb0a296d734189414b6efa.tar.gz
reprap-6a7a4f983a4523e5d1cb0a296d734189414b6efa.zip
tagging 0.2
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@1774 cb376a5e-1013-0410-a455-b6b1f9ac8223
-rw-r--r--trunk/users/vasile/tags/brlcad-0.2/brlcad_mechanical.py92
1 files changed, 92 insertions, 0 deletions
diff --git a/trunk/users/vasile/tags/brlcad-0.2/brlcad_mechanical.py b/trunk/users/vasile/tags/brlcad-0.2/brlcad_mechanical.py
new file mode 100644
index 00000000..482b4923
--- /dev/null
+++ b/trunk/users/vasile/tags/brlcad-0.2/brlcad_mechanical.py
@@ -0,0 +1,92 @@
+## Copyright (C) 2008 James Vasile <james@hackervisions.org>
+
+## This is a freed work; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## any later version.
+
+## This is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+## License for more details. You should have received a copy of the
+## GNU General Public License along with the work; if not, write
+## to the Free Software Foundation, Inc., 51 Franklin Street, 5th
+## Floor, Boston, MA 02110-1301 USA
+
+from brlcad import *
+
+class stepper_motor(Shape):
+ '''Vertex is center point box, along the center of the cylinder.
+
+ TODO: implement mounting holes'''
+
+ def __init__(self, vertex, base_height, base_width,
+ mount_hole_rad,
+ motor_height, motor_rad,
+ spindle_height, spindle_rad, **kwargs):
+
+ x, y, z = vertex
+ by = base_height
+ my = motor_height
+
+ bw = float(base_width) / 2
+
+ self.vertex = vertex
+
+ Shape.__init__(self, [
+ Comment('Stepper Motor'),
+
+ Cylinder((x, y+by, z), (0,motor_height,0), motor_rad),
+ Cylinder((x, y+by+my, z), (0,spindle_height,0), spindle_rad),
+ Box_rounded_edge_corners(x-bw,x+bw, y,y+by, z-bw,z+bw, bw/10),
+ ], basename='stepper', suffix='', group=True, **kwargs)
+
+
+class Threaded_rod():
+ '''Threaded rod. Horrible detail right now'''
+ def __init__(self, name, vertex, length_vector, major_diameter, minor_diameter, tpi):
+ '''If tpi is < 1, it's pitch in whatever the current units is,
+ otherwise it's teeth per current units'''
+
+ ## Pitch
+ if tpi < 1:
+ pitch = tpi
+ else:
+ pitch = 1/tpi
+
+ ## Major and minor radii
+ major = float(major_diameter) / 2
+ minor = float(minor_diameter) / 2
+
+ ## Mock it up as a cylinder in a cylinder
+ ## Todo: improve mock up to use major diameter disks around a minor diameter core
+ return Script(
+ Cylinder('unique_name_token', vertex, length_vector, major),
+ Cylinder('unique_name_token', vertex, length_vector, minor)
+ )
+
+
+class Threaded_hole():
+ '''Threaded hole. Horrible detail.'''
+ def __init__(self, name, vertex, length_vector, major_diameter, minor_diameter, tpi):
+ '''If tpi is < 1, it's pitch in whatever the current units is,
+ otherwise it's teeth per current units'''
+
+ ## Pitch
+ if tpi < 1:
+ pitch = tpi
+ else:
+ pitch = 1/tpi
+
+ ## Major and minor radii
+ major = float(major_diameter) / 2
+ minor = float(minor_diameter) / 2
+
+ ## Mock it up as a cylinder in a cylinder
+ ## Todo: improve mock up to use major diameter disks around a minor diameter core
+ return Script(
+ Cylinder('unique_name_token', vertex, length_vector, major),
+ Cylinder('unique_name_token', vertex, length_vector, minor)
+ )
+
+