Parts, ports and mates
Declare parts, give them typed ports, place them on axes and connect them with mates.
Parts and kinds
part NAME kind KIND { ... } declares a part. The kind is one of shaft gear bearing housing key cap seal spacer washer bolt assembly. A part with kind assembly, or any place, is an assembly.
Ports
A port is a typed interface. Its fields are values, so a port carries diameters, lengths and fits that other parts read. Every part has an implicit axis ax, the axis of revolution. at is the axial start, in millimetres from the part origin.
| Port | Fields | Meaning |
|---|---|---|
cyl | d (length or fit), len, at | An outer cylinder section |
bore | d (fit), len, at | An inner cylinder section |
face | at, r0, r1, side (+1 or -1) | An annular shoulder or end face |
key | host, b, h, t, len, at | A keyway seat on a cyl or bore |
thread | d, pitch, len, at, form, hand | A threaded section |
holes | n, d, pcd, at | A bolt-circle pattern |
mesh | m, z, b, alpha (default 20 deg), at | A gear-tooth section; dp derives as m*z |
port s2: cyl(d = d2 k6, len = 60 mm, at = 55 mm)
port k2: key(host = s2, b = 14 mm, h = 9 mm, t = 5.5 mm, len = 50 mm, at = 60 mm) @T1 "Bảng 10.5"
port m3: mesh(m = m3, z = z3, b = 85 mm, at = 125 mm)Place parts
An assembly places child parts on its axes.
axis a1 = (0 mm, 0 mm) dir 0 deg
axis a2 = (0 mm, a12) dir 0 deg
place shaft2 = shaft2(T = T2, n = n2) on a2 at 0 mm
place wheel2 = wheel2 on a2 at 60 mm
place b1 = standards.bearing.b6208 on a2 at 10 mmplace x = p(...) on a at L creates an instance x of part p, binds its inputs, and puts its origin on axis a at offset L. Its own axis lies along a. Parallel shafts use separate axes declared with axis.
Library parts such as standards.bearing.b6208 and standards.key.a14x9x50 are referenced, never copied.
Data flow
inflows down: a childintakes itsplacebinding, else its default. An unboundinis an error (E02).outrolls up: the parent readschild.out_name.- Every assembly gets an
out massthat sums its children’s masses, unless it declares one.
Mates
A mate connects two ports and names the pairing. The first path is the inner side (the shaft side, the external thread, the pinion). The second is the outer side.
mate m3 fit shaft2.s2 wheel2.bore
mate m4 key shaft2.k2 wheel2.key via key2
mate m6 mesh shaft1.m1 wheel2.m drive inner| Mate | Pairs | drive default |
|---|---|---|
fit | cyl to bore, coaxial, equal nominal diameter | cyl |
stop | face to face, contact on shared radii | the first face |
key | key seat on cyl to key seat on bore, via a library key | the shaft seat |
screw | external thread to internal thread | external |
bolt | holes to holes, via a library bolt | the first holes |
mesh | mesh to mesh, parallel axes | the pinion |
The driver holds the authoritative values and the other side must agree. A mate between ports of the wrong kind reports M01. A missing port or library reference reports M02. A mate id is unique inside its part, and check and mate ids share one namespace.
Checks
check NAME: lhs REL rhs is a relation that must hold. When it fails, arc check reports it under the rule name calc.check.
check len_ok: shaft2.s4.at + shaft2.s4.len <= req.L_max