Syntax
Files, identifiers, comments and the declarations of a .arc file.
Source text
- UTF-8, NFC, LF line ends, 2-space indent, no tabs.
- A comment runs from
//to the end of the line. - An identifier matches
[A-Za-z][A-Za-z0-9_]*. Vietnamese (tiếng Việt) appears only in strings: labels such as"Bảng 10.5", prose and titles. - A number is
12,0.97,1.5e3or12_000. - A string is
"..."with\"and\\. Onlyprosestrings interpolate{ref}. - A newline ends a declaration, unless the line ends with
,,(,{or a binary operator, or sits inside()or[].
Keywords: arc use lib req need limit formula part kind in let axis port shape place pose mate check out sheet view scale bom title artifact section prose table figure for on at via drive dir to from auto.
File structure
Every file starts with the version header, then its use lines, then its formula declarations and, optionally, a req, part or artifact.
arc 0.1
use T1 = uploads/giao-trinh-ctm.pdf
use gbox = rec/gbox.arc
use standards = lib archee.standardsuse NAME = PATH binds an upload, another .arc file, or a library (lib archee.standards).
Requirements
A req holds what the job asks for.
req gbox_req {
need P: power = 7.5 kW
need n_in: speed = 1450 rpm
need Lh: time = 20000 h @T1 "Bảng 10.5"
limit L_max: 480 mm <= 520 mm
}need declares a typed value. limit declares a relation the design must hold.
Formulas
A formula takes positional quantities and returns a quantity in the declared unit. Use - for a dimensionless parameter or result.
formula shaft.dmin(T: Nm, tau: MPa) -> mm = cbrt(T / (0.2 * tau)) @T1 p.188Use shaft.dmin(180 Nm, 20 MPa) in a calculation. A formula can call other formulas in the workspace. Its optional citation resolves through the use bindings where the formula is declared. agentcad arc check DIR --json lists each evaluated expression with its substituted inputs, result and resolved source.
Parts
A part declares, in this order:
| Member | Declares |
|---|---|
in | An input: in T: torque, optionally with a default |
let | A derived value: let d2: length = d1 + 5 mm |
axis | A parallel axis: axis a2 = (0 mm, a12) dir 0 deg |
port | A typed interface; see Ports |
place | A child part on an axis |
mate | A pairing of two ports |
check | A relation that must hold: check tau_ok: x <= tau |
out | A value the parent can read |
sheet | A drawing sheet; see Sheets |
arc fmt puts members in this order and sorts dependencies inside each group.
Variants
A variant is a base part with some in or let values replaced:
part wheel3 : wheel2 { z = 72 }A variant adds no members. Naming an undeclared field, or replacing one name twice in a chain, is an error, and a variant chain is one level deep.
Canonical format
arc fmt produces one layout, so a file that differs from it reports P03.
- Header first, then
uselines sorted by name, one blank line, then the body. - One declaration per line, one space around
=and binary operators, a unit separated by one space,,followed by one space. - A citation comes last on its line. A comment sits on its own line above its declaration.
- A port stays on one line, so a line is one fact.