DECISION: Decode canonical placement ticks before exporting MJCF frames
DECISION: Preserve the existing workspace fix that routes MJCF frame decoding through placement_from_canonical. WHY: In the 2026-11-17 project publication discussion, the owner asked to push the current project to make-cad/main. Inspection found this pending exporter fix. Product placement.py persists positions and directions as integer ticks; treating those values as ordinary floats changes the exported frame scale. The shared decoder already handles both canonical ticks and legacy float frames. ALTERNATIVE CONSIDERED AND REJECTED: Publishing only the previous HEAD would omit the owner's current working tree and retain the incorrect scale conversion. WHAT CHANGES: Save the existing src/simplecadapi/exporter/mjcf.py change without changing its implementation. Checked: Loaded the working-tree exporter into the installed runtime and checked nonzero tick and legacy-float origins and basis vectors. The six existing MJCF exporter tests passed (nine unrelated tests deselected). Python compilation and git diff --check passed. This does not claim validation of the complete hand mechanism. Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
@@ -18,7 +18,7 @@ from ..artifacts.assembly_io import materialize_definition
|
||||
from ..artifacts.canonical import parse_canonical_json
|
||||
from ..artifacts.part_definition import PartDefinition
|
||||
from simplecadapi._cpp import Assembly, Part
|
||||
from ..product.placement import Placement, relative_placement
|
||||
from ..product.placement import Placement, placement_from_canonical, relative_placement
|
||||
from ..translator.package_units import (
|
||||
ProductInput,
|
||||
read_product_package_translation_units,
|
||||
@@ -137,12 +137,9 @@ def _fmt_vec(values: tuple[float, float, float] | list[float]) -> str:
|
||||
|
||||
|
||||
def _placement(payload: Mapping[str, Any]) -> Placement:
|
||||
return Placement(
|
||||
origin=tuple(float(value) for value in payload["origin"]),
|
||||
x_axis=tuple(float(value) for value in payload["x_axis"]),
|
||||
y_axis=tuple(float(value) for value in payload["y_axis"]),
|
||||
z_axis=tuple(float(value) for value in payload["z_axis"]),
|
||||
)
|
||||
# Package frames are persisted as integer ticks (1e-9 mm, see product/placement.py); reading them as
|
||||
# floats put every joint and site 1e9 times too far away. Legacy float frames still decode as they are.
|
||||
return placement_from_canonical(payload)
|
||||
|
||||
|
||||
def _inverse_vector(
|
||||
|
||||
Reference in New Issue
Block a user