Create a long, straight linkage rod aligned with global X. Its central shank is a solid circular cylinder with diameter rod_outer_diameter....
harbor run -t gnucleus-ai/freecad-0fe4ba14a9harbor download gnucleus-ai/freecad-0fe4ba14a9Write a FreeCAD Python script to /app/answer.py that reproduces the
part described below.
FreeCAD version: 1.1.0.
Part description:
Create a long, straight linkage rod aligned with global X. Its central shank is a solid circular cylinder with diameter rod_outer_diameter. Each end carries an identical rounded lug formed from the same cylindrical stock, and the two ends are symmetric about the plane X = 0. Width is measured along Y and thickness along Z. The cylindrical material envelope applies to the entire finished part, including both lugs: Y^2 + Z^2 <= (rod_outer_diameter / 2)^2.
At each end, a centered transition region has cross-section dimensions rod_cross_section_length by rod_cross_section_width and axial extent rod_end_body_length. Its exterior remains within the cylindrical envelope of the shank.
At each lug, subtract rectangular_slot_count parallel transverse rectangular cutting profiles. Here rectangular_slot_count counts the cutting profiles, including profiles that extend beyond the stock. Each profile has width rectangular_slot_width along Z before it is clipped by the available material. The profile centers are evenly spaced by spacing_distance_between_rectangular_slots and centered as a group about Z = 0. Each cut starts at the absolute X distance first_slot_left_edge_x_offset from the origin, extends outward beyond the rounded end, and passes completely across Y.
With the supplied values, the three cutting profiles are centered at Z = -15, 0, and 15 mm, with Z intervals [-18.5, -11.5], [-3.5, 3.5], and [11.5, 18.5] mm. The central profile creates one complete 7 mm slot. The outer two profiles intersect only the lower and upper surfaces of the diameter-30 mm cylindrical stock, creating two surface cuts. Thus each lug has one complete central slot plus two surface cuts. In the cut region, away from the pin hole and rounded end boundary, the remaining material at Y = 0 occupies Z intervals [-11.5, -3.5] and [3.5, 11.5] mm. These two layers remain connected to the rod through the uncut lug root. The 7 mm width and 15 mm pitch describe the cutting profiles; the two surface cuts do not retain both boundaries of a complete 7 mm slot.
An outward-facing semicircle in the XY plane defines the rounded trimming boundary at each outer end, with radius clevis_slot_end_arc_radius. The left semicircle is centered on the rod axis at X = clevis_slot_end_arc_center_x, and the right semicircle is its symmetric counterpart. Retain only material that also lies within the cylindrical envelope, so the surviving curved end surfaces are clipped by that envelope and the transverse cuts. A circular pin opening of diameter clevis_pin_hole_diameter shares each semicircle center, has its axis along Z, and passes completely through both remaining lug layers.
The finished part transfers load between two pinned joints, with two aligned connecting layers at each end separated by the central slot.
Key parameters:
rod_outer_diameter = 30.0 mm
rod_cross_section_length = 30.0 mm
rod_cross_section_width = 30.0 mm
rod_end_body_length = 40.0 mm
rectangular_slot_width = 7.0 mm
rectangular_slot_count = 3
spacing_distance_between_rectangular_slots = 15.0 mm
first_slot_left_edge_x_offset = 210.0 mm
clevis_pin_hole_diameter = 15.0 mm
clevis_slot_end_arc_radius = 15.66 mm
clevis_slot_end_arc_center_x = -233.58 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.