## Introduction: Customizable Nut & Bolt Using Tinkercad Codeblocks

We all tinkerers need various sizes of nuts and bolts and sometimes its hard to find the particular size you are looking for so here’s the solution for it, why don’t we make our own customised pair of Nut and Bolt for our particular needs.
So in this Instructables I will show you how you can make your own pair of Nuts and Bolts with just few lines of codes. All you need is just a computer with a reliable internet connection and access to https://www.tinkercad.com/codeblocks.

If you want to follow along with the steps on Tinkercad you can go to the link below to access the tinkercad Codeblocks project.

## Step 1: Parameters Involved in Bolts

We have some variables in our Codeblocks sketch which act as the base parameter for the model we are trying to make i.e. the Bolt and the same parameters will be followed for the Nut as well.

• Length: Length determines how long will our bolt will be.
• Diameter : It determines the Diameter of the bolt and also the inner diameter of the Nut.
• Nut Tolerance : It is used to set the tolerance of 3D printed Nut and Bolt and will vary according to the printer tolerance level. I have used 1.05 as for AnyCubic I3 Mega.

Note: Pitch is also a parameter for any Bolt but in the followed project we have chosen the standard pitch angle for the Bolt to be 5 degree.

## Step 2: Explanation of the CodeBlocks : Object Helix Sub Part

To make a bolt we are first going to make a helix which will then be subtracted from the cylindrical body to make the structure of a bolt.

To create a helix we are using quarters of a toroid and rotating across the joining point with the pitch angle of 5 degree and rotating it across the Z-Axis with 90 degree so with 4 such quarters we will get our basic structure which can be replicated further to create a full helical structure.

To Create the Quarter of a toroid we first create a toroid then two subtracting cuboid of little more than half of the toroid and move one across Y and another across Y by the distance a little less than the radius then group then all.

Now this quarter toroid is rotated by 5 degrees and a copy of it is rotated across 5 axis which then is moved up by the distance of (Sin(5º)*diameter)

## Step 3: Explanation of the CodeBlocks : Object Bolt

As we have the basic structure of the helix now we will replicate it appropriate number of times to cover the full length of the cylindrical body to cut out from. i.e. it would be replicated (Sin(5) X diameter X 4) +1) number of times.

The subtractive conical objects are added to provide a chamfer to the bolt which is good for easy penetration in the Nut or similar object.

As the replication is done we will create a group and there by subtracting the helix and conical objects and thereafter we can add the hexagonal top of the Bolt by adding a 6 sided polygon object and scaling it down. And moving up by length of the bolt.

## Step 4: Explanation of the CodeBlocks : Object Nut

After knowing all the basics making the Nut object would be pretty easy as we have the required Helix Sub Part (scaled appropriately to Nut Tolerance parameter) first we have copies of subtractive Helix Sub Part object thrice at appropriate Z Heights and moved adjacent to the bolt along with we create a new 6 sided Polygon i.e. the Nut Body with a subtractive cylinder of diameter equals to (diameter*Nut Tolerance) to complete the Nut Structure by grouping all of it together.

## Step 5: 3D Print It

The Bolt Body is rotated 180 degrees around the middle so that both the Nut and Bolt are flat for 3D printing.

Now the Design is complete we can Export it using the Export Button on the Top Right corner of the Tinkercad Codeblocks into .STL or .OBJ Format and send to any 3D Slicer like Ultimater Cura or Simplfy3D to get the GCODE for 3D Printing.

If you have any queries regarding the codeblocks or the project in general then do comment below I will try to help you out.

Runner Up in the
Block Code Contest