cadbuildr.frames
Summary
Structural and woodworking frames (weldments) built on CADbuildr foundation —
the Onshape Frame / Frame trim / Gusset / End cap / Cut list features as a
library. A Frame sweeps a profile (square/rect/round tube, angle, channel,
I-beam, flat/round bar, dimensional lumber) along a skeleton of line and arc
segments, trims the corners (miter, butt "trim to", coped), adds gusset plates
and end caps, and reports a cut list. Every member is its own Part inside the
frame Assembly, so BOMs and exports see real cut pieces.
It composes plain foundation operations only — Extrusion along each segment,
Lathe for bent (arc) members, cut Extrusions on trim planes for miters and
butts, and the through member's outline for copes — so it renders anywhere
foundation does (Prototype app, Hub, Playground, kernel-api). No schema nodes.
Tags
cad, python, frames, weldments, structural, steel, tube, lumber, cut-list, assembly
Status
yellow
Guidelines
- Pure layout maths (
layout.py) is separate from geometry (frame.py): the cut list is computed from the skeleton + profiles without a kernel, and the Parts are built from that same layout — one source of truth. - Named defaults, no silent magic:
DEFAULT_UP/FALLBACK_UPdecide profile orientation, "longer member runs through" decides butt corners, and every rule is documented onFrameand below. - Unsupported input fails loudly (
ValueErrornaming the members): overlapping members, a coped member wider than its host, an arc that would need cutting back, a gusset on something that is not a two-member corner. - Publish-first: depends on
cadbuildr-foundationfrom PyPI only.
Dependencies
Upstream
- cadbuildr-foundation (PyPI)
Downstream
- None yet (to be added to the curated-libraries registry once on PyPI).
Usage
from cadbuildr.foundation import show
from cadbuildr.frames import EndCap, Frame, Gusset, SquareTube, rectangle
# 600 x 400 mm rectangle (skeleton = tube centrelines), 40x40x3 square tube,
# mitered corners, a gusset in each corner.
frame = Frame(
skeleton=rectangle(600, 400),
profile=SquareTube(40, 3),
corner="miter",
gussets=[Gusset(at=(x, y, 0), size=60, thickness=4)
for x in (-300, 300) for y in (-200, 200)],
)
print(frame.cut_list_table())
show(frame)
Item Qty Profile Length Angle 1 Angle 2 Ends
---- --- -------------- ------ ------- ------- -----------
1 2 SHS 40x40x3 640.0 45.0 45.0 miter/miter
2 2 SHS 40x40x3 440.0 45.0 45.0 miter/miter
The same rectangle with corner="butt": the 600 rails run through (640 long,
square ends), the 400 sides are trimmed to their faces (360 long).
frame.cut_list() returns CutListItem rows: profile, length (overall,
long point to long point, mm), end_angles (degrees from square: 0 = square,
45 = corner miter), end_cuts (free, miter, butt, through, coped,
continuous), count, members (Part names) and bend_radius for arcs.
Skeleton
Line3D(start, end),Arc3D(start, through, end)— segments in mm.- Helpers:
rectangle(width, depth, center)(closed, XY plane),polyline(points, closed=False),box_edges(width, depth, height)(the 12 edges of a box / table frame). - Segments sharing an end point are joined. An end lying inside another straight member is a T-junction.
Profiles
| Profile | Arguments |
|---|---|
SquareTube(size, wall) |
square hollow section |
RectTube(width, height, wall) |
rectangular hollow section |
RoundTube(diameter, wall) |
round tube |
RoundBar(diameter), RectBar(width, height) |
solid bar / flat bar |
Angle(width, height, thickness) |
L section, heel at the -u/-v corner |
Channel(height, width, web, flange) |
C channel, web at -u |
IBeam(height, width, web, flange) |
I / H beam |
Lumber("2x4") |
dimensional lumber, actual dressed size (1.5" x 3.5") |
Profiles are centred on the skeleton at their bounding-box centre. u (the
first dimension) lies across the member in the frame's plane, v (the
second) points to the up side: for a planar skeleton up is its plane
normal (towards +Z), otherwise world +Z; members parallel to up (table
posts) use world +X. Pass up= to change it. Tube corners are sharp and
beams have no root fillets (a simplification).
Corners and junctions
| Node | Treatment |
|---|---|
| free end | square cut (end caps go here) |
two members, corner="miter" |
both cut on the bisector plane |
two members, corner="butt" |
the longer member runs through (square end, extended over the other), the other is trimmed to its face; ties: the first segment runs through; an arc always runs through a line |
two members, corner="coped" |
as butt, but the trimmed member is cut to the through member's outer shape (round tube to round tube) |
| collinear / tangent ends | continuous, no cut |
| three or more members | the longest runs through, the others are butted (coped with corner="coped") |
| T-junction | the end is butted (coped) onto the member it lands on |
Gussets and end caps
Gusset(at=corner_point, size=60, thickness=5, position="center")— a triangular plate in the corner with both legssizelong from the members' inner corner.position:"center"(frame mid-plane),"top"/"bottom"(flush with that face). Only on two-member corners.EndCap(thickness=3)— a plate of the outer outline on every free end, added beyond the end (cut lengths are unchanged).
Members are FrameMember Parts named member_1… (skeleton order), plates
gusset_N / end_cap_N; frame.members, frame.gussets, frame.end_caps
list them.
Connector hook (joint hardware)
Frame(..., connector=...) is the one extension point for joint hardware —
brackets, fasteners, end caps — that a library (e.g. cadbuildr-tslot)
places on the frame. It is called once per junction, after the layout is
solved and before any member is added, so it can also machine the members.
from cadbuildr.frames import Connection, ConnectorRule, Placed, basis_transform
class PostsThrough(ConnectorRule):
def choose_through(self, node, ends): # optional
return next((i for i, e in enumerate(ends) if abs(e.into[2]) > 0.99), None)
def prepare_member(self, part): # optional, once per member
... # e.g. add slot anchors
def connect(self, junction, layout): # per junction
if junction.kind == "free":
return None
end = junction.butting[0]
return Connection(
components=[Placed(MyBracket(), basis_transform(junction.node, end.basis))],
machining=[(end, lambda part: part.add_operation(...))],
)
Frame(box_edges(600, 400, 300), profile, corner="butt", connector=PostsThrough())
- A plain callable
connector(junction) -> Connection | Noneworks too. Junction:kind(free,continuous,corner,tee,multi),node,through(the member running through,Nonefor free / continuous / mitered nodes),butting(the trimmed members),ends,corner,up. EachJunctionEndhasmember(MemberLayout),which("start"/"end",Nonefor a T host),into(unit direction from the node into the member),basis(member x / profile u / v at the node),profileandcut(theEndCut, withextension).choose_throughoverrides "longest runs through" at butt / coped / multi nodes (return an index intoends, orNone).- Machining functions get the
FrameMember(local coordinates: start at the origin, +X along the member);part.plane(origin, x, z),part.local_point(p),part.local_dir(v)andpart.length_rangehelp. frame.junctions,frame.connectionsandframe.connectorslist what was found and added. Without a connector the frame is unchanged.
Not supported (yet)
- T-junctions onto arc members; mitering two arcs that are not tangent.
- Per-corner overrides (choose which member runs through), profile offsets
(e.g. an angle's heel on the skeleton) and profile rotation other than
up=. - Weld beads, tube corner radii, hole patterns.
Example
examples/frames_showcase.py builds four small frames — a mitered rectangle
with gussets, a table base (butted three-member corners, capped feet), a bent
round-tube rail with a coped post, and a channel bracket with a butt corner —
and prints their cut lists. Rendered in the Playground:
docs/funnel-evidence/frames-weldments-library/showcase.png.
User docs: tsjs/apps/documentation/pages/Foundation/Libraries/frames.mdx.
Tests
cd py && uv run --frozen --package cadbuildr-frames python -m pytest packages/cadbuildr/frames/tests -q
Metadata
Release files for cadbuildr-frames 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cadbuildr_frames-0.2.0.tar.gz | 89.2 kB | With provenance | Details for cadbuildr_frames-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cadbuildr_frames-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cadbuildr_frames-0.2.0-py3-none-any.whl |
Total release size: 116.2 kB
Release files / cadbuildr_frames-0.2.0.tar.gz
| Download URL | cadbuildr_frames-0.2.0.tar.gz |
|---|---|
| Size | 89.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81f5c29cecda50ffb144674aa8b09a606b1101d6993709a41a851e2fabcc2fc5
|
|
BLAKE2b-256 checksum How to use checksums |
cb7e4d9642ce878de6b0baf0f4d72cca96109852594574885affaeb10b55bcc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / cadbuildr_frames-0.2.0-py3-none-any.whl
| Download URL | cadbuildr_frames-0.2.0-py3-none-any.whl |
|---|---|
| Size | 27.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcf74998ccce4033203a21575ce580c838ad9a326ee6cf4071df3e422640d30d
|
|
BLAKE2b-256 checksum How to use checksums |
68b7a582ea22e714d76dde4cd84de6cefefa5148b38b93c6e3137c00e87d5546
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for cadbuildr-frames 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cadbuildr_frames-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.