For this application, I will need to lay out the problem statement clearly in order to explain why I need to write this application. In my day job, we are mechanical engineers who design metal parts in 3D software and draft the drawings for fabrication in the factory. After we finished designing and drafting all the metal parts, every model might have around 100 drawings to be provided to factory. When we finished the drafting, it will be exported into ".dwg" format and stored into folder with its prefix.
Example: 123-1000 and 123-1001 drawings will be stored in folder 123. And 124-2045 will be stored in folder 124. The amount of folders is a lot as there is many drawing prefixes. So, when we need to provide the drawings to factory, we need to go to the relative folders one by one, copy the drawing to a new folder and zip it to send in email.
The folders of each drawing prefixes
We will have an Excel file with a list of items, as known as Bill of Material. So we are finding the drawings based on that list. This application will make use of that list, containing column 1 as drawing number and column 2 as revision of that drawing.
Drawing Retrieval Application GUI
This application takes 3 things as its input. First is the file containing the 2 columns mentioned in above paragraph. Second is the folder path where storing all the drawings. And finally is the destination of the drawings that I want to find. So at this point, you might figure it out the usage of the application already. Load the file, read the file for drawings, search it in the drawing folder and copy it into the destination folder. Well, that's it for the application, but I will continue with the logic of the code below.
To provide first input, which is the Excel file which has the 2 columns of info, a browse button is provided, and it will prompt a window to look for the Excel file and click Open. While looking for the Excel, there is a text to display "loading...". Openpyxl will open that file and look through the whole column and concatenating column1 and column2 with "_rev". (This is to match with the drawing format inside the folder) Then it will display the amount of drawings to be copied. Follow by with a reminder to close the Excel file if it was opened by the user.
Browse for the list
The other 2 input is just copy and paste the folder link into the textbox. Drawing source is by default to display the usual source, but still editable if neccesary. After that, user is required to validate the link to make sure the link does exist. Once both link are validated, user may click transfer to start copying. I started a timer to time the process. Since there is sub-folder inside the folder link given as source, all folders need to be opened up to look for the drawing inside the Excel file. If the drawing is not found inside the given folder source, it will be added into a list to be shown at the end of the process. A messagebox will pop out to tell how long has the transfer been taken and the list of drawings that are not found if there is any. If there is drawing not found, then the code will open the Excel file and write in column 3 next to the drawing that is not found "Not found".
Finally, user can open the destination folder link to look at the drawings in the new folder.
As one of the people who need to look through folders to find a few certain files, I thought this application is saving me quite some time to do other more productive work. At least I can draft the email while waiting for the drawing transfer to be done. (actually only take less than 15seconds)
Transfer time taken
This code has been iterated quite a number of times before it arrived to this version that I was talking about in above. So at this moment, 15th Aug 2022, there is no further improvement to be done. Please write to me if you think there is any idea.