A single coaxial grooved-head pin is arranged along one longitudinal axis. Use the junction between the elongated rod and the tip-side rod...
harbor run -t gnucleus-ai/freecad-5eb4588cc2harbor download gnucleus-ai/freecad-5eb4588cc2Write a FreeCAD Python script to /app/answer.py that reproduces the
part described below.
FreeCAD version: 1.1.0.
Part description:
A single coaxial grooved-head pin is arranged along one longitudinal axis. Use the junction between the elongated rod and the tip-side rod extension as the axial datum: positive axial distance runs through the elongated rod toward the head, and negative axial distance runs toward the free tip. All cylindrical sections, shoulder features, head lands, and circumferential grooves are complete surfaces of revolution about this axis. From the free tip toward the head, the axial sections are the tip, shallow circumferential groove, taper, cylindrical rod extension, elongated rod, shoulder, and grooved piston head, with every neighboring section joined continuously.
The elongated rod has a constant circular section. At its head end it meets the wider shoulder, whose two axial edges have equal chamfers. The piston head begins immediately after the shoulder. Its first circumferential groove begins at this shoulder/head junction. The second circumferential groove begins after piston_head_first_to_second_groove_axial_gap measured from the end of the first groove. The recessed terminal boss begins after piston_head_first_groove_to_recess_boss_axial_gap measured from the end of the first groove, and its far edge is the terminal end of the piston head. Raised lands between these recessed portions use piston_head_outer_diameter. All groove transitions are tangent to the adjoining axial and radial faces, using the specified inner and outer fillet radii. The terminal boss ends with an equal-length edge chamfer.
At the opposite end of the elongated rod, the cylindrical rod extension joins it at full rod diameter. Moving toward the free end, the rod extension is followed by the taper, the shallow circumferential groove, and then the tip. The taper connects the rod-extension diameter to the shallow-groove diameter. The tip has a constant diameter except for its terminal straight chamfer, which connects to tip_end_diameter over tip_end_chamfer_axial_length.
Near the tip side of the rod extension, form two identical mutually perpendicular pairs of opposing shallow trapezoidal flats. Each pair is symmetric about the longitudinal axis and removes equal outer material from two opposite sides while retaining the central core, so the pin remains one connected solid. In its longitudinal section, the flat-bottom interval begins at the shallow-groove/taper junction and runs toward the elongated rod by trapezoidal_flat_width. Its radial depth is measured inward from the full rod-extension surface, and its return flanks use trapezoidal_flat_flank_angle. One pair is oriented in each transverse principal direction. Each shaping profile passes completely through the pin in its normal direction and is centered on the longitudinal axis; geometry outside the pin envelope is clearance only.
Key parameters:
rod_diameter = 8.0 mm
rod_length = 112.3 mm
shoulder_diameter = 19.6 mm
shoulder_length = 6.5 mm
shoulder_edge_chamfer_length = 0.3 mm
piston_head_outer_diameter = 20.0 mm
piston_head_first_groove_diameter = 11.0 mm
piston_head_first_groove_width = 3.5 mm
piston_head_second_groove_diameter = 14.0 mm
piston_head_second_groove_width = 2.4 mm
piston_head_first_groove_to_recess_boss_axial_gap = 5.0 mm
piston_head_first_to_second_groove_axial_gap = 1.0 mm
piston_head_groove_outer_fillet_radius = 0.3 mm
piston_head_groove_inner_fillet_radius = 0.2 mm
piston_head_recess_boss_diameter = 18.0 mm
piston_head_recess_boss_length = 1.0 mm
piston_head_end_chamfer_length = 0.3 mm
rod_extension_length = 4.4 mm
taper_axial_length = 1.1 mm
shallow_groove_diameter = 5.8 mm
shallow_groove_length = 2.0 mm
tip_diameter = 6.0 mm
tip_length = 13.0 mm
tip_end_diameter = 4.77 mm
tip_end_chamfer_axial_length = 0.61 mm
trapezoidal_flat_depth = 1.0 mm
trapezoidal_flat_width = 3.0 mm
trapezoidal_flat_flank_angle = 135.0 degrees
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.