© 2026 MVC Software Ltd. All rights reserved. Free to download. AutoStruct 0.1, made from the source of 2026-11-21 (1ed71f970). Working with the assistant Questions, a design brought onto the Design board, the results read, and scripts written

Working with the assistant
Questions, a design brought onto the Design board, the results read, and scripts written

AutoStruct

23 October 2026

Abstract

AutoStruct has an assistant: a language model that runs on your computer, answers from these manuals and from the project you have open, and puts before you the changes you ask for. This manual says what to ask it, how a design is brought onto the Design board with its help, how the results are read, and how the Python scripts that do both at scale are written. It also says, at each step, what the assistant does not do — the engine designs, the codes check, and the assistant never puts a number into a design.

Contents

1 What the assistant is
2 Asking
2.1 What it can read
2.2 Making what it proposes
3 Bringing a design onto the Design board
3.1 Element by element, by asking
3.2 From a table, with a script
3.3 From another AutoStruct project
3.4 Not from a drawing or a picture
4 Reading the results
4.1 By asking
4.2 From the documents, with a script
4.3 From the project database, with a script
4.4 Checking a section with the code
5 Writing scripts with the assistant
5.1 Where a script runs
5.2 From an answer to a script
5.3 Asking for a whole script
5.3.1 Letting it run and correct a script that only reads
5.3.2 Letting it try a script that draws, on a copy
5.4 Rules a script keeps
6 When an answer is wrong

1 What the assistant is

2 Asking

The ribbon’s Help tab has two buttons. Help (also F1) brings the Help panel forward at its contents; Ask brings it forward at the question, with the caret in it. Type the question and press Ask. The answer shows:

Ask one thing at a time, in the program’s words where you know them, and name the element by its label (O 3, B 12). Good questions:

How many columns are there on this level? 
Is column O 9 of steel or of concrete? 
What is the width of beam B 1? 
Does every level’s model agree with its drawing? 
How do I copy a level to another storey? 
Where is the allowable soil pressure set?

The program names element kinds its own way, and so does the assistant: a column is an ortho, a pad footing a foot, a strip footing a strip, a slab’s edge a boundaryline; a beam and a wall are as they read.

2.1 What it can read

The assistant may run any command that only answers a question, and no other. Among them:

command

answers

status, levels, tabs

what is open and in front; the levels

element::count, element::list

how many elements of a kind; their labels

element::fields, element::geometry

one element’s position, size, section and grade

levels::checksync

whether each level’s model agrees with its drawing

levels::foundations

the footings, strips and raft panels designed

levels::capacity

the beams and columns given a capacity shear

levels::mats

which raft or slab panels are mats

settings::find, settings::get

a setting’s path; its value

sections::list, sections::get

the steel sections and their properties

The manual Driving AutoStruct from TCL lists every command and says which ones only answer questions.

2.2 Making what it proposes

Make it runs the proposed command exactly as it is shown, through the same road as a command you type. It goes on the history like any other edit: the Edit tab’s Undo takes it back. Read a proposal before you make it — a model can misread a number — and remember what follows from it: every geometry change on the Design board needs that level’s Create Model, and a Create Model needs the rest of the computation after it.

3 Bringing a design onto the Design board

There are three roads. Choose by how much there is to bring.

3.1 Element by element, by asking

For a few elements, ask. The assistant proposes element::create with the numbers in their order, in metres:

kind numbers
ortho (column), foot (pad footing) x y dx dy: a corner, then the size
beam, wall, strip x1 y1 x2 y2 width
boundaryline (a slab’s edge) x1 y1 x2 y2
Add a column of 0.4 by 0.4 with its corner at x 2, y 3. 
  -> autostruct::element::create ortho 2 3 0.4 0.4          Make it 
Put a beam from x 0, y 0 to x 5, y 0, 0.25 m wide. 
  -> autostruct::element::create beam 0 0 5 0 0.25           Make it 
Add a pad footing 1.2 by 1.2 with its corner at x 4, y 6. 
  -> autostruct::element::create foot 4 6 1.2 1.2            Make it

Give a column’s corner and its size, not its centre and not two corners. The program gives the new element its label; ask for another level by name (on the Roof ) when it is not the one in front.

3.2 From a table, with a script

For a storey’s worth of elements — a schedule from another program, a spreadsheet of grid positions — write a short Python script (where it runs: §5.1). This one lays columns and beams from two tables and computes the level:

import autostruct 
 
LEVEL = ’First’ 
 
COLUMNS = [            # x, y: the corner; dx, dy: the size (m) 
    (0.0, 0.0, 0.4, 0.4), 
    (5.0, 0.0, 0.4, 0.4), 
    (0.0, 4.0, 0.4, 0.4), 
    (5.0, 4.0, 0.4, 0.4), 
] 
BEAMS = [              # x1, y1, x2, y2, width (m) 
    (0.2, 0.2, 5.2, 0.2, 0.25), 
    (0.2, 4.2, 5.2, 4.2, 0.25), 
] 
 
def create(kind, numbers, level): 
    line = ’autostruct::element::create %s %s -level {%s}’ % ( 
        kind, ’ ’.join(’%g’ % n for n in numbers), level) 
    return autostruct.tcl(line) 
 
autostruct.level(LEVEL) 
autostruct.board(’Design’) 
for row in COLUMNS: 
    create(’ortho’, row, LEVEL) 
for row in BEAMS: 
    create(’beam’, row, LEVEL) 
 
print(autostruct.tcl(’autostruct::element::count ortho’)) 
# autostruct.create_model(LEVEL)   # when the drawing is complete

A table in a file is read the same way — csv.reader over autostruct.project_dir() / ’imports’ / ’columns.csv’, say — and a row the program refuses raises autostruct.TclError with the program’s reason, which names the row. Levels themselves are made in the new-project wizard or the levels dialog (autostruct::new, autostruct::editlevels, and form::levels to fill the table from a script).

When every level is drawn, compute the building: autostruct.staging() runs every level’s Create Model from the lowest up, the gather, the frame analysis and the design, in that order.

3.3 From another AutoStruct project

A level of this project is copied to another storey with levels::copy or levels::copydrawing; a whole project travels as a recipe (project::export, then built on the other machine). Driving AutoStruct from TCL has both. Ask the assistant: How do I copy a level to another storey?

3.4 Not from a drawing or a picture

The assistant does not read a plan — a DXF, a PDF or a photograph of a sketch — into elements. Bring such a design in element by element or from a table, as above.

4 Reading the results

4.1 By asking

The assistant reads what the commands of §2.1 answer. After a computation, ask:

Does every level’s model agree with its drawing? 
Which foundations were designed on the Foundation level? 
How many beams on the First level were given a capacity shear? 
Which panels of the raft are mats?

It does not yet read an element’s forces or its reinforcement directly; for those, a script reads the program’s documents (next).

4.2 From the documents, with a script

Every computation writes its results as documents in the project’s folder. A level’s Create Model writes designs/json/<level>.json: its columns, beams and slabs, each slab with its span moments and its reinforcement, and a units block that names the unit of every quantity. A script reads it as it is — it is the program’s own answer, and nothing is recomputed:

import json 
import autostruct 
 
LEVEL = ’First’ 
path = autostruct.project_dir() / ’designs’ / ’json’ / (LEVEL + ’.json’) 
with open(path, encoding=’utf-8’, errors=’replace’) as f: 
    document = json.load(f) 
 
units = document[’units’][’slabs’]          # Mx: kNm/m, Asd: m2/m, ... 
print(’slab   lx    ly    Mx     My     bars x     bars y’) 
for slab in document[’level’][’slabs’]: 
    moments = slab[’spanMoments’] 
    x = slab[’reinforcement’][’directionX’][’bars’] 
    y = slab[’reinforcement’][’directionY’][’bars’] 
    print(’%-5s %5.2f %5.2f %6.2f %6.2f  d%d/%d     d%d/%d’ % ( 
        slab[’id’][’label’], 
        slab[’dimensions’][’lx’], slab[’dimensions’][’ly’], 
        moments[’Mx’], moments[’My’], 
        x[’diameter’], x[’space’], y[’diameter’], y[’space’]))

The beams of the same document carry their loads (g, q, g+q in kN/m) and their sections. A script that compares levels, finds the most heavily loaded beam or tabulates every slab’s steel is a loop over these lists. Ask the assistant what a field means; read the units block for its unit rather than assuming one.

4.3 From the project database, with a script

The frame analysis and the design are also kept in the project’s database, database/project.sqlite (see Driving AutoStruct from TCL, “The project database”). It holds what a level document does not: the frame’s members and, for each load case, the forces at their two ends. Open it read-only; its forces are in N and its moments in Nm:

import sqlite3 
import autostruct 
 
path = autostruct.project_dir() / ’database’ / ’project.sqlite’ 
db = sqlite3.connect(’file:%s?mode=ro’ % path, uri=True) 
run = db.execute("select max(run_id) from run where stage = ’epilysi’").fetchone()[0] 
 
#  The columns under level First (its storey is 2), under the permanent load G 
rows = db.execute(’’’ 
    select e.label, a.N from member m 
      join member_action a using (member_id) 
      join load_case c using (case_id) 
      join element e using (element_id) 
     where m.run_id = ? and m.kind = ’K’ and c.name = ’G’ 
       and m.storey = (select storey from level where name = ’First’)’’’, (run,)) 
for label, n in rows: 
    print(’%-4s N = %8.1f kN’ % (label, n / 1000))

A member is a column (K) or a beam (D); its storey is the storey of the level it belongs to, and the columns under a level belong to it. The load cases are named as the analysis names them: G, Q, Ex, Ey. A compressed column’s N is negative.

4.4 Checking a section with the code

The codes of practice the program designs with are open to a script as autostructcodes. A section is given in millimetres, moments in kNm:

import autostruct, autostructcodes 
 
section = autostructcodes.Section( 
    web_width=250, overall_depth=500, effective_depth=450, compression_depth=50) 
code = autostructcodes.project(str(autostruct.project_dir()), ’First’) 
code.bending(section, m_ed=100, m_ser=70)

A section given in metres answers nonsense quietly; mind the units.

The documents are the way into the results from a script; the assistant reads the project through its commands.

5 Writing scripts with the assistant

5.1 Where a script runs

All three are one interpreter: a name defined in one is there in the others. In it, import autostruct gives the program under Python names:

autostruct.tcl(line) any command of the program; raises TclError with its reason
status(), project(), project_dir() what is open, and its folder
levels(), level(name), board(name) the levels; bring one forward
create_model(level) a level’s Create Model
collect(), solve(), design() the computation’s later stages
staging() the whole computation, in its order
save(), open(name) save; open a project

5.2 From an answer to a script

In the notebook the assistant is autostruct_ai.assist. Its answer keeps what it proposed, and script() writes the proposals as a Python script — one line each, with what it does as a comment, and nothing run:

import autostruct_ai 
 
answer = autostruct_ai.assist( 
    ’Add a column of 0.4 by 0.4 with its corner at x 2, y 3.’) 
print(answer.script())
# Proposed by the assistant for: Add a column of 0.4 by 0.4 with its 
#   corner at x 2, y 3. 
# Nothing has been run. Read it, change it, then run it. 
import autostruct 
 
# Add a column of 0.4 by 0.4 with its corner at x 2, y 3. 
autostruct.tcl(’autostruct::element::create ortho 2 3 0.4 0.4’)

That is the start of a script, not the end of one: turn the line into a loop over your table (§3.2), give it another level, save it in the project’s notebooks folder. answer.run(n) makes the n-th proposal from the notebook, as Make it does in the panel. autostruct_ai.ask(question) answers from the manuals alone — Which command copies a level? — and is the quickest way to find the command a script needs.

5.3 Asking for a whole script

autostruct_ai.write(task) asks the assistant for a complete script. It is told what the program’s Python offers, the shape of the level document, the tables of the project database and what is open, and it writes one script. Nothing is run:

import autostruct_ai 
 
s = autostruct_ai.write( 
    ’Put in result the label of the slab of level First with the largest Mx.’) 
print(s)          # read it first 
s.run()           # then run it; s.run()[’result’] is what it left

Before you see it, the script is checked without being run: it must compile, import only what exists, and call only commands the program has. A script that fails is given back to the assistant with the reason, at most twice. One that still fails is handed over with the reason as its first line, # Checked and still wrong: …. A script that passes the check can still be wrong: it can read the wrong field or count the wrong thing. Read it before you run it, and compare what it prints with a number you know.

5.3.1 Letting it run and correct a script that only reads

For a question about the project — a count, a force, a list — you can let the assistant run the script itself and correct it when it fails:

s = autostruct_ai.write( 
    ’Which column of First is the most compressed under G? Its label.’, run=True) 
print(s)          # the script that ran 
s.result          # what it left in result

The script is run reading only. It may read the level documents, the project database and the commands that only read; a command that would change the project, a save, a computation, or bringing another level or board forward is refused as it runs. If the script stops with an error, the error and the lines it came from go back to the assistant, which writes the script again; so does a script that ends without leaving an answer in result. It has four tries. What it gets back is only that: nobody has told it the answer, so a script that runs to the end can still answer the wrong thing. Check s.result against a number you know, as before.

A script that would change the project — one that adds elements, for instance — is not run at all. It is handed over with # Not run, because … as its first line, for you to read and run with s.run(). If the project’s files change while a script runs, it is not run again, and s.error says so. s.error is empty when the last script ran to the end; otherwise it holds the error it stopped on.

5.3.2 Letting it try a script that draws, on a copy

A script that draws can be tried too, on a copy of your project rather than on the project itself:

s = autostruct_ai.write( 
    ’Draw a 30 cm beam on First from (0, 0) to (5, 5).’, run=True, draw=True) 
print(s)          # the script, and what it changed on the copy 
s.changed         # {’First’: {’beam’: 1}}: one beam more on First

With draw=True the program saves your project, closes it, copies it beside itself as <project>_assistant_trial, and opens the copy. The script runs there with everything the program’s Python offers, except leaving the copy: opening, closing or copying a project is refused. What it changed is counted — the columns, beams, walls, pad footings and strips of every level, before and after — and an error, or a script that changed nothing and left no result, goes back to the assistant, whose next script is tried on a fresh copy. When it is done the copy is deleted and your project is opened again, with the level and board you had in front.

Your project itself is never drawn on. The first line of what print(s) shows says how many times the script was tried and what the last try changed; if that is what you wanted, run it with s.run() on the Design board. If a folder named <project>_assistant_trial is already there, nothing is tried and the folder is left alone: s.error names it.

A change the counts cannot see — a beam moved, a section widened — is not measured; check it on the board after s.run().

5.4 Rules a script keeps

6 When an answer is wrong

The model is small enough to run on a laptop, and it can be wrong: a number misread, the wrong command chosen. The program’s design keeps that from reaching the building — it reads only with commands that change nothing, and what it proposes waits for you — but read what it proposes before you make it. When it answers a question about the program wrongly, the manual section it cites is one click away: the section is the authority, not the answer.