iorodeo avatar iorodeo committed 99b25ca

Made dxf files for laser cutting version 0.2 (both single and arrayed) of the
sensor enclosure.

Comments (0)

Files changed (12)

make_arrayed_enclosure.py

+import subprocess
+import os.path
 from py2scad import *
 from arrayed_enclosure import Arrayed_Enclosure
 from make_enclosure import params
 
+create_dxf = True 
+
 params['number_of_sensors'] = 5
 params['sensor_spacing'] = INCH2MM*2.0
 params['array_bottom_overhang'] = 1.0*INCH2MM
     enclosure = Arrayed_Enclosure(params)
     enclosure.make()
 
+    # Display size of bottom plate.
+    #print [x/INCH2MM for x in enclosure.array_bottom_size]
+
     part_assembly = enclosure.get_assembly(
-            show_top=False,
+            show_top=True,
             show_bottom=True, 
-            show_front=False,
-            show_back=False,
-            show_left=False,
-            show_right=False,
-            show_standoffs=False,
-            show_capillary=False,
-            show_sensor=False,
-            show_diffuser=False,
-            show_diffuser_standoffs=False,
-            show_led_pcb=False,
-            show_guide_plates=False,
-            show_guide_top=False,
-            show_clamp=False,
+            show_front=True,
+            show_back=True,
+            show_left=True,
+            show_right=True,
+            show_standoffs=True,
+            show_capillary=True,
+            show_sensor=True,
+            show_diffuser=True,
+            show_diffuser_standoffs=True,
+            show_led_pcb=True,
+            show_guide_plates=True,
+            show_guide_top=True,
+            show_clamp=True,
             explode=(0,0,0),
             )
     prog_assembly = SCAD_Prog()
     top_guide_projection = enclosure.get_guide_top_projection()
     side_guide_projection = enclosure.get_guide_side_projection()
 
+    # Create scad files
+    filename = 'arrayed_box_projection.scad'
+    scad_projection_files = []
     prog_box_projection = SCAD_Prog()
     prog_box_projection.fn = 50
     prog_box_projection.add(box_projection)
-    prog_box_projection.write('arrayed_box_projection.scad')
+    prog_box_projection.write(filename)
+    scad_projection_files.append(filename)
 
+    filename = 'diffuser_projection.scad'
     prog_diffuser_projection = SCAD_Prog()
     prog_diffuser_projection.fn = 50
     prog_diffuser_projection.add(diffuser_projection)
-    prog_diffuser_projection.write('diffuser_projection.scad')
+    prog_diffuser_projection.write(filename)
+    scad_projection_files.append(filename)
     
+    filename = 'top_guide_projection.scad'
     prog_top_guide_projection = SCAD_Prog()
     prog_top_guide_projection.fn = 50
     prog_top_guide_projection.add(top_guide_projection)
-    prog_top_guide_projection.write('top_guide_projection.scad')
+    prog_top_guide_projection.write(filename)
+    scad_projection_files.append(filename)
     
+    filename = 'side_guide_projection.scad'
     prog_side_guide_projection = SCAD_Prog()
     prog_side_guide_projection.fn = 50
     prog_side_guide_projection.add(side_guide_projection)
-    prog_side_guide_projection.write('side_guide_projection.scad')
+    prog_side_guide_projection.write(filename)
+    scad_projection_files.append(filename)
 
+    filename = 'arrayed_bottom_projection.scad'
     prog_bottom_projection = SCAD_Prog()
     prog_bottom_projection.fn = 50
     prog_bottom_projection.add(bottom_projection)
-    prog_bottom_projection.write('arrayed_bottom_projection.scad')
+    prog_bottom_projection.write(filename)
+    scad_projection_files.append(filename)
+
+    # Create dxf files
+    if create_dxf:
+        for scad_name in scad_projection_files:
+            base_name, ext = os.path.splitext(scad_name)
+            dxf_name = '{0}.dxf'.format(base_name)
+            print '{0} -> {1}'.format(scad_name, dxf_name)
+            subprocess.call(['openscad', '-x', dxf_name, scad_name])
+
+

make_enclosure.py

 """
 Creates an enclosure
 """
+import os.path
+import subprocess
 from py2scad import *
 from capillary_enclosure import Capillary_Enclosure
 
 INCH2MM = 25.4
+create_dxf=True
 
 # Inside dimensions
 x,y,z = 61.4, 45.0, 0.75*INCH2MM 
     top_guide_projection = enclosure.get_guide_top_projection()
     side_guide_projection = enclosure.get_guide_side_projection()
     
+    # Write assembly scad file
     prog_assembly = SCAD_Prog()
     prog_assembly.fn = 50
     prog_assembly.add(part_assembly)
     prog_assembly.write('enclosure_assembly.scad')
     
+    # Write scad file for projections
+    scad_projection_files = []
+
+    filename = 'box_projection.scad'
     prog_box_projection = SCAD_Prog()
     prog_box_projection.fn = 50
     prog_box_projection.add(box_projection)
-    prog_box_projection.write('box_projection.scad')
+    prog_box_projection.write(filename)
+    scad_projection_files.append(filename)
     
+    filename = 'diffuser_projection.scad'
     prog_diffuser_projection = SCAD_Prog()
     prog_diffuser_projection.fn = 50
     prog_diffuser_projection.add(diffuser_projection)
-    prog_diffuser_projection.write('diffuser_projection.scad')
+    prog_diffuser_projection.write(filename)
+    scad_projection_files.append(filename)
     
+    filename = 'top_guide_projection.scad'
     prog_top_guide_projection = SCAD_Prog()
     prog_top_guide_projection.fn = 50
     prog_top_guide_projection.add(top_guide_projection)
-    prog_top_guide_projection.write('top_guide_projection.scad')
+    prog_top_guide_projection.write(filename)
+    scad_projection_files.append(filename)
     
+    filename = 'side_guide_projection.scad'
     prog_side_guide_projection = SCAD_Prog()
     prog_side_guide_projection.fn = 50
     prog_side_guide_projection.add(side_guide_projection)
-    prog_side_guide_projection.write('side_guide_projection.scad')
+    prog_side_guide_projection.write(filename)
+    scad_projection_files.append(filename)
 
+    # Create dxf files
+    if create_dxf:
+        for scad_name in scad_projection_files:
+            base_name, ext = os.path.splitext(scad_name)
+            dxf_name = '{0}.dxf'.format(base_name)
+            print '{0} -> {1}'.format(scad_name, dxf_name)
+            subprocess.call(['openscad', '-x', dxf_name, scad_name])
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 ProjectModifiedEvent.java.
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.