Docs / Shapes / Components

Components

Components are objects built from reusable building blocks. A clock, a compass, a speedometer, a circular gauge, a rotating vector and an orbit system all come from the same set of circles, lines, polygons, text and rotations.

Screenshot: Clock and compass components on the board

Overview

The Objects button on the toolbar opens the object palette: every object with a preview of what it draws and a description of what it does, searchable by name, description or tag. Pick one and drag on the board to place it. An object behaves like every other shape: it can be selected, moved, resized, rotated, locked, hidden, duplicated, copied, undone and saved.

An object you build on the board — with the AI assistant, or by hand — can be shared: Copy definition in its settings menu puts its definition on the clipboard, ready to paste into the object editor in the catalogue.

What makes a component different is how it is built. Instead of a dedicated drawing for each object, a component is a small tree of approved building blocks — shapes, transforms, interactions and value bindings — that Modellus compiles and draws. Because they share the same blocks, components look consistent with each other and can be extended without new drawing code. Building Blocks explains the construct, and Object Definition is how a new object is written.

Try them all at once: open the Building blocks demo model, then press play. One simulation drives a clock, a compass, a speedometer, a circular gauge, a rotating vector and an orbit system.

Available components

ComponentWhat it shows
ClockA clock reading an hour, a minute, a second and a millisecond variable — or the model's own time taken as a count of seconds — shown either as a face with a hand for each or as a digital readout of the same time, and able to run itself as a stopwatch with a lap list of its own
CompassA compass rose whose needle follows a heading variable, and whose rose can be turned by a second variable
SpeedometerA swept dial with a scale, a needle and a numeric readout
Circular gaugeA ring that fills in proportion to a variable
Rotating vectorA phasor whose angle and length follow variables, with optional projections
Orbit systemA central body with orbiting bodies placed from simulation time and their periods
Steering wheelThe controls a vehicle is driven with: a wheel turned by an angle or an orientation and a pair of pedals pressing a value each the same way, both up from zero as far as an end of that pedal's own, drawn as a car, a motorbike or a boat, with the wheel, the pedals or the brake among them left out as you like
ThermometerA temperature read as the height of a column, against a scale marked every so many degrees — one step, the way a slider is stepped — and named in Celsius or Fahrenheit. A dashed line carries the top of the column across to the scale, the way a chart's crosshair places a point against its axes, and the eye on the temperature's row stands the term and its value out past the scale beside the reading. The column can be dragged to set the temperature, and the marks and their numbers keep the size the board's own axes use, so resizing stretches the scale rather than the writing on it

Binding a component to the model

Every component exposes a small set of inputs in the variables menu of its toolbar. An input takes either a model variable or a plain number, exactly like the terms of a body or a point. The clock, for example, reads an hour, a minute, a second and a millisecond variable, and turns them into hand angles using the Modellus expression language:

HandAngle
Hour((hour mod 12) + minute / 60) × 30
Minute(minute mod 60) × 6
Second((second + millisecond / 1000) mod 60) × 6
Millisecond(millisecond mod 1000) × 0.36

The clock is shown as a face or as digits, and a key of its own in the toolbar says which. The key wears the choice it is on and opens on the two: analogue draws the face, its hands and its numbers, and digital draws the same time as digits on a panel — hh:mm:ss, each field padded to its own width. Both read the same four variables, so switching between them changes nothing about what the clock is bound to. The numbers and the dragging belong to the face alone, so they leave the menus while the digits are what is shown.

The digits are the bars of an old digital clock rather than writing: each character is spelled out in seven lamps, and the ones it does not light are left showing faintly behind it, the way the unlit segments of a liquid crystal panel are. They are drawn rather than typed, so they stay square at every size and need no font to have been loaded. Face colour is the panel they are read on and Number colour the lamps themselves, so a dark panel with pale lamps is two colours away.

How finely the clock reads the time is said by painting it, not by switching parts on. There is no show seconds or show milliseconds: a part is left off the clock by clearing the colour it is read in, and brought back by giving it one. Clear the second's colour and the second hand goes from the face and the field after the minutes goes from the readout; the thousandths start clear, so a clock reads none until one is chosen, and choosing one puts a hand of its own on the face — round once a second — and three more digits after the seconds. The numbers around the face go the same way, with the number colour. The face carries no marks for the thousandths: that hand is read against the same ring the second hand is.

The second hand sweeps rather than ticks: it carries the thousandths the clock is standing in, so a reading of 15 s 500 ms puts it half a mark past the fifteenth rather than sitting on it waiting for the next whole second to jump to. A clock reading no milliseconds has nothing to carry, so its second hand steps a mark at a time exactly as before.

The whole clock can be read from the model's own time instead. Use independent, the switch above the terms in the variables menu, hands the whole clock over to the independent variable — whatever the model has called it — read as a count of seconds, with the four parts worked out from it. A run reaching 3725.5 stands at 1:02:05.500 without the model ever mentioning an hour. The four rows stay where they are, with their selectors emptied and gone quiet: the terms they named are still on the object, waiting for the switch to come back off, but nothing is reading them — so the key in the toolbar names the model's own clock in every slot instead, and the colour each part is drawn in is still chosen on its row, because a clock the model moves has hands to paint like any other. And since the model is what moves it, the only key worth offering is the lap — the play and the stop go, and the laps are emptied from the bin instead.

Each row carries the colour its own part is read in. The swatch at the end of the hour's row is the hour hand on the face and the first field of the digits on the panel, and the minute, second and millisecond rows are the same for theirs — so the colour is chosen beside the term it paints rather than from a list somewhere else, and the reading and its colour are named together. They begin dark for the hour and the minute and warm for the second; the millisecond begins clear, which is what keeps a new clock down to three hands. Number stays in the colour menu, since it is what is left: the numbers around the face, and the colons and the point between the fields of the readout.

The clock can run itself. Switch Buttons on in the settings menu and three keys appear in a strip of their own under the face or the panel, which makes room for them: play/pause sets the clock counting real time from wherever it stands and holds it there when it is pressed again — one key, wearing the mark for what pressing it would do next — lap takes the reading as it stands and keeps it, and stop ends the run, clears the reading back to nothing and forgets the laps. The keys wear the same marks the rest of the board wears, drawn from the same set of icons rather than drawn to look like them. A running clock draws its first key the other way about, mark for face, so it says so.

The laps it has taken can be listed under the keys. Switch Show laps on and a section of its own opens below the strip, ruled off from it: one row for each press of the lap key, newest at the top, each reading as it stood and the seconds it stood at. The list is the object's own memory, so the file carries it, undo restores it and reopening the model finds the laps still there — unlike the run itself, which a saved clock never remembers. The lap key writes into it and the stop key empties it.

What it counts goes where the four rows point: each part of the reading is written into the term that row names, so hour, minute, second and millisecond move in the model and everything else reading them moves with them. A row holding a plain number instead of a term is written itself, so a clock straight from the palette runs with nothing bound to it. A row naming a term the model works out for itself cannot be written, and a clock whose every row is like that says so with the cursor a locked handle uses. It counts on a clock of its own rather than the model's, so it goes on counting whether the player is running or standing still, and the whole run — from play to stop — is one step to undo.

The compass reads two variables. Heading turns the needle clockwise from north, and Rose turns the rose — its ticks, its cardinal letters and its degree labels — clockwise underneath it. Leaving the rose at 0 gives a plotting compass with north fixed at the top. Binding it to a term equal to minus the heading, and leaving the heading at 0, gives an aviation card compass: the needle stays pointing up as a lubber line while the card turns, so the current heading is always the value under the needle.

The compass also marks Pointers: as many directions as you name, listed in its variables menu the way a chart lists the terms it plots. Each row chooses from its own two buttons whether it is an angle in degrees or an orientation, a pair of terms read as a vector — how far east and how far north — and points where that vector points. An angle is measured from N and grows clockwise, so each marker stands where the tick for its direction stands and turns with the rose the way that tick does. Each row is given a colour. Drag a row by its handle to reorder it, and press the bin to take it away.

A hand is dragged to write its value back into the model, in the same way a gauge needle is. Nothing switches that on: what decides it is the term the row names, exactly as it decides every other drawing of a value the reader can change — a hand naming a term the model works out for itself stays read-only, and so does every hand on a clock the model is driving.

The steering wheel is driven by one row, Turned by, and a key of its own in the toolbar says how that row is read. The key wears the choice it is on and opens on the two: an angle , and an orientation . Read as an angle, the row offers one selector — a term or a number read as degrees, anticlockwise, the way an angle is measured everywhere else in the model: turning the wheel left raises it and turning it right lowers it, so a wheel held to the right reads a value below zero — and the toolbar shows that one value. Read as an orientation, a second selector appears beside the first and the toolbar shows both: the pair is read as the direction it points, how far across and how far up. A direction is a bearing rather than an angle, and turns the other way round — clockwise from straight up, the way a compass reads, so that a marker stands where the tick for its direction stands. An orientation is what lets a wheel follow a velocity or a force without the model working the angle out first, and dragging the wheel writes the pair back, so the reader can point that velocity by hand. The colour at the end of the row is the colour of the mark at the top of the wheel — the part that shows the direction it is turned to — so it is picked where the direction is named rather than on a colour menu of its own.

The compass marks its pointers with the same two choices under the same two icons, so a direction is named the same way wherever one is asked for. A compass names as many pointers as the reader asks for, so each of its rows carries the choice itself; the wheel is turned by one thing, so its choice is made once, in the toolbar, and its row carries only the terms and the colour.

Vehicle in the settings menu chooses which vehicle is drawn, from three buttons: a car, a motorbike or a boat. The wheel follows it — a car's three-spoke wheel, a motorbike handlebar or a boat's eight-handled helm, all three carrying a mark at the top so how far the wheel has been turned can be read at a glance — and so do the pedals: a car's brake and accelerator pedals hanging from their box, a motorbike's pair of hand levers on the bar, or a boat's pair of binnacle levers.

The wheel, the pedals and the brake among them are the parts of one object, and each can be left out. Wheel and Pedals in the settings menu switch the two halves on and off: the wheel alone is the object as it has always been, the pedals alone are the pair of controls in the whole box, and with both on the box is split — the wheel in the top half and the pedals underneath, the way they sit in the vehicle. Brake is the third, and appears once the pedals are on: switch it off and the brake pedal, the bike's brake lever and the boat's astern lever are not drawn, and the accelerator has the whole of the pedals to be pressed in — the vehicle a model drives on one control alone. A part that is switched off takes its own rows with it, so the menus never name a term nothing reads: the brake takes Braked on, Brake maximum and its colour away with it.

Either way the wheel can be dragged: it points wherever the pointer is, so a reader can steer the model by hand, and the angle is measured from straight up — zero is at twelve o'clock, and a whole turn of the wheel is the whole of the range. Turned by an angle, that angle is what gets written back, read the short way round from the top: the left of it is above zero and the right of it below. Pointed by an orientation, the pair is written back instead — it keeps the length it had and takes the direction the wheel was turned to, which is v = √(vx² + vy²) laid down again along the new angle. A pair holding nothing at all has no length to keep, so it is laid down at length one and the drag has something to turn.

Each pedal presses a value of its own, and zero is where both rest. The accelerator is driven by Accelerated on and the brake by Braked on, and the two rows are made the same way: a term or a plain number, an eye that reads it on the drawing, and the colour of the pedal at the end. Both are pressed the same way: holding a pedal and sliding up presses its term above zero, as far as that pedal's own end — Maximum for the accelerator, Brake maximum for the brake. Neither crosses the rest it starts from — sliding the wrong way eases a pedal off and stops at zero — and a slide across the whole of a pedal's own area covers the whole of its range. What each holds is how hard that pedal is being stood on, above zero either way, and what braking does to the model is the model's own business: read Braked on as the amount to take away, the way Accelerated on is the amount to add. Name the same term on both rows and the two pedals press one value between them; name two and the brake is a value the model reads apart from the throttle. Whichever vehicle is drawn, the brake is on the left and the accelerator on the right, and each is pressed on its own half of the pedals — or, with the brake switched off, the accelerator is pressed anywhere in them.

Each pedal stands where its own term stands, each on its own scale. So a model that is braking presses the brake pedal, pulls the boat's lever astern and draws the bike's brake lever in, and a model that is accelerating does the same on the other side, and the two are free to happen at once. Each value is read over the pedal that presses it, in the colour at the end of that pedal's own row — which is why both colours are picked there rather than on a colour menu that would name the same thing twice.

Read as an orientation, a pedal presses a pair of its own along the bearing the wheel is turned to. The pedals are read the way the wheel is: pick orientation and a second selector appears on every one of the three rows, so Accelerated on and Braked on each name a pair — how far across and how far up — beside the pair the wheel is pointed by. The wheel says which way the push goes and the pedal says how hard: holding the accelerator lays its pair down along the bearing, as far as Maximum, and holding the brake lays its own down the other way along the same bearing, as far as Brake maximum — so the brake's pair points back the way the vehicle came while the amount the pedal is pressed by stays above zero, just as it does read as an angle. A model that reads a velocity from these two accelerates along its course and decelerates against it, without either pedal touching the pair the wheel is steering.

How far a pedal is pressed is read back along that same course — the accelerator's forwards and the brake's backwards — not as the plain size of the pair. So a pair pointing across the course presses nothing at all: what a pedal shows is the push along the way the model is going. A standstill has no direction of its own — a pair of zeros points nowhere — so the object keeps the bearing it was last going on: the wheel stays turned that way while the model stands still, and pressing a pedal sets it going along that same course rather than jumping to north. It is remembered while the board is open rather than written into the model, which says nothing about which way a stopped vehicle was facing.

A pair springs back the way a term does, along the bearing it was pressed on, until it is at a standstill again — an acceleration is a push, and a push the foot is off is no push at all. Switch the brake off here and the model can only be pushed forwards: nothing is left to push back.

The boat's levers swing in depth rather than sideways, the way the real ones do under the hand: the ahead lever is pushed away from the reader as the accelerator's term rises and the astern lever pulled back towards them as the brake's own rises, so a lever stands taller and thinner as it goes away and shorter and thicker as it comes near, its shaft riding forwards and back along the slot it stands in. Neither lever travels across the drawing.

A pedal is held down, like the real one. Press it and nothing happens: the value stays exactly where it was, for as long as you keep holding. Slide the pointer up while you hold and the pedal goes down further; slide back down and it eases off. A slide across the whole of a pedal's own area covers the whole of its range, from rest to the far end of it, so the reader presses as gently or as hard as they mean to.

Let go and what that pedal presses comes back to rest by itself — a step every tenth of a second, until it is at zero again, the way the spring under a real pedal lifts it once the foot is off. Pedal return in the settings menu says how big that step is, for both pedals alike and whichever way they are read; set it to zero and what was pressed stays wherever it was released. Pressing again catches the pedal wherever it has got to on the way back. The whole gesture — pressing, sliding and coming back to rest — is a single undo step. A pedal whose row names a term the model works out for itself cannot be moved, and says so with the cursor a locked handle uses; one whose row holds a plain number moves that number instead, so the object can be tried out before it is bound to anything.

The eye at the start of each row shows what that pedal is holding, on the object itself: term = value, over the pedal that presses it and in that row's own colour, written the way every other term label on the board is written. Turn them off and the drawing carries no numbers at all.

Toolbar

Screenshot: Component toolbar
MenuContains
Name and coloursThe object name and every colour the component draws with
How it is read Only on a component that reads a direction: whether it is read as an angle or as an orientation. The key wears the choice it is on
How it is shown Only on a component drawn in more than one way: the clock's choice between a face and a digital readout. The key wears the choice it is on
VariablesThe model inputs of the component
Settings Display options, scale and interaction

Colours

A component draws with the standard Modellus palette — its colours, line widths and type sizes come from the shared design tokens, so components look native to the board. Every individual colour can still be overridden in the name and colours menu.

Asking the assistant for an object

The Modellus assistant builds components through the same building blocks. It can only use approved blocks, must bind values to variables that exist in your model, and cannot insert an object that fails validation, so anything it produces behaves like an object you placed yourself and stays fully editable.

Building an object of your own

An object is not drawing code: it is one JSON document naming approved blocks, and the same document is what the editor bundles, what the community catalogue publishes and what the assistant invents. Anything on this page can be built that way.