shravya 5s

shravya 5s

thingiverse

This code is not a valid JavaScript code, but rather a series of settings for creating a custom case for an electronic device, likely a smartphone. Based on the names and values in this file, it seems like it might be configuration data from OpenSCAD or Fusion 360. OpenSCAD's "mobile_phone_customizer.ini" file format could be used here as it shares many similar parameters. I can give you some examples of possible implementations using a language of your choice, based on the parameters you've provided: Python example using the openjscad library ```python from jscad import * # Set the settings from the config.txt case_thickness = 1.6 # Default is 5 mm (change to whatever thickness suits your phone) custom_corner_radius = 10 use_pattern = 1 phone_model = 3 # Default model number for a Samsung phone bottom_port_length = 40 left_port_length = 50 back_extra_port_x_position = 0 right_port_length = 30 top_outer_edge_chamfer_radius = 5 top_inner_edge_chamfer_radius = 6 bottom_outer_edge_chamfer_radius = 6 top_fillet_radius = 10 bottom_fillet_radius = custom_corner_radius * .6 # Use a fraction of the corner radius for fillets. bottom_port_x_position = phone_length / 2 - (phone_width / 2) back_camera_corner_resolution = top_port_corner_resolution # Use some basic math to create these points, as it's easier than copying values from a spreadsheet: def create_rectangle(x_size,y_size,top_port_length,right_port_length,left_port_length): rectangle(top_port_length,left_port_length,x_size,y_size); # Now let’s generate our main rectangle with port cutouts. Since the code for OpenSCAD would get really ugly if # it had lots of ports or patterns (which makes a great case!), we’re using two parameters: top_fillet_resolution = custom_back_camera_x_position + top_fillet_radius * 2 bottom_fillet_resolution = bottom_fillet_radius*2 phone_model_size_multiplier = custom_case_wall_thickness top_port_y_position = phone_model_size_multiplier / 3 # Let's have a smaller height here. #top_port_x_position, we'll be placing this later with “align” # The top left position should always equal the y value for port cutouts when rotated properly. bottom_port_corner_radius = custom_back_camera_x_position + custom_bottom_fillet_radius*2 phone_model_size_multiplier *= bottom_fillet_resolution/ phone_model_size_multiplier top_outer_edge_chamfer_radius *= bottom_port_length right_port_corner_resolution *= custom_right_port_x_position / right_port_corner_resolution * top_port_corner_resolution print('OpenSCAD Version', openjscad_version) openjscad_script = ''' module MobileCase(model){ cube( [ %s, // top height, %s, // top length, 4*%f , // side (width), custom_case_wall_thickness/2], false); difference(){ module Port(p_height,p_length){ union(){ # This makes the case body first. hull( [ [ %f+top_port_y_position + bottom_port_x_position -custom_bottom_port_length, 0 ], [ phone_model_size_multiplier, -2.3], [ -bottom_fillet_resolution/phone_model_size_multiplier/2 , %f ] ] ) # the “hull” makes a smoother corner between two things. hull([ [-right_port_length - top_outer_edge_chamfer_radius, custom_back_extra_port_x_position], [-1.6, custom_right_port_x_position] ]); // left corner cube( [left_port_corner_resolution,top_port_x_position ,top_fillet_radius], center=false,origin=[ right_port_length,left_port_y_position + ( phone_model_size_multiplier /2 - top_port_y_position) ,-5*phone_model_size_multiplier], $fn=20); module Cutout (y_size,port_length,thickness = .2, xoffset,yoffset){ rotate(45) intersection() { union(){ for($angle=range([-270, 90], 45)) { minkowski() [for(r=range([.25,.9]),[top_fillet_radius-top_port_x_position/2,y_size/port_length],custom_left_port_y_position- port_length/4+0,r]) rotate([$angle,top_fillet_resolution/ phone_model_size_multiplier, top_port_length * right_port_length]) # Cutout a series of tiny rectangles in our pattern with minkowski translate([r/1.5*r ,phone_model_size_multiplier ,r/top_fillet_radius*6 ]) cube(size=r/4,r$=top_port_corner_resolution,origin=r$) ] } minkow(){ for ($angle=range([-180,-135],45)){ rotate([-$angle,$xoffset+$yoffset,$yoffset] ) translate($r*0) # Create a rectangle cutout at a certain y value on this pattern $angle translate([.8, r/port_length - $y_offset]) cube(size=[port_length/6 * ($y / port_length +$x/ right_port_x_position),r,port_length * right_port_length],$r=r) } }; }; //left corner cutouts module Corners(right_top , xoffset,yoffset){ hull([ [-phone_model_size_multiplier, custom_right_port_x_position- phone_model_size_multiplier + y_size/port_length], [phone_model_size_multiplier,right_port_x_position-y_offset]]) } hull( [ [-y_size,port_length /2] , top_fillet_resolution* r + bottom_port_x_position - y_offset, ] ) } # port_length cutout Cutout(custom_right_port_corner_resolution,port_length,top_fillet_radius * (custom_right_port_x_position),xoffset, yoffset) translate(-top_fillet_resolution) for (r=range(0,port_length-top_outer_edge_chamfer_radius-5)) union() { # cube([phone_model_size_multiplier/port_length # top_outer_edge_chamfer_radius / 4 +port_length/top_fillet_radius], center=false); cutout(y_size, phone_model_size_multiplier, bottom_fillet_radius*(r) * r, custom_left_port_y_position - right_port_corner_resolution* (r/20)+1, # custom_bottom_fillet_xoffset,yoffset,r * .15 + y_offset); hull( [phone_model_size_multiplier-top_port_y_position/port_length/3- (top_outer_edge_chamfer_radius-port_length),0] [ phone_model_size_multiplier,top_fillet_resolution+ top_port_x_position+ bottom_fillet_resolution], [-y_offset, bottom_fillet_resolution *(r * port_length + port_length*right_port_corner_resolution)] ); union() cube([ (bottom_fillet_resolution/ r* r), phone_model_size_multiplier/port_length +phone_model_size_multiplier-port_length,top_fillet_radius],origin=[ r/port_length,port_length , right_port_x_position-top_fillet_resolution*r /port_length ], center = false, $fn = top_port_corner_resolution ) hull([ [bottom_fillet_resolution, top_fillet_radius ], -bottom_fillet_resolution ])[ ]; # rotate([-180,top_fillet_resolution* port_length,-90*right_port_corner_resolution]) cube(port_length, // the "bottom" phone_model_size_multiplier-port_length ) # left side port cutouts. We need to place our corner first, hull([ -top_port_x_position ,0 ], [-phone_model_size_multiplier, bottom_fillet_resolution +custom_bottom_port_corner_radius-1]) }; rotate([-45]) Cutout(top_port_length,y_size,right_port_x_position,0, phone_model_size_multiplier/port_length); } } module Back( cut_out){ cube([bottom_fillet_resolution*2,bottom_fillet_radius * bottom_port_x_position ,custom_case_wall_thickness], origin=[right_port_corner_resolution/custom_right_port_y_position-top_fillet_radius,bottom_port_x_position+right_port_corner_resolution* (port_length/right_port_x_position ) ,bottom_fillet_radius ] ) # Cutout to help get better support in some ports: cube(custom_left_port_xposition-1, cut_out - right_port_length*2,right_port_y_position/custom_right_port_length/port_length,top_fillet_resolution), center=false, origin=[0,right_port_y_position/right_port_corner_resolution+ custom_back_extra_port_x_position,0] ) }''' script= """ module Model3() { MobileCase(model=phone_model);} module Model4 (){ rotate (45) # The left is always first to avoid cutouts in the port. rotate([-180,top_fillet_radius,-90*right_port_corner_resolution]) rotate(45) Back ( right_port_length +custom_right_port_y_position) union(){rotate([ -45, 0 , right_port_x_position-port_length/2 ]){ // Rotate this back around a few times for pattern: difference() Port(port_height= bottom_fillet_radius, port_length = phone_model_size_multiplier/port_length + port_length); Back(custom_right_port_length-right_port_y_position/5, phone_model_size_multiplier-top_fillet_resolution/top_fillet_resolution,custom_left_port_corner_resolution+port_length,port_fillet_radius*( right_port_length /port_length )); rotate([right_port_y_position- bottom_fillet_radius- bottom_fillet_radius, -top_port_x_position, -port_fillet_radius]){ Back( port_length,top_port_length,right_port_x_position,y_size/port_length,top_port_corner_resolution ); Back(custom_left_port_xposition,right_port_length-port_fillet_radius , right_port_y_position/port_length +port_length/top_fillet_resolution-1,phone_model_size_multiplier+bottom_fillet_resolution/top_fillet_resolution,y_offset/custom_bottom_port_xoffset); };}; } # MobileCase //model """ # Create a new G-code script file in the current working directory open('MobileCase.scad','w').write(script) def parse_file(filename, search_strings=None): """Open and return contents of given file. If a list of strings is passed, skip lines containing those strings. Returns a string. If not found on local disk or when reading an absolute path to an inaccessible directory: None. """ with open(unicode(filename),'r') as f: # import time # time.sleep(1) lines = (s for s in f if (not search_strings or s.rstrip('\n\r') not in search_strings) and s[0]!='#') return '\n'.join(lines) def find_all_files(directory=None,extension=None): """Yield the names of all files on given directory, its subdirectories (recursively). Optionally include only certain file extensions. Due to the 'recursive=True' parameter the following limitation exists: it needs write access to the entire subdirectory tree because it must be able to rename temporarily any newly discovered hidden file with the exact same name as the currently searched hidden one. A hidden filename will then become inaccessible. When writing the corresponding (if existing) non-hidden filename the temporary object will be deleted from disk, hence only write-access permissions are a prerequisite for working with subdirectories, i.e., directories need to be writable in any case! Due to the 'max_numhid' limitation on Macs when deleting temporarily hidden files, it is usually fastest (even if slower than doing no filtering at all!) to specify either one of extensions (use an empty string to match anything) or, respectively, one or more strings which shall be completely excluded from the output. If no filename has been provided to include/exclude in the filter use wild-card * for it. """ if directory==None: directory=os.getcwd() for root, dirs, filenames in os.walk(directory): # print os.path.join(root,".",dir) # print type(filenames), type(root) # print(dirs) # return foundfile=None foundcount =0 filenames.sort() # for dirname in sorted(dirs): # os.mkdir(os.path.join(root,'.',dirname)) if not isinstance(extension,(str,tuple)): raise AttributeError("Extension must be string or tuple, got " + str(type(extension))) # for file_extension in extensions.split(): for filename in filenames: path = root absolute_filename=os.path.abspath(os.path.join(root,filename)) is_dir = os.path.isdir(absolute_filename) relative_filename_path=root+ '/' + filename if filename[0]!='.': foundfile=True fullpath=os.path.join(root,os.sep,filename) # print "File: "+ str(fullpath)+ " Is Dir: ",str(is_dir) if extension and (not filename.endswith(extension)): foundcount = 1 absolute_path= os.path.abspath(path) # print(relative_filename_path," relative_file") found=True if (directory.startswith('/home/user/Documents' or \ (directory.startswith("/"))==False)): found=False # If directory starts with ~ do nothing and go back fname=os.path.splitext(os.path.split(absolute_filename)[1])[0] # extract file name w/o path and ext. fextension = os.path.splitext(absolute_filename) [-1]# ext of the file if .ext if fname != 'readme': foundfile = True # full_path[absolute_filename]=root # found_file.append(fullpath) # found=True; # if filename[-3:]=='scd' and fextension!='.scad': yield (foundcount,fullpath) try: dir='/media/case/' os.chdir('/home/user/Documents') find_all_files() for name in find_all_files(extension=".gcode"): os.rename(name[1], name[1] +".g") open("/home/user/Documents/gcode.txt","a+").write(find_file(path="/media/", filename='script.gcode')) except AttributeError: print "Extension parameter needs to be of type tuple (str)" pass finally: find_all_files(extension='.scad') try: find_all_files(extension='*.(sc[ae])')

Download Model from thingiverse

With this file you will be able to print shravya 5s with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on shravya 5s.