#2889 FreeCAD Script
#2889 FreeCAD Script
#2889 Provide a FreeCAD script to produce a pully system with a hand-crank and gears
Below is a FreeCAD script written in Python to produce a pulley system with a hand crank and gears. This script uses FreeCAD's Python API to create a simple assembly. The design includes a base plate, two pulleys, a connecting belt, a crank handle, and a simple gear mechanism. You can customize dimensions and details based on your requirements.
import FreeCAD as App import Part import Draft # Create a new FreeCAD document doc = App.newDocument("PulleySystem") # Dimensions base_length = 100 base_width = 60 base_height = 5 pulley_radius = 15 pulley_thickness = 5 crank_length = 50 crank_radius = 5 gear_radius = 10 gear_thickness = 5 shaft_radius = 3 shaft_height = 20 # Base plate base = Part.makeBox(base_length, base_width, base_height) base.translate(App.Vector(-base_length / 2, -base_width / 2, 0)) Part.show(base) # Pulleys pulley1 = Part.makeCylinder(pulley_radius, pulley_thickness) pulley1.translate(App.Vector(-30, 0, base_height)) Part.show(pulley1) pulley2 = Part.makeCylinder(pulley_radius, pulley_thickness) pulley2.translate(App.Vector(30, 0, base_height)) Part.show(pulley2) # Connecting belt (simplified as a rectangle for now) belt = Part.makeBox(60, 5, 2) belt.translate(App.Vector(-30, -pulley_radius - 2, base_height + pulley_thickness / 2)) Part.show(belt) # Shaft for pulleys shaft1 = Part.makeCylinder(shaft_radius, shaft_height) shaft1.translate(App.Vector(-30, 0, base_height)) Part.show(shaft1) shaft2 = Part.makeCylinder(shaft_radius, shaft_height) shaft2.translate(App.Vector(30, 0, base_height)) Part.show(shaft2) # Gear on Pulley 1 gear1 = Part.makeCylinder(gear_radius, gear_thickness) gear1.translate(App.Vector(-30, 0, base_height + pulley_thickness)) Part.show(gear1) # Gear on Pulley 2 gear2 = Part.makeCylinder(gear_radius, gear_thickness) gear2.translate(App.Vector(30, 0, base_height + pulley_thickness)) Part.show(gear2) # Crank handle crank_base = Part.makeCylinder(crank_radius, crank_length) crank_base.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), 90) crank_base.translate(App.Vector(-30, pulley_radius + 10, base_height)) Part.show(crank_base) crank_handle = Part.makeCylinder(crank_radius / 2, crank_length / 3) crank_handle.translate(App.Vector(-30 - crank_length / 3, pulley_radius + 10, base_height)) Part.show(crank_handle) # Recompute and view App.ActiveDocument.recompute() App.Gui.activeDocument().activeView().viewAxometric() App.Gui.SendMsgToActiveView("ViewFit") print("Pulley system created in FreeCAD.")
From <https://chatgpt.com/>
AI-generated script tested in FreeCAD:
Comments
Post a Comment