iorodeo avatar iorodeo committed 9e6c491

Added cut_depth option to add_holes method of Basic_Enclosure.

Comments (0)

Files changed (2)


 from py2scad import *
 import scipy
-if 1:
+if 0:
     c = Circle(r=2.0)
     s = Square(size=[3,1])
     print torus
-if 0:
+if 1:
     x = scipy.linspace(0,8,500)


         self.front = plate_maker.make()
         self.back = plate_maker.make()
-    def add_holes(self, hole_list):
+    def add_holes(self, hole_list, cut_depth = None):
         Add holes to given panel of the enclosure. 
-        wall_thickness = self.params['wall_thickness']
+        if not cut_depth:
+            cut_depth = 2*self.params['wall_thickness']
         for hole in hole_list:
             # Create differencing cylinder for hole based on hole type.
             if hole['type'] == 'round':
                 radius = 0.5*hole['size']
-                hole_cyl = Cylinder(r1=radius, r2=radius, h = 2*wall_thickness)
+                hole_cyl = Cylinder(r1=radius, r2=radius, h=cut_depth)
             elif hole['type'] == 'square':
                 sz_x, sz_y = hole['size']
-                sz_z = 2*wall_thickness
+                sz_z = cut_depth 
                 hole_cyl = Cube(size = (sz_x,sz_y,sz_z))
             elif hole['type'] == 'rounded_square':
                 sz_x, sz_y, radius = hole['size']
-                sz_z = 2*wall_thickness
+                sz_z = cut_depth 
                 hole_cyl = rounded_box(sz_x, sz_y, sz_z, radius, round_z=False)
                 raise ValueError, 'unkown hole type {0}'.format(hole['type'])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.