Skip to content
cccskills
FreePublished on GitHub

arranging-simulink-layouts

Clean up Simulink block diagram layouts when blocks overlap, lines cross, or newly added blocks look out of place. It can rearrange selected blocks, tidy a whole scope when requested, set specific positions, and group blocks into or expand a subsystem.

OriginalShow the original description

Arranges and tidies Simulink block diagram layouts with the model_edit layout engine. Use when the user asks to fix, clean up, tidy, straighten, or rearrange a layout, when blocks overlap or lines cross, when specific blocks need re-placing, or when grouping blocks into or expanding a subsystem.

matlab/simulink-agentic-toolkit1,289 stars(GitHub 1,289 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Tidy overlapping blocks in a Simulink diagram
  • Reroute lines that cross or run through blocks
  • Reposition or align selected blocks
  • Group blocks into a subsystem or expand one

Files included (3)

  • SKILL.md5.5 KB
  • manifest.yaml771 B
  • references/subsystem-restructuring.md2.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Arranging Simulink Layouts

Re-place blocks with the SATK layout engine in model_edit. Move as little of the user's diagram as the request allows.

When to Use

  • "Fix / clean up / tidy / straighten / rearrange the layout", "make it readable"
  • Blocks overlap, lines cross or run through blocks, a few blocks landed in odd places
  • "Move these blocks", "line these up", "sort out the blocks I just added"
  • Grouping blocks into a subsystem, or expanding a subsystem into its parent

When NOT to Use

  • Adding, connecting, deleting, or configuring blocks: use building-simulink-models. Layout already runs automatically after every model_edit call.
  • Stateflow chart layout: the layout op is Simulink-only. A chart scope accepts only a full re-layout (operations [], layout_mode "full"), which moves every element, so ask first.

Set Expectations

  • You drive an automatic layout engine. You don't place blocks pixel by pixel. Say so if the user expects hand-tuned placement.
  • Ctrl+Z is not reliable for agent edits, including layout. Don't offer undo. Before any layout that moves many blocks, recommend that the user saves the model (or a copy) first.
  • The first layout in a MATLAB session can take about 20 s while the engine starts. Later calls take 1–2 s.

Choose the Method

Selective layout is the default. A full layout of a diagram the user has arranged by hand discards their arrangement, so ask before running one.

SituationMethod
A few blocks are messy, overlapping, or just added{"op":"layout","targets":[...]} with layout_mode "incremental"
The whole scope is a mess and the user agrees that everything movesoperations [] with layout_mode "full"
The user explicitly asks for Simulink's own tidy-upFormat > Auto Arrange / Simulink.BlockDiagram.arrangeSystem, and only on request
The user wants an exact placementconfigure with Position through model_edit

Selective layout (default)

model_edit(model, "root", '[{"op":"layout","targets":["blk_5","blk_7"]}]', "incremental")
  • Targets must sit directly inside scope. Make one call per scope.
  • The targets move and the lines touching them are rerouted. Other blocks stay put, except that blocks downstream of a target may shift to make room. Mention that in your report.
  • You can combine a layout op with edits in the same call. A #ref target names a block that the call adds: [{"op":"add_block","type":"Gain","ref":"g"},{"op":"connect","target":"blk_3.y1 -> #g.u1"},{"op":"layout","targets":["#g","blk_9"]}]
  • When the wiring is tangled, add the targets' immediate neighbours to targets.
  • With layout_mode "full", the targets are ignored and the whole scope is re-laid out.

Full layout of a scope

model_edit(model, "blk_12", "[]", "full")

Use it for a scope that is new or already unreadable, and only with the user's agreement. Prefer the smallest subsystem that contains the mess over root.

Exact placement

model_edit(model, "root", '[{"op":"configure","target":"blk_5","params":{"Position":"[300 100 340 130]"}}]', "incremental")

Later incremental layouts leave the block where you put it, but a full layout of the scope moves it. Use this only when the user names a position or asks for specific alignment.

Pick the Targets

  1. The user names blocks: find their blk_X IDs with model_read (depth "0") or model_overview on the scope.
  2. The user points at the diagram ("these blocks", "the ones on the left"): ask them to select the blocks in the editor, then read the selection:
    sel = find_system('<scopePath>', 'SearchDepth', 1, 'Type', 'Block', 'Selected', 'on');
    ids = cellfun(@(p) ['blk_' extractAfter(Simulink.ID.getSID(p), ':')], sel, 'UniformOutput', false)
    
    A selection can be stale: earlier operations sometimes leave blocks selected. Read the block names back to the user and confirm before laying out.
  3. Overlaps: compare the targets' Position values with model_query_params, or check the model in the editor.

After Layout

  • Read the layout: block in the response. applied: false comes with a detail that explains why. Report it; don't retry blindly.
  • Run model_check(model, scope, '["unconnected_lines"]') to confirm that the wiring survived.
  • Tell the user which blocks moved, and mention any downstream blocks that shifted.

Restructuring Subsystems

To group blocks into a new subsystem, or expand a subsystem in place, see references/subsystem-restructuring.md. Don't rebuild the content block by block with model_edit.

Anti-Patterns

  • set_param(..., 'Position', ...) block by block to "fix" a layout. Use a layout op, or configure Position through model_edit.
  • Simulink.BlockDiagram.arrangeSystem when the user didn't ask for Auto Arrange.
  • A full layout of an existing, hand-arranged diagram without asking.
  • Copying blocks into a subsystem one at a time, which loses wiring and layout. Use Simulink.BlockDiagram.createSubsystem.
  • Promising that Ctrl+Z will restore the previous layout.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Create or upgrade Model Advisor checks for Simulink and System Composer rules. The workflow covers guideline writing, check specifications, implementation, and qualification tests, including converting legacy check styles to the modern DetailStyle format.

  • Turn a modeling rule into a formal guideline and check
  • Create an auto-fix or batch Model Advisor check
  • Upgrade a legacy check to modern DetailStyle
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

Create synthetic waveforms such as steps, ramps, sine waves, chirps, pulses, and noise for Simulink inports. Populate an External Inputs or Signal Editor Dataset while preserving signal types, dimensions, units, and interpolation metadata, including timing for trigger and function-call inputs.

  • Creating waveform data for Simulink inports
  • Filling an empty input Dataset with test signals
  • Preparing Signal Editor scenarios
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

Build and refine system architecture models in System Composer across functional, logical, and physical layers. Define interfaces and stereotypes, create views and sequence diagrams, link layers through allocations, and trace requirements to components.

  • Design functional, logical, or physical architecture layers
  • Set up interface dictionaries and port interfaces
  • Create allocation sets between architecture layers
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

Build and edit Simulink, System Composer, Stateflow, and Simscape models by changing blocks, parameters, connections, architecture components, or chart internals. The workflow checks the resulting structure and flags unconnected ports or dangling lines.

  • Adding or connecting model blocks
  • Editing Stateflow chart contents
  • Building System Composer architectures
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

Run Model Advisor checks on a Simulink model against supported standards such as MISRA, JMAAB, ISO 26262, and DO-178C. Get prioritized findings and suggested fixes; for JMAAB and MAB, add an AI review of guidelines that automated checks cannot fully assess.

  • Checking a model against MISRA or ISO 26262
  • Running JMAAB checks and reviewing guidelines needing judgment
  • Summarizing compliance findings with prioritized fix suggestions
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

Set up or update `.satk/block-policy.json` to control which Simulink blocks an agent may use, which it must exclude, and which block parameters it must leave unchanged. The skill validates policy settings before saving.

  • Setting which blocks an agent may use
  • Excluding obsolete or disallowed blocks
  • Protecting block parameters from edits
matlab/simulink-agentic-toolkit1.3KUpdated Oct 30, 2026

See all skills by matlab

Report a problem with this skill