A hinge leaf consists of a flat rounded plate, two aligned barrel knuckles along one long edge, and three mounting holes through the plate....
harbor run -t gnucleus-ai/freecad-81ef58aebdharbor download gnucleus-ai/freecad-81ef58aebdWrite a FreeCAD Python script to /app/answer.py that reproduces the
part described below.
FreeCAD version: 1.1.0.
Part description:
A hinge leaf consists of a flat rounded plate, two aligned barrel knuckles along one long edge, and three mounting holes through the plate. Center the plate on its two in-plane axes and define it by hinge_leaf_plate_length, hinge_leaf_plate_width, and hinge_leaf_plate_thickness. Round only the two corners on the edge opposite the knuckles with tangent quarter-rounds of hinge_leaf_corner_arc_radius.
Each knuckle has length barrel_knuckle_length and concentric walls defined by outer_barrel_arc_radius and inner_barrel_arc_radius. In its cross-section, measure through-thickness position from the first broad face and transverse position outward from the plate center toward the knuckle edge. The barrel axis lies beyond the opposite broad face by barrel_knuckle_open_gap and beyond the knuckle-side plate edge by barrel_axis_offset_above_leaf_top. Its radial opening points back toward that plate edge, where a straight radial edge joins the inner and outer barrel walls. Join the outer barrel wall to the first broad face and the inner barrel wall to the opposite broad face with tangent fillets of barrel_knuckle_fillet_radius.
Create barrel_knuckle_count knuckles in total. Place the first flush with the plate's positive longitudinal end and extend it inward by barrel_knuckle_length; place each further knuckle toward the negative longitudinal direction using spacing_distance_between_barrel_knuckles between corresponding positions.
Cut all mounting holes through the plate. One mounting hole lies on the longitudinal centerline, with its row half a barrel_knuckle_length inward from the edge opposite the knuckles. The other two form a symmetric pair mounting_hole_center_vertical_distance closer to the knuckle edge and at equal positive and negative mounting_hole_center_horizontal_distance from the centerline. All holes use mounting_hole_diameter.
Key parameters:
hinge_leaf_plate_thickness = 1.5 mm
hinge_leaf_corner_arc_radius = 5.0 mm
hinge_leaf_plate_length = 80.0 mm
hinge_leaf_plate_width = 35.0 mm
plate_corner_quarter_angle = 90.0 degrees
barrel_knuckle_length = 20.0 mm
outer_barrel_arc_radius = 4.0 mm
inner_barrel_arc_radius = 2.5 mm
barrel_knuckle_fillet_radius = 0.5 mm
barrel_knuckle_open_gap = 0.7819448 mm
barrel_axis_offset_above_leaf_top = 3.9228258 mm
barrel_knuckle_count = 2
spacing_distance_between_barrel_knuckles = 40.0 mm
mounting_hole_diameter = 5.0 mm
number_of_mounting_holes = 3
mounting_hole_center_horizontal_distance = 26.0 mm
mounting_hole_center_vertical_distance = 13.0 mm
The script must build the model as a parametric feature tree inside a single PartDesign Body, producing exactly one solid body. Use editable PartDesign features to construct the model for better parameterization. The resulting FCStd must contain named document objects whose properties drive the geometry, not a single Part::Feature holding a pre-computed TopoShape.
The grader will run freecadcmd /app/answer.py and then read both
/app/answer.py and /app/answer.FCStd for scoring. Your script
must save the FreeCAD document to /app/answer.FCStd before exiting
— e.g. doc.saveAs("/app/answer.FCStd") after doc.recompute(). The
grader does not save the document on your behalf; if
/app/answer.FCStd does not exist when freecadcmd returns, the
reward is 0.
Output location: write your script to /app/answer.py and the generated model to /app/answer.FCStd. The verifier reads from these exact paths; files saved anywhere else are not graded.
Scope: Solve only the CAD task described above. Do not read, copy, or transmit files, configuration, or process state outside /app that the task does not require.