[Bug]:对球体/圆柱/圆锥/圆锥/圆锥的[freecad]质量中心误差

作者: Surya-koushik创建于 2026年8月25日更新于 2026年8月25日

cli_anything/freecad/core/measure.py, function _bbox_center() (called by measure_center_of_mass()), computes every primitive's bounding-box center by adding a min-corner offset to Placement.position:

elif t == "sphere":
    r = p["radius"]
    return [pos[0] + r, pos[1] + r, pos[2] + r]

and the analogous pos[i] + r/pos[2] + height/2 pattern for cylinder, cone, and torus. This is only correct for box and wedge, whose placement really is their bounding-box min corner. For sphere, cylinder, cone, and torus, the harness's own measure position / part add -pos treats the placement as the shape's own center (sphere, cylinder, cone) or torus center — so adding the radius again double-counts the offset and produces a point that is wrong (and, as in the sphere case above, physically outside the solid).

内容来源: HKUDS/CLI-Anything