Spotify Keychain Python Macro

For my schools applied engineering team, we ran a fundraiser, selling 3d printed scannable Spotify keychains, which were quite popular online at the time. As you can see above, these keychains are all unique, which led to a quite time consuming process of 3d modeling each on individually. Me, and the other 3 team members in charge of the fundraiser found ourselves wasting several hours a day, to cover the dozens of orders we’d receive daily. To help combat this, I decided to code a Fusion-360 Macro to do the job.
Each Keychain had two customizable parts, the front, which could display the code for any song or album, and a string of customizable text on the back. We set up a base CAD file, with editable text, but we still had to manually import and scale the code SVG, and also had to write the text.

To achieve the dual color effect, we designed two separate pieces, a black body, and a green insert. We would print the black shells, and then pause halfway through. Then, we would insert the green pieces in. Finally, we would resume printing, and the printer would print the text over the green insert, sealing it inside.
Above, is a screen recording of the Macro generating a keychain(Don’t mind the time, I finished coding after my homecoming dance). Essentially, the code finds the SVG saved at an inputted file path, and then scales and extrudes it into the body. After doing this, it creates a popup for the user to enter a desired amount of tolerance, and offsets the faces in which the green insert will be press fit into. I wish that I could automate this section, but the Fusion API is very old and does not include the offset feature. Finally, it creates and scales a textbox, before embossing it in the back of the keychain
Coding this was quite a challenge; I had to sift through the Fusion API documentation, and figure out how to make everything work. It took me around a week of programming in total to get all of the macro functions working, and extensive testing. The main trouble was finding ways to extrude select and edit the complex Spotify logo SVG, and entailed sifting individually through line and curve objects and manually selecting them with loops. I’m sure that there was a smarter way to do this, but this was the best I could come up with. It definitely made the process a lot easier, as I came to print more and more keychains for our fundraiser, at faster and faster rates. Overall, this was just a super fun project that helped me improve my coding skills by quite a bit.