stupidPhone Case

stupidPhone Case

thingiverse

This is a settings file for 3D printing or laser cutting, possibly for making custom phone cases. The various options include parameters for case size and shape, material (case wall thickness), port and hole placement, stencil design, mirror symmetry, chamfer radii, edge types, tolerances, fillets, resolution of corners, back extra port dimensions, top inner edge radius, pattern element radius, and rotation. Some observations from this list are that it includes numerous settings related to printing tolerance and case specifics, including ports, hole placement, corner chaffer radius, phone model specifics like dimensions, shape specifics like port types (inner outer left right front top bottom overhang), edge and fillet resolution specifications. It is worth noting most options here don't really affect overall aesthetics directly, other than port placement and pattern line thickness for some stencil type use case designs. It appears you may want a Python parser, possibly from `re`, that interprets the key-value pairs here (or some specific portion of it) to do some operation. Below I include one method which assumes most relevant keys (some edge case or unusual options left unaccounted). ```python def read_file_settings(path='settings.txt'): """Parses key=value from txt.""" config = {} with open(path, 'r') as settings: for line in settings: line = line.strip() if not line.startswith('#'): option, value = line.split('=') option, _ = option.strip().split('\t') # remove possible tab delimiters value = value.replace('"', '').strip() # quote unquotes, then removes leading & trailing spaces try: config[option] = int(value) except ValueError: config[option] = float(value) return config print(read_file_settings('path/to/settings.txt')) ``` In above, `int()` and `float()` would not catch complex values that need converting to their python native equivalent form like some pattern rotation etc. Here is Python version which checks if each part was split correctly. Some other option name keys do get incorrectly captured with some possible extra stuff following, we just assume that such keys exist. This might not be suitable if settings aren't tab delimitted as in the source txt. ```python def read_file_settings(path='settings.txt'): """Parses key=value from txt.""" config = {} options_to_key = {'stencil_shape', 'stencil_horizontal_position', 'phone_model'} with open(path, 'r') as settings: for line in settings: line = line.strip() if not line.startswith('#'): if "\t" not in line: print(f"Not in expected tab format '{line}'") continue else: #split tab style parts = [item.replace('\n','') for item in line.split("\t")] option, value = None,None for pair in zip(parts[::2], parts[1::2]): if(pair[0].startswith('#')): break pair_key,pair_value = tuple(item.strip() for item in pair) # clean & remove whitespace else: continue #keyname capture try: option, value = pair_key,'='.join([part.replace('\t',"").replace('"', "") .strip() for part in parts]) except: continue if(option in options_to_key): option += "_" + (value) # config[keyname]=pair_value #print(value); input(pair) value = ''.join( [item.strip().strip('\\"') for item in value.split("=")]) try: option = pair_key.lower() option,value='='.join(part.replace('"\t"', "").strip() \ if (value is not None ) else '' # if it starts w "#", remove & break. Also convert key name and val back, check what value type expected in code, for part in parts) except: continue option += "_"+ str(index).split() value= str(value) #input(value); print(type(pair_key)); # try: # if value.startswith('["'): config[option] = (value.lower()) # return config print(read_file_settings('settings.txt')) ```

Download Model from thingiverse

With this file you will be able to print stupidPhone Case 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 stupidPhone Case.