Skip to content
Archee Docs

Python SDK

The archee modules available inside execute, with their main functions.

Inside execute, import archee gives the modules below. This page lists the main functions. search returns the full signature, units and docstring of each one and is always current.

calc

Cited engineering calculations. Each result carries its values, checks and the textbook sources behind them.

  • calc.list() returns every calculation available.
  • calc.describe(name) returns the inputs, units and outputs of one calculation.
  • calc.run(name, **inputs) runs a calculation by name, for example "vbelt".
  • calc.run_bearing_rolling(...), calc.run_belt_life(...) and others are typed shortcuts for individual calculations.

standards

Catalogue lookups.

  • standards.lookup(kind, **params) returns rows of one standard-part kind, for example lookup("bearing", d=40), lookup("key", d=42) or lookup("fastener", size="M12").
  • standards.kinds() lists every kind lookup reads, with its parameters.
  • standards.housing_proportions(a_w) returns gearbox housing proportions from the centre distance.

draft

DXF and DWG drawings.

  • draft.inspect(drawing, …) lists entities, layers and blocks, paged. member_offset pages the entities of one id.
  • draft.render(drawing, output, …) writes a PNG of the drawing or a region of it.
  • verify(drawing) returns the drawing findings, most severe first.
  • draft.patch(drawing, id, output, edits) moves, adds (line, circle, arc, polyline, text) and deletes the entities of one id in a DXF.
  • draft.convert(to, input, output) converts DXF ↔ DWG.
  • draft.detail(design, out_dir, part_type) makes a shaft or gear detail drawing from the design.
  • draft.build(...) and draft.edit(...) build or change drawings with a builder script.

Draw an editable block

Use agentcad.proj to generate a view and agentcad.open to write it as a named DWG or DXF block. Add open strokes and lettering in the view’s local millimetres.

import agentcad
from agentcad.kinds import Projected
from agentcad.proj import Box, Model, Part, Stroke, Text, project_model

model = Model(name="bracket", parts=(Part(id="body", shapes=(Box(dx=35, dy=16, dz=20),)),))
front = project_model(model, view="front").view("front")
block = Projected(
    view=front,
    overlays=(
        Stroke(points=((24, 0), (31, 8), (44, 8))),
        Text(at=(24, 12), body="Bracket", height=3.5),
    ),
)
with agentcad.open("bracket.dxf", "x", title="Bracket", paper="a4", scale="1:1") as drawing:
    drawing.write("projected/bracket", block, create=True)

For flat geometry, pass only overlays. Set closed=True for a closed stroke and pass bulges to specify circular edges. To revise a block in code, open the DXF in r+, call drawing.read("projected/bracket"), and write the updated record to the same path. Closing a drawing that passes its checks writes a DWG beside the DXF. In CAD, the block contains native linework and MTEXT.

kb

The Knowledge Base of engineering textbooks and standards.

  • kb.search(query, limit) returns passages with their source, printed page and score.
  • kb.page(source, page) returns one page of a source.

verify and deliver

  • verify.check(path, standard="TCVN") returns TCVN findings for a drawing.
  • deliver.package(kind) returns a submit-ready a0_assembly, a3_detail or report package.

files and project

  • files.upload(name, data) stores bytes or text in the project.
  • files.list(prefix) lists files with size and SHA-256.
  • files.link(path) returns a signed download link that expires.
  • project.info() returns the current project.
  • project.design(path) returns the design record, or one value in it.
  • project.design_set(path, value, expected_revision) changes one design value safely.

agent and runs

  • agent.run(prompt) hands long work to Archee’s agent and returns a run id.
  • runs.get(run_id) returns the state and output of a run.

errors

Every SDK error derives from archee.errors.ArcheeError.

  • BudgetExceeded: the program spent its credit allowance.
  • ScopeDenied: the connection lacks a scope the call needs.
  • PlanDenied: your plan does not include the feature.
  • NotFound and Invalid: a missing file or a bad argument.
  • Unavailable and BridgeTimeout: a service was busy or slow. Retry.
  • Internal: something failed on Archee’s side. Quote the call_id.