def run(self): path = geom.path( geom.XYZ(0.0, 0.0, 0.0), geom.XYZ(0.0, 1.0, 0.0), geom.XYZ(1.0, 0.0, 0.0), geom.XYZ(0.0, 0.0, 100.0), geom.XYZ(0.0, 0.0, 1.0), geom.XYZ(1.0, 0.0, 0.0), ) #geom.plot(path.position) print path.get_length() print path.find(90.0) print path.get_point(90.0) l = path.get_length() prof = profile.make_profile([(0.0, 20.0), (l, 0.0)]) tentacle = shape.path_extrusion(path, shape.circle, prof) self.save(tentacle, 'tentacle')
def run(self): path = geom.path( geom.XYZ(0.0,0.0,0.0), geom.XYZ(0.0,1.0,0.0), geom.XYZ(1.0,0.0,0.0), geom.XYZ(0.0,0.0,100.0), geom.XYZ(0.0,0.0,1.0), geom.XYZ(1.0,0.0,0.0), ) #geom.plot(path.position) print path.get_length() print path.find(90.0) print path.get_point(90.0) l = path.get_length() prof = profile.make_profile([(0.0,20.0),(l,0.0)]) tentacle = shape.path_extrusion(path,shape.circle,prof) self.save(tentacle, 'tentacle')
def construct(self): bore = self.bore outside = self.outside #outside = bore * 1.4 bore_length = bore * 1.5 #*2.0 gap_length = bore * self.gap_length windcutter_length = bore * 1.0 airway_length = bore*1.5 z_min = -bore_length z_gap_0 = z_min + bore_length - gap_length z_gap_1 = z_min + bore_length z_windcutter_0 = z_gap_0 - windcutter_length z_windcutter_1 = z_gap_0 z_airway_0 = z_gap_1 z_airway_1 = z_airway_0 + airway_length z_max = z_airway_1 #airway_xsize = bore * 0.15 #airway_xsize = (outside-bore) * 0.4 airway_xsize = 2.0 #Constant! airway_ysize = bore * self.gap_width #print 'Note mill bit diameter must be less than: %.1fmm' % (airway_xsize*2.0) windcutter_rounding = bore * 0.1 windcutter_ysize = airway_ysize + windcutter_rounding windcutter_lip = bore * 0.02 airway_x_low = bore*0.5-airway_xsize*0.5+windcutter_lip*0.5 airway_x_high = bore*0.5+airway_xsize*0.5+windcutter_lip*0.5 airway_line_0 = profile.make_profile( [(z_airway_0, airway_x_low), (z_airway_1, airway_x_low)]) airway_line_1 = profile.make_profile( [(z_airway_0, airway_x_high), (z_airway_1, airway_x_high)]) windcutter_line = profile.make_profile( [(z_windcutter_0, outside*0.5), (z_windcutter_1, bore*0.5+windcutter_lip)]) undercutter_line = profile.make_profile( [(z_windcutter_0, bore*0.35), (z_windcutter_1, bore*0.5)]) body = shape.extrude_profile( profile.make_profile([(z_min,outside),(z_max,outside)]), ) bore_space = shape.extrude_profile( profile.make_profile([(z_min,bore),(z_gap_1,bore)]), ) #body.remove(bore_space) space = bore_space.copy() windcutter_space = shape.extrude_profile( windcutter_line.clipped(z_windcutter_0-1.0,z_gap_1), cross_section = lambda x: shape.rounded_rectangle( x, x+bore, windcutter_ysize*-0.5,windcutter_ysize*0.5, windcutter_rounding) ) body.remove(windcutter_space) #space.add(windcutter_space) undercutter_space = shape.extrude_profile( undercutter_line.clipped(z_windcutter_0,z_gap_1), cross_section = lambda x: # shape.halfrounded_rectangle( shape.rectangle( x-airway_xsize, x, airway_ysize*-0.5,airway_ysize*0.5) ) #body.remove(undercutter_space) space.add(undercutter_space) airway_space = shape.extrude_profile( airway_line_0.clipped(z_gap_0,z_airway_1+ airway_xsize*2), #Make longer, for milling inside airway_line_1.clipped(z_gap_0,z_airway_1+ airway_xsize*2), cross_section = lambda x0, x1: shape.rectangle( x0, x1, airway_ysize*-0.5,airway_ysize*0.5) ) body.remove(airway_space) space.add(airway_space) gap_space = shape.block( 0.0, bore, airway_ysize*-0.5,airway_ysize*0.5, z_gap_0,z_gap_1 ) body.remove(gap_space) #space.add(gap_space) cutaway_diameter = outside*1.5 cutaway_space = shape.extrude_profile( profile.make_profile([(-outside*0.51, cutaway_diameter),(outside*0.51,cutaway_diameter)])) cutaway_space.rotate(1,0,0, 90) cutaway_space.move(-cutaway_diameter*0.5+bore*0.5-(outside*0.5-bore*0.5),0,z_max) #cutaway_space.clip(shape.block(-outside*0.51,outside*0.51,-outside*0.51,outside*0.51,z_min,z_max)) body.remove(cutaway_space) space.add(cutaway_space) #self.save(body, 'whistle') #assert airway_xsize_0 == airway_xsize_1 #jaw_clipper = shape.extrude_profile( # profile.make_profile([(-outside,0),(outside,0)]), # cross_section=lambda foo: shape.rounded_rectangle( # z_gap_0, z_max+gap_length, # -outside, airway_line_0(z_airway_0), # gap_length*2.0) # ) #jaw_clipper.rotate(1,0,0,90) #jaw_clipper.rotate(0,1,0,-90) #jaw_clipper.rotate(0,0,1,180) #jaw_clipper = shape.extrude_profile( # airway_line_0.clipped(z_airway_0,z_airway_1+1.0), # airway_line_1.clipped(z_airway_0,z_airway_1+1.0), # cross_section = lambda x0, x1: # shape.rounded_rectangle( # -x0*0.8, #(Can't be larger than bore) # x1 * 0.995, #So as to not leave a little fuzz # airway_ysize*-0.5,airway_ysize*0.5, # (x1-x0)*2.0) # ) d = airway_x_low*2 jaw_clipper = shape.extrude_profile( profile.make_profile([(-outside*0.5-10, d),(outside*0.5+10, d)]), cross_section = lambda d: shape.halfrounded_rectangle( -0.001, airway_x_low*1.001, z_airway_0-d*0.5,z_max+d*0.5) ) jaw_clipper.rotate(1,0,0, 90) #jaw = jaw_clipper.copy() #jaw.remove(space) #jaw.clip(body) #self.save(jaw, 'jaw') #head = body.copy() #head.remove(jaw) #self.save(head, 'head') return body, space, jaw_clipper
def construct(self): bore = self.bore outside = self.outside #outside = bore * 1.4 bore_length = bore * 1.5 #*2.0 gap_length = bore * self.gap_length windcutter_length = bore * 1.0 airway_length = bore * 1.5 z_min = -bore_length z_gap_0 = z_min + bore_length - gap_length z_gap_1 = z_min + bore_length z_windcutter_0 = z_gap_0 - windcutter_length z_windcutter_1 = z_gap_0 z_airway_0 = z_gap_1 z_airway_1 = z_airway_0 + airway_length z_max = z_airway_1 #airway_xsize = bore * 0.15 #airway_xsize = (outside-bore) * 0.4 airway_xsize = 2.0 #Constant! airway_ysize = bore * self.gap_width #print 'Note mill bit diameter must be less than: %.1fmm' % (airway_xsize*2.0) windcutter_rounding = bore * 0.1 windcutter_ysize = airway_ysize + windcutter_rounding windcutter_lip = bore * 0.02 airway_x_low = bore * 0.5 - airway_xsize * 0.5 + windcutter_lip * 0.5 airway_x_high = bore * 0.5 + airway_xsize * 0.5 + windcutter_lip * 0.5 airway_line_0 = profile.make_profile([(z_airway_0, airway_x_low), (z_airway_1, airway_x_low)]) airway_line_1 = profile.make_profile([(z_airway_0, airway_x_high), (z_airway_1, airway_x_high)]) windcutter_line = profile.make_profile([ (z_windcutter_0, outside * 0.5), (z_windcutter_1, bore * 0.5 + windcutter_lip) ]) undercutter_line = profile.make_profile([(z_windcutter_0, bore * 0.35), (z_windcutter_1, bore * 0.5)]) body = shape.extrude_profile( profile.make_profile([(z_min, outside), (z_max, outside)]), ) bore_space = shape.extrude_profile( profile.make_profile([(z_min, bore), (z_gap_1, bore)]), ) #body.remove(bore_space) space = bore_space.copy() windcutter_space = shape.extrude_profile( windcutter_line.clipped(z_windcutter_0 - 1.0, z_gap_1), cross_section=lambda x: shape.rounded_rectangle( x, x + bore, windcutter_ysize * -0.5, windcutter_ysize * 0.5, windcutter_rounding)) body.remove(windcutter_space) #space.add(windcutter_space) undercutter_space = shape.extrude_profile( undercutter_line.clipped(z_windcutter_0, z_gap_1), cross_section=lambda x: # shape.halfrounded_rectangle( shape.rectangle(x - airway_xsize, x, airway_ysize * -0.5, airway_ysize * 0.5)) #body.remove(undercutter_space) space.add(undercutter_space) airway_space = shape.extrude_profile( airway_line_0.clipped( z_gap_0, z_airway_1 + airway_xsize * 2), #Make longer, for milling inside airway_line_1.clipped(z_gap_0, z_airway_1 + airway_xsize * 2), cross_section=lambda x0, x1: shape.rectangle( x0, x1, airway_ysize * -0.5, airway_ysize * 0.5)) body.remove(airway_space) space.add(airway_space) gap_space = shape.block(0.0, bore, airway_ysize * -0.5, airway_ysize * 0.5, z_gap_0, z_gap_1) body.remove(gap_space) #space.add(gap_space) cutaway_diameter = outside * 1.5 cutaway_space = shape.extrude_profile( profile.make_profile([(-outside * 0.51, cutaway_diameter), (outside * 0.51, cutaway_diameter)])) cutaway_space.rotate(1, 0, 0, 90) cutaway_space.move( -cutaway_diameter * 0.5 + bore * 0.5 - (outside * 0.5 - bore * 0.5), 0, z_max) #cutaway_space.clip(shape.block(-outside*0.51,outside*0.51,-outside*0.51,outside*0.51,z_min,z_max)) body.remove(cutaway_space) space.add(cutaway_space) #self.save(body, 'whistle') #assert airway_xsize_0 == airway_xsize_1 #jaw_clipper = shape.extrude_profile( # profile.make_profile([(-outside,0),(outside,0)]), # cross_section=lambda foo: shape.rounded_rectangle( # z_gap_0, z_max+gap_length, # -outside, airway_line_0(z_airway_0), # gap_length*2.0) # ) #jaw_clipper.rotate(1,0,0,90) #jaw_clipper.rotate(0,1,0,-90) #jaw_clipper.rotate(0,0,1,180) #jaw_clipper = shape.extrude_profile( # airway_line_0.clipped(z_airway_0,z_airway_1+1.0), # airway_line_1.clipped(z_airway_0,z_airway_1+1.0), # cross_section = lambda x0, x1: # shape.rounded_rectangle( # -x0*0.8, #(Can't be larger than bore) # x1 * 0.995, #So as to not leave a little fuzz # airway_ysize*-0.5,airway_ysize*0.5, # (x1-x0)*2.0) # ) d = airway_x_low * 2 jaw_clipper = shape.extrude_profile( profile.make_profile([(-outside * 0.5 - 10, d), (outside * 0.5 + 10, d)]), cross_section=lambda d: shape.halfrounded_rectangle( -0.001, airway_x_low * 1.001, z_airway_0 - d * 0.5, z_max + d * 0.5)) jaw_clipper.rotate(1, 0, 0, 90) #jaw = jaw_clipper.copy() #jaw.remove(space) #jaw.clip(body) #self.save(jaw, 'jaw') #head = body.copy() #head.remove(jaw) #self.save(head, 'head') return body, space, jaw_clipper