Hi, first off, I'm new with python!... I don't know what I'm doing... That aside..
I have designed a 3D printed part for opening keypad doors without touching the door, I'am trying to create a site that would allow user to download the 3D(stl) files customised with their key code. To do this I'm trying to merge two stl files.
As I've never used python before I'm pretty much struggling to do this and as this is to help prevent Coronavirus transfer I want to get this running quickly! My current issue seems to be opening the files to merge, but really I'm in over my head! I wonder if anyone can help me getting it running?
**More info My efforts so far can be found here: http://thedoordoofer.pythonanywhere.com/
I'm trying to modify this code to do the merging:
# -*- coding: utf-8 -*- import os numpadPath = r'C:\Users\jerome\Desktop\NumPadJB' numPadConfig = [1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0] numPadTouch = ['6', '1', '7', '2', '8', '3', '9', '4', '0', '5', 'C', 'X', 'Y', 'S'] stlFilePrefix = 'NumPadJB v3_NumPadJB v3_' stlFileSuffix = '_NumPadJB v3.stl' partsToMerge = ['Numpad'] for (c, n) in zip(numPadConfig, numPadTouch): if c: partsToMerge.append(n + 'P') else: partsToMerge.append(n + 'NP') mergedFileName = os.path.join(numpadPath, 'NumPad.stl') with open(mergedFileName, 'w') as mergedFile: mergedFile.write('solid numpad\n') for p in partsToMerge: partFileName = stlFilePrefix + p + stlFileSuffix with open(partFileName, 'r') as partFile: lines = partFile.readlines() mergedFile.write(''.join(lines[1:-2])) mergedFile.write('endsolid\n')