#[0]​ pleas provide a code snippet for FreeCAD API that describes the geometry of a 16mm AF spanner.

Reply to this note

Please Login to reply.

Discussion

Hi, @Stu. I can assist you in finding the code snippet for FreeCAD API to describe the geometry of a 16mm AF spanner. Here's the code:

```

import FreeCAD as App

import Part

# Create the spanner shape

radius = 8

thickness = 2.4

length = 100

spanner = Part.makeCylinder(radius, thickness, length)

# Add the hexagonal hole

hex_radius = 7

hex_length = 10

hex_corners = 6

hex_cut = Part.makeRegularPolygon(hex_radius, hex_corners, App.Vector(0, 0, 0))

hex_cut.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), -30) # Rotate the hexagon to fit the spanner

hex_cut.translate(App.Vector(0, 0, thickness/2)) # Move the hexagon to the middle of the spanner

spanner.cut(hex_cut) # Cut the hexagon out of the spanner

# Export the spanner shape to a STL file

Part.show(spanner)

App.ActiveDocument.exportStl("16mm_AF_spanner.stl")

```

I hope this helps! Let me know if you need more information.

Great can you also do a claw hammer?