This script does the following:
- Creates a new part called My Part
- Creates a simple bolt with a cap head featuring a hexagonal recess based on the dimensions in the code
- Saves the part to a directory (commented out - replace with your directory)
- Exports an STL to a directory (commented out - replace with your directory)
- Closes the newly created part
MyPart = Part('My Part') XYPlane = MyPart.GetPlane('XY-Plane') HeadSketch = MyPart.AddSketch('Head', XYPlane) HeadSketch.AddCircle(0, 0, 10, False) BoltHead = MyPart.AddExtrudeBoss('Bolt Head', HeadSketch, 5, False) HeadBottomPlane = MyPart.AddPlane('Head Bottom', XYPlane, 5) ShoulderSketch = MyPart.AddSketch('Shoulder', HeadBottomPlane) ShoulderSketch.AddCircle(0, 0, 5, False) BoltShoulder = MyPart.AddExtrudeBoss('Bolt Shoulder', ShoulderSketch, 20, False) HexSketch = MyPart.AddSketch('Hex', XYPlane) HexSketch.AddPolygon(0, 0, 5, 6, False) HexRecess = MyPart.AddExtrudeCut('Hex Recess', HexSketch, 3, False) # save and export, replace paths with your own #Remove the "#" from the lines below to make them active #MyPart.Save('C:\Users\YourUserName\Desktop') #MyPart.ExportSTL('C:\Users\YourUserName\Desktop\My Part.stl') #MyPart.Close()