Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script to produce key type device (Covid-19 *Shameless clickbate)

Message 1 of 15
987 Views, 14 Replies

Script to produce key type device (Covid-19 *Shameless clickbate)

Hi Everybody...


First let me apologise for being such a noob and wanting to do something outwith my skill level and basically just jump the whole learn how to do it bit... but I have good reason to want to get this done asap.


I work in IT at a hospital in the UK  - we are currently prepping for the impending Covid-19 outbreak.

In my department we make wide use of door lock/keypads like the one shown here. These area are accessed by many people  each having to handle the keypad and knob - not ideal given the current situation!


I have designed a key type thing that presses the correct number pattern, and a knob cover that has a slot that the key can lock into to turn it, all without having to touch the door (well apart from your foot to then kick it open)




So that's all good, It works and the guys seem to like it! however I would like to share this out I know of many places it could be of great help just now, I guess I could just stick my STL's on thingiverse or the likes, but I would really like to make it easy for people to create different code combinations.

The 'key prongs' are really just areas of a sketch extruded, could I possibly number these areas then have some sort of script that would create a STL?


I know I'm asking a lot, but also that it really could help stopping Covid-19 being transferred within these types of secured locations.... hence speed in getting it done is kinda essential.


Anyone willing to assist? please.




Message 2 of 15
in reply to: ppicozzi

I would like to help.  What I'm envisioning is a script that would let you choose which numbers and then it would modify the model and create the STL file.  Another option would be to have it read in a file that has a series of numbers defined and it would export an STL for each set of numbers.  You can use the contact info in my signature.  It sounds like it should be simple, which also means fast.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 3 of 15
in reply to: BrianEkins

I want to help if I can help.
(I don't know if I can communicate because I'm not good at English)


Even in Japan, very confused and scared for Covid-19.
(All schools are already closed.)

Message 4 of 15
in reply to: ppicozzi

Hi @ppicozzi ,

That is great initiative. 

Will it be a good idea just using simple pen or pencil to punch in the keys?
As this items will be readily available to every location and any changing key combination can be typed in.


Nilesh Mohite

If my answer helped you, please use  ACCEPT SOLUTION .
Also be generous with Likes!  Thank you and enjoy!

Message 5 of 15
in reply to: ppicozzi

Smashing guys (replying to all who have offered help here)

Sorry for pushing for quick answers, but works a bit busy to skive off just now!

It's hard to ask for specific help without really knowing the requirements so first lets define what we are doing..


@BrianEkins Yes that's what I was looking for 'the ability for a user to get a different model by typing in the number'.


What would be required to do this, i.e. could it be done via one of the popular STL sharing sites or would some sort of custom web page or server processing have to be involved? 

What else actually need to be done to make this a reality? - I have some basic models that should be OK to use... maybe have to tidy up some stuff, but mostly just delete some stuff left over from different design iterations.

I'm happy to share these out... I'll try and work out how to do that tonight.


@Nilesh.Mohite  Good idea, infact one of my colleges commented on how he used the corner to access other doors.. I was thinking of doing a version with a protrusion for this. Maybe you could do an 'generic' version that is designed just for this but also locks into the same handle twisting slot as the 'custom' version does? 


@kandennti Don't Panic! 🙂 Thanks, I would love to have your assistance, the fact that you have poor English (seems fine to me) might be an advantage if you could promote its use in your country?


Thanks again everyone, ohhh and sorry for the duplicate post (roll's eyes).


**Update! Well that was easy!

Before commenting lets remember the level of competence i have previously stated 😉

Here's what I have

The key and first try at making a handle (turns out we use a different shape, but this still might be OK foe that shape knob)

The Current knob cover (it's hard not to start making jokes!)




Message 6 of 15
in reply to: BrianEkins

Hi, thanks,

I have made a group reply, but would love to have your assistance.

Message 7 of 15
in reply to: ppicozzi

There's a problem with providing a UI to the user via the web.  Fusion doesn't run on a server but would need to be running locally on a computer.  So, we would really be automating the process for whoever has Fusion and the script and are running it all on their machine.  The script makes it easier for the person but it doesn't remove people from the process.

What about a different design where instead of making a model that will only work for a specific combination, you instead have little plugs that can be inserted or removed to customize to any combination you want, at any time.  That way you would just be publishing a static model that people can get and print and don't need to keep generating new ones.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 8 of 15
in reply to: BrianEkins

@BrianEkins I like your 'default key idea' that way I could just publish some STL's. I'' definitely do this maybe even get it done tonight 🙂

I would still like to push out a custom version, and think it's acceptable to expect anyone to have or install 360.

After seeing how to share my 360 project, I figured that anyone with 360 could then download my project and presumable the 'script' would be within the project. If simple instructions could be done, say on an instruction website 😉 to run the script, then that seems like a reasonable workpath for anyone wanting to print or get printed online.

So that means I need a script for inside my project that asks for a number&(XYZ) and then extrudes the correct squares. Is that correct?

If so is this something you could do if I clean up the project to only include the stuff needed?





Message 9 of 15
in reply to: ppicozzi

Hi Mr PPicozzi,


It is a noble initiative. Acclaimed wholeheartedly!


... but the solution?


I checked your post a few times. Is it the UK???. The door lock you described is an old fashioned device. In the context of institutions like hospitals, some would call it the antique belonging to the museum.

Would it be better to ask Mr. Boris Johnson for some founds to install touchless entry systems across UK hospitals?

Installing them and maintaining would be beneficial in case of Covid-19 and alike but also for well being of your IT department, wouldn't it be?


Personally, I can not imagine doctors/nurses/etc. with all aura of stress following them to search in their pockets a 3D-printed plastic mechanical key and after being heavily overworked, leaving it accidentally in a patient's cavity.




Message 10 of 15
in reply to: ppicozzi

I have made a new version of the key

It's basically the same, but cleaned up.
Is it doable to also have the script calculate the total size of the platform and handle to make it as small as possible for any given combination (not a show stopper if this is too much) 





Message 11 of 15
in reply to: ppicozzi

Scripts aren't part of a project but are a set of files you would need to provide separately and have them copy to their machine, following a set of instructions.


Attached is a sample model that might be easy enough to use that you won't need a script.  The model looks like this.



They can enable/disable specific buttons by suppressing features.  This can be done by right-clicking on the feature in the timeline and choosing the "Suppress Features" command, as shown below.  The features are named the same as the button they represent and the graphic button highlights as you move over the timeline.




An alternative that makes it easier to use is to set the selection tools to only select "Features", as shown below.


Now, they can right-click on the feature in the graphics window and use the "Suppress Features" command there, as shown below.


A script could still be written to provide a UI for setting which buttons to use but I think this might be simpler than figuring out how to install the script. 

Brian Ekins
Inventor and Fusion 360 API Expert
Message 12 of 15
in reply to: BrianEkins

The first idea I came up with was to use a user parameter to control key ON / OFF.


If you are using the API, I feel that if you combine TableCommandInput and BoolValueCommandInput, it can be provided in a form close to the actual layout.


However, I think @BrianEkins  idea is simpler and better.

Message 13 of 15
in reply to: ppicozzi



Here is another approach.


First, I created the geometry with Fusion 360 using surface bodies. For each key, I created one surface body for the pressed position and another one for the unpressed position.


Next, I exported each surface body in a separate STL file.


Last, I wrote a Python code that merge the needed STL files only for a combination of keys. So you can use a webserver to create the final STL file without Fusion 360.


See the attached zip file.


This is just the idea.




Message 14 of 15
in reply to: JeromeBriot

G'Evening everyone,


Thanks for all the ideas, I agree and think the general consistence would be that the idea suggested by @BrianEkins is the best compromise to allow a way for both me to get this up and running quickly and the end user having minimal instructions to follow.


As progress I hope to do an instructable tonight and post some default/generic files to thingiverse (as soon I can get an account created, I'll have to try again with another email addy 😞 )


@JeromeBriot So I have a solution that I should get up tonight, but the initial concept of a user entering a number in a web page and just downloading the STL still appeals to me, I don't mind purchasing a domain name and some cheep server capabilities, if you could point me to the best option from fasthosts (or other provider) I'll could get that done.
Would you or anyone else be prepared to stick a simple page to go on it and probably modify your code to work on the page? Again I probably could do this myself if I had a few weeks to play with!


Once again thanks for all the help:)

Message 15 of 15
in reply to: ppicozzi

Hi again,


Just though I would give an update on my project, and say thanks to @JeromeBriot for the python code example for joining STL's.

Since the I have published my files on thingiverse

I need to update them, but really not liking thingiverse speed, so might remove them from there.

I have also used @JeromeBriot 's script to create a web page I'm pretty happy with the page (it does have a few technical 'issues;' tho) but it 's pretty close to my initial concept, and again it's a work in progress.. I'm no web designer!

Anyway thanks everyone for the suggestions


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators

Autodesk Design & Make Report