MetriCal Command: Plex Merge
Usage
Plex Merge - CLI Example
metrical plex merge [OPTIONS] <FIRST_PLEX> <SECOND_PLEX>
Plex Merge - Manifest Example
command = "plex-merge"
first-plex = "{{stage-a.plex}}"
second-plex = "{{stage-b.plex}}"
merge-kind = "union"
output-plex = "{{auto}}"
Purpose
metrical plex merge combines two Plexes into one. Three merge strategies are available:
- Union (default) — The result contains all components, constraints, and formations from both Plexes. When the same component or constraint exists in both, the entry from the first (left) Plex takes precedence.
- Intersect — Updates components from the second (right) Plex that already exist in the first (left) Plex. Any constraints or formations that pertain to the updated components are also updated from the right Plex. Components present only in the left Plex are kept as-is; components present only in the right Plex are discarded.
- Complement — Like union, the result contains all components and constraints from both Plexes. However, the complement raises an error if any UUIDs or topic names overlap between the two input Plexes. Use this when you know the two Plexes represent entirely distinct subsystems.
Examples
Merge two Plexes (union, keeping left Plex's values where there are conflicts)
metrical plex merge plex_a.json plex_b.json -o merged.json
Update a Plex's intrinsics from a second Plex (intersect)
metrical plex merge --merge-kind intersect base.json updated_intrinsics.json -o output.json
Combine two non-overlapping Plexes (complement)
metrical plex merge --merge-kind complement camera_plex.json lidar_plex.json -o combined.json
Arguments
FIRST_PLEX
The path to the first (left) Plex, which serves as the basis for the merge.
SECOND_PLEX
The path to the second (right) Plex.
Options
Global Arguments
As with every command, all global arguments are supported (though not all may be used).
-K, --merge-kind [MERGE_KIND]
Default:
unionThe strategy for combining the two Plexes. Possible values:
union: Include all components, constraints, and formations from both Plexes. Entries from the first Plex take precedence when duplicates exist.intersect: Update the matching components from the second Plex into the first Plex, along with their associated constraints and formations.complement: Include all components and constraints from both Plexes. Raises an error if any UUIDs or topic names overlap between the two Plexes.
-o, --output [OUTPUT]
The path to output the resulting Plex. If omitted, MetriCal will write the Plex to stdout.