On This Page (13)
- CLI Usage
- Subcommands & Flags
- Envelope Format & Execution Semantics
- Complete Operation Reference (38 Operations)
- File & Control (3 Operations)
- Project & Variants (10 Operations)
- Schematic & Symbol Libraries (8 Operations)
- PCB & Footprint Libraries (17 Operations)
- Practical MCO Recipes
- 1. Assembly Variant Cloning & DNP Update
- 2. Bake Virtual Fabrication Layers Onto Safe Mechanical Layers
- 3. Programmatic Board Creation & Micro-STEP Alignment Export
- Related Guides
CLI: Monkey Change Orders (acr mco)
Monkey Change Orders (MCO) are declarative, ordered JSONC automation files that execute typed CAD mutations and exports across Altium projects (.PrjPcb), schematics (.SchDoc), symbol libraries (.SchLib), PCB documents (.PcbDoc), and footprint libraries (.PcbLib) through altium-cruncher.
MCO is both a standalone automation command (acr mco) and the shared execution substrate behind higher-level workflows such as acr vdoc, acr mate, acr prjpcb, acr schdoc, acr schlib, acr pcbdoc, and acr pcblib.
CLI Usage
# Generate an editable starter MCO JSONC file
acr mco init change_order.mco.jsonc
# List all 38 supported operations (human table or machine-readable JSON/JSONC)
acr mco list
acr mco list --json
acr mco list --output mco-operations.jsonc
# Validate and preview planned outputs without writing files
acr mco run change_order.mco.jsonc --dry-run
# Execute an MCO file and save a structured JSON execution report
acr mco run change_order.mco.jsonc --json-output out/mco-report.jsonSubcommands & Flags
| Subcommand | Flags | Description |
|---|---|---|
acr mco run <file> | --dry-run, --json, --json-output <PATH>, --no-color | Execute an MCO JSONC file, print a colored step summary (or stdout JSON with --json), and optionally save the execution report receipt to --json-output |
acr mco init <file> | --force | Write a commented starter MCO JSONC template (--force overwrites an existing file) |
acr mco list | --json, --output <PATH>, --no-color | Display all supported MCO operations grouped by domain, print altium_cruncher.mco.operations.a0 JSON, or write a JSONC catalog file |
Envelope Format & Execution Semantics
An MCO file is standard JSONC (line comments //, block comments /* ... */, and trailing commas are supported) using schema "altium_cruncher.mco.a0":
{
"schema": "altium_cruncher.mco.a0",
"operations": [
{
"id": "step_1",
"op": "mco.message",
"message": "Human-readable log label for this step",
"args": {
"text": "Starting change order"
}
// Optional control-flow jump target on failure:
// "on_fail": "fallback_step_id"
}
]
}Key execution guarantees:
- Typed contract validation: Every built-in operation validates its
argsagainst the generated TypeSpec MCO schema before running. Relative file paths insideargsresolve relative to the MCO file's parent directory. - Run-scoped document session: Consecutive operations mutating the same
.PrjPcb,.SchDoc,.SchLib,.PcbDoc, or.PcbLibreuse a single in-memory document session and flush dirty files once when the run completes. This keeps multi-step board, schematic, and library pipelines fast and consistent while preventing partial mid-sequence disk writes. - Fail-fast &
on_failcontrol flow: By default, execution stops on the first failed operation and returns a non-zero exit code. Settingon_failto another operation'sidjumps to a recovery/reporting step with built-in loop detection. --dry-runpreflight: Validates the envelope and operation specs and reports planned outputs without writing files to disk.- Structured execution receipt (
--json/--json-output): Emits a machine-readable report containingschema("altium_cruncher.mco.a0"),ok,dry_run, andresults[]— where each entry recordsop,id,status("ok"or"fail"),message,outputs, and optionalerror.
Complete Operation Reference (38 Operations)
All 38 built-in MCO operations are grouped into four domains below. Run acr mco list --json at any time to inspect the exact live metadata.
File & Control (3 Operations)
| Operation | Required Args | Key Optional Args | Summary & Outputs |
|---|---|---|---|
file.copy | source, destination | overwrite (false) | Copy one file into the workflow output tree. Outputs source, destination. |
mco.message (alias message) | — | text | Emit a human-readable status message in the execution log and receipt. |
mco.fail (alias fail) | — | message | Fail intentionally (useful with on_fail error-handling branches). |
Project & Variants (10 Operations)
| Operation | Required Args | Key Optional Args | Summary & Outputs |
|---|---|---|---|
project.create | file | name, project_name, overwrite | Create an empty .PrjPcb file. Outputs project. |
project.add_document | file, document | unique_id | Append a document entry to a .PrjPcb file (idempotent if already listed). Outputs project, document. |
project.add_parameter | file, name, value | — | Set one project-level parameter on a .PrjPcb. Outputs project, name. |
project.add_variant | file, name | unique_id, allow_fabrication, current | Add one assembly variant to a .PrjPcb. Outputs project, name. |
project.list_variants | file | — | List project variants, admitted DNP rows, and parameter changes. Outputs structured variant summary. |
project.clone_variant | file, source_name, name | unique_id, allow_fabrication, current | Clone an existing project variant (including DNP rows and parameter overrides) under a new name. |
project.rename_variant | file, name, new_name | — | Rename an existing project variant in place. |
project.delete_variant | file, name | — | Delete one project variant from a .PrjPcb. |
project.add_variant_dnp | file, variant, designator | unique_id, alternate_part | Mark one component designator Not Fitted (DNP) in a project variant. |
project.toggle_variant_dnp | file, variant, designator | unique_id, alternate_part | Toggle one designator between fitted and Not Fitted in a project variant. Outputs dnp state. |
Schematic & Symbol Libraries (8 Operations)
| Operation | Required Args | Key Optional Args | Summary & Outputs |
|---|---|---|---|
schdoc.create | file | template, sheet_style ("D"), apply_template_visual_sheet_settings, custom_sheet_mils, overwrite | Create an empty .SchDoc (optionally applying a .SchDot template or custom size). Outputs schematic. |
schdoc.add_component | file, library, symbol, designator, position_mils | output_file, overwrite, unique_id, design_item_id, footprint_model, footprint_library, parameters, orientation, mirrored, part_id, display_mode, designator_style, comment_style, footprint_description | Insert a schematic component from a .SchLib with optional parameters and footprint links. |
schdoc.add_wire | file, points_mils | output_file, overwrite | Add a multi-vertex schematic wire (points_mils array of [x, y] mil points). |
schdoc.add_net_label | file, text, location_mils | output_file, overwrite, orientation, justification ("BOTTOM_LEFT") | Add a schematic net label at location_mils. |
schdoc.add_power_port | file, text, location_mils | output_file, overwrite, style ("BAR"), orientation, show_net_name (true) | Add a schematic power port symbol at location_mils. |
schdoc.rename_source_fields | file, edits | output_file, overwrite | Preflight exact scalar Name/Text edits (object_kind, object_uid, owner_uid, field, old_value, new_value) and atomically rename the selected source fields. |
schlib.create | file | overwrite | Create an empty .SchLib symbol library. Outputs library. |
schlib.add_symbol | file, name | description | Add one empty schematic symbol to a .SchLib. Outputs library, symbol. |
PCB & Footprint Libraries (17 Operations)
| Operation | Required Args | Key Optional Args | Summary & Outputs |
|---|---|---|---|
pcbdoc.create | file | layer_stack_template, rigid_stack, stackupx_file, board_outline_mils, board_origin_mils, sheet_frame_mils, mechanical_layer_profile, mechanical_layers, mechanical_layer_pairs, mechanical_layer_kinds, overwrite | Create an empty .PcbDoc with board outline, origin, layer stack, and mechanical layer setup. Outputs board. |
pcbdoc.add_component | file, library, footprint, designator, position_mils | output_file, overwrite, layer ("TOP"), rotation_degrees, pad_nets, component_parameters, comment_text, comment_visible, source_unique_id, source_hierarchical_path, source_component_library, source_lib_reference, source_description, source_footprint_library, source_designator, channel_offset | Insert a PCB component from a .PcbLib with pad net assignments and source links. |
pcbdoc.add_pad | file, designator, position_mils, width_mils, height_mils | output_file, overwrite, shape, corner_radius_percent, rotation_degrees, hole_size_mils, plated, layer, net, solder_mask_expansion_mils, paste_mask_expansion_mils, tenting_top, tenting_bottom, solder_mask_expansion_mode, paste_mask_expansion_mode | Add a free SMT, through-hole, or NPTH PCB pad. |
pcbdoc.add_via | file, position_mils, diameter_mils, hole_size_mils | output_file, overwrite, layer_start, layer_end, net | Add a PCB via spanning layer_start to layer_end. |
pcbdoc.add_track | file, start_mils, end_mils, width_mils | output_file, overwrite, layer ("TOP"), net | Add a routed or mechanical PCB track segment. |
pcbdoc.add_arc | file, center_mils, radius_mils, start_angle_degrees, end_angle_degrees, width_mils | output_file, overwrite, layer ("TOP"), net | Add a PCB circular arc or full circle. |
pcbdoc.add_fill | file, corner1_mils, corner2_mils | output_file, overwrite, rotation_degrees, layer, net | Add a rectangular PCB fill primitive. |
pcbdoc.add_region | file, outline_points_mils | output_file, overwrite, layer, hole_points_mils, is_keepout, keepout_restrictions, net, is_board_cutout | Add a polygonal copper, mechanical, keepout, or board-cutout PCB region. |
pcbdoc.add_text | file, text, position_mils, height_mils | output_file, overwrite, layer, font_kind, font_name, bold, italic, rotation_degrees, stroke_width_mils, is_comment, is_designator, is_mirrored, is_inverted, is_frame, text_justification, barcode_kind, barcode_render_mode, barcode_full_size_mils, barcode_margin_mils, barcode_min_width_mils, barcode_show_text, barcode_inverted | Add stroke text, TrueType text, or 1D/2D PCB barcodes (Code 39, Code 128, QR Code, Data Matrix). |
pcbdoc.add_embedded_3d_model | file, model_file | output_file, overwrite, model_name, name, layer ("MECHANICAL_13"), side ("TOP"), location_mils, rotation_x_degrees, rotation_y_degrees, rotation_z_degrees, z_mm, z_mils, bounds_mils, projection_outline_mils, overall_height_mils, opacity | Embed a STEP 3D model into a .PcbDoc and place a board-level 3D body. |
pcbdoc.arrange_designators | file | output_file, overwrite, designators, placement, offset_mils, height_mils, layer, stroke_width_mils, width_factor, bold, italic, font_name, font_kind | Reposition and style generated PCB component designator text. |
pcbdoc.create_user_union | file, name | output_file, overwrite, members | Create a named Altium User Union over PCB objects. |
pcbdoc.bake_virtual_layers (alias pcbdoc.bake-virtual-layers) | input, layer_map | output, project, variant, virtual_layers, clear_existing (true), clear_only (false), remove_cleared_layers (true), set_layer_names (true), set_layer_pairs (true), cutouts_union_name ("Virtual_Cutouts"), union_designators_with_component (true), designator_mode ("strokes" | "native_text") | Compute FabView virtual layers and bake them onto Altium mechanical layers of a .PcbDoc (preserving component ownership and User Unions), or clear & hide emptied layers with clear_only: true. Outputs per-layer counts (tracks, arcs, regions, texts, cleared), total_written, total_cleared, unions_created, layers_removed, warnings. |
pcbdoc.export_layer_step | file, output_file | layer, board_name, highlights, overwrite | Export a 3D PCB layer alignment STEP model via the pure-Python Micro-STEP AP242/AP214 engine alongside its companion manifest. |
pcblib.create | file | overwrite | Initialize a new .PcbLib footprint library. Outputs library. |
pcblib.add_footprint | file, name | output_file, overwrite, height, description, item_guid, revision_guid, parameters, primitive_parameters | Add one empty footprint container to a .PcbLib. |
pcblib.bake_virtual_layers (alias pcblib.bake-virtual-layers) | input, layer_map | output, footprints, virtual_layers, clear_existing (true), clear_only (false), remove_cleared_layers (true), set_layer_names (true), set_layer_pairs (true), designator_mode ("strokes" | "native_text") | Compute virtual layers (ASSEMBLY_OUTLINES_TOP, PIN1_TOP, PAD_LABELS_TOP, etc.) and bake them onto mechanical layers of .PcbLib footprints (with shared STEP HLR cache), or clear & hide emptied layers with clear_only: true. Outputs per-layer counts, layers_removed, and footprints_processed. |
Practical MCO Recipes
1. Assembly Variant Cloning & DNP Update
Clone a baseline variant, mark prototype debug parts as Not Fitted, update a project revision parameter, and inspect the resulting variant summary:
{
"schema": "altium_cruncher.mco.a0",
"operations": [
{
"id": "clone_prod",
"op": "project.clone_variant",
"message": "Create Production variant from Prototype",
"args": {
"file": "sensor_board.PrjPcb",
"source_name": "Prototype",
"name": "Production",
"allow_fabrication": true,
"current": true
}
},
{
"id": "dnp_debug_hdr",
"op": "project.add_variant_dnp",
"message": "Mark debug header J7 Not Fitted in Production",
"args": {
"file": "sensor_board.PrjPcb",
"variant": "Production",
"designator": "J7"
}
},
{
"id": "set_rev",
"op": "project.add_parameter",
"message": "Record release revision parameter",
"args": {
"file": "sensor_board.PrjPcb",
"name": "ReleaseVariant",
"value": "Production"
}
},
{
"id": "verify_variants",
"op": "project.list_variants",
"message": "Emit updated variant inventory in the execution report",
"args": {
"file": "sensor_board.PrjPcb"
}
}
]
}2. Bake Virtual Fabrication Layers Onto Safe Mechanical Layers
Bake cutouts, Pin 1 markers, diode glyphs, 3D STEP HLR assembly outlines, fitted assembly designators, and pad labels onto MECHANICAL35..44 (safely above Altium's MECHANICAL1..32 footprint layers) into a separate output .PcbDoc:
{
"schema": "altium_cruncher.mco.a0",
"operations": [
{
"id": "bake_board",
"op": "pcbdoc.bake_virtual_layers",
"message": "Bake virtual fab and assembly layers onto M35..M44",
"args": {
"input": "sensor_board.PcbDoc",
"output": "out/sensor_board_with_vdoc.PcbDoc",
"project": "sensor_board.PrjPcb",
"layer_map": {
"CUTOUTS": "MECHANICAL35",
"PIN1_TOP": "MECHANICAL36",
"PIN1_BOTTOM": "MECHANICAL37",
"DIODES_TOP": "MECHANICAL38",
"DIODES_BOTTOM": "MECHANICAL39",
"ASSEMBLY_OUTLINES_TOP": "MECHANICAL40",
"ASSEMBLY_OUTLINES_BOTTOM": "MECHANICAL41",
"ASSEMBLY_DESIGNATORS_TOP": "MECHANICAL42",
"ASSEMBLY_DESIGNATORS_BOTTOM": "MECHANICAL43",
"PAD_LABELS_TOP": "MECHANICAL44"
},
"virtual_layers": {
"font_mode": "stroke",
"stroke_font": "sans_serif",
"pin1": {
"style": "dot",
"exclude_two_pin_prefixes": ["X", "Y"]
},
"pad_labels": {
"knockout": false
}
},
"clear_existing": true,
"set_layer_names": true,
"set_layer_pairs": true,
"designator_mode": "strokes"
}
}
]
}Tip: For interactive day-to-day baking with automatic
vdoc.jsoncmanagement, siblingfab.jsoncinheritance,.bakbackups, and occupied-layer collision protection, seeacr vdoc.
3. Programmatic Board Creation & Micro-STEP Alignment Export
Synthesize a fresh 2-layer test coupon .PcbDoc, add pads, routing, and a silkscreen label, then export a colored AP242 Micro-STEP layer alignment model:
{
"schema": "altium_cruncher.mco.a0",
"operations": [
{
"id": "create_board",
"op": "pcbdoc.create",
"message": "Create 2000 x 1200 mil test fixture coupon",
"args": {
"file": "out/fixture_coupon.PcbDoc",
"board_outline_mils": {
"left": 0,
"bottom": 0,
"right": 2000,
"top": 1200
},
"overwrite": true
}
},
{
"id": "add_tp1",
"op": "pcbdoc.add_pad",
"message": "Add plated mounting/probe pad TP1",
"args": {
"file": "out/fixture_coupon.PcbDoc",
"designator": "1",
"position_mils": [400, 600],
"width_mils": 80,
"height_mils": 80,
"hole_size_mils": 40,
"plated": true,
"layer": "MULTI_LAYER",
"net": "SIG_A"
}
},
{
"id": "add_tp2",
"op": "pcbdoc.add_pad",
"message": "Add plated mounting/probe pad TP2",
"args": {
"file": "out/fixture_coupon.PcbDoc",
"designator": "2",
"position_mils": [1600, 600],
"width_mils": 80,
"height_mils": 80,
"hole_size_mils": 40,
"plated": true,
"layer": "MULTI_LAYER",
"net": "SIG_A"
}
},
{
"id": "route_bottom",
"op": "pcbdoc.add_track",
"message": "Route SIG_A on Bottom copper",
"args": {
"file": "out/fixture_coupon.PcbDoc",
"start_mils": [400, 600],
"end_mils": [1600, 600],
"width_mils": 20,
"layer": "BOTTOM",
"net": "SIG_A"
}
},
{
"id": "export_step",
"op": "pcbdoc.export_layer_step",
"message": "Export Bottom copper alignment STEP via Micro-STEP",
"args": {
"file": "out/fixture_coupon.PcbDoc",
"output_file": "out/fixture_coupon_bottom.step",
"layer": "BOTTOM",
"board_name": "fixture_coupon",
"overwrite": true
}
}
]
}Related Guides
acr mcoCommand Reference — exact CLI flags forrun,init, andlist- CLI Quick Start & Config — overview of
acrworkflows and JSONC configs - Fabrication & Outputs —
acr vdoc(vdoc.jsonc),acr pcb-layer-step, andacr fab - Virtual Fab Layers — all 17 virtual layer keys and mechanical-layer baking API
- Full Command Reference — complete
acrcommand catalog