A hydraulic cylinder end cap consists of a solid cylindrical body, a shallow open-sided rebate on its top face, two bottom-side reliefs, an...
harbor run -t gnucleus-ai/freecad-06a5c206229harbor download gnucleus-ai/freecad-06a5c206229Write a FreeCAD Python script to /app/answer.py that reproduces the
part described below.
FreeCAD version: 1.1.0.
Part description:
A hydraulic cylinder end cap consists of a solid cylindrical body, a shallow open-sided rebate on its top face, two bottom-side reliefs, an arc-shaped relief through the central web, and one centered blind face bore. There is no large through-bore through the full cap body.
The body has end_cap_outer_diameter and end_cap_thickness and is centered about its axial mid-plane. Along the cap axis, the top face is at +end_cap_thickness / 2 and the bottom face is at -end_cap_thickness / 2.
The top-face rebate extends groove_depth inward from the top face and leaves a raised central boss of annular_groove_inner_diameter. Its outer boundary uses outer_diameter, which extends beyond the main cylinder so the recessed shoulder opens into the outer cylindrical surface. A concentric small_center_bore_diameter bore starts on the same top face and has center_bore_depth without breaking through the body.
Two rectangular reliefs start on the bottom face and extend side_relief_depth toward the top. In the bottom-face local frame, the right relief starts at (right_relief_x_min, right_relief_y_min) and spans right_relief_length in +X by right_relief_width in +Y. The left relief similarly starts at (left_relief_x_min, left_relief_y_min) and spans left_relief_length in +X by left_relief_width in +Y. Their inner flanks are at +right_relief_x_min and -right_relief_x_min, leaving a centered web between them.
A two-sided arc relief passes symmetrically through that web. Its profile lies in an axial-radial plane whose local X follows the cap axis and whose local Y is radial. The curved boundary has arc_relief_radius, is centered at (arc_relief_center_x, arc_relief_center_y), and spans arc_relief_start_angle to arc_relief_end_angle. The center's axial coordinate equals end_cap_thickness / 2 - arc_relief_radius.
The arc's upper endpoint is (arc_relief_profile_x1, arc_relief_profile_y1), and its lower endpoint is (arc_relief_profile_x2, -arc_relief_profile_y0). The remaining boundary is closed by four straight segments in sequence: from the outer-surface anchor (arc_relief_profile_x0, arc_relief_profile_y0) to the upper arc endpoint; from the lower arc endpoint to (arc_relief_profile_x3, -arc_relief_profile_y0); vertically to (arc_relief_profile_x3, arc_relief_profile_y0); and back to the outer-surface anchor. Here arc_relief_profile_y0 equals end_cap_outer_diameter / 2, so the upper and lower horizontal boundaries lie on the cylindrical outer radius.
The arc relief is symmetric through the web about its profile plane. It removes arc_relief_offset on each side of that plane, for total width arc_relief_depth, without laterally shifting the profile.
Key parameters:
end_cap_outer_diameter = 80.0 mm
end_cap_thickness = 130.0 mm
annular_groove_inner_diameter = 70.0 mm
outer_diameter = 89.8937082 mm
groove_depth = 10.0 mm
right_relief_length = 31.1513256 mm
right_relief_width = 93.7870873 mm
left_relief_length = 30.8350117 mm
left_relief_width = 92.3636746 mm
side_relief_depth = 80.0 mm
arc_relief_radius = 28.1676805 mm
arc_relief_start_angle = -65.2655325 degrees
arc_relief_end_angle = 68.268198 degrees
arc_relief_depth = 78.0 mm
arc_relief_offset = 39.0 mm
small_center_bore_diameter = 20.0 mm
center_bore_depth = 31.0 mm
right_relief_x_min = 12.5 mm
right_relief_y_min = -47.3680146 mm
left_relief_x_min = -43.3350117 mm
left_relief_y_min = -46.7353867 mm
arc_relief_center_x = 36.8323195 mm
arc_relief_center_y = -14.4165172 mm
arc_relief_profile_x0 = -17.5 mm
arc_relief_profile_y0 = 40.0 mm
arc_relief_profile_x1 = 47.2617529 mm
arc_relief_profile_y1 = 11.7492074 mm
arc_relief_profile_x2 = 48.6180581 mm
arc_relief_profile_x3 = 67.6634428 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.