Sheets and reports
Declare drawing sheets with paper ids, views, a bill of materials and a title, and assemble reports from parts.
Sheets
A sheet belongs to a part. It sets the paper, the scale and the views.
sheet a0 landscape {
scale 1:2
view top = cut(gbox, through = a1)
view front = proj(top)
view side = proj(front, top)
bom auto
title from req
}| Line | Meaning |
|---|---|
sheet PAPER [landscape or portrait] | The sheet and its paper id |
scale 1:2 | The drawing scale |
view NAME = cut(...), proj(...), detail(...) | A view of a part, or a projection of another view |
bom auto | The bill of materials from the assembly’s parts, or bom PATH |
title from PATH or title "text" | The title block source |
Views are expressions over parts, so a projected view stays aligned with the view it comes from.
Paper ids
PAPER is an id from the paper table, in any case, or a custom W x H mm.
| Family | Ids | Standard |
|---|---|---|
| ISO A | a0 to a4 | ISO 216 |
| ISO B | b0 to b4 | ISO 216 |
| ANSI | ansi_a to ansi_e | ASME Y14.1 |
| ARCH | arch_a to arch_e, arch_e1 | ASME Y14.1 |
| Id | Long side x short side (mm) |
|---|---|
a0 | 1189 x 841 |
a1 | 841 x 594 |
a2 | 594 x 420 |
a3 | 420 x 297 |
a4 | 297 x 210 |
An unknown id reports N01 with the nearest ids. The sheet size is data, so the same part moves from A3 to A1 by changing one id.
Reports
An artifact assembles a report, a bill of materials, a quote, a drawing set or a notice.
arc 0.1
use gbox = rec/gbox.arc
artifact report kind report {
section "1. Chọn thông số trục" {
prose "Mô men xoắn trên trục II là {gbox.T2:Nm:0}, đường kính sơ bộ {gbox.shaft2.d_min:mm:1}."
}
for s in parts(gbox, kind = shaft) {
section "Trục" {
prose "Trục {s.name} có d1 = {s.d1}."
table dims = s.out
}
}
section "Bản vẽ" {
figure gbox.a0
}
}section "title" { ... }holdsprose,tableandfigurelines.prosestrings interpolate values:{path},{path:unit}and{path:unit:digits}.table NAME = PATHrenders the outputs of a part.figure PATHplaces a sheet.for s in parts(PATH, kind = KIND)repeats its sections once per part of that kind.{s.name}is the instance name.
A prose section remembers a hash of each value it shows. When the value changes, the section is marked stale (A02) so you rewrite it.